element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
1 Meter of Pi
  • Challenges & Projects
  • Design Challenges
  • 1 Meter of Pi
  • More
  • Cancel
1 Meter of Pi
Blog Blog-6 Starting the RGB LED strip with FastLED
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: embeddedguy
  • Date Created: 2 Jan 2021 10:45 AM Date Created
  • Views 1278 views
  • Likes 3 likes
  • Comments 0 comments
  • 1m3pi
Related
Recommended

Blog-6 Starting the RGB LED strip with FastLED

embeddedguy
embeddedguy
2 Jan 2021

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.

 

image

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.

image

 

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.!!

image

imageimage

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube