Any color is made up of three colors: Red, Green and Blue, using a simple RGB LED you can generate any color. But the limitation of RGB LED is that it has three separate LEDs inside it and requires three Pins of any microcontroller to operate one RGB LED. So it is not possible to connect hundreds of LEDs with one microcontroller.

To overcome this problem Adafruit has created NeoPixel LED Strip. It requires only three pins to drive several RGB NeoPixel LEDs. Two pins are for power and ground and one Pin is for Data In (DI). Data IN pin is used to address and control the different LEDs in the strip with their color, brightness etc. But it requires a Microcontroller to run NeoPixels. Arduino is very commonly used with NeoPixel, so today we will learn to Interface NeoPixel LEDs with Arduino. You can learn more about NeoPixels at AdaFruit.

Here in this project we are Controlling NeoPixel LED using Arduino and TFT LCD touch Screen. We have created 7 touch buttons of different colors on 2.4 inch TFT LCD and when we tap the button of certain color on the LCD, the NeoPixel LED strip illuminates with the same color of that button. Here we have used NeoPixel Digital RGB LED strip of 30 LEDs.

NeoPixel RGB LED can be illuminated in any color and so we can add more buttons on the LCD to glow the LED in more colors on tapping on those buttons. Other beautiful effects and patterns can also be added using Coding. You can build a full Arduino controlled Decoration System using NEO Pixel LEDs and can control this system by LCD lying near to you.

Take care not to interchange GND and 5V pin of NeoPixel LED strip while connecting it to Arduino, otherwise it will damage the NeoPixel LED strip. Also note that here we have used Arduino Mega but you can use any other Arduino model.

Connections to Arduino to NeoPixel RGB LED Strip:

Arduino Pins

NeoPixel Strip’s Pins

5v

5v

GND

GND

Digital Pin no. 36

DI (data in)

Working Explanation:

Working of NeoPixel LED with Arduino is very easy. Just tap the touch button of any color on the LCD in which you want to glow the NeoPixel LED strip. The LED will light according to that color. Code is written in such a way so that you can repeat this task endlessly without having to reset the Arduino Mega. You can check the Code and Demo Video at the end of this article.

When any button is tapped on the LCD, data is sent to Arduino and Arduino further sends instruction to NeoPixel Strip to light accordingly. For example NeoPixel LED strip glows in Green color when we tap the Green button on the LCD and LED strip glows in Red color when we press the Red button and so on.

Programming Explanation:

To Interface TFT LCD with Arduino we have used some libraries. All the libraries come in one rar file and can be downloaded from this link. Click on ‘Clone or download’ and ‘Download ZIP’ file and add to your Arduino library folder. This library is needed for proper functioning of TFT LCD.

You should test your TFT LCD by burning Arduino with examples codes given in the Library and check if codes are working properly. First check the graphics test, then calibrate test and finally paint test. If you find that all features all working fine then start with code given in this tutorial.

Also for proper functioning of NeoPixel RGB LED strip, you will need one more library, which can be downloaded from here.

#include <Adafruit_NeoPixel.h>

As described earlier Digital Pin 36 of MEGA is connected to DI pin of NeoPixel LED Strip as shown in code below. Also the numbers of LEDs in the Strip are 30 so as is written in code:

#define PIN 36
#define NUM_LEDS 30

Display colors of LCD buttons are denoted by some Codes. You can change these codes according to your LCD.

To find the digital RGB values to be entered for the given color, you can follow this link. Just enter the color you want your NeoPixel strip to glow, find the RGB values for that color and put in above functions.

void initializeButtons() function is used for giving text and color to buttons and also for placing them at required place on LCD.

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);