Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Wiring LEDs to your Raspberry Pi is the most important step!
WS281x LEDs are very simple to wire with their 3 LEDs. There are three options of how to wire, each detailed below.
Make sure you have a sufficient power supply!
You cannot power more than a handful of pixels direct from the Raspberry Pi - it can output a maximum of 500mA, which with a printer and camera connected leaves little left for LEDs. Please use an external power supply rated for the number of LEDs you have.
Using SPI to control the LEDs means you can only use one LED strip at a time with the Raspberry Pi. If you have more than one, you can 'chain' them together to make a longer strip.
The hardest part about wiring with a Raspberry Pi is connecting up the 3.3v logic from the Pi to the strip that wants 5v. There are several ways you can do this, which are described in more detail below.
All of the references to GPIO pins here are referring to the BCM Pin numbering. For more details on GPIO pins and the different ways of numbering them please see pinout.xyz
It is possible to connect the LEDs up without any kind of level shifting, however mileage varies from strip to strip. I have one setup like this, and one with the full logic shifter. This can work because the spec of the LED strips means they need 0.7 * VDD(5v) which is ~3.5v. Close to the Pi's 3.3, so depending on how tight of a tolerance your strip has, this is possible.
Wiring is as follows:
Pi GND to LED GND
Pi GPIO 10 to LED Data in
Power supply GND to LED GND
Power supply 5V to LED 5V
Make sure you have a common ground between the power supply and Pi.
You can use a level shifting chip to convert the signals from 3.3v to 5v. Recommended one to use is a 74AHCT125, I have this and it works well.
Please note that whilst the wiring below is on a breadboard, this is for illustrative purposes and is not suitable for high current installations. Test with a breadboard and few LEDs, then connect them directly.
Wiring of this is as follows:
Common ground between:
Pi GND
LED GND
Power Supply GND
74AHCT125 GND
74AHCT125 pin 1OE
Pi GPIO 10 to 74AHCT125 pin 1A
74AHCT125 pin 1Y to LED Data in
Power supply 5V to:
74AHCT125 VCC
LED 5V
The diode method is a quick way to reduce the power supply voltage slightly, so that the LED strip can read the 3.3v.
Make sure you have a diode that can cope with the amount of power drawn! As a result of them running at lower voltage the LEDs may not be as bright.
Please note that whilst the wiring below is on a breadboard, this is for illustrative purposes and is not suitable for high current installations. Test with a breadboard and few LEDs, then connect directly.
Wiring is as follows:
Pi GPIO 10 to LED Data in
Power supply 5V to 1N4001 diode anode (side without the stripe)
1N4001 diode cathode (side with the stripe) to LED 5V
Power supply GND to Pi GND
Power supply GND to LED GND
How to setup and configure the Raspberry Pi's SPI interface for use with WS281x LEDs.
The plugin uses the Raspberry Pi's SPI interface to push data to the LED strip, rather than PWM since it doesn't need to be run as root to use SPI.
As a result of this, there are a couple of OS level configuration items that need to be handled. Luckily for you, the plugin makes this very easy for you to do by providing a UI to run the commands.
Note: You may need to reload the web UI after installing the plugin, to get the wizard to show up. It will not display if all settings are correct or you have dismissed the wizard once already.
The setup wizard requires root access, and therefore the password for the Pi user if you have not configured passwordless sudo
, as is default on OctoPi. This password is not stored, and is only used for the steps below.
Add the pi
user to the gpio
group.
Already configured on newer images. Means the pi
users can access the GPIO pins.
Runs sudo adduser pi gpio
Enable SPI. The plugin uses SPI to drive the LEDs, which is disabled by default and needs to be turned on.
Adds dtparam=spi=on
to /boot/config.txt
Increase SPI buffer size. Whilst the plugin will work without this, it will only work well with a handful of LEDs.
Adds spidev.bufsize=32768
to the end of /boot/cmdline.txt
Set compatible clock frequency Raspberry Pi 3 or earlier only, not required for a Pi 4 The Pi 3's default internal clock frequency is not compatible with SPI, so it needs to be set to 250 to be compatible.
Adds core_freq=250
to /boot/config.txt
Set a minimum clock frequency Raspberry Pi 4 only On a Raspberry Pi 4, the clock frequency is dynamic and can change when the pi is 'idle' vs. 'working', which causes LEDs to flicker, change colour, or stop working completely. By setting a minimum the same as the max, we stop this dynamic clocking.
Adds core_freq_min=500
to /boot/config.txt
WS281x LED Status OS configuration complete! You will need to reboot your Pi for these changes to take effect.
There are common defaults set in the plugin, here is an explanation of those you should change to match your setup.
Open the plugin's entry in OctoPrint's settings interface, and you should be presented with this view:
Click on the 'LED Strip Settings' button in the top right. The key settings you should edit are listed below:
Strip Type Select the type of strip you have connected to your Pi. Note: This may not be exactly what you were sold, sometimes they send variations. If you have issues, please try similar strip types here.
Number of LEDs This should be easy, count the number of LEDs you have connected and enter the right number!
Max Brightness This setting controls the maximum brightness that your LEDs should reach.
For more details on the rest of these settings, please see the full documentation
How to setup WS281x LED Status on your Raspberry Pi running OctoPrint.
I've tried to make this setup process as simple as possible, while it was already easy it is even easier with this guide.
Install the plugin via OctoPrint's bundled or manually using this URL:
Once you have installed and enabled the plugin, OctoPrint will prompt you to restart the server.
Once the server is back up, you may have to refresh the page for in order for the wizard dialog to show up.
Using the OctoPrint Docker container? There's some for this to work.
This page lists the hardware that is officially supported to use this plugin
The 3 types of LED strips that the plugin supports are:
WS2811 (including B variants)
WS2812 (including B variants)
SK6812 RGB
SK6812 RGBW
Please note as well that 'NeoPixels' are an Adafruit brand name, I find that they are much cheaper direct from China with just as good results, they are the same thing.
At this time, only the RGB LEDs are used. Thanks to a PR from @samwiseg0 this is coming soon!
There are no officially-supported models for power supplies, since they are all the same. However, please make sure you are using an external power supply and not using the RPi GPIO pins to power the LEDs. They cannot provide the power drawn by a strip of WS281x LEDs.
Don't use tiny wires to connect the LEDs - these can heat up and melt if they are too thin.
I have had good results with a 74ACHT125 level shifter, which is recommended by Adafruit for their Neopixels. Please note that while WS281x LEDs work without level shifting, you may need to keep the wires as short as possible - especially when using 12V LEDs.
The documentation for WS281x LED Status!
This documentation should tell you all you need to know about how to use the plugin. There's a lot of information here, please be sure to read some of it before opening issues in case the solution is here.
Want to contribute? Go for it! There should be an 'Edit on GitHub' button to the top right of each page. .
Enjoying the plugin? Please consider supporting it's development! You can sponsor it Thank you for your support! It means a lot.
Feedback? Questions? Need more info? Please give feedback! You can rate the pages using the smiley faces in the bottom of each page. Feel free to get in contact anywhere to let me know of issues with any of these docs, or contribute.
The core of the plugin, the most used feature to find the status of your printer.
The plugin reacts to several events to display printing effects. For each of these effects, they have similar settings:
Enable Whether the effect will run or not
Effect One of the available
Colour The primary colour to run the effect. Note this is ignored in some effects.
Delay The length of time to wait between each frame of the effect.
Some events also have some specific settings, these are detailed alongside them.
Startup
Printer Connected/Idle
Printer Disconnected
Print Success
This effect has configurable 'Return to idle' time in seconds. Set to 0 to disable returning to idle.
Print Paused
Print Failed
Printing
This effect will override the print progress effect.
All the standard effects available, with fancy visualisations!
Sets all LEDs to one colour, forever.
Wipes colour across the strip pixel by pixel, then clears it pixel by pixel.
Wipes colour pixel by pixel, as above, but to clear it turns around and heads backwards.
Fades brightness up and down. Looks better in real life than the visualisation below!
Sends a pulse of light bouncing from one side of your strip to the other.
Sends just a single pixel from one side to the other, bouncing about.
Cycles all the LEDs through the rainbow together.
Rainbow that cycles across the strip, so a full rainbow is across the whole strip at once.
Two pixels bouncing in opposite directions, crossing over in the middle.
Sets all LEDs to a random colour, then changes a random pixel, to a new random colour
A physics based effect, simulating 2 balls bouncing up and down. Looks great on longer strips (and shorter ones too...!).
Unfortunately creating the simulation for this effect didn't work, so is unavailable for now. Sorry!
Using OctoPrint in a docker container? You need to do some slightly different config.
This step is not required if you are not using a docker container. The standard setup guide can be found here
You will still need to follow the full setup guide, this is additional.
The plugin needs to be able to access 3 files to run. These are:
/boot/config.txt
/boot/commandline.txt
/proc/device-tree/model
It also needs access to the underlying hardware to drive the LEDs. To do this it will need to run privileged with docker.
This guide assumes you are using the official OctoPrint container and it's docker-compose.yml
file.
Add the following mappings to docker-compose.yml
under the volumes:
section of the OctoPrint service
To enable access to the hardware to drive the LEDs, the container must be run privileged:
The final file should look something like this Gist: https://gist.github.com/cp2004/5e32b021fca66e7167039a1737fd7f21
Version 0.6.0 of the plugin requires these files to exist on the system for the UI to work. When these don't exist, it crashes the web UI.
Even if your system doesn't use these files, they must exist - just skip the wizard and it will not add anything to them
You may still need to use the SPI setup guide, adjusting the paths.
Progress can be tracked as well, to display more detailed status
Each progress effect has some standard options, to customise them. Individual effects have additional options, listed alongside them.
Enabled
Progress Colour The colour to indicate the progress of whatever event is happening.
Base Colour
The base/background colour of the progress indication.
In addition, there are two global options:
Reverse the direction of the progress bar
Base temperature Heating/cooling progress bar will make '0' the temperature specified. Suggested value is just below room temperature, so that the progress bar starts closer to the end of the strip.
Matches the progress bar in OctoPrint's UI, on your LED strip.
Triggered when a blocking heating command (M109
or M190
) sent to the printer.
Additional options:
Index of tool to track Leave this at 0 for single extruder printers, for multiple extruder printers you can choose a single tool to track.
Enable tracking tool heating
Enable tracking bed heating
Triggered on print success, this will display the progress of the printer while it is still cooling.
Additional options:
Track cooling on bed or tool Select one, since they usually cool down at the same time.
Cooling temperature threshold The temperature when cooling tracking should stop
Don't set cooling tracking below room temperature, or this effect will never end!
The plugin reacts to a number of @ commands, this will tell you the details.
From OctoPrint's documentation:
@ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins. Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint.
The plugin reacts to some different @ commands, listed below:
These commands can be used in g-code scripts, or in custom controls in apps - see here for instructions for OctoRemote, or the guide on how to create a timelapse flash in OctoLapse which also uses @ commands.
Command
Explanation
@WS_LIGHTSON
Turns lights on, same as pressing switch in navbar.
@WS_LIGHTSOFF
Turns lights off.
@WS_TORCH
Activates the torch mode, for timer mode
@WS_TORCH_ON
Turn torch on, for toggle mode
@WS_TORCH_OFF
Turn torch off, for toggle mode
There are various utilities available to help with using the plugin.
These utilities are provided for convenience, I make no claim they are 100% accurate.
Requires M150 intercept to be enabled & printer to be connected. This is due to a small shortcut, which is adjusted in a future version.
Press the 4 buttons to check that each segment of your LEDs are working. Useful if the colours are showing wrong, some LEDs don't work or anything hardware related. Each button sets that colour to maximum intensity, to isolate the individual colours.
The popup box will run a configuration test on your OS. It tests for the same things that the initial setup wizard does, to allow you to verify everything is OK down the line.
At any time, you can run a test of the above settings, using the configuration test dialog. When you run the test, it will tell you if all of the steps are filled in correctly, and if they are not, prompt you to fix it with a click of a button.
This data is also logged to octoprint.log
on startup, to help me with diagnosing issues reported to rule out this configuration being the problem.
Calculates the approximate power consumption of the LED strip. Useful to work out if your power supply is up-to-the task.
The nominal value included by default is 40mA, since this is what I have found to be most common. Brighter LEDs take more power, so adjust to what you think is right for your strips.
Detailed descriptions of the LED Strip Configuration dialog.
This documentation aims to explain all of the settings in the LED Strip Configuration dialog, so you can make the most use of them.
DMA Channel and PWM channel will remain available for editing using config.yaml, just in case you need to change this. You probably won't.
Documentation for the plugin's API, which can be used to create custom controls etc. in other services.
The plugin implements a SimpleAPI as provided by OctoPrint, which enables external access to the plugin's functionality.
It has a single endpoint, supporting a get request and posting a command.
GET
http://octopi.local/api/plugin/ws281x_led_status
Get current state of the plugin, which includes the light status and the torch status.
Name | Type | Description |
---|---|---|
POST
http://octopi.local/api/plugin/ws281x_led_status
Send commands to the plugin, to make it do something.
See also the SimpleApi docs for details about how the request should be structured.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
X-Api-Key
string
A valid OctoPrint API key.
X-Api-Key
string
A valid OctoPrint API key
command
string
The command to be sent to the plugin. See commands below.
Setting
Value Type
Explanation
Strip Type
Selection
The type of strip you have connected, for a complete list see supported hardware
Max Brightness
Percentage
The maximum brightness the strip should reach in any effect.
Number of LEDs
Number
I hope this one is obvious enough
GPIO Pin
Number
The pin that the LEDs are connected to. This should be BCM GPIO 10 for normal operation, other pins are available when OctoPrint is run as root and can use PWM - though this is explicitly not recommended for security reasons.
Frequency
Number
Frequency to drive the LEDs at. This should be 800 000 in normal use, some older strips may require different values.
DMA Channel
Number
(To be removed from the UI in a future version)
Do not change the DMA channel if you do not know what you are doing.
This should be 10 in normal use, other values can cause severe problems.
Invert Pin output
Checkbox
Invert the signal from the Raspberry Pi. Useful if your setup uses a level shifter that inverts the signal, it can be inverted again to make it the right way around in the end.
PWM Channel
Number
(To be removed from the UI in a future version)
Internal PWM Channel. Irrelevant to the plugin since it uses SPI in most cases.
WS281x LED Status will intercept M150 commands to control the LEDs.
Commands should be formatted as such:
M150 [P{intensity}] [R{intensity}] [G{intensity}] [B{intensity}] [W{intensity}]
All of the parameters are optional, and can be included in any order. If an option is not included, its value is 0 - as a result sending an empty M150
command will turn the LEDs off.
It's not recommended to send an empty M150
, and instead use @ commands to turn the LEDs on and off.
Examples:
On a standard RGB WS281x strip, the W parameter sets an equal value of R, G and B on the LEDs.
If you have an RGBW strip and enable the 'Use dedicated white' setting, the W parameter will control the white LEDs only.
Sending any of R, G or B with the command takes priority over the W.
Parameter
Explanation
P
Brightness, max 255. If not included, defaults to maximum brightness in the settings
R
Red intensity, max 255.
G
Green intensity, max 255. Can also be U
for Marlin compatibility.
B
Blue intensity, max 255.
W
White intensity, max 255.
This page aims to list common problems people have with the plugin. Please read it before opening issues.
This is going to be an ever-evolving page, as I learn of common issues people identify when setting up the plugin.
Got something to contribute? You can send a PR to edit this page, just click the 'Edit on Github' button. All contributions are welcome!
Check you have a common ground between an external power supply, and the Pi. See more (including an example video) in the issue opened here
Make sure you have the correct order of RGB strip selected in the strip settings. You can use the LED Strip test to help debug this issue quickly.
Make sure you restart the OctoPrint server, and reload the web interface. You should see the wizard pop up, or the light/torch icon in the navbar.
It is likely that the OS level config is incorrect. To fix this, please head to the OS Configuration Test section (under 'Utilities') to run a test and fix the configuration. See the OS Configuration Test docs.
If you get the error:
From the plugin_ws281x_led_status_debug.log
then it likely means that you have some extra peripherals attached to your Pi, that are taking up the SPI channels, therefore conflicting with the plugin's use of SPI.
Specific to this Elecrow 5 inch HDMI touchscreen
A user reported that SPI failed to initialise with the above screen, however commenting out the lines the guide asked you to enter meant that both the screen and LEDs could work at the same time.
The dependency that this plugin relies on was not updated to add support for these boards as of the last release of the plugin. Please see this issue for instructions of how to fix it.
Some strips do not like 3.3V signals, and if you do use 3.3v (without a level shifter) then please keep the wires to the LEDs fairly short to avoid voltage drop.
Adding a 470Ω resistor in the signal line can help. Some guides recommend this, in my experience it is not always required. Worth a try if you have unstable signal to the LEDs. Link to issue.
Mixed reports that using a sacrificial LED on a short wire (to avoid voltage drop) can be beneficial for the LED strip. See this Hackaday article for more details. This solution is untested, only linked because it might be useful.
The configuration for the features tab under the plugin's settings
Here's all the details of the additional features of the plugin, so you can effectively configure them.
The torch button can be turned on or off to clear up navbar space if you don't want it. It has the same settings as standard effects but with some added extras for a manual trigger.
Using @ commands to trigger the torch can enable cool integrations with other software, such as OctoLapse.
The torch button or @ command turns the torch on permanently, until it is turned off. This blocks any other effects.
The torch button starts a timer to turn off after configurable length of time.
The LED strip will turn on at the start time, off at the end time. Potentially useful if you don't want them on overnight.
Make sure your system time is set on the server. If you want to change this run sudo raspi-config
on the Pi.
This currently does not support the end time being later than the start time, since it will end up with all the LEDs being off.
Enable intercepting and using M150 commands. If not checked, these commands will be sent to the printer.
For documentation of the command, please see the M150 Intercept documentation page.
Debug logging logs a lot more information about the effect runner process. This will help massively when reporting issues on Github, so please enable it when reporting issues!
Need help using the plugin? Read this page first.
Please select the area that most describes what you need help with:
There's a lot of documentation here, that describes in detail the configuration options and the features of the plugin. Be sure to read the pages under the configuration section, such as LED Strip Configuration
Still struggling? Please seek help on the OctoPrint community forums, or the Discord Server. I'm often there, or there are other users of the plugin who can help out.
Probably the step that has the most problems, you're not alone here.
Please double check that you have wired the LEDs exactly as shown in the Wiring Guide and double check all connections.
Next up is the troubleshooting guide, where there's a list of common problems identified with solutions. Please check there and make sure your problem isn't listed, or try some of the recommended solutions.
Still won't work?
Before asking for help, please ensure that your LED strip works with other devices if possible. The best thing to check is with an Arduino, since these work more reliably than Raspberry Pi & Python.
You can seek support by opening a 'Get Help' issue, on the OctoPrint community forums, or the Discord Server. Helpful people are around most of the time to get your problems solved.
Really? You found a bug? Ok then, best make sure it is fixed.
Please open a bug report issue providing as much information as possible, including:
(Always) octoprint.log
file
(Always)plugin_ws281x_led_status_debug.log
file, preferably with debug logging enabled.
Clear, easy steps to reproduce.
The hardware you are using (if relevant)
Screenshots/video showing the problems (if necessary - these can help quite a lot)
Please use the bug report template!
Describes how to use the torch effect to simulate a flash for OctoLapse.
Using WS281x LEDs to create a flash for a timelapse
By using the power of @ commands it is very easy to make your LEDs react to other plugins that use GCODE scripts. For example, to make the LEDs flash for the timelapse, to light it up, you can use the following settings:
Enable 'Torch mode is a toggle' in the WS281x LED Status settings, and set the torch effect to solid colour & bright white (and colour will do, but white is the most common!)
OctoLapse Custom Camera Gcode Scripts
Before snapshot:
After Snapshot
That's it! Run OctoLapse in test mode to test it out.