Addressable Strip LED Police Strobo

About: Electronic, Arduino, Raspberry, Photography, Model Train Entusiat

This Police Strobo Light Bar is made with a single WS2812B addressable strip LED bar (97 cm, 29 LEDS) and an Arduino Nano.

This solution allows to make several different light pattern with different color scheme otherwise not possible with standard Red-White-Blue LEDs bar (as used for police strobo lights) or RGB LEDs bar.

I would recommend not using this in your vehicle unless you have checked local laws and have a legal/valid reason to do so.

Step 1: ​How WS2812B Strip LEDs Work

The WS2812B LED strip consist of type 5050 RGB LEDs in which the WS2812B LED driver IC is integrated.

Depending on the intensity of the three individual Red, Green, and Blue LEDs it is possible to simulate any color we want.

The great thing of these LEDs is that it is possible to control even the entire LED strip with just a single pin from our Arduino board.

Each LED has three connectors at each end, two for the powering and one for the data. The arrow indicates the data flow direction. The data output pad of the previous LED is connected to the Data Input pad of the next LED. We can cut the strip to any size we want, as well as distance the LEDs using some wires.

They work on 5V DC and each Red, Green and Blue LED draws around 20mA, or that’s total of 60mA for each LED at full brightness.

If Arduino is powered via the USB, the 5V pin can handle only around 400 mA, and when powered using the barrel power connector, the 5V pin can handle around 900 mA. So if you are using more LEDs and the amount of current that they would draw exceeds the limits mentions above, you must use a separate 5V power supply.

In such a case you also need to connect the two Ground lines two each other.

Additionally it is recommended to use a resistor of around 330 Ohms between the Arduino and the LED strip data pin in order to reduce the noise on that line, as well as a capacitor of around 100uF across the 5V and Ground to smooth out the power supply.

Step 2: Circuit Wiring

Wiring scheme to connect the Arduino nano to the WS2812B addressable strip LED bar is very simple.

The model needs to have wires or pin header soldered to it, I used a pin header for testing but for an actual project you should consider soldering wires.

The WS2812B addressable strip led has 3 solder pads on each side.

+5V (red wire in the scheme) goes to +5V of the Arduino;

GND (black wire in the scheme) goes to the GND of the Arduino;

DIN (green wire in the scheme) goes to a Arduino PIN 5 (for the data) trough a 330 Ohm resistor.

Step 3: Code Setup

I used Arduino IDE with the FAST LED Library

First we need to include the FastLED library, define the pin to which the LED strip data is connected, define the number of LEDs, as well as define an array of type CRGB.

This type contains the LEDs, with three one-byte data members for each of the three Red, Green and Blue color channel.

In the setup section we just need to initialize the FastLED with the parameters with defined above. Now it the main loop we can control our LEDs anyhow we want. Using the CRGB function we can set any LED to any color using three parameters of Red, Green and Blue color. In order to make the change happen on the LEDs we need to call the function

The FastLED library features many other functions which can be used for making really interesting animations and light shows, so it’s only up to your imagination to make your next LED project shine.

My code includes several different LED patterns not otherwise possible with standard RGB LED bar.

The patterns can be modified or recalled in the void loop() section as a single subroutine.

Step 4: Final Note

My code runs through a variations of each pattern to give you a starting point to modify the code to meet your needs.

Code in my GitHub



    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest
    • Organization Contest

      Organization Contest
    • Faux-Real Contest

      Faux-Real Contest