RGB LEDs have numerous applications, ranging from decorative lighting (home decoration) to stage lighting, message boards, and TV backlights. Instead of building an LED system from scratch, you can use a pre-built LED system to make your work easier. One such system is the WS2801 addressable LED strip light. If you need such lighting for your project, here is a close-up look at the strip light. Let's dive in!
What is a WS2801 Addressable LED Strip Light?
The WS2801 is a constant current LED driver containing a strip of LED lights for indoor or outdoor LED displays. It features three output channels for red, green, and blue light, and each drives 30mA constant current maximum. At the heart of the strip is the WS2801 controller chip containing the following:
- Output registers
- Serial shift registers
- Data latches
- An internal oscillator
- Band-gap reference-voltage generator
- Programmable constant output current drivers
This unit uses a 2-wire scheme that is affordable and ideal for low-cost decorative LED systems.
WS2801 Pin Configuration
This 3-channel current driver has the following features.
- Supports constant current and constant voltage drive modes
- Broad constant output 5-150mA current range
- 3.3-5.5V power supply voltage
- Supports hot-swap
- Polarity output reverse function
- 25MHz max input clock frequency
- Programmable constant LED drive current.
- Buffers built into cascade clock and data to the adjacent driver
- PWM dimming scheme built-in for every output channel with free-run support (suitable, especially for low-cost controller applications)
WS2801 chip connection in a typical application circuit
- Backlight for LCD TV
- PWM signal generator
- Decorative LED lighting
- Indoor/outdoor video/message LED display
WS2801 vs. WS2812
Compared to the WS2812 LED strip, the WS2801 features two data lines (clock and data) for addressing the individual LEDs. The WS2812 has a single data pin, and therefore, it needs more calculations before addressing the individual LEDs.
The WS2812 strip light
How to Connect and Control a Raspberry Pi WS2801 RGB LED Strip?
- WS2801 LED strip with 32 addressable RGB LED strips per meter
- Raspberry Pi
- A power adapter and plugin connector (for beginners)
- A switching power supply and power cord (for experts)
A switching power supply LED driver in a metal case.
- Jumper cables
Each LED consumes about 60mA. Therefore, 32 LEDs in a one-meter strip will consume roughly 2A. Raspberry Pi GPIO pins cannot supply such power, so you need an external power supply. The longer the WS2801 strip, the more current it will consume, so the external power connection should match the current demand.
The switching power supply option requires high voltage wiring, which is risky. Working with 230V is even deadlier than 110V, so disconnect everything before cutting the wires from the power plug.
Also, ensure you know the color-coding of the three wires before making the connections. Live or L goes to the phase or outer conductor in the switching power supply. The cable has a black or brown jacket.
On the other hand, neutral or N is the blue cable, and it should go to the neutral conductor. Lastly, the green or yellow wire should go to the PE or grounding conductor.
However, some plugs only have two cables and if using such, leave out the PE connector.
A 2-pin plug with two wires
The output from the switching power supply should be similar to that of a charger-like power supply (5V). With this, connect the LED strip as follows:
Usually, the LED light strips come with soldered plugs for connecting multiple strip lights. Also, they feature a plug for the breadboard and two extra cables for the external current power supply.
Be careful with the power connection because incorrect wiring can short or overheat the Raspberry Pi. Also, ensure the external power supply and Raspberry Pi have the ground or GND connected.
Raspberry Pi WS2801 Library Installation
You must install the Adafruit Raspberry Pi python library to control the light strip. The library gives you the ability to control the LEDs individually to produce any RGB color.
However, this library requires an activated SPI bus, which you call using this command.
Select SPI under the advanced option, then enable it and exit the configuration settings. After that, update the package sources, then install pip using the following commands.
Newer Raspbian versions usually come with these installed.
Brightness Dimming Code
First, create the code file using the following command.
After that, write the following code and save it in the file.
The code switches several rainbow colors in series and simultaneously dims each LED's brightness. You can use the RGB values to define a color's brightness.
In the code, you can modify the pixel count (line in yellow) to include the number of LEDs in the light strip. Remember, a one-meter strip has 32 LEDs. Press CTRL + O to save the file, then CTRL + X to close the editor.
In conclusion, the WS2801 strip light is an easy-to-control 3-channel constant current LED driver that gives you complete control over the entire strip. Additionally, it runs on an affordable 2-wire scheme that can build low-cost decorative system projects. We hope the article will help you set up and control the lighting for your project. If you have any questions or comments, don't hesitate to reach out.