Warning: Declaration of Db::query($query) should be compatible with mysqli::query($query, $resultmode = NULL) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 29

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php:0) in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 168

Warning: session_start(): Cannot start session when headers already sent in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 169

Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64
jobs.html_title
0

members

Easy Basics: Project 075g WS2812B digital RGB LED Strip

of Acoptex.com in UNO

Basics: Project 075g

Project name: WS2812B digital RGB LED strip controlled with Arduino

Tags: Arduino Uno, WS2812B, digital, addressable, RGB LED strip

Attachments: library1 and sketch1, library2 and sketch2

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. Arduino IDE ( you can download it from here  )

4.Jumper cables F-M

5.  WS2812B digital RGB LED Strip 60 LEDs - 1pc

6. Power supply 5V 3A (depends on LEDs quantity) - 1pc

 or 

General

We will learn how to connect WS2812B digital RGB LED strip to Arduino board and use it.

Understanding the WS2812B digital RGB LED strip

These flexible RGB LED strips are an easy way to add complex lighting effects to a project. Each LED has an integrated driver that allows you to control the color and brightness of each LED independently. The combined LED/driver IC on these strips is the extremely compact WS2812B (essentially an improved WS2811 LED driver integrated directly into a 5050 RGB LED), which enables higher LED densities. In the picture on the right, you can actually see the integrated driver and the bonding wires connecting it to the green, red, and blue LEDs, which are on at their dimmest setting.

In contrast to the APA102C used in some other similar LED strips, which uses a standard SPI interface (with separate data and clock signals), the WS2812B uses a specialized one-wire control interface and requires strict timing. 

There are different kinds of WS2812 LED strip with different LED densities and lengths:

  • 1 meter 30 LEDs
  • 2 meters 60 LEDs
  • 5 meters 150 LEDs
  • 1 meter 60 LEDs
  • 1 meter 144 LEDs
  • 2 meters 120 LEDs

Features and specifications:

  • Individually addressable RGB LEDs (30, 60, or 144 LEDs per meter)
  • 24-bit color control (8-bit PWM per channel); 16.8 million colors per pixel
  • One-wire digital control interface
  • 5 V operating voltage
  • Each RGB LED draws approximately 50 mA at 5 V with red, green, and blue at full brightness
  • Power/data connectors on both strip ends for easy chaining, and the input side includes an additional power and ground wire for alternate power connections
  • Strips can be cut apart along the lines between each RGB LED segment to separate them into usable shorter sections

You can find the WS2812B datasheet here and you can read more about LED strips here.

In the following figure you can see our WS2812B digital RGB LED strip. It is 5 meters long, the LEDs are in a water resistant silicone tube filed with glue. It means that LED strip can be left outside at the rain and dust without any problem.

You can control the brightness and the color of each LED individually, which allows you to produce amazing and complex effects in a simple way. This LED strip is made by WS2812B LEDs wired in series. These LEDs have an IC built right into the LED. This allows a communication via a one-wire interface. This means that you can control lots of LEDs using just one digital pin of your Arduino. In the following figure you can see the chip inside the LED. The LED is an RGB LED and works like so.

This kind of strips are very flexible and can be cut to any length you want. As you can see, the strip is divided into segments and each segment contains one RGB LED.  You can adjust its size by cutting the strip with a scissors in the right place (the proper places to cut the strip are marked).

These strips come with  connectors  at each end. We have cut the connectors, and solder header pins. This is more handy if you need to connect the strip to an Arduino or to a breadboard.

Selecting power supply

The WS2812B digital RGB LED strip should be powered using a 5V power source. Each LED draws about 50mA, when set to its full brightness at 5V.  As we have the LED strip with 60 LEDs the the LED strip may draw approx 3A. Make sure you select a power source that matches the strip’s needs. An AC to DC power adapter that provides 5V and 3A should do the job.

We recommend chains of LEDs powered from a single supply not exceed 180 total RGB LEDs. It is fine to make longer chains with connected data lines, but you should power each 180-LED section separately. If you are powering each section from a different power supply, you should cut the power wires between the sections so you do not short the output of two different power supplies together.

Using an LED Strip Case

These LED strips usually come with a removable tape, so that we can stick them wherever we want. The problem is that LED strips don’t stick very well, so chances are that you’ll find your strip in the floor the following day.

The LED strip case that diffuses the light well available on the market with different shapes and you can screw it to a shelf or wall if you want a permanent solution.

Signals and connections of the WS2812B digital RGB LED Strip

This LED strip have three pins: VCC, GND and data (DO and DI). VCC (+5V) and GND are used to apply power to the strip and the data pin should be connected to your microcontroller.

Wiring

The following picture shows the needed connections with the Arduino Uno 

Warning: The WS2812B is more sensitive than previous ICs so we recommend taking several precautions to protect it:

  • Connect a capacitor of at least 100 μF between the ground and power lines on the power input.
  • Avoiding making or changing connections while the circuit is powered.
  • Minimize the length of the wires connecting your microcontroller to the LED strip.
  • Follow generally good engineering practices, such as taking precautions against electrostatic discharge (ESD).
  • Consider adding a 100-500 Ohm resistor between your microcontroller’s data output and the LED strip to reduce the noise on that line.
  • If the strip does get damaged, it is often just the first LED that is broken; in such cases, cutting off this first segment and resoldering the connector to the second segment brings the strip back to life.

Step by Step instruction

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Verify and upload the the sketch to your Adruino Uno.
  5. Open up serial monitor and set your baud to 9600 baud

Summary

We learnt how to connect WS2812B digital RGB LED strip to Arduino board and use it.

Code

1.ATA library

SimpleRgbStrip - A simple animation with an RGB LED strip.

RgbStripSequence - Animation sequence for an RGB LED strip.

RgbStripSerial - This is a playground for the ALA library that allows to control animations using AT serial commands.

 

Libraries:

  • See attachment on the begining of this project description
  • ATA library included. Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.
  • FastLED library included. Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.

Sketch:

  • See attachment on the begining of this project


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

jobs.published_at
jobs.viewed