Help with a project wireless LED control

Arduino question:

Hi, my name is Yotam and I am a theater technical director in the international school of Bangkok. Right now i am doing the some props and set design for our up coming show "Peter Pan" and i have been given a pretty big challenge...
I was told to make a light system for the costume of Tinkerbell. Not only this, but it has to have about 200 LED lights in 4 different colors. Each color has to be a 'channel' and each channel must be able to fade in and out. Now I actually made a prototype of this and it pretty much worked. However the controller was HUGE it wouldn't really fit inside the belt. And ever worse the actress playing the tinkerbell wasn't able to figure out the controls...
So it made me think... Can I control the lights on the costume from afar... And shortly Arduino came to my mind...
I'm a newbie to Arduino but I have some experience I. Electronics and in programming. But I still am a newbie. My question is what do I need in order to make it happen?
Here are some stuff I figured from my research:
?4* 50 LEDs (4 channels * 50 LEDs, each LED is 20 mA, 3v)
?2* Arduino Unos (one for the actual costume and one controller)
?2* XBee transceiver (for RF control over the Arduinos)
?4* potentiometers (for the fade in/out)
?2* power modules
?2* battery indicator (LED bar graph display) - possible??
?1* LCD Display (to show percentage of light) - possible??

So let me simplify this:
so essentially I need to create a system that is made up of a controller unit and an operational unit. the controller will have 4 potentiometers, and these potentiometers will operate the 4 channels of LEDs (50 LEDs per channel) on the operational unit. This operation will have to be achieved wirelessly (via the XBee transceivers). in addition, I was wondering if I could have an LCD display that will show me some info on the controller unit, the percentage of light for each channel (0% when turned off and 100% when fully turned on) and also some indication of how much battery I have left...

can it be done?!

Now, i'm not entirely sure if this is at all doable, but what I do know is that you guys in the forums can help me a lot with this issue. it is very important for me, and possibly for all of you guys since if this works we will try to convince the head master of the school to include a class about Arduino and stuff in the school.

So anyway, sorry about the very long question, and thanks to everyone in advance... this will be HUGE for me if you can help me! Also, sorry if my english is messed up, im still not a native speaker...

Thanks in advance,

Yotam

can it be done?!

Absolutely.

For the XBees, get the series 1 variety (point to point). They come in regular and pro versions. The difference is the amount of power used to send/receive the data, which affects range. In the regular and pro series, the XBees come in 4 different antenna configurations. The antenna style will also affect range.

The controller unit has to do all the hard work of lighting the LEDs, but you said that that is working.

Attaching an LCD to the sending Arduino is relatively easy to very easy, depending on the particular LCD. If you get a serial LCD, connecting it is trivial - power, ground, and one digital pin. Use NewSoftSerial to talk to that pin.

Displaying pot setting for each channel is trivial. Battery level remaining would be easy to display. Figuring out what value to display is harder. Voltage is not the only factor in how much longer a battery will last. A 9V battery might still read 7.5 volts but be unable to light a single LED.

By the way, your english is just fine. Much better than some posters... ;D

Thank you sir!
your comment answers pretty much my main questions...

The prototype i made is actually just bare electronics, didnt have any Arduino involved... I just made 4 long LED strings and used 4 PWM controllers I found somewhere, so the power ran from a battery to the PWM controller to the LED string and back to ground. So by doing the same type of circuit 4 time, each time with a different set of LEDs I was able to achieve my old goal.a But this isnt really good... its way too big (just imagine 4 batteries (or one big battery), the 4 PWM controllers, bunch of wires, and a case for everything). It worked, but it wasn't optimal.

So my question is, can you really connect 4 Channels of 50 LEDs (I guess that this means 1 Channel per output digital pin) and make all these LEDs (200 of them) to work at the same time?

