- Learn Linux
- Learn Electronics
- Raspberry Pi
- LPI certification
- News & Reviews
This is a pixel server project, controlling PixelStrips (NeoPixels) using a web server. This allows for control of RGB LEDs using a Raspberry Pi which can be accessed via a web browser on a computer or on a smartphone. The LEDs can be configured with a number of different sequences, variable speed and any color combination. It also includes support for automation and can be used with the IoT CheerLights project.
If you find these kind of videos useful please subscribe to my channel : Click here to subscribe.
PixelStrips, also known as NeoPixels and RGB LEDs are individually addressable multicoloured LEDs. They are usually controlled by WS2811, WS2812, WS2812B or otherwise referred to as WS281x integrated circuits. You can connect these directly to a Raspberry Pi GPIO, although these should normally be connected through a voltage level shifter. This is explained in my guide to using NeoPixels / WS2812B RGB LEDs with a Raspberry Pi.
The pixel server software can be used in home automation, either using a crontab or for other home automation systems that can connect to a locally hosted web page.
To download the software visit the github page linked further down this page.
This video explains about the security updates implemented to make the server IoT ready and safe for connecting to the Internet.
Additional configuration is required which is explained in the README.md file included in the source code.
A new custom color option has been added, which can be used to read the colour from a file customlight.cfg. This can be updated through a simple call to the CheerLight API or through your own automation.
For more details of how this can be configured see the video above or the README.md file in the software download files.
There are two new updates that I introduced towards the end of April 2022. These are both related to additional features which may be useful for pixel-server home automation or for use by other remote applications.
The first is to add a new toggle option. This is used to allow you to toggle between the pixel-server showing a specific sequence and turning all the LEDs off. This may be useful as a way of toggling the lights through a toggle switch on a remote system. This is something I've used with an ESP32 dev board to allow a single button to toggle the lights on and off.
To use this feature just add toggle=True to your automation GET request.
The second feature is to provide more information back to the client making the request. It now responds with JSON information about the status of the request and the light sequence currently in use. This has allowed me to improve the status message along the bottom of the web client, but could also be used by other systems. This is likely to be useful when used in conjunction with the toggle parameter as it provides a way to identify the status of the lights.
There is a small risk that this could break some other services that check the status of the response, but as the previous response was only ever "Ready" it is not likely to to be an issue for most users.
At the end of March 2022 the Raspberry Pi OS has been updated so that it no longer uses the default pi username. I've had to make some changes to some of my software so that it still works correctly. This video goes through the changes I have made to my Raspberry Pi Pixel Server software so that it works without the default username of pi.
In this case I've changed some code and the installation instructions to use the /opt directory instead of using /home/pi. This shouldn't break any existing installs as it's only the systemd configuration files that have changed, but means that new installs will not have to make any specific changes to reflect their username.
See this video for more details about the changes to the Raspberry Pi username and the implications for IT Security.
This explains about the December 2021 update to the Pixel Server code and additional light sequences. These are explained in the below video.
See below for details of installing the latest updates.
The Pixel Server code is available to download from github at:
Full install instructions are provided in the README file available on the GitHub page.
If you installed the software using a git clone then you can update by issuing a
git pull. Alternatively you can download the latest version overwriting your existing files manually.
As long as you followed the instructions regarding using a custom configuration file, then your config will still be kept.
If upgrading from a version prior to September 2022 you may need to add the following pre-requisites if not already installed:
sudo apt install python3-argon2
sudo pip3 install Flask-WTF
Then you will need to create a login using the createadmin.py script explained under the install instructions.
python3 createadmin.py <username> <password> >> users.cfg
You may also need to create a new configuration file for auth.cfg
I originally created a graphical interface for controlling the NeoPixels. The GUI was designed for use with Disco / Theatre Lighting and as such it works well if you want to control the NeoPixels directly on the Raspberry Pi it is connected to.
I also added and outdoor RGB Pixelstrip to my driveway. This is to provide lighting when returning home during the dark as well as a way to show appropriate lighting displays. Whilst you could control these manually and could access them from another computer using VNC the use of the GUI application means that it was not so useful for automation. So this is why I created this new client server version. The graphical application is still available, although future development is going to concentrate on this new server version instead.
See the link below for a related project using an ESP32 with a capacitive touch sensor to toggle the LEDs on and off.
I'm always working on new projects
To find out about the updates please:
Subscribe to the PenguinTutor YouTube Channel
Follow @penguintutor on Twitter
Please view the copyright information regarding use of the circuits.