Pages: [1]   Go Down
Author Topic: EXTREMELY Simple Questions  (Read 739 times)
0 Members and 1 Guest are viewing this topic.
My own little world
Offline Offline
Newbie
*
Karma: 0
Posts: 18
If at first you don't succeed, smack it harder.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone. smiley It's me again. This time I've got some crazy simple questions regarding my  hardware components, so I hope you refrain from tittering as you answer me. Bear with me; I'm curing my ignorance little by little.  smiley-razz

So first off, I have a LilyPad Arduino that I bought from SparkFun, along with some yellow LEDs.

As you can see, the LEDs have 2.0 to 2.4V DC forward drop, the max current is 20mA, and the suggested using current is 16-18mA.

The LilyPad has the following specs:
Operating Voltage   2.7-5.5 V
Input Voltage   2.7-5.5 V
Digital I/O Pins   14 (of which 6 provide PWM output)
Analog Input Pins   6
DC Current per I/O Pin   40 mA

In order to get enough voltage for the microcontroller, I'll use two AAA (1.5V) batteries in series.

That being said, on to my questions. smiley

1. I want to use this microcontroller to control the operation of seven of the yellow LEDs. If I attach each LED to a single I/O pin, I'm thinking that, through Ohm's law, the resistance I'll need per LED is the following (rounding up to the nearest Ohm):

Power Supply Voltage = (Current from Pin - Current needed for LED) (Resistance)
3.0 V = (0.04A - 0.017 A)(R)
3.0 V = (0.023A)(R)
131 Ohms = R

Is that even right? What about the voltage drop over my LEDs? Does that factor in somewhere too?

2. I bought an enclosed battery holder from Radio Shack that holds two AAA batteries. I was wondering if it would be safe to assume that the batteries are connected in series, and not in parallel. It probably says so on the package, but I'm away from home at the moment, so I can't check. They sell it on their website, too.

3. Finally, am I even correct in figuring that two AAA 1.5V general purpose batteries are appropriate for this setup? I know next to nothing about hardware or circuits, so maybe I need something more specialized. I just want to make sure. :x

Thanks in advance for all your patience with me. I know I must get on your nerves when my questions are probably so rudimentary.
Logged

Being an adult shouldn't be about maturity; it should be about being old enough to go out and do bigger and better things with your time.

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi. Also a newbee.

Found this excellent LED resistor calculator link to a post on this site : http://led.linear1.org/1led.wiz
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26534
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
3.0 V = (0.04A - 0.017 A)(R)
3.0 V = (0.023A)(R)
131 Ohms = R

Your arithmetic is correct, but the premise flawed.

The series resistor is calculated by taking the supply voltage, the forward voltage of the LED, and the desired current.
R= (Vsupply - Vforward) / current.

The maximum pin current must not be exceeded, but otherwise does not enter into the calculation.
If in doubt, go for a higher resistance than calculated.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1404
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming your output is 3 volts and your LEDs forward voltage drop is a nominal 2.2 volts then your series resistor controlling LED current is (3-2.2)/0.017   or 0.8/0.017  =  47ohms

You want to control 7 LEDs but you have only 6 outputs.   You therefore need to do some multiplexing if you want independent control of each of the LEDs

If you can tolerate 2 of the LEDs in parallel then this can be done but each LED must have its own 47ohms control resistor.

Your batteries will be in series to produce 3 volts

AAA are limited in current capability and if all 7 LEDs are lit at 17mA your load current will be at least 0.25 amps (inclusive of the lillypad)
If size is an issue then these batteries might work, but don't expect any more than a few 10s of minutes or so of battery life.   Obviously if only 1 LED is illuminated at a time then battery life will be greatly extended.  I'd suggest at least AA cells for better life and more stable operation.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 637
Posts: 34602
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if it would be safe to assume that the batteries are connected in series, and not in parallel.
Yes, it is not a good idea to connect batteries in parallel.

Quote
am I even correct in figuring that two AAA 1.5V general purpose batteries are appropriate for this setup?
Two batteries will give you 3V as the arduino you have will work down to 2.7V it will work.
However, as the batteries drain the voltage will drop a bit and you won't get the maximum life out of it. It would be better to have three in series. You can get a single battery holder to go along side the double one.

