So this is a bit different. In a recent live stream, we coded an RGB strip light web control system using an old Raspberry Pi Zero W. After the stream, I received a few messages asking for a comprehensive guide on how to set it all up, so here it is, along with the demo.
Unlike most of my articles, there will be a video to go with it, so check the YouTube channel, where I will also explain how the code works.
Step 1: Setting up the Pi
I’ll go a bit quickly here, as I’m assuming this is not the first time you’ve used a Raspberry Pi. Create your image on the SD card. I used the Raspberry Pi Imager tool for this. I used the Lite version, as I have no use for a GUI and decided I was going to set everything up over SSH. Use whichever image suits you best. When you get to the OS customisation option, make sure you set up an account and enable SSH. I used the username „lights“. Again, you can use whatever username you want—just make sure you remember to use that name in the file paths later.
Next, SSH into your Raspberry Pi. You can use the command ssh username@ip
in any operating system’s terminal. I found my Pi’s IP address using a network scanning app.
Once in, we are going to update and upgrade. This is very easy to do—just run the following command. This can take up to half an hour, so if it’s taking a while, don’t worry:
sudo apt update && sudo apt upgrade -y
Next we want to disable GPIO18 this is fairly easy to do we are doing this to prevent audio interfearing with the GIO outputs. This is easy to do first we are going to open up the boot config as root
sudo nano /boot/firmware/config.txt
then look for
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
change the on to be off so after the edit it should look like
# Enable audio (loads snd_bcm2835)
dtparam=audio=off
After this reboot your raspbery pi with
sudo reboot
this will take a few miniutes
Step 2: Installing the packages
So we need to install some packages. You will see the --break-system-packages
flag—this may sound a bit scary, but as the Pi Zero is only controlling our lights, it is fine to install the libraries globally. If you are going to use the Pi to control something else as well, feel free to set up a virtual environment, but that’s a bit much for this article.
`sudo pip install rpi_ws281x adafruit-circuitpython-neopixel` --break-system-packages
followed by
sudo python -m pip install --force-reinstall adafruit-blinka` --break-system-packages
and now its time for the fun part.
Step 3: Wiring
Make sure the power supply is suitable for the lights. The voltage and amps should be written on the strip somewhere. If you do what I’ve done and pull apart an old phone charger and join it to the LEDs, I would recommend using some heat shrink or some electrical tape. I’ve damaged equipment before by accidentally shorting circuits.
Diagram made by Kattni Rembor
Step 4: Downloading the Project
So step one clone the project
git clone https://github.com/micfun123/Light-Web-Controller
next open the project
cd Light-Web-Controller
And then test everything is working before we get it to start up on boot and make it easy to control from our phone.
Run sudo python app.py
and you should see a URL. If you did your wiring right, it will all work. If not, check your cables.
Step 5: The final touches
OK, so we are going to set up a systemd service to run the app on boot, as well as a hostname so we can just enter smartlight.local
into our browser and the page opens, instead of us having to find the IP every day.
So, step one: run sudo nano /etc/systemd/system/ledapp.service
And we are going to paste in our config file:
[Unit]
Description=NeoPixel Flask Web App
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/lights/Light-Web-Controller/app.py
WorkingDirectory=/home/lights/Light-Web-Controller
StandardOutput=inherit
StandardError=inherit
Restart=always
User=root
[Install]
WantedBy=multi-user.target
As you remember, my user is called „lights“. If you used a different username, make sure you change it here. Now lets enable it:
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable ledapp
sudo systemctl start ledapp
Lets check the status of that with sudo systemctl status ledapp
you should get a output along the lines of
● ledapp.service - NeoPixel Flask Web App
Loaded: loaded (/etc/systemd/system/ledapp.service; enabled; preset: enabled)
Active: active (running) since Fri 2025-07-18 15:13:55 BST; 49min ago
Main PID: 406 (python3)
Tasks: 4 (limit: 374)
CPU: 19.808s
CGroup: /system.slice/ledapp.service
└─406 /usr/bin/python3 /home/lights/Light-Web-Controller/app.py
So this should start up on boot now. Let’s set a hostname, then restart it.
Run
sudo raspi-config
, and navigate through the menus with your keys: System Options > Hostname
. The default host name is raspberrypi
I changed mine to smartlight
just make sure its all lowercase and has no spaces. After that you should be prompted to restart the pi. If you did’t run sudo reboot
Once the Pi has turned back on you should be able to open up your firefox (fine ill let you use other browsers if you really want to) and type in http://smartlight.local/
this will be the control panel to your lights.
If you enjoyed the blog, feel free to join Discord to get updates and discuss the articles, or follow the RSS feed. If you feel like supporting me feel free to donate a cuppa using the buy me a coffee link in the corner, it helps me keep making these kind of projects.