Serial Addressable LEDs Using Arduino

by lewisrl4x4 | January 27, 2014 | (6) Posted in Projects

Today we will be tackling the project of implementing Serially Addressable LED tape and an Arduino into your flying projects.

The Open Source movement has a caused a great stir among hobbyists worldwide. From 3D printers, to laser cutters, to immense processing power for only a few cents, the average person can create many things at home that were not obtainable in the past. This project, while not immensly challenging, utilizes a few core components from the open source movement. Lets get started.

 

Here are the parts we will be using:

Arduino Pro Mini 328 5V 16MHz --- https://www.sparkfun.com/products/11113

Serial Addressable LED Tape --- http://www.adafruit.com/products/306

(2) 12" Jumper Wire 6-Pin --- https://www.sparkfun.com/products/10376

Straight Header Pins --- http://www.adafruit.com/products/392

FTDI to USB Cable --- http://www.adafruit.com/products/70

Hot Glue

Soldering Station/Solder

Velcro/Hook and Loop

 

There are an assortment of parts (some much cheaper than those I used) that could be substituted for the above. These are simply the ones I had laying around. Hopefully from seeing how these parts are assembled, others will be able to develop their own custom setup.

 

 Lets first get out the LED strips. These are usually able to be cut in short lengths to fit various applications. The ones I have are 2 LEDs per section. The ends will be marked to identify which side is the input and output. As you can see from the photo above, DO and CO are Data Out and Clock out. DI and CI represent Data In and Clock In.

 For my Knuckle Quad, I used 2 strips of 4 LEDs each. I cut my clear tubing to be just a tad shorter than the LED tape so that the wires dont cause such a huge deformation of the tubing around the solder joints. This will be helpful when we hot glue the ends to keep out bad stuff (water, dirt, etc.).

The next thing to do was to test the strips. Since I knew that I wanted to solder the connections to the Pro Mini, it was easier to test the strips using a regular Arduino Uno with Female Headers. Once we have verified the strips are working, its time to look at the microcontroller we will be putting into the air.

For this project I am using the Arduino Pro Mini 5V from Sparkfun. Its is a very lightweight and inexpensive board and is great for anything that flies. Although it is tiny, it still has many great features that you would expect from a larger board. The most critical feature is the onboard voltage regulator. This allows us to hook up anywhere from 5V-12V to power the board. This gives us the ability to run this in any airframe that uses 2S or 3S batteries. The output voltage will always be a clean 5V which is exactly what our LED strips require.

To power the Arduino, I will be pulling power from my 3S LiPo. My Knuckle Quad uses the HobbyKing power distribution board. On this board there is a set of output pins for accessories. This is a perfect spot to pull power for the Arduino. If you aren't using a power distribution board, you can solder two wires into your harness or main power plug to achieve the same result.

 To connect the Arduino to the power pins, I picked up a JST connector set at HobbyTown. 

When soldering the JST connector to the Arduino, be sure that the input voltage connects to the pin labeled "raw". This is the pin that feeds the internal voltage regulator. If you hook your 3S LiPo to the pin labeled Vcc, youl will let all the smoke out. The smoke never goes back in. Trust me.

This is also a good time to solder on the header pins for the FTDI Cable.

I tested the board to make sure everything was working properly. The quickest way I know to check if my Arduinos (and the IDE) are working properly, is to upload the example script "BLINK". If this works, you are more than likely good to go.

Next is to solder the wired to each LED strip. I cut the ends off of the jumper cables and removed 2 wires. This gave me a nice 4 wire bundle for each strip.

I sealed the ends of the strips with some hot glue. This should help keep dirt, water, and grime out of my LEDs.

Next, I attached the strips to the frame of my Quad using zip ties. I tried hot glue at first, but it wasn't sticking as well as I would have hoped. The zip ties seem to hold up well.

Once both strips were installed, I soldered the wires to the Arduino. Both power lines went to Vcc, both ground lines went to the extra GND pin. The DI and CI pins for both strips go into the digital pins. The exact pin number for each D and C line can be tweaked in the code. Personally, I used digital pins 3-6.

A little bit of velcro to secure the Arduino to the KK2 case.

You can barely make out the pins where the JST connector is to be connected.

Now the mounting and wiring is complete. Time to program.

The project is complete! Enjoy programming fun patterns and colors into your Arduino. If you have any questions or comments, please dont hesitate to leave them below. Good Luck!

COMMENTS

