Go to Post I think with so many facets of FIRST, success comes from learning the true meaning of teamwork through working towards a common goal. - Kristina [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 3.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-06-2013, 12:31
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
controlling LED strips

I know there are many kinds of LEDs out there,
and for next season I thought it would be best for our team to buy one color LEDs which you can control each LED separately.

I'd like to ask for help with that..
How can I control each LED in LabVIEW?
(And if you know some electrical things) How is it connected to the robot?

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 07-06-2013, 14:47
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 432
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: controlling LED strips

I can't really help with the LabView code directly, as my team uses Java.

But we used these strips for the first time this year: http://www.adafruit.com/products/306
They also have a newer version of the strips (NeoPixel) which use a different LED driver, long story short, you can get more LEDs for less money with the NeoPixel version. These weren't available until recently though, so I have no direct experience with them.

I'll describe how we implemented things and hopefully that can get you moving in the right direction.

The color and brightness for each LED in the strip we purchased can be modified through a "SPI-like" protocol. The cRIO should be able to talk to these LEDs directly, but a lot of work has been done by the people at adafruit to get the non-standard elements of the communication protocol working on an arduino. Since this library is tested and working, we decided to offload all the communications with the strips themselves to an arduino.

In our case there were a number of different light sequence which we wanted to play, or colors we wanted to display, depending on what was going on with the robot. for example, when our shooter was raised we would display a certain color, when it was lowered, a different color, when our shooter was up to speed we would flash the lights white, etc.
The ardunio was responsible for knowing how to set the LEDs to the right colors depending on what 'mode' we were in. There are plenty of good examples of code that controls the LEDs here.

So the next step is bridging the gap between the arduino and the cRIO. There are many ways which this could be accomplished (RS-232, Relay outputs from DSC, Digital outputs from the DSC, etc.). Probably the simplest way would be to use the digital I/O channels on the digital side car (DSC). For example one digital output channel on the cRIO could be assigned to the shooter position (raise/lowered) when the signal is high (5v) the shooter is raised, when it's low (0v) the shooter is lowered. A wire between the digital output on the DSC and an input pin on the arduino is all you need to represent these two states. If you need to indicate more items, just add more wires. If you have a lot of data to convey, this can start to require quite a few wires, and digital output channels on the DSC play double duty as digital inputs. You may need these for encoders or other sensors on your robot (this is why we ended up using Relay outputs - since we had spares, same principles apply with them). So plan accordingly.

The last thing worth mentioning is power for these devices. The arduino itself needs to run off 5v. The 5V supply on the DSC is sufficient to power the arduino, but can't supply enough current to power the LEDs. There are two pins near the end of the digital IO channels which is a spare set of 5v and gnd connections that's convenient to wire to.
Read the spec for the lights you buy. It will tell you how much power or current they draw. The most current (worst case) will be drawn when all the lights are white and running at full brightness, so you should design for this to be safe.
We purchased some little 3Amp 5V power supplies off of ebay. I think they were around $5, but you could make your own from a bunch of linear voltage regulators (LM7805) you could buy from most RadioShacks if you are in a pinch. Regardless of which regulator you go with, the input wires of the supply will connect to the PD board (suggest a 20A breaker - or smaller if you have them). The output wires of the supply will connect directly to the LED strip.

If you have other specific questions, let me know. If you don't get a reply, PM me as I don't get on CD all the time during the off season.
__________________
http://team2168.org
Reply With Quote
  #3   Spotlight this post!  
Unread 07-06-2013, 16:50
orangemoore orangemoore is offline
Registered User
AKA: Roger Moore
FRC #3135 (Robotic Colonels)
Team Role: College Student
 
Join Date: Dec 2012
Rookie Year: 2013
Location: Chicago
Posts: 2,309
orangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond reputeorangemoore has a reputation beyond repute
Re: controlling LED strips

I can't help you with the programming but, Macetech has reasonably priced LED strips. They sell the strips by 1/2 meter increments.

http://macetech.com/store/
Reply With Quote
  #4   Spotlight this post!  
Unread 07-06-2013, 17:11
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: controlling LED strips

Quote:
Originally Posted by otherguy View Post
They also have a newer version of the strips (NeoPixel) which use a different LED driver, long story short, you can get more LEDs for less money with the NeoPixel version. These weren't available until recently though, so I have no direct experience with them.
Based on requiring timing of 100ns, you wouldn't be able to use the NexPixel ones directly with the cRIO, so you'd have to use an arduino or another co-processor.
Reply With Quote
  #5   Spotlight this post!  
Unread 08-06-2013, 04:29
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
Quote:
Originally Posted by otherguy View Post
I can't really help with the LabView code directly, as my team uses Java.

But we used these strips for the first time this year: http://www.adafruit.com/products/306
They also have a newer version of the strips (NeoPixel) which use a different LED driver, long story short, you can get more LEDs for less money with the NeoPixel version. These weren't available until recently though, so I have no direct experience with them.

I'll describe how we implemented things and hopefully that can get you moving in the right direction.

The color and brightness for each LED in the strip we purchased can be modified through a "SPI-like" protocol. The cRIO should be able to talk to these LEDs directly, but a lot of work has been done by the people at adafruit to get the non-standard elements of the communication protocol working on an arduino. Since this library is tested and working, we decided to offload all the communications with the strips themselves to an arduino.

In our case there were a number of different light sequence which we wanted to play, or colors we wanted to display, depending on what was going on with the robot. for example, when our shooter was raised we would display a certain color, when it was lowered, a different color, when our shooter was up to speed we would flash the lights white, etc.
The ardunio was responsible for knowing how to set the LEDs to the right colors depending on what 'mode' we were in. There are plenty of good examples of code that controls the LEDs here.

So the next step is bridging the gap between the arduino and the cRIO. There are many ways which this could be accomplished (RS-232, Relay outputs from DSC, Digital outputs from the DSC, etc.). Probably the simplest way would be to use the digital I/O channels on the digital side car (DSC). For example one digital output channel on the cRIO could be assigned to the shooter position (raise/lowered) when the signal is high (5v) the shooter is raised, when it's low (0v) the shooter is lowered. A wire between the digital output on the DSC and an input pin on the arduino is all you need to represent these two states. If you need to indicate more items, just add more wires. If you have a lot of data to convey, this can start to require quite a few wires, and digital output channels on the DSC play double duty as digital inputs. You may need these for encoders or other sensors on your robot (this is why we ended up using Relay outputs - since we had spares, same principles apply with them). So plan accordingly.

The last thing worth mentioning is power for these devices. The arduino itself needs to run off 5v. The 5V supply on the DSC is sufficient to power the arduino, but can't supply enough current to power the LEDs. There are two pins near the end of the digital IO channels which is a spare set of 5v and gnd connections that's convenient to wire to.
Read the spec for the lights you buy. It will tell you how much power or current they draw. The most current (worst case) will be drawn when all the lights are white and running at full brightness, so you should design for this to be safe.
We purchased some little 3Amp 5V power supplies off of ebay. I think they were around $5, but you could make your own from a bunch of linear voltage regulators (LM7805) you could buy from most RadioShacks if you are in a pinch. Regardless of which regulator you go with, the input wires of the supply will connect to the PD board (suggest a 20A breaker - or smaller if you have them). The output wires of the supply will connect directly to the LED strip.

If you have other specific questions, let me know. If you don't get a reply, PM me as I don't get on CD all the time during the off season.
The problem is that I have zero experience with arduino, will it be hard to learn using it for the LED control?
Which kind of arduino should I get for this? I want it to be strong enough for image processing in the future.
And about the connection between the arduino to the DSC - is there a way to give a numeric output like the game time?
Thx a lot for the detailed answer
Reply With Quote
  #6   Spotlight this post!  
Unread 08-06-2013, 12:58
alex.lew alex.lew is offline
college student
FRC #1912 (Team Combustion), FRC #0558 (Elm City Robo Squad)
 
Join Date: Jan 2012
Rookie Year: 2012
Location: New Haven
Posts: 72
alex.lew will become famous soon enoughalex.lew will become famous soon enough
Re: controlling LED strips

We used the same LED strip from Adafruit as 2168 and attached it to our robot cart instead of the actual robot. We used an Arduino Uno board, powered by a 12V rechargeable battery provided by a mentor. Then we used the DC/DC power converter from the KOP for the LEDs, since they only take 5V.
For the programming, download the LPD8806 Arduino library. It gives a couple example sketches with which you can learn how to customize the LED sequences. One of our mentors had prior experience with Arduino, which helped a lot with more complex sequences. but basic control is pretty simple and fun to learn. There are a ton of additional resources and tutorials on Adafruit.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-06-2013, 13:38
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
Re: controlling LED strips

Quote:
Originally Posted by electrian21 View Post
We used the same LED strip from Adafruit as 2168 and attached it to our robot cart instead of the actual robot. We used an Arduino Uno board, powered by a 12V rechargeable battery provided by a mentor. Then we used the DC/DC power converter from the KOP for the LEDs, since they only take 5V.
For the programming, download the LPD8806 Arduino library. It gives a couple example sketches with which you can learn how to customize the LED sequences. One of our mentors had prior experience with Arduino, which helped a lot with more complex sequences. but basic control is pretty simple and fun to learn. There are a ton of additional resources and tutorials on Adafruit.
Is that necessary to buy the same LED strip model from Adafruit to use the LPD8806 Arduino library?
If so, what should I look for in a LED strip to be sure it works with the library?

I live in Israel and prefer buying a LED strip in Israel rather than paying more for shipment.

Last edited by bumblebee3339 : 08-06-2013 at 13:48.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-06-2013, 14:54
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 432
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: controlling LED strips

Quote:
Originally Posted by bumblebee3339 View Post
Is that necessary to buy the same LED strip model from Adafruit to use the LPD8806 Arduino library?
I didn't actually buy my strip from adafruit. As long as the strip you buy uses the LPD8806 as the LED driver, the arduino library should work.


Quote:
Which kind of arduino should I get for this? I want it to be strong enough for image processing in the future.
We used an Arduino uno r3 clone from deal extreme, simply because it was on sale for $15. The specific one we got is no longer in stock. Most arduino models should work though. The comments in the example code referring how to wire up the strand to the arduino list quite a few:
Code:
// You can optionally use hardware SPI for faster writes, just leave out
// the data and clock pin parameters.  But this does limit use to very
// specific pins on the Arduino.  For "classic" Arduinos (Uno, Duemilanove,
// etc.), data = pin 11, clock = pin 13.  For Arduino Mega, data = pin 51,
// clock = pin 52.  For 32u4 Breakout Board+ and Teensy, data = pin B2,
// clock = pin B1.  For Leonardo, this can ONLY be done on the ICSP pins.
//LPD8806 strip = LPD8806(nLEDs);
As far as doing vision processing on an arduino goes... I wouldn't plan on it. They aren't well suited for the computations required to quickly process images. Not if you're using an IP camera at least. You could probably get something working with a camera that does some of the processing for you, like the CMUcam. Although it didn't make it on to the robot, we had very good results using openCV on the original beaglebone this year. I believe other teams have gotten rasberrypi's to work as well, although I can't really speak to how well that worked out.
__________________
http://team2168.org
Reply With Quote
  #9   Spotlight this post!  
Unread 16-06-2013, 04:30
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
Quote:
Originally Posted by otherguy View Post
I didn't actually buy my strip from adafruit. As long as the strip you buy uses the LPD8806 as the LED driver, the arduino library should work.



We used an Arduino uno r3 clone from deal extreme, simply because it was on sale for $15. The specific one we got is no longer in stock. Most arduino models should work though. The comments in the example code referring how to wire up the strand to the arduino list quite a few:
Code:
// You can optionally use hardware SPI for faster writes, just leave out
// the data and clock pin parameters.  But this does limit use to very
// specific pins on the Arduino.  For "classic" Arduinos (Uno, Duemilanove,
// etc.), data = pin 11, clock = pin 13.  For Arduino Mega, data = pin 51,
// clock = pin 52.  For 32u4 Breakout Board+ and Teensy, data = pin B2,
// clock = pin B1.  For Leonardo, this can ONLY be done on the ICSP pins.
//LPD8806 strip = LPD8806(nLEDs);
As far as doing vision processing on an arduino goes... I wouldn't plan on it. They aren't well suited for the computations required to quickly process images. Not if you're using an IP camera at least. You could probably get something working with a camera that does some of the processing for you, like the CMUcam. Although it didn't make it on to the robot, we had very good results using openCV on the original beaglebone this year. I believe other teams have gotten rasberrypi's to work as well, although I can't really speak to how well that worked out.
I decided to focus on one color LEDs first (non-addressable), I found that I can power a 12V LED strip with a spike. How fast can I blink the LEDs with a spike, I've read it's limited.

And is there a way to dim the strip via PWM? Should the strip be 5V for PWM control?
Thanks
Reply With Quote
  #10   Spotlight this post!  
Unread 16-06-2013, 12:28
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: controlling LED strips

Quote:
Originally Posted by bumblebee3339 View Post
I decided to focus on one color LEDs first (non-addressable), I found that I can power a 12V LED strip with a spike. How fast can I blink the LEDs with a spike, I've read it's limited.
The Spike is a mechanical relay. You'll be limited by the physical response time of the contacts. (And you'll eventually wear it out if you switch it too often, though it's probably in the tens of millions of switching events.)

Quote:
And is there a way to dim the strip via PWM? Should the strip be 5V for PWM control?
If you want 12 volt dimming, you can use a speed controller such as a Victor or Talon.
Reply With Quote
  #11   Spotlight this post!  
Unread 17-06-2013, 04:56
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
Re: controlling LED strips

Quote:
Originally Posted by Alan Anderson View Post
The Spike is a mechanical relay. You'll be limited by the physical response time of the contacts. (And you'll eventually wear it out if you switch it too often, though it's probably in the tens of millions of switching events.)



If you want 12 volt dimming, you can use a speed controller such as a Victor or Talon.
If I use a speed controller for the LEDs, how fast can I blink it while not breaking it?

BTW will it drain the battery?

Last edited by bumblebee3339 : 17-06-2013 at 06:02.
Reply With Quote
  #12   Spotlight this post!  
Unread 17-06-2013, 08:04
Jim Wilks Jim Wilks is offline
Electrical Engineer
AKA: Jim Wilks
FRC #1360 (Orbit Robotics)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Oakville, ON
Posts: 1,186
Jim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond repute
Re: controlling LED strips

Quote:
Originally Posted by bumblebee3339 View Post
If I use a speed controller for the LEDs, how fast can I blink it while not breaking it?

BTW will it drain the battery?
A speed controller will allow virtually infinite levels of dimming. It's ability to blink is dependent on how fast if can switch off and on. Different speed controllers have different specifications here.

In general. LED's (in reasonable quantities) are fairly minimal in battery drain.
__________________
Jim

Reply With Quote
  #13   Spotlight this post!  
Unread 17-06-2013, 14:09
bumblebee3339's Avatar
bumblebee3339 bumblebee3339 is offline
Team's main account
FRC #3339 (BumbleBee)
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Israel
Posts: 34
bumblebee3339 is an unknown quantity at this point
Quote:
Originally Posted by Jim Wilks View Post
A speed controller will allow virtually infinite levels of dimming. It's ability to blink is dependent on how fast if can switch off and on. Different speed controllers have different specifications here.

In general. LED's (in reasonable quantities) are fairly minimal in battery drain.
Ok, I'll try different speed controllers to test that.

I've just thought about it, if the battery is more than 12V, would it damage the LEDs? (When the value for the controller is 1)
Reply With Quote
  #14   Spotlight this post!  
Unread 17-06-2013, 18:40
Jim Wilks Jim Wilks is offline
Electrical Engineer
AKA: Jim Wilks
FRC #1360 (Orbit Robotics)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Oakville, ON
Posts: 1,186
Jim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond reputeJim Wilks has a reputation beyond repute
Re: controlling LED strips

Quote:
Originally Posted by bumblebee3339 View Post
Ok, I'll try different speed controllers to test that.

I've just thought about it, if the battery is more than 12V, would it damage the LEDs? (When the value for the controller is 1)
If you have 5V LED strips, then yes. I use 12V LED strips.
__________________
Jim

Reply With Quote
  #15   Spotlight this post!  
Unread 17-07-2013, 12:50
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 432
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: controlling LED strips

Quote:
Originally Posted by bumblebee3339 View Post
I've just thought about it, if the battery is more than 12V, would it damage the LEDs? (When the value for the controller is 1)
Just to make sure there aren't any future misunderstandings...
Going along with your logic above, you wouldn't just have a problem with the voltage level being too high when the controller is being commanded with a "1". You would have a problem ALL the time.

It's important to remember that the motor controllers don't regulate the output voltage, they simply connect and disconnect the output to the battery (very quickly). For example when you command the motor controller to "0.5" it's not sending you 50% of the battery voltage. Instead 50% of the time the motor controller is connected to the battery, and 50% of the time it isn't (Call this the "off time"). What it's doing during the "off time" how the controller is designed. It may connect both terminals to ground, or both to 12V, it may leave them both floating, or it may short the two together.

Also, if using a speed controller, you need to be careful that your output polarity never switches. Speed controllers are designed to allow you to run a motor in forward and reverse. So if you wire your lights to the speed controller and the polarity gets reversed (commanded the controller to a negative value), the light circuit may not take kindly to this. This may not be a concern if your LED circuit is literally just LEDs (Light Emitting Diodes), as the diodes themselves will prevent current flow in the reverse direction. But if the LED strip had any active components on it, they might let out their magic smoke.
__________________
http://team2168.org
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi