Arduino Tutorials

ws2811 arduino pixel Led Programming Tutorial

Hey Techies and Artists! Isn’t it interesting to control the colour and pattern of light? At any festival like Diwali and eid, there is a lot of colorful lights.  which runs on the logic IC’s. there is some logic ic that sends the data to the LED to change the color and the pattern. Seeing that lights are joyful. So, for today we are going to make an activity to control the color and the pattern of the pixel light. Ws2811 Arduino is the best combination to control the led pixels. pixel led has an ic that sends a command to led to change the color. so today we will connect ws2811 with the Arduino and will make Arduino code to control the pixel light. . I have made many controllers control a lot of pixels led in restaurants, clubs, and many other places. Once you will learn to program you can make it for your home, office, and wherever you want to put it.

ws2811 arduino

In this article, we will share all the programming basic, connection, libraries, and much more. so you can learn a lot with the Arduino pixel led. if you wanna really want to learn the programming terms like functions, voids, conditions, loop pixel is best to learn these programming terms. So, read the full article to learn & make this activity. This is another Arduino tutorial in the Arduino category.

HTML Image as link
Qries

What is Ws2811 Pixel LED?

There are 3 output channels in the WS2811 it is special for the LED driver circuit. at internal of this ic include an intelligent digital port data latch.  also, there is a signal reshaping amplification drive circuit. and 12 voltage constant current output with a precision internal oscillator. it can control hundred of colors in the pixel LED. there are only three wires needed to two for power and one for data. first, we need to program our Arduino which will control the IC data for each IC we have. There is a library known as neo pixel Arduino library to make all the programming. Here we need some programming and a ws2811 datasheet to know it better. Ws2811 Arduino is the best combination to make the required pattern of light because here one IC control 3 led.

How does the ws2811 Arduino Work?

Ws2811 ic a small ic that needs data to control the color of the RGB led. First, we need to include the library Adafruit neomatrix which we gonna share below. after including the library we need to code it. we need to select the ic number how many ic’s we are using there so we can program the same ic which we are using. after that upload the code and it will start working. the Arduino sends the command to the pixel ic for the color according to our database color code. here we have three patterns RGB red blue green and for each, we have some PWM command which is from 0 to 255. so there is a combination of 255,255,255 we can make any color by choosing the color code.

Required Components:

  • Arduino Uno
  • WS2811 Pixel Led
  • Breadboard
  • Connecting cable
  • Jumper wires
  • 5V 5amp Adapter
S.NoComponent RequiredQuantityBuy Link
1.Arduino UNO1https://amzn.to/3ue2vmh
2.Arduino UNO Cable1https://amzn.to/3obXjht
3WS2811 Pixel Led1https://amzn.to/3BuOjI3
4.Jumper Wire40https://amzn.to/39q43jr
5.Breadboard1https://amzn.to/39vsRX2
6.5V 5Amp Adapter1https://amzn.to/3amFLae

WS2811 Arduino circuit diagram:

WS2811 Arduino circuit diagram:
Arduino UNOPixel Led
D2 PinOUT Pin
( +5V ) VCCVCC ,  ( + 5V )
GND ( Ground )GND

After making this diagram include the library – download library 

HTML Image as link
Qries

pixel led ws2811 Arduino code

 // Techatronic.com  
 #include <Adafruit_NeoPixel.h>  
 #define PIN 2      // input pin Neopixel is attached to  
 #define NUMPIXELS   12 // number of neopixels in strip  
 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);  
 int delayval = 100; // timing delay in milliseconds  
 int redColor = 0;  
 int greenColor = 0;  
 int blueColor = 0;  
 void setup() {  
  // Initialize the NeoPixel library.  
  pixels.begin();  
 }  
 void loop() {  
  setColor();  
  for (int i=0; i < NUMPIXELS; i++)   
 {  
   // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255  
   pixels.setPixelColor(i, pixels.Color(redColor, greenColor, blueColor));  
   // This sends the updated pixel color to the hardware.  
   pixels.show();  
   // Delay for a period of time (in milliseconds).  
   delay(delayval);  
  }  
 }  
 // setColor()  
 // picks random values to set for RGB  
 void setColor(){  
  redColor = random(0, 255);  
  greenColor = random(0,255);  
  blueColor = random(0, 255);  
 }  

All the best

Related Articles

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button