So I was waiting for updates on Klipper macros from a number of posts, and eventually decided that I'd take my own crack at making klipper macros for the chameleon unit.
Now, disclaimer: I'm a bit of a hardcore geek, and really just wanted to get the physical filament switching unit from the 3D Chameleon with the PTFE Y plugs. I got my kit direclty from Bill in the online auction at SMRRF in December, and I don't think it was a MK3 unit? Anyway, driving the filament swap from outside electronics with a US plug when I'm not in the US was... suboptimal for me.
So I connected both of the steppers to my control board and am not using the electronics that Bill built with a lot of effort. (sorry! I'm just a huge nerd that way). Even though Bill said all of it is available, I don't think I've seen his hardware kits available outside his webshop, and that's perfectly fine. Happy to throw my $$ at a good product, which this clearly is.
So in Klipper, I setup the selector and extruder motors
of the chameleon unit as manual steppers. I'm including a snippet of what the config for that looks like for me, just remember to check your MCU pins and run_current values if you want to use those:
#S6
[tmc2209 manual_stepper selector]
uart_pin: ar100:PD2
uart_address: 3
run_current: 0.3
stealthchop_threshold: 0
#S7
[tmc2209 manual_stepper chameleon]
uart_pin: ar100:PD3
uart_address: 2
run_current: 0.8
stealthchop_threshold: 0
#S6
[manual_stepper selector]
step_pin: ar100:PL10
dir_pin: !ar100:PE14
microsteps: 1
rotation_distance: 2
#S7
[manual_stepper chameleon]
step_pin: ar100:PL11
dir_pin: !ar100:PE15
microsteps: 16
rotation_distance: 34.408602151 # reverse engineered from the ESteps value
Now for the really complicated bit.
These macros are going to behave like a regular toolchange. Meaning T0, T1, T2, T3 will do what we need them to do before the slicer creates the color purge.
I tried to build them like a good programmer would, to reuse code as much as possible. TS0, TS1, TS2 and TS3 are meant to facilitate filament selection after a boot if you're not on T0 being loaded into the nozzle (just shorthand for KlipperScreen calling TOOL_SELECT TOOL=[0-3]). TOOL_INIT does the initial homing sequence.
So, make sure you include TOOL_INIT in your PRINT_START macro if you have one, or your start gcode otherwise, and remember it defaults to setting the tool to T0.
This is still under construction to a certain extent, as there are ways to modify the printer.cfg to make it save variables, so the printer would remember what filament is loaded between reboots. I just didn't want to futz with that until I get some basic multi-color prints done.
To make the macros appear, put the chameleon.cfg file in the config directory on mainsail, and add a line near the top or bottom to include it with [include chameleon.cfg].
In the chameleon.cfg file, you will need to double check a couple of values before getting started.
The first is on the 4th line of the file. This is the distance in millimeters you want to retract the filament to clear the Y joint. The same distance is used to push it back in.
The WIPE macro on lines 16 through 22 is directing my printer's toolhead to a nozzle cleaning brush and making two swipes across it to clean the nozzle before going to print on the purge block. This catches ooze that could otherwise get caught elsewhere.
The TOOL_INIT macro is the last place to check. This was what I had a number of difficulties with, until I re-watched Bill's setup video and he talks about the selector motor's position to determine where each filament is properly selected. The setup for the selector is such that each filament selection's position is 0.5 away from the other. You can see this below in the TOOL_SELECT macro. On line 9 you'll notice I have this weird value of movement:
MANUAL_STEPPER STEPPER=selector MOVE=0.12
This is because the hard stop of my chameleon isn't exactly when T0 is selected. The selector's slot in the bearing wasn't aligned with the perpendicular of the frame. This value will probably differ from one unit to the next.
How do you calibrate this? Run the following commands in the console until you find the value that you need:
MANUAL_STEPPER STEPPER=selector SET_POSITION=0
MANUAL_STEPPER STEPPER=selector MOVE=-1.65
MANUAL_STEPPER STEPPER=selector SET_POSITION=0
Now the selector thinks it's in position 0. This should be parallel to the long edge of the unit's frame.
If it's not (it wasn't exactly right on mine), slowly move the stepper by small increments with a command like this:
MANUAL_STEPPER STEPPER=selector MOVE=0.05
If 0.05 isn't enough, increase it. Remember, the value you're setting in MOVE= is a position for the stepper. Not an increment. When the slot is properly aligned, you've found what the value is that you want to put in for the MOVE= on line 9.
With this, you're left with simply setting up your slicer for multi-material color, just make sure that your TOOL_CHANGE custom gcode simply calls.
T{next_extruder}
This will depend on the slicer you use, but hopefully it will bring the needed controls you were looking for.
If there's interest, I can put this up on Github for folks to contribute and make this a community resource with continuous improvement.
Multi-colored cheers from Switzerland!
Jon
EDIT: Forgot to share the Github Repo where the code will likely be updated: https://github.com/goeland86/3DChameleon_Klipper_macros
Trying to figure out the best way to use this as an extruder in bowden/remote config.
Well done!
But what i miss is a check if the printhead is heated when you're loading and unloading the extruder.
Do you think this would work with a rooted Creality K1 series printer?
Just ordered my Mk4, but have a BTT MMB I can tinker around with. I am using a V400 delta printer with an ERCF v2. This will eliminate the attached electronics, and I will need to wire in the steppers to the MMU board correct?
I'm curious ... why not set the selector motor's rotation_distance to 4? You'll have to adjust your "move to T0 location and reset" amount in TOOL_INIT (for me it came out to 0.20), but then everything after that will make the "MOVE" and the "TOOL" be the same ... aka turning things like
{% if TOOL == 0 %} MANUAL_STEPPER stepper=selector MOVE=0 {% elif TOOL == 1 %} MANUAL_STEPPER stepper=selector MOVE=0.5 {% elif TOOL == 2 %} MANUAL_STEPPER stepper=selector MOVE=1.0 {% elif TOOL == 3 %} MANUAL_STEPPER stepper=selector MOVE=1.5 {% endif %}
into a nice and simple
MANUAL_STEPPER stepper=selector MOVE={TOOL}
That won't work for your TOOL_FREE macro, obviously, so you'll have to adjust the values (Tool 0 Move 2, etc) on that one. That's how I set mine up and it works great, at least in testing. I haven't printed anything yet because I wanted to see if anybody else had done something similar and make sure I was on the right track. I saw that you had some more advanced macros than I did which I will be incorporating. So thank you for this.
what if I were to use physical filament sensors instead of rotation distance/measurements?
say one in a printed y-pipe or something and 1 or 2 (1 at the extruder entry and one before the hotend, sorta like what some are doing with the ercf) in the toolhead.
How would I go about setting something like that up in the .cfg file?
Do you have a link to the github page?
Thanks, works great. I added a conditional statment to the tool variables, that checks if its the same extruder so you can do an initial load on any filament. Just add to T0-T3 and change {% if TOOL != 0,1,2,3 %}....
{% if TOOL != 0 %}
EXTRUDER_UNLOAD
TOOL_SELECT TOOL={TOOL}
CHAMELEON_UNLOAD
{% endif %}
Most people wont have two extra axes on her Board. (Me too). I am thinking about using a ercf board and using it as a scondary mcu. Hast anyone done that?
The 3d Chameleon is a great piece of Hardware, and of course it is genious to use with a Button. But that is far away fromm my preffered way of doing such a thing. It would be great If Bill would publish a "pro board" with full control possibilities. Maybe with additional gpios to add Filament Sensors or LEDs to visualize what the Chameleon is doing. Or Pause the Print in Case of any Errors (Cross Talk, unsucessfull load)
Inspired greetings from germany
Wow, this is a pretty elegant way of doing this!
Edit:
Finally got around to setting up an old SKR E3 board as a secondary mcu and after some fiddling with code it works great! I'm excited to use some extra motors I have to add even more colors. I figure I can have 8 filaments and basically leave the whole rainbow of colors loaded up permanently.
Beautiful work!