What's new
VORON Design

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members!

Klipper LED effect

Hagbard

New member
Trusted Advisor
Voron Owner
Klipper LED effect

This is the thread for the Klipper Plugin to run RGB effects on neopixels & co from within Klipper
Check it out here.

hockey afford GIF


Latest release:
Pre-Release v0.0.10

Highlights:
Effects can now be stopped more easily
Effects can now replace effects runnning on the same LEDs
New Effect: Homing (triggers on endstops and probe)

Happy RGBing!
 
Last edited:
I love this plugin and abused the heck out of it. You can tell what task my printer is doing from across the room.
 
'Neopixel update didn't succeed' most certainly is coming from too much load on the MCU. It means that it couldn't finish sending out the whole frame in time or it was interrupted by e.g. motor commands. For long chains or a lot of LEDs I recommend reducing the frame rate and using a dedicated MCU like a Pi Pico, Xiao Seeeed or KlipperExpander.
 
Are there some examples of using LED_EFFECT for different statuses? I've looked thru the doc and have a basic effect on power up. But I'm still trying to wrap my head about doing stuff when homing, printing, heating up, etc. Like any good programmer I work best by ripping off someone else's complete code rather than figuring it out from the documentation. :)

Also... has anyone implemented a Larson Scanner (back and forth chasing) in LED_Effect?
 
Here you can find a example template: https://github.com/tanaes/whopping_...o_LED/Code/stealthburner_led_effects_barf.cfg

I used this as well and it's working pretty fine. I only struggle at the moment that it does everything as expeceted on first print but for the next prints it starts doing some weird things (flickering, color changing where it souldn't etc.).
This is awesome thanks, going to take me a week to process the contents and figure out what’s what lol.

It’s all a learning curve!
 
This is awesome thanks, going to take me a week to process the contents and figure out what’s what lol.

It’s all a learning curve!
I just played around with it so see what it's doing if I change a parameter :)

For example this is my G32, everything with "status XXX" is for controlling the LEDs:

[gcode_macro G32]
gcode:
status_off
status_homing
BED_MESH_CLEAR
CLEAR_PAUSE
G90
G28 X Y
ATTACH_PROBE_LOCK
ATTACH_PROBE
G28 Z
status_off
status_meshing
BED_MESH_CALIBRATE
DOCK_PROBE_UNLOCK
status_off
status_ready

All the status off should not be necessary but I try to figure out why the light go crazy after the first print...
 
Thanks for this Hagbard! The new "homing" effect is really great. I have it on autostart to track Z and probe so that it works even with Mainsail homing/leveling/mesh calibration. Love it.
 
OK so I have this plug-in working and I can show a normal rainbow effect when the printer is at idle but once the printer starts working the LED effects go kind of crazy. The normal slow flow of the rainbow is erratic and flickering. Anybody know what I did wrong?
My LED is plugged into a BTT octopus exp1 bank pe7 pin of it matters. I tried using a spare bltouch pin earlier and same behavior occurred.
 
OK so I have this plug-in working and I can show a normal rainbow effect when the printer is at idle but once the printer starts working the LED effects go kind of crazy. The normal slow flow of the rainbow is erratic and flickering. Anybody know what I did wrong?
My LED is plugged into a BTT octopus exp1 bank pe7 pin of it matters. I tried using a spare bltouch pin earlier and same behavior occurred.
How looks your configuration?
 
How looks your configuration?
Relevant block below. It seems hardware related. When the printer is not printing the LEDS act properly. Effects are smooth and predictable. Seems like noise on the signal pin or something being generated when the printer is printing actively.
Where do you put the resistor? I put it close to the signal pin on the BTT octopus but in retrospect I bet it should be closed to the LEDs. Is 100 ohm enough? Any insight is welcome. Thanks

[neopixel rainbowstick]
pin: PE7
#EXP1 Bank BTT Octopus
chain_count: 25
color_order: GRB
initial_RED: 0.0
initial_GREEN: 1.0
initial_BLUE: 0.0

