Skip to content

robotfishe/MaterialSelector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MaterialSelector

This Klipper plugin lets you use physical switches to set filament types in Happy Hare or AFC. It pairs nicely with my SpoolVision plugin for automated colour detection, but can be used independently.

Photo of a selector switch with options for 'PLA', 'PETG', 'ASA', and 'custom'

To install, just download material_selector.py and put it in your klipper/klippy/extras directory.

You can technically use any kind of switch that will flip a GPIO pin to low, but I recommend these selector switches, which are available with anywhere from 2 to 8 positions.

The common contact on each switch should be wired to ground, and each of the other contacts to a different GPIO. You can then define a material_selector section in your printer config for each lane - for example:

[material_selector lane1]
mmu_type: afc   # defaults to "afc"; you can also use "happy_hare"
preset1_pin: ^!selector:PB5
preset1_material: PLA
preset2_pin: ^!selector:PC1
preset2_material: PETG
preset3_pin: ^!selector:PA3
preset3_material: ASA
custom_pin: ^!selector:PC13

One pins must define a "custom" signal which will clear the MaterialSelector input so you can enter material details through KlipperScreen, Mainsail/Fluidd, etc. For each of the other pins, you can define the material to match one of your most-used filament types.

You will also need to add RESET_LANE_MATERIAL LANE={lane_name} to your HH or AFC post-load macro. This checks the current position of the switch when a new spool is loaded and sets the material to whatever is selected if you don't turn the switch.

Obviously this will use up a lot of GPIO pins, so you will probably need an additonal MCU board to handle them. The good news is because this board will only be handling switch inputs, you have some very inexpensive options. This STM32 board from WeAct (I'm using the F446 variant) is a great option - for less than £5 (or $6), you get dozens of GPIOs. Documentation is minimal and there are some pins that don't work as inputs, so you will need to do some trial and error.

Pins confirmed working on STM32F446 (click to expand):
  • PA0
  • PA2
  • PA3
  • PA7
  • PA10
  • PA12
  • PB0
  • PB1
  • PB2
  • PB5
  • PB10
  • PB12
  • PB14
  • PC1
  • PC2
  • PC4
  • PC6
  • PC8
  • PC10
  • PC13

You can use the above boards over USB or CAN. CAN will require a transceiver module like this one.

I'm thinking I might design a breakout board PCB in the future that will be a bit more plug-and-play, but at the moment the best way to do this is with a bit of protoboard.

Photo of a handmade breakout board for the STM32 MCU dev module

If you're going to use one of these over CAN, make sure you have a voltage regulator somewhere in the mix as neither the STM32 dev board nor the CAN transceiver can handle 24V!

Once you're all set up, all you need to do is move the selector to the appropriate spot after you load your filament, and the plugin will update the material type in software for you!

About

Use physical switches to set filament types in Happy Hare or AFC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages