Skip to content

Led Support

moggieuk edited this page Aug 7, 2024 · 43 revisions

Page Sections:

Happy Hare now can drive LEDs (NeoPixel/WS2812) on your MMU to provide both functional feedback as well as to add a little bling to your machine. Typically you would connect a string of neopixels (either descrete components or an LED strip, or combination of both if compatible contollers) to the neopixel output on the MCU that drives your MMU although this can be changed.

The setup for LED's is contained at the bottom of the mmu_hardware.cfg file and requires the installation of LED Effects for Klipper.


#f03c15 #c5f015 #1589F0 Wiring

LED Connection

LED strips can be formed but soldering together individual neopixels or using pre-made strips. You can also mix the two but if the "RGBW" order is different you must specify color_order as a list with the correct spec for each LED. There is a lot of flexibility in how the LEDs are connected - segments can even be joined in parallel to drive two LED's for the same index number. The only important concept is that each segment in the strip that represents the MMU gates must be contiguous (ascending or decending), but the order of segments is unimportant (see config examples below)


#f03c15 #c5f015 #1589F0 Hardware Config

If you have run the Happy Hare installer it should have added a section to the end of your mmu_hardware.cfg that starts like this:

# MMU OPTIONAL NEOPIXEL LED SUPPORT ------------------------------------------------------------------------------------
# Define the led connection, type and length
#
# (comment out this section if you don't have leds)
[neopixel mmu_leds]
pin: mmu:MMU_NEOPIXEL
chain_count: 17            # Number gates x1 or x2 + 1 (if you want status)
color_order: GRBW          # Set based on your particular neopixel specification