[led_effect rainbow]
leds:
neopixel:rainbowstick (1-25)
layers:
gradient 1 1 top (1,0,0),(0,1,0),(0,0,1)

[led_effect idle]
leds:
neopixel:rainbowstick (1-25)
layers:
breathing 10 1 top (.98,1,.27)
frame_rate: 24


#LED EFFECT MACROS
[gcode_macro LED_RAINBOW]
gcode:
STOP_LED_EFFECTS
SET_LED_EFFECT EFFECT=rainbow

[gcode_macro LED_IDLE]
gcode:
STOP_LED_EFFECTS
SET_LED_EFFECT EFFECT=idle

[gcode_macro STOPLED]
gcode:
STOP_LED_EFFECTS
 
Hm, I can't see a problem on first sight. Even if it does not matter I would wirte small/capital letter the same the whole time. I don't use a resistor. Where did you get power from? same ground as rest of machine?

Most of my effects work fine, only with one I have a similar problem, should be comet in SB with one color while meshing but another color does just show up. Printing macro works fine on mine.
 
OK so I have this plug-in working and I can show a normal rainbow effect when the printer is at idle but once the printer starts working the LED effects go kind of crazy. The normal slow flow of the rainbow is erratic and flickering. Anybody know what I did wrong?
My LED is plugged into a BTT octopus exp1 bank pe7 pin of it matters. I tried using a spare bltouch pin earlier and same behavior occurred.
Can you post your [PRINT_START] macro here as well? Are you accidentally stacking multiple effects on the same Neopixel chain (which works but might account for the flickering you see)?
 
Can you post your [PRINT_START] macro here as well? Are you accidentally stacking multiple effects on the same Neopixel chain (which works but might account for the flickering you see)?
Here is my print start macro but there shouldn't be anything to trigger the LEDS in there. I've been triggering them manually for testing rather than trying to automate a routine.


[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - PLEASE CUSTOMISE THE SCRIPT
gcode:
CANCEL_FAN_TIMER
DAYLIGHT_STARTING #set daylight leds to bright
SET_TEMPERATURE_LED LED=front_led SENSOR=heater_bed
M117 Homing... ; display message
STATUS_HOMING
G28
M117 Leveling...
STATUS_LEVELING
M117 Z Tilting...
Z_TILT_ADJUST
M117 Homing...
STATUS_HOMING
G28 Z
M117 Meshing...
STATUS_MESHING
SETUP_KAMP_MESHING DISPLAY_PARAMETERS=1 LED_ENABLE=1 FUZZ_ENABLE=1
SETUP_LINE_PURGE DISPLAY_PARAMETERS=1 ADAPTIVE_ENABLE=1
BED_MESH_CLEAR
BED_MESH_CALIBRATE
M117 Heating...
M104 S245 ; set extruder temp
M109 S245 ; wait for extruder temp
M117 Purging...
LINE_PURGE LINE_LENGTH=25 PURGE_AMOUNT=20
STATUS_READY
M117 Printing ; display message
DAYLIGHT_PRINTING #set daylight leds 25%
 
What is DAYLIGHT_STARTING? You set the brightness with color RGB value (1,0,0),(0,1,0),(0,0,1). 1 = 100% 0.5 = 50% etc.
 
Daylight starting sets my case light (daylight on a stick) 24v leds to a certain brightness. They are separate from the Disco stick XXL I'm trying to get to work.
I did some further testing and it has something to do with the output pins I'm trying to 'hijack' on the board. I wired the disco stick to the neopixel slot and it works great. No issues. But I lose my bed LED that I have wired up to show the bed temp reflected as LED color. Seems like no matter what other pin I use on the BTT Octopus it doesn't want to work. When I use the EXP1 pins or TFT pins (both 5v for the bed led now it goes to the wrong colors). I'm thinking for my wiring I need a second neopixel slot.
Klipper expander perhaps?
 
Top