As I am going to use RGB LED strips to provide proper lights to my plants, I have started to do experiments with the
strips I have. The LED strip is 2m long with 60Leds/m. Each LED consumes approx ~60 mAmps. This means the entire
strip would need approximately 7.2 Amps. The Led strip needs a standard 5V supply. So the adapter like the one in the
below picture should work to supply the required Watts to the strip.
Now, the RGB Led's have +(plus) and -(minus) as well as DIN pin to send the RGB color data.
Hence one needs to connect the DIN pin to the controller which will send the RGB data.
I am using Arduino to control the RGB strip. Normally the strips are connected with the Arduino
as shown in the below picture. The ground pins from the Arduino and the LED strips Both needs
to be connected. The DIN pin requires small Resistance to avoid any disturbance on the DIN line.
The next thing is to install the FastLED library. The library can be downloaded in the .Zip file format from Github.
Then place the unzipped file with the name FastLED in the /Libraries folder of the Arduino installation.
You can try some of the examples code in the Examples directory. I would like to explain some of the parts the library has.
The first line here is to include the FastLED header file in the file and then #define the number of LEDs and the data pin
which is used to output the data from the LED strip. In my trial, I used Arduino Mega pin No. 25 to output the RGB DIN values
#include <FastLED.h>
#define NUM_LEDS 120
#define DATA_PIN 25
In the setup() function of the Arduino one must include the FastLED object with the required LED strip type and color scheme.
void setup() {
delay(2000);
FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
}
In the loop() function one can iterate over the available LEDs and turn the LEDs with the specified color.
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::Green;
// Show the leds (only one of which is set to white, from above)
FastLED.show();
// Wait a little bit
delay(100);
// Turn our current led back to black for the next loop around
//leds[whiteLed] = CRGB::Black;
}
}
After a while, you would see that the LED strip is entirely blinking starting from the first to the last LED.
You might notice that the RGB calibration is not good.! There is wrong color blinking from the LED!!
To calibrate that you may want to upload the Calibration program from the Examples directory.
You can then set the right RGB sequence in the above loop() function.
For example, after uploading the calibration program if there is 1 Blue 2 Red, and 3 Green LEDs blinking then
the right setting should be BRG.!!