Wifi Prusa Light Bar (WLED + NeoPixels)

Synchronize WLED with your printer
10
17
0
1169
updated January 27, 2023

Description

PDF

Work In Progress!!

This design is a work in progress.  Here is a list of current issues / todos:

  • After printing, P73 goes low and stays low. WLED interprets this as a new button hold event every few seconds. Causes flickering, setting the same animation as currently playing.
    1. Possible Fix: Set the Button Hold → Idle animation preset to be a static non-animated color band.
    2. Possible Fix: Remove the button hold macro.  Use press and double press to navigate the presets.
    3. Possible Fix: Set WLED button to Push Inverted and swap the gcode around.
  • After a power cycle, the ESP8266 filesystem becomes corrupt when connecting P73 through a voltage divider to the D3 input.  Measured 1.2V when first turned on (bad).
    1. Solved: Moved to D1 and using a reverse diode and 3.3v pullup resistor to convert from 5V.  Measured 3.3V when first turned on (good)
  • ESP8266 crashes periodically.  Scope says the 5V and P73 lines are noisy during a print job.  
    1. Possible Fix: Try adding a 330uf or 1000uF capacitor to each. 
  • Finalize presets file.  
    1. TODO: No .json is attached, use appendix for now.

 

Introduction

By inserting custom gcode into PrusaSlicer, we can press a virtual button input to an ESP8266 running WLED.  This gives us the benefits of WLED (wifi smartphone app and lots of animation options) with very little overhead. 

A typical print will follow the following animation routine:

  1. Button Hold → Idle
  2. Button Double Press → Heating Up
  3. Button Press → Auto Bed Leveling
  4. Button Press → Active Print
  5. Button Hold → Idle

No raspberry pi needed.  If you are running OctoPrint, you can still follow this build.  Do not wire the ESP8266 into your einsy.  Instead, use the WLED OctoPrint Plugin.

Shopping List

Optional:

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

Remix Notes and Assembly

This is a remix of Prusa Multi-Color Unit | RGB Individually Addressable LED Light Bar by Mew.  Go there for additional 3D parts and assembly notes.  Come back here for wiring and WLED setup.

Changes from Mew's Version:

  • Light Controller box stl fits in a D1 Mini.
  • Added magnetic end caps
  • Added support bars (replaces bamboo sticks)
  • Wiring for D1 Mini
  • Custom G-Code for WLED integration

WLED 

Installation

Installation is all done from your browser.  No tools needed.

  1. Plug the ESP8266 into your computer 
  2. Visit https://install.wled.me/
  3. Click Install and select your com port
  4. Connect to Wifi and launch settings

Settings

After connecting to your WLED installation, set the config options:

Config > LED Preferences:

  • LED outputs > Pin: 2 (D4)
  • LED outputs > Count: 20
  • Button pin = 5 (D1)
  • Apply preset 1 at boot (Idle Animation)

Config > Time & Macros:

  • Button short press Preset = 99 (Next Animation)
  • Long Press = 1 (Idle Animation)
  • Double Press = 2 (Heating Animation)

Optional: If you have a tactile button, you can also setup Button 2’s input and Macros.

Presets

THIS SECTION IS A WORK IN PROGRESS!!! USE PRESETS FROM APPENDIX

Using WLED's file explorer, we can enter all the presets in one go.

  1. Change the url to http://yourIPaddress/edit 
  2. Rename the attached presets.json.txt to presets.json
  3. Upload presets.json file
  4. Change the URL back and confirm the following presets were added:
    • Preset 99 Next
    • Preset 1 Idle
    • Preset 2 Heating Up
    • Preset 3 Bed Leveling
    • Preset 4 Active Print

Tips: 

  • Click 'PC Mode' for a better interface when using from PC.
  • Click ‘Peek’ to preview the animations without connecting the light bar.
  • Getting started with WLED

Wiring

THIS SECTION IS A WORK IN PROGRESS!!!

Now that WLED is configured, you can wire your ESP8266 into the neopixel strip and Prusa.

  • Use J19-7 (PJ3) on the einsy board for the button input to WLED. 
  • Use a diode and 10k resistor to drop the 5 volts to below 3.6 volts for the ESP8266.
  • Add a 330uF to 1000uF capacitor to the 3.3 volt rail.

THIS SECTION IS A WORK IN PROGRESS!!!

PrusaSlicer Settings

Do not just copy and paste these.  Compare them to your own Custom G-code in your PrusaSlicer > Printer Settings.  Copy only the animation parts for toggling the P73 without erasing your existing G-Code.

When done, save your new printer profile in PrusaSlicer.

Start G-code:

