Welcome! Log In Create A New Profile

Advanced

Need a little help understanding the M163 G-code.

Posted by kd6hq 
Need a little help understanding the M163 G-code.
February 18, 2017 01:53PM
How does weight correspond to a color.

How do you calculate the P value for a color.
Using R, G, B how do you calculate P where
Saddle Brown uses R = 139, G = 69 and B = 19
So what would the definition look like?

M163 S0 P ??
M163 S1 P ??
M163 S2 P ??

thanks
Re: Need a little help understanding the M163 G-code.
February 19, 2017 04:28AM
I haven't played with the weight mixing yet, but your saddle brown color scheme seems to be scaled to 256 steps in total.
Question is: Do we have to scale it down to 100% or what?

I'd start an experiment with scaled down values.
e.g. R= 139/256 = 0.54 or 54%

If you see under extrusion, try to use the original values.

PS: It's a shame the Wiki doesn't come with an example. Where are the marlin guys when you need them?

Edited 1 time(s). Last edit at 02/19/2017 04:31AM by o_lampe.
Re: Need a little help understanding the M163 G-code.
February 19, 2017 06:13AM
I will try that. It will take me a couple of days (waiting on filament) but I will report back what I find. Perhaps someone will add more information while I'm waiting.

In the mean time did you see this? [forums.reprap.org]

It is a true mixing hot end, it has a motor and a mixing chamber to actually mix the material.
Re: Need a little help understanding the M163 G-code.
February 22, 2017 12:35PM
Well I've printed my first test piece and it did not turn out too bad.
It is a simple 3 layer part with red, green and blue. 20 x 20mm sq and 2 mm thick.
Each layer is a solid color without any mixing.





The second try called for the same size part but with "mixing".
The colors picked for the second part are yellow, cyan and saddle brown.
Yellow = 50% red, 50% green and 0% blue or R=255, G=255, B=0
Cyan = 0% red, 50% green and 50% blue or R=0, G=255, Blue=255
Saddle Brown = 60% red, 30 % green and 20% blue or R=139, G=69, B=19

This test did not work so well.
First my color mixing is off.
Secondly it appears like my second extruder motor is having some type of problem.
When called upon to extrude the color green into the mix, apparently it was unable to
extruded anything. I need to research it.

The M163 commands used for this try were:
; Yellow
M163 S0 P0.5
M163 S1 P0.5
M163 S2 P0.0
M164 S3

; Cyan
M163 S0 P0.0
M163 S1 P0.5
M163 S2 P0.5
M164 S4

; Saddle Brown
M163 S0 P0.6
M163 S1 P0.3
M163 S2 P0.1
M164 S14




I will post some more pictures in a day or two, I need to look at the green extruder motor
and figure what is going on with it. I also need to do some reading on color mixing and
how to use the M163 command better.

Your commits are welcome.
Re: Need a little help understanding the M163 G-code.
February 22, 2017 02:16PM
At least you've found the right way to define mixed colors. All three extruders have to sum up to 1. ( same as RRF mixing )
Did you place the tool definitions in the slicer startcode? Or do you have to set all virtual tools in firmware?
Re: Need a little help understanding the M163 G-code.
February 22, 2017 03:31PM
I'm not sure that is the correct way to define the colors, but it seems like it may work after I fix a couple mechanical problems (stepper slipping).

I ended up placing the definitions is the slicer startcode.
; Yellow
M163 S0 P0.5
M163 S1 P0.5
M163 S2 P0.0
M164 S3 P1

The P1 stores the setting under S3 in the eeprom. Since I did not store them in the eeprom, I left the P1 off or you can say P0, which tells the system not to sore them.

The only thing you have to define in the firmware is the number of virtual tools.

#define EXTRUDERS 1
#define MIXING_EXTRUDER
#if ENABLED(MIXING_EXTRUDER)
#define MIXING_STEPPERS 3 // Number of steppers in your mixing extruder
#define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164
//#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands

The other thing is that filament I got is not a true red or green.
The "red" is actually more of a salmon color and the green is a lime green. So even though my color wheel tells me to use 50% red and 50% green to get yellow, it will be some shade of yellow instead of a true yellow. So there will be a lot of experimenting.