This section may be all commented out, if so and you wish to configure LEDS, uncomment the entire section and ensure that the MMU_NEOPIXEL pin is correctly set in the aliases in mmu.cfg and that the color_order matches your particular LED (don't mix type or if you do, set to a comma separated list of the type of each led in the chain. e.g. "GRB, GRB, GRB, RGBW, RGBW, RGBW"). Note that you must also install "Klipper LED Effects" plugin.

The wiring of LED's is very flexible but must be controlled by the same pin. Happy Hare defines three led segments: "entry", "exit" and "status" as described in the config file:

# MMU LED EFFECT SEGMENTS ----------------------------------------------------------------------------------------------
# Define neopixel LEDs for your MMU. The chain_count must be large enough for your desired ranges:
#   exit   .. this set of LEDs, one for every gate, usually would be mounted at the exit point of the gate
#   entry  .. this set of LEDs, one for every gate, could be mounted at the entry point of filament into the MMU/buffer
#   status .. this single LED represents the status of the currently selected filament
#
# Note that all sets are optional. You can opt simple to have just the 'exit' set for example. The advantage to having
# both entry and exit LEDs is, for example, so that 'entry' can display gate status while 'exit' displays the color
# 
# The effects requires the installation of Julian Schill's awesome LED effect module:
#   https://github.com/julianschill/klipper-led_effect
# LED's are indexed in the chain from 1..N. Thus to set up LED's on 'exit' and a single 'status' LED on a 4 gate MMU:
#   exit_range:   1-4
#   status_index: 5
# In this example no 'entry' set is configured.
#
# Note the range order is important and depends on your wiring. Thus 1-4 and 4-1 both represent the same LED range
# but mapped to increasing or decreasing gates respectively
#
# Note that Happy Hare provides a convenience wrapper [mmu_led_effect] that not only creates an effect on each of the
# [mmu_leds] specified segments but also each individual LED for atomic control. See mmu_leds.cfg for examples
#
# (comment out this section if you don't have leds)
[mmu_leds]
num_gates:                      # Number of gates on your MMU
led_strip: neopixel:mmu_leds
exit_range: 
entry_range: 
status_index: 
frame_rate: 24

Some examples of how to set these values can be seen in this illustration (ERCFv2 MMU example):

LED Configuration

Note

All the default LED effects are defined in the read-only mmu_leds.cfg. You can create your own but be careful and note the [mmu_led_effect] definition - this is a wrapper around [led_effect] that will create the effect on the specified LED range (segment) but also duplicate the effect on each LED individually. This is especially useful on the MMU where you want per-gate effects.


#f03c15 #c5f015 #1589F0 Controlling LED Effects

Happy Hare LED effects are 100% implemented in mmu_leds.cfg as macros so you can review if you want to tweak and create your own modifications. I would caution that you make sure you understand the logic before doing so, and in most cases you may just want to tweak the effects defined in mmu_macro_vars.cfg to customize. The macros work by intercepting changes of the Happy Hare's print state machine, changes in actions it is performing and changes to the "gate_map" containing gate status and filament color.

You can change default effect or enable/disable in mmu_macro_vars.cfg under the _MMU_LED_VARS macro:

# LED CONTROL -------------------------------------------------------------
# Only configure if you have LEDs installed
#   (base/mmu_led.cfg)
#
[gcode_macro _MMU_LED_VARS]
description: Happy Hare led macro configuration variables
gcode: # Leave empty

# Default effects for LED segments when not providing action status
# This can be any effect name, 'r,g,b' color, or built-in functional effects:
#   'off'             - LED's off
#   'on'              - LED's white
#   'gate_status'     - indicate gate availability
#   'filament_color'  - indicate filament color
#   'slicer_color'    - display slicer defined color for each gate (printer.mmu.slicer_color_rgb)
variable_led_enable             : True                  ; Whether LEDs are enabled at startup (MMU_LED can control)
variable_default_exit_effect    : "gate_status"         ;    off|gate_status|filament_color|slicer_color
variable_default_entry_effect   : "filament_color"      ;    off|gate_status|filament_color|slicer_color
variable_default_status_effect  : "filament_color"      ; on|off|gate_status|filament_color|slicer_color

To change the default effect for a segment change the appropriate line. These effects can be any named effect you define, the built-in functional defaults, "on", "off", or even an RGB color specification in the form red,green,blue e.g. 0.5,0,0.5 would be 50% intensity red and blue with no green.

Happy Hare also has an empirical command to control LEDs:

> MMU_LED
  LEDs are enabled
  Default exit effect: 'filament_color'
  Default entry effect: 'gate_status'
  Default status effect: 'filament_color'
  ENABLE=[0|1] EXIT_EFFECT=[off|gate_status|filament_color|slicer_color] ENTRY_EFFECT=[off|gate_status|filament_color|slicer_color] STATUS_EFFECT=[off|on|filament_color|slicer_color]

You can change the effect at runtime, e.g. MMU_LED ENTRY_EFFECT=gate_status or MMU_LED ENABLE=0 to turn off and disable the LED operation. Please note that similar to MMU_TEST_CONFIG changes made like this don't persist on a restart. Update the macro variables in mmu_macro_vars.cfg to make changes persistent.

The slicer_color is not persisted and can be set with the command MMU_SLICER_TOOL_MAP GATE=.. COLOR=.. as is the case in the recommended MMU_START_SETUP macro. The color can be a w3c color name or RRGGBB value.

Tip

The strongly recommended Happy Hare version of Klipperscreen has buttons to quickly "toggle" between gate_status and filament_color for the default gate effect...


#f03c15 #c5f015 #1589F0 Summary of Default Effects

The default effects, which are both functional as well as adding a little color, are summerized here:

State Filament Entry LEDs
(typically gate loading)
Filament Exit LEDs
(to bowden tube)
Status LED
MMU Disabled OFF OFF OFF
MMU Print States:
"initialization" OFF Shooting stars
(for 3 seconds)
OFF
"ready" default default default
"printing" default default default
"pause_locked"
(mmu pause)
OFF Strobe Strobe
"paused"
(after unlock)
OFF Current gate: Strobe Strobe
"completed" default Sparkle
(for 20 seconds)
default
"cancelled" default default default
"error" default Strobe
(for 20 seconds)
default
"standby" OFF OFF OFF
Actions States:
"Loading"
(whole sequence)
default Current gate: Slow Pulsing White OFF
"Unloading"
(whole sequence)
default Current gate: Slow Pulsing White OFF
"Heating" default Current gate: Pulsing Red Pulsing Red
"Selecting" default Fast Pulsing White OFF
"Checking" default default Fast Pulsing White
"Idle" default default default
Possible Defaults default_entry_effect:
- gate_status
- filament_color
- slicer_color
- off
default_exit_effect:
- gate_status
- filament_color
- slicer_color
- off
default_status_effect:
- filament_color
- slicer_color
- on (white)
- off

In the table above, Effect designates effect (animation) rather than static color


Note

  • MMU Print State is the same as the printer variable printer.mmu.print_state
  • Action State is the same as the printer variable printer.mmu.action
  • These are built-in functional "effects":
    • filament_color - displays the static color of the filament defined for the gate from MMU_GATE_MAP (specifically printer.mmu.gate_color_rgb). Requires you to setup color either directly or via Spoolman.
    • slicer_color - dispays the static color of the filament defined in the slicer tool map (printer.mmu.slicer_color_rgb). Note this might be empty until a print starts.
    • gate_status - dispays the status for the gate (printer.mmu.get_status): red if empty, green if loaded, orange if unknown

Tip

Whilst not LEDs, Mailsail and Fluidd have visualizations of the filament color next to the "extruder" T0, T1, T2, ... buttons. Happy Hare can drive these in various ways similar to LED visualization here. Read Mainsail/Fluidd Integration for more details

 1. Introduction
 2. Installation
 3. Essential Configuration
 4. Calibration
 5. Operation

-- YOUR MMU IS READY TO PLAY WITH --

 6. Slicer-MMU Setup

-- NOW YOU ARE READY TO PRINT! --

 7. Tuning
 8. Optional Feature Setup
 9. Advanced Configuration
 10. Advanced Concepts
11. Quick References

12. Troubleshooting
13. FAQ
14. MCU Board Reference 🆕
15. Change Log

Clone this wiki locally