how would you set all of these up?
im still very new to this (haven't even seen a real Arduino) so I wouldn't know if this will work or not...

Thanks again for the reply!

ohh and thanks for comment on the English! much appreciated! haha :slight_smile:

Just a thought, before you go and get too complicated... maybe the right answer could be modifying the controls so that Tink could do it more easily, rather than remote control. I'm just thinking along the lines of added complexity adds more places for things to go wrong.

As it is a play, there's a specific sequence that Tink's lights will follow- in other words, you might have four or five sequences needed for the character, for particular scenes.

That being the case, why not program those sequences in, and have her just press a single button for each sequence? I'm just thinking that remote control adds a lot of places for problems, and the problem seems pretty easy to address.

As for how to hook it up, I'd probably use a power transistor. The arduino provides PWM for us, all we need to add is a nice switching transistor that can handle the total current of those 50 LED's. Four channels of PWM is still "stock" arduino language, so you won't even need to use an external library.

tink's still gonna need to be toting a couple of batteries, if those scenes are very long..

Now, all you need is a Belief sensor on an analog pin...

Thanks for the reply!

That is a perfectly fine idea, and you're more than right with the complexity issue there...
the only thing is that the people nothing it too simple here... my director is a very visual person, and as I know, everything is a subject to change, all the time...
with this in mind, I though that giving her the controller in her hand, would be the easiest way of doing this. it is going to allow her to run the lights as she wishes...

besides... this is going to be very useful for all the projects in mind for the future.
and also, this is a great way to learn... (although not the easiest one...)

Well, then the complexity really isn't THAT much higher, just thought I'd throw that out there. Up next in the scale of complexity would be to use the xbee's, but instead of a second Arduino as the controller, you would use Processing or another language sending control information from a computer via serial; xbee can be set up as a "virtual wire" serial connection. The simplest solution then would be to be running the Firmata sketch on the Arduino, with the remote computer handling it. Firmata basically gives you direct control of the Arduino from your PC in realtime (well pretty close), it basically makes the Arduino an I/O peripheral. Coding control on the PC, you could come up with really funky stuff, especially with PWM.

Then of course, you've got the whole setup- a second arduino reading analog pots, then either building Firmata commands and sending them to the LED-controlling Arduino, or developing a protocol to communicate between the controller and the controlled Arduinos. That means development of both "client" and "server" side software.. which can be more of a pain than you might think. Using something like Firmata on the LED controller Arduino simplifies the project by removing a lot of that work, and putting all the code problems in one bucket instead of two, when looking for errors and problems.. you are only developing the server side while Firmata provides the client.

At face value, I'd see if I could build Firmata commands on the remote control, and have the LED's run by an Arduino running the Firmata sketch. That way, if for some reason your homebrew controller dies or doesn't work, you can fall back to using a PC, without modifying Tink's end... However, I've never really looked at the internals of the Firmata protocol, which you'd need to research pretty well.. in the long run, probably a good time investment.

I'm pretty new to Arduino myself and am by no means a decent engineer... there may be better solutions- I tend to try to find the easiest route, which sometimes ends up being the wrong way !

I still think that the two Arduinos and two Xbees are my solution... I just feel as if this is the only right solution for this problem as far as i can figure out. Not that there is anything wrong with your suggestions Focalist...

so yeah, I think I will have to stay with the Double Arduino setup to liven up Tink!

in addition, I know that there is a limit of 200mA for all the outputs pins. My question is can I run 50 LEDs from 1 digital pin (to allow the PWM fade in/out)? Can I run the same setup 4 time (from 4 digital pins)?

I hope I worded it right... :-?

So my question is, can you really connect 4 Channels of 50 LEDs (I guess that this means 1 Channel per output digital pin) and make all these LEDs (200 of them) to work at the same time?

No. The Arduino can't power 50 LEDs at once.

how would you set all of these up?

The simplest would be to make the Arduino simply turn on and off the controllers you now have, using a transistor in place of the switch you now have.

Here's a MUCH simpler version I made recently for adding a lightning effect to a halloween display:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287349568

It shows how to use a transistor to control a larger current.

What are my options now?
are there any drivers that would allow me to power more than this amount of LEDs...

would I be able to power the LEDs from an external power source but close the circuit through Arduino and thus have it dim the LEDs from the grounding point?

The simplest would be to make the Arduino simply turn on and off the controllers you now have, using a transistor in place of the switch you now have.

doing so, would I be able to dim the lights?
if there a specific transistor I should use for this? any suggestions?

BTW, Thanks for the replies everyone, you are really helping me!

Well, each channel is 50 LED's, each of which is wanting 20ma.. so, if you multiply that out, it comes to 1000ma, or 1 amp total. You will be connecting the LED's in parallel, because otherwise you would want to power it with a much higher voltage than 3v.. in fact you'd want 3v times the number of LED's, or 150volts.. way too high for close contact with a human, and hard to make anyway.

So, you are going to want a power transistor that can handle at least 1amp at 3v. Thankfully, this is not a big deal at all- especially as we will be using the transistor as a switch. PWM is on/off pulses, with no intermediate values, so we can use a transistor driven fully as an on/off switch of a sort (with a small voltage drop of it's own).

Okay, here's where a GOOD engineer is going to be helpful, as they remember what all the values actually MEAN, where I'm still a bit sketchy on some finer points. In any case, in the design I used for my lightning thing there, I used an NPN Darlington transistor that goes by the designation TIP-120. These are very common and inexpensive, and very sensitive in terms of an amplifier- so they are useful for many things. Additionally, they can handle quite a bit of current... in fact, 5 amps... five times what you need per channel. So unless I miss my mark, I'll recommend you go for something like a TIP120, which should be available readily and cheaply.

Using http://ledcalculator.net/ (and another I checked on), the right to drive this would be to have a 43ohm resistor in series with each LED, if driving it with 5v (1.2 volts is lost across a TIP120). That way, you can use easily-designed power supplies.. you can get a cheap 7805 5v regulator and run it from the same source that you are feeding the Arduino from. Note that this isn't a constant-current circuit, and probably isn't the "right" way, just the way I'd end up doing it!

So here's what im gonna try to do...

Take whatever I have now (4 batteries, 4 switches and the LEDs that are wired parallel to each other), remove the switches that are on the grounding wire, replace with a transistor that is capable of handeling 1amp at 3V and connect it to a digital pin on my Arduino (which I have to buy hehe).
is this what I need to do? Im such a noob...

I just want to make sure I get this straight... I will be able to dim those right?

I will be able to dim those right?

Only if you connect them to PWM capable pins.

least 1amp at 3v.

What transistor can't handle 3V - I have yet to see one.

Only if you connect them to PWM capable pins.

which are the digital ones right... (after i set up the PWM potentiometer of course...)

Check in the Reference section of the language under analogWrite().

The core Arduino supports enough PWM so you won't need to add any software libraries to do what you want.

Then in code, you just write the duty cycle to the pin (range 0-255, which ranges from on 0% of the time to 100% of the time) that you want to get that dimming level. This will give you 255 levels of brightness.

If you look at the lightning project code, I use PWM on pin 11 to give the flickering effect.. when the variable "flash[]" is declared, I preload it with the PWM levels I want to produce the flicker sequence. In reality, what you are trying to do is basically the same thing I did.. except I used a single 1watt LED rather than a bunch of little ones. In any case, when you think power, you're going to need to supply at least 4 amps if all the LED's are on at the same time (which they will be, if they aren't totally off... PWM, remember?) plus the power for the Arduino and xbee. I'm thinking you might be able to find some Lithium pack or even rig up some "D" cells to feed the regulators.

7805's are rated for 1amp- which is what we're trying to power- but maybe a slightly higher capacity regulator (one for each channel!) might be a good idea.. or better yet, a regulator rated for 5 amps is your best bet, that will be able to drive all the channels with one regulator with another amp to spare, more or less. Don't forget to connect the grounds.. Now let's assume the whole shooting match including Arduino and xbee comes to 5 amps, roughly. You are going to need a power source that can deliver at least an hour's usage- that's 5,000 maH- but that's not realistic for a number of reasons.. otherwise that fits into the power that AA's could handle. I'd use C or D sized cells at least. If using dry cells (1.5v each), I'd go for either 4 or 5 batteries connected in series (6-7.5v). You may be able to find a rechargable pack that's smaller that can provide this level of power.. you might want to look at RC hobby batteries. Probably the batteries could be hooked to the belt and covered with cloth, not very visible at a distance- the harness is probably more obtrusive. As for dimming, etc, my code there also gives a REALLY basic dim/flicker, which might be easy to visualize.

int flash[]={255,128,64,255,64,255,255,0,128,0};

Basically, you see four levels of brightness I use- 255 (100% or fully on), 128 (50%), 64 (25%) and 0 (0%, or off). I just stuff that into an array and cycle through it with some delays. If you visualize those numbers as a sequence of brightness levels, you know what my "flash" of lightning looks like- four levels producing a flickering effect (ending with zero to take it back dark until the next lightning "cycle").

Work out the power supply details, and choose your PWM pins.. then it's time to think about protocols and remote control.

NOTE: Richard makes VERY good points.. and in all seriousness, these guys know a lot more than I.. give them a good listen if they recommend something! I'm not exactly known for considering safety as the primary design constraint.. and some little girl in green tights catching fire thirty feet off the ground.. well that'd just ruin the whole "feel" of the show.

Hi Richard,
Thanks for the links, ill be sure to check those out...

You are saying the exact same thing I had in mind. Acting is thing that requires a lot of attention. therefore Tink will have a lot to think about so we better control it ourselves...

so as you said, we are having a few people in the air for this show... and do not worry, Im in an international school in thailand which means that we have worked all the safety things out... We have a special rigging and flying company that will set up and operate the flying for us...

Thanks for your help!

Yotam

Thanks again everyone...

i have two more questions...

do any of you have a suggestion for a nice and free electronics (circuitry) drawing programs I can use? links would be appreciate...
EDIT: I guess I forgot to mention that its a Mac...oops ::slight_smile:

Also, if its not too big of a deal, I would like to know how would I go with wiring and placing the components. both with the wireless battery operation and the Arduinos... something visual would be greatly appreciated!

thanks to everyone again! I think im gonna have to put all of you in the credits for the play... :slight_smile:

Richard, I can really see why you are said to a God User... its pretty clear... haha

I was defiantly looking into having some 8 or 10 pin connectors for the Tink costume... the lights are going to be placed on a skirt that is made up of 30 layers of special nets with some stuff going out of it... I am going to take over 3 layers of the nets and get my LEDs wired together and sewed to place on middle layer and so i will try to prevent the wiring from getting messed up by having another layer of netting from each side... the wiring will then (hopefully) end with a connector that will enable me to just plug the skirt to the belt with all the controls and batteries and to just run it...

I was actually looking into the Lilypad version... it seemed as if it is going to do a lot of good...
but like any other institution, my school is trying to save money, and I have been specifically told that they want something that will be reusable in many different ways... I think that the Arduino will fit right in with my next project which is supposed to be a nice animatronic head or somethimg... thats why I kind of gave up on the lilypad. but If I can get them to pay the extra 30 bucks for it I will defiantly get it... (the shipping to Thailand is pretty... how can I phrase it... Special... haha)

There is an Arduino supply place in thailand... but they only sell the very basic things... not including the lilypads... but I got myself a nice price for those so I don't really care too much... however, I will probably be hitting the US shelves soon as I will try to get more advanced stuff out of the Arduino with time...

I really do think that the Arduino system will solve so many problems for me... its just amazing how much stuff you can get out of this much money... i love it!

and one more thing. The community online is amazing! the amount of respect, and the fact that everyone here is just purely helping with this is amazing for me... its a complete new experience for me... and I can already tell that this one is going to last a very long time... i LOVE it!

Well, glad to be of help. The community here is tremendous- in the couple of months since I first started playing with Arduino, these folks have taught me an awful lot. Perfect example: in that very project, the lightning LED strobe, I totally forgot an important factor (the voltage drop across the transistor).. which these guys caught and let me know that I could get better out of my design.. and very right they were- it's now easily TWICE as bright as it was.

My wife is involved in community theatre, and so in addition to the photography I usually do for them, I may start lending a hand in set design and special effects- of which Arduino will be pivotal because it's just so darn easy to use. The arduino language simplifies things quite a bit, as it's so similar to standard "C" that most can pick up the fundamentals fast, especially if they have a little experience programming with any other language. The community here is what really makes the whole thing shine, in my opinion, though.

One of the most powerful "toys" I've ever had...