I have not found a correlation between values in a color wheel and the P % values. (I'm not sure if the P value is a percentage)

For instance, on the color wheel saddle brown shows R=139, G=69, B=19. So you would think you could simply get the % and plug it in. 139/256 = .54, 69/256=.26, 19/256=.07
.54+.26+.07=.87 not quite 1.

So there's more work to do.
Re: Need a little help understanding the M163 G-code.
February 23, 2017 12:12AM
o lampe

What is RRF mixing?

I thought I could search on internet for it but I have not been able to.
Re: Need a little help understanding the M163 G-code.
February 23, 2017 01:35AM
RRF is reprap firmware (for 32bit boards based on Atmel SAM3X8E and ATSAM4E8E chips) [reprap.org]
Re: Need a little help understanding the M163 G-code.
February 23, 2017 02:40AM
Thank you
Re: Need a little help understanding the M163 G-code.
February 23, 2017 03:02AM
From: G-code -[reprap.org]

M163: Set weight of mixed material
Parameters
Snnn extruder number
Pnnn weight
Set weight for this mixing extruder drive.

M164 Parameters
Snnn virtual extruder number
Pnnn store to eeprom (P0 = no, P1 = yes)
Store weights as virtual extruder S.

For those of us who are just starting out with a Diamond type hot end I found the following information on this web site: [www.marlinkimbra.it]

M163 S [index] P [mix value], this command we say that we use the extruder [index] [mix value] value,
the value is a number with a comma between 0 and 1, where 1 stands for 100% and 0 for 0%.
To understand the final color will consist of a percentage of E0 + a percentage of E1 + E2 and the total percentage must do 100%.
This is due to the fact that in addition to printing color, we extrude a fixed value of material to compose our object.
So if the object is made of 100% Red will extrusion E0 + 0% E1 + E2, 0% if it is a color X will have different values for each extruder, but always the 100% material should extrude.

Then we create the first Tools T0, which will be red.
M163 S0 P1; 100% Red
M163 S1 P0; 0% Green
M163 S2 P0; 0% blue

Now save this color scheme in our Tools T0 we use the command:
M164 S (index), where index is our Tools, and then click:
M164 S0; Store color mixing in tools T0

Now we create the Tools Green:
M163 S0 P0; 0% Red
M163 S1 P1; 100% Green
M163 S2 P0; 0% blue
And keep it on the Tools T1:
M164 S1; Store color Mixing in Tools T1

We create Tools T2 Blue:
M163 S0 P0; 0% Red
M163 S1 P0; 0% Green
M163 S2 P1; 100% Blue
And keep it on the Tools T2:
M164 S2; Store color Mixing in Tools T2

We create a yellow:
M163 S0 P 0.5; 50% Red
M163 S1 P 0.5; 50% Green
M163 S2 P0; 0% blue
And keep it on the Tools T3:
M164 S3; Store color Mixing in Tools T3
Re: Need a little help understanding the M163 G-code.
February 23, 2017 03:35AM
I had the same problems with searching for Cyan, Magenta, Yellow. There are standards for colors ( like RAL ) but the filament vendors don't provide such information.
IMHO, CMY colors are better suited for color mixing, although all color wheels also mention Black ( CMYB ), which isn't possible with the diamond.

Edited 1 time(s). Last edit at 02/23/2017 03:36AM by o_lampe.
Re: Need a little help understanding the M163 G-code.
February 27, 2017 08:32PM
o lampe

I just started to look for CYM filament today. So far I have not found any.
Did you find a vendor that has all 3 colors?
Re: Need a little help understanding the M163 G-code.
February 28, 2017 02:36AM
Quote
kd6hq
o lampe

I just started to look for CYM filament today. So far I have not found any.
Did you find a vendor that has all 3 colors?

No, especially Cyan is hard to find and Magenta is often sold under different names like Pink ( or pink is sold as magenta but it isn't )
The images in online stores aren't helpful either.
I have ordered lots of samples and ended up with:

Magenta from bq
Sunshine-Yellow from bq
Cyan from 3dpfilament

but the Cyan is very light colored and almost transparent.

I asked a few bigger vendors, if they were able to offer a set of CMY filament, since color mixing is more and more en vogue, but the most promising answer was:
Order a batch of 25 kilo/color and we can deliver any color you like :p

BTW: With Magenta and Sunshine Yellow I was able to mix a very nice palette of colors I called " Indian Summer "
Re: Need a little help understanding the M163 G-code.
February 28, 2017 07:42AM
No so far I have not found anyone who has all 3 colors. I have not finished looking yet and will report back if I do.

I saw a picture of a prototype Diamond hotend with 5 filaments. It looked like they just drilled 2 more holes in the existing head.
Should be interesting.






I've also read about some experimental mixing using 6 colors [forums.reprap.org]
It's not in production yet but at least someone is working on one.
Re: Need a little help understanding the M163 G-code.
February 28, 2017 10:08AM
Five colors is great!
They should go for watercooling instead of these huge heatsinks, tho. The mini hotend has already proven they don't have to be that tall. You have to use a huge fan to get enough air through the bottom fins ( or cover the top fins with tape winking smiley )
Re: Need a little help understanding the M163 G-code.
March 01, 2017 01:08PM
Not any luck so far finding a vendor that has all 3 colors. What I have found tends to be ABS not PLA and the diameter is usually 3.0 not 1.75.

The Indian Summer colors sound interesting, I will take a look at it.

Dealing with a clogged hot end so search will have to wait.
Re: Need a little help understanding the M163 G-code.
July 20, 2022 09:48AM
Hello,
I am attempting to print color gradient parts on Creality CR-X pro printer with Marlin firmware version 2.0. I am unable to print with concurrent feeding of the filaments as it still prints with single extruder. Our .gcode files are simialr to as mentioned in the forum above. Any help or suggestions would be much appreciated.
Thank you.
Karun
Sorry, only registered users may post in this forum.

Click here to login