Quote
if all 7 LEDs are lit at 17mA your load current will be at least 0.25 amps (inclusive of the lillypad)
17 * 7 = 119mA so add 20mA or so for the arduino and you get 140mA
« Last Edit: April 07, 2011, 01:07:39 pm by Grumpy_Mike » Logged

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1404
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Mike,

I can't blame my calculator,   it 119 and I also added on 20mA plus a bit for tolerance so rounded up to 150mA but somehow put it in as 250mA  (0.25)   Doh!

Logged

My own little world
Offline Offline
Newbie
*
Karma: 0
Posts: 18
If at first you don't succeed, smack it harder.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow! Thanks for all the great advice and corrections to my mistakes! I will definitely be taking all this into account! But now I have new questions. :x

1. Let's say I used two AA batteries instead (or even three of them). Would doing that affect anything other than the effective lifespan of my voltage? Would it also affect the amount of current going into the microcontroller, and potentially damage it?
Ignore this question. -_-... After doing some digging, I realize now how silly it was.

2. I thought I had 14 pins to work with... I suppose I don't really understand the difference between the digital I/O and the analog pins. But let's just assume for now that I'll be using the six analog pins for my LEDs, and that I'll use three AAs to power the setup. I could attach two of the LEDs to one pin and, if I don't mind both LEDs acting in unison with each other, I'd still have enough current to run them, so it should be fine, right? It would change the value of the resistance I'll have to wire in, but the increased voltage would have done that anyway.

3. And what's to stop me from attaching two LEDs to each of three of the pins and one LED to a fourth? Can I do that, as long as I allow for the appropriate resistance for each pin? Let's say that multiplexing won't be an issue, because I can verify that I want each pair of LEDs to turn on and off at the same time as each other, so I won't have to control them independently. I can do that, right?
« Last Edit: April 07, 2011, 08:36:55 pm by Shuko » Logged

Being an adult shouldn't be about maturity; it should be about being old enough to go out and do bigger and better things with your time.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 637
Posts: 34602
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I suppose I don't really understand the difference between the digital I/O and the analog pins.
There is no difference when talking about digital I/O the analogue inputs can also be used as digital inputs or outputs. Not sure where you get 14 from as there are 20 I/O on the arduino.

Quote
I could attach two of the LEDs to one pin
You would need to limit the current of each LED to about 15mA to stay withing the current limit of an output pin. In addition there is an absolute limit of 200mA for the whole arduino (this is best kept to 150mA in practice).
Each LED would need it's own resistor. It's value should be calculated using the output voltage of the processor.

Quote
And what's to stop me from attaching two LEDs to each of three of the pins and one LED to a fourth?
the current limit on the individual pins and that on the processor as a whole.
Logged

My own little world
Offline Offline
Newbie
*
Karma: 0
Posts: 18
If at first you don't succeed, smack it harder.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

- helpful input -
Thanks! Since I last posted all those questions, I did a little research and testing on my own, and I came to the same conclusions. At first I didn't understand why Jacrae said I only had six pins, but after thinking about it for a bit, I realized that those six pins are the analog ones, and it was assumed that I'd only be using them. Since I planned to make use of the IDE to provide the instructions for the LEDs, I realized that all twenty pins were available to me (so long as I didn't exceed 200mA overall smiley-kitty). With that knowledge, I pretty much had all that I needed. I've currently got seven LEDs hooked up to seven of the pins, and I've put 68 Ohm resistors in place on all of the LED input leads. I figure I should be safe with 68. Even with the 5% tolerance on them, there's no way I'll need more than that amount of resistance for 3V.

I've got all the bare connections made. Now I need to write my program and test it and all my connections out. Once I'm sure everything works the way I want it, I'll reinforce the connections with solder. smiley

I appreciate everyone's help! The only thing that could make this idea even better is if I could find some way to drive some sort of beep-producing device along with the LEDs. But all of the sound devices I've found require more voltage than what I can get from two AA batteries. :p
Logged

Being an adult shouldn't be about maturity; it should be about being old enough to go out and do bigger and better things with your time.

Pages: [1]   Go Up
Jump to: