NeoPixel Led as Progress Bar

Hi all

I made a macro that use NeoPixel led as a progress bar.

Main features:

  • available for extruder and bed temperatures, printer speed, print progress
  • use display templates with higher fps than delayed_gcode
  • activated by a macro
  • can be changed in start/end macros or during printing

You can find the macro here GitHub - digitalninja-ro/klipper-neopixel: Klipper NeoPixel Templates and if you have an working neopixel I love your feeback.


Hi, i tested your macro, works great so far - Thank you for the macro!

May i ask for a feature request:
When i use the print progress, all leds are switched off and i have no light in my case.
Would it be possible to add another type of progess with all leds on ( i.e white ) and only chage the colour of the corresponding led# to the progress percentage is switched to red or green or whatever ( maybe configurable with parameter? )

At the beginning when using progess, all leds are off - i would prefer to switch on the 1st led even if the print starts and is at 0 or 1% - what do you think?

Hi!. Thank you for testing and feedback.

Yes, I could extend the option to colors, “background” color, “foreground” color and so on. But, after I see led_effects plugin, I promised myself that I keep this as simple as I could :slight_smile:

If you want a red “background” color for print progress change the line 99 from here to:

1.0, 0.0, 0.0, 0.0

The colors are in order RED, GREEN, BLUE, WHITE (for RGB neopixel, white values is igored)

About the second request with one led on: that means I must lie about the progress. The first led will be turn on only after 1/total_leds from print are done.

1 Like

I made some code optimization and add the option to clear the current template in order to use SET_LED command. All changes are in a new beta branch. Fell free to test it and share your feedback.

Thank you

Interesting. Just as an FYI, you can invoke other display_templates from a display_template. Not sure if that would simplify your examples. For example (totally untested):

[display_template get_bed_temp]
     { }

[display_template led_progress]
param_led_num:  0
param_led_total: 1
param_ratio_tmpl: ""
    {% set ratio = render(param_ratio_tmpl)|float %}
    {% set led_ratio = param_led_num|float / param_led_total %}
    {% if ratio > led_ratio %}
        {led_ratio}, 0.0, 0.0, 0.0
    {% else %}
        0.0, 0.0, 0.0, 0.0
    {% endif %}

And (again totally untested): SET_LED_TEMPLATE LED={led} INDEX={i+1} TEMPLATE={'led_' ~ type ~ '_' ~ mode} param_led_num={i+1} param_led_total={my_neopixel.chain_count|int} param_ratio_tmpl="\"get_bed_temp\""


First of all, thank you Kevin for your feedback. Coming from the one who started this wonderful firmware gives me wings.

Based on your example I finally understand how render() works and I’m already starting to think about how it can be used in my macros.

And one question: I read in a dev comment from a klipper commit that display template has 2 fps refresh rate. Consider increasing the fps in the future or this will load the CPU too much?

Thank you,

Thanks. I haven’t run any tests with a higher update rate. You can change the RENDER_TIME value at the top of klippy/extras/ if you want to experiment with something else (be sure to run a full sudo service klipper restart after any code change).


1 Like

Hi george, great job making this progress bar!!
Got it running on 2 machines, the first one is a 8 led strip with the non beta fw klipper, and the second one is with beta fw klipper and this one is a bit buggy(weird with colours stil have to look in to)
But is there a way or a macro to turn the template off while printing, and is there an option to dimm the lights so they are not on 100% power

Thank you for testing and feedback.

I already implement a macro in beta version that clear the template and turn off the led. I test it and have no bugs so far. Give it a try. With master version you could use something like this in your end macro


About light intensity, this isn’t a good idea for GLOW mode because will limit the “range”. In PROGRESS mode not all leds glow with the same intensity. For example the first led will have 1/chain intensity and this will increase for each led that is turn on until the last one, which is the only one that glow at full power.

I hope this helped you

Hi, I’m new here and would like to ask about the type of led diodes used. Drivers are different. Thanks

See Configuration reference - Klipper documentation

Thanks for the quick reply. There was a bug in the config in the GRBW label. I had a chaos of colors. This W is used in other applications.

I just set up your macro, I can get glow and clear to work, but I can not get progress to. The error is:
Error evaluating ‘gcode_macro NEOPIXEL_DISPLAY:gcode’: UndefinedError: ‘dict object’ has no attribute u’neopixel neoneo’

Not sure why two templates work and not the other? Thanks in advance!

I suspect a typo. Could you drop your klippy.log file here after you get the error?

Here is my log file. Thank you.

klippy.log (3.88 MB)

The only difference I see so far is at you neopixel configuration. The new leds don’t have white values. Remove the initial_WHITE from [neopixel] section and try again.

I don’t find the lines where you call the NEOPIXEL_DISAPLY with MODE=progress.

If you try to execute from terminal

NEOPIXEL_DISPLAY LED="neo" TYPE=extruder_temp MODE=progress

what did you get?

Removed the white and still the same thing, the error does seem different now.
Error evaluating ‘gcode_macro NEOPIXEL_DISPLAY:gcode’: UndefinedError: ‘dict object’ has no attribute u’neopixel neoneo’

The only way I can get back the same error is when I misspell the led name. And again, I didn’t find any call in your log with mode=progress. How did you call the macro?

NEOPIXEL_DISPLAY LED=“neo” TYPE=print_percent MODE=progress

Try to use " " instead of “ ”.