windphile on January 31, 2014
Awesome article. I have being wanting to start a project with arduino and this is great.
Log In to reply
lewisrl4x4 on January 31, 2014
Thanks! The Pro Mini is a great little platform for plans and quads alike. I highly recommend it!
Log In to reply
wussie on February 1, 2014
Depending on the number of pins ie number of separate LED strips or if you wanted to add an input from your Rx I would actually recommend a trinket or Gemma from Adafruit. I've been playing around with a Gemma and a neo pixel ring because of the Gemma's built in jst connector. Only downside is the lack of RAM and pins from the ATiny.
Log In to reply
lewisrl4x4 on February 1, 2014
Thanks for the comment!

I do however have to disagree with you. The Gemma (and Flora for that matter) are both quality boards, but have some serious drawbacks for these type of applications. The first is most importantly the native onboard voltage. The Pro Mini is a 5V board, where as the Gemma is 3.3V. Since most serial addressable LEDs are either 5V or 12V logic, this may be a problem for some folks. Other issues include having to do some tricky coding in the IDE to make the Gemma work as a true arduino, the limited number of pins, both (Digital and Analog), and the lower crystal clock speed. For the case of RX input, any switch can control any of the pins on the Pro Mini. You could use analogRead() and set some if statements around what the number is (0-255), or you could get fancy with a digitalRead() and scale the incoming status. Either way, the Pro Mini can handle this task on multiple pins.

Although I love the Gemma and the products Adafruit has to offer, For the case of putting a small Arduino onto an RC project, I don't think that there is a better option (currently) than the pro mini. I would love to see more projects using Arduino, so throw the Gemma on something and let us see how it works!
Log In to reply
JimmyD on February 1, 2014
Where did you get the protective case for the kk2 board?
Log In to reply
lewisrl4x4 on February 1, 2014
I 3D printed it. The .stl files can be found for free over on ThingVerse.
Log In to reply
wussie on February 2, 2014
The trinket is available in 5v logic, and not to continue tooting Adafruit's horn the neopixels work very well with the Gemma:
https://www.youtube.com/watch?v=umteNHddno4&feature=youtube_gdata_player
Aside from that I would agree the pro mini is much better, but it costs more and it's more difficult to work with, needing ftdi and the like to program. Once I modified my Arduino ide following the instructions it works just as well as my uno.
Log In to reply
lewisrl4x4 on February 2, 2014
Hadn't seen that 5V trinket before. I'll have to pick one of those up! Thanks!
Log In to reply
wussie on February 2, 2014
Happy making! I want to do something with GPS and neopixels on my quad!
Log In to reply
Alf on February 3, 2014
I'm also looking at ways to integrate an Pro Mini as LED driver (mostly for strobes). One thing you may want to look into is the current load exceeding the 150mA board regulator limit. Considering that each 2-LED segment use 120mA on white you could be looking at 480mA total if all were White-ON at the same time.

I was using unassignable LEDs which further complicates things as each pin is limited to 40mA. I am almost done with a prototype 12V LED driver using a Mosfet which I'm hoping to post soon. Definitely not as versatile as the Arduino, but able to handle quite a bit more LEDs.
Log In to reply
wussie on February 3, 2014
You're very right, with many LEDs on a circuit you are much better off running a separate power circuit for the LEDs and not directly from the Arduino. There are also ways of controlling a mosfet or relay with the arduino so you can still control the lights without worry of damage to the arduino.
Log In to reply
skindoc on February 7, 2014
Super cool ! I love the hard cover you have for your KK board - did you print that or buy it ? link ?
Thanks for the inspiration to dive down another rabbit hole !
Log In to reply
lewisrl4x4 on August 6, 2014
Check out Thingiverse.com

Log In to reply
flash_os on June 19, 2014
Why did you supply voltage via RAW and VCC?

RAW supply voltage to 3-6 digital pins?
And VCC supply voltage to atmega328 chip?
Log In to reply
lewisrl4x4 on August 6, 2014
On this particular board, RAW is the input to the onboard voltage regulator. The inputted voltage can be from 5V to 12V. The onboard regulator will power the entire arduino with a clean regulated 5V, regardless of the input voltage on the Raw Pin.

The VCC pin is an output. It allows you to tap into the regulated 5 volts and use that for powering external things. As mentioned in a comment above, the VCC pin is only good for a small amount of current, so be careful. It is for this reason that I have my lights "chase" instead of coming on all at once. There would be too much current draw for the regulator to handle.


Log In to reply

You need to log-in to comment on articles.


Serial Addressable LEDs Using Arduino