M862.3 P "[printer_model]" ; printer model check
M862.1 P[nozzle_diameter] ; nozzle diameter check
M115 U3.11.0 ; tell printer latest fw version
G90 ; use absolute coordinates
M83 ; extruder relative mode

M42 P73 S255 ; Heating Up Animation
G4 P500
M42 P73 S0
G4 P150
M42 P73 S255
G4 P150
M42 P73 S0
G4 P150
M42 P73 S255

M104 S[first_layer_temperature] ; set extruder temp
M140 S[first_layer_bed_temperature] ; set bed temp
M190 S[first_layer_bed_temperature] ; wait for bed temp
M109 S[first_layer_temperature] ; wait for extruder temp

M42 P73 S255 ; Auto Bed Leveling Animation
G4 P500
M42 P73 S0
G4 P150
M42 P73 S255

G28 W ; home all without mesh bed level
G80 ; mesh bed leveling

M42 P73 S255 ; Active Print Animation
G4 P500
M42 P73 S0
G4 P150
M42 P73 S255

G1 Z0.2 F720
G1 Y-3 F1000 ; go outside print area
G92 E0
G1 X60 E9 F1000 ; intro line
G1 X100 E12.5 F1000 ; intro line
G92 E0
M221 S{if layer_height<0.075}100{else}95{endif}

; Don't change E values below. Excessive value can damage the printer.
{if print_settings_id=~/.*(DETAIL @MK3|QUALITY @MK3).*/}M907 E430 ; set extruder motor current{endif}
{if print_settings_id=~/.*(SPEED @MK3|DRAFT @MK3).*/}M907 E538 ; set extruder motor current{endif}

End G-code:

{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+1, max_print_height)} F720 ; Move print head up{endif}
G1 X0 Y200 F3600 ; park
{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+49, max_print_height)} F720 ; Move print head further up{endif}
G4 ; wait
M221 S100 ; reset flow
M900 K0 ; reset LA
{if print_settings_id=~/.*(DETAIL @MK3|QUALITY @MK3|@0.25 nozzle MK3).*/}M907 E538 ; reset extruder motor current{endif}
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
M84 ; disable motors

M42 P73 S255 ; Idle Animation
G4 P500
M42 P73 S0
G4 P1000
M42 P73 S255

Appendix: References

Appendix: Annotated Gcode Logic

WLED is expecting button presses with specific timings.

  • A short press (less than 700ms) will go to the next preset
  • A long press (greater than 700ms) will go to the idle animation
  • A double press (two short presses within 700ms) will go to the heating animation

Short Press

M42 P73 S255 //clear previous
G4 P500
M42 P73 S0   //short press
G4 P150
M42 P73 S255 //clear press

Long Press

M42 P73 S255 //clear previous
G4 P500
M42 P73 S0   //long press
// no need to wait to clear

Double Press

M42 P73 S255 //clear previous
G4 P500
M42 P73 S0   //short press
G4 P150
M42 P73 S255
G4 P150
M42 P73 S0   //double press
G4 P150
M42 P73 S255 //clear press


Appendix: Animation Presets

This is for reference only.  Uploading the presets.json will set these for you.  Or make your own :D the app is very easy to use with lots of youtube tutorials.

  1. Click Create Preset
  2. Unclick Use current state
  3. Copy paste one of the following API commands
  4. Save to the corresponding ID number

Preset 1 Idle

This needs to be a static non-animation.  Holding the button after the print can re-trigger the animation to start over and cause flickering of a moving animation.

{"on":true,"bri":255,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":20,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"col":[[255,224,160],[0,0,0],[0,0,0]],"fx":115,"sx":187,"ix":0,"pal":0,"sel":true,"rev":false,"mi":false},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}]}

Preset 2 Heating

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":20,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"col":[[255,4,0],[255,180,82],[0,0,0]],"fx":2,"sx":128,"ix":128,"pal":0,"sel":true,"rev":false,"mi":false},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}]}

Preset 3 Bed Leveling

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":20,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"col":[[0,0,255],[255,180,82],[0,0,0]],"fx":27,"sx":128,"ix":128,"pal":0,"sel":true,"rev":false,"mi":false},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}]}

Preset 4 Printing

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"start":0,"stop":20,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"col":[[179,0,255],[0,26,255],[0,0,0]],"fx":9,"sx":128,"ix":128,"pal":0,"sel":true,"rev":false,"mi":false},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0},{"stop":0}]}

Preset 99 Next Preset

Preset selection loop must start at 1 so WLED can track the currently selected preset and always increment to the next preset. More info

win&P1=1&P2=5PL=~

Tags



Model origin

The author remixed this model.

License


Highlighted models from creator

View more