Driving RGB LEDs with an Arduino

F

fungus

Guest
The next project I have in my head is to make a
small gizmo with a big RGB LED which responds
to sound.

It has to be battery powered and SMALL. I'm
thinking of having two 3xAA battery boxes
joined by a wire, one with batteries and the
other with the control circuitry and a LED
fixed to it.

It also has to be programmable so you can
select colors, brightness, etc. on the fly.
I'm thinking of using an Arduino Pro with
add-on FET board to switch the LEDs
with Arduino PWM output:

https://www.sparkfun.com/products/9627

The question is how to drive the LEDs?

I'm probably not going to run them at full
power because of cooling and limitations
on how much current the batteries can
supply (I doubt they can supply an amp!)

If I can get 100-125mA per color that's
probably enough.

If needed I could put in a little DC boost
board to get an accurate starting voltage
for driving the LED (eg. 5V).

So...

The datasheet for the LED I'm looking at
is here:

http://www.sure-electronics.net/download/LE-LL007.pdf

Would it be OK to rely on pure PWM to
control the LED power? That's what the
LED controller boards seem to be doing.

It says "max voltage 2.8" for red but I
figure that's max continuous voltage.
The example circuits they show with
the LED in them are 12V with a controller
board to limit the current. The boards
seem to be using PWM.


nb. I'm more of a programmer then an
electronics guy...
 
On Sun, 25 Sep 2011 04:18:36 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

The next project I have in my head is to make a
small gizmo with a big RGB LED which responds
to sound.

It has to be battery powered and SMALL. I'm
thinking of having two 3xAA battery boxes
joined by a wire, one with batteries and the
other with the control circuitry and a LED
fixed to it.

It also has to be programmable so you can
select colors, brightness, etc. on the fly.
I'm thinking of using an Arduino Pro with
add-on FET board to switch the LEDs
with Arduino PWM output:

https://www.sparkfun.com/products/9627

The question is how to drive the LEDs?

I'm probably not going to run them at full
power because of cooling and limitations
on how much current the batteries can
supply (I doubt they can supply an amp!)

If I can get 100-125mA per color that's
probably enough.

If needed I could put in a little DC boost
board to get an accurate starting voltage
for driving the LED (eg. 5V).

So...

The datasheet for the LED I'm looking at
is here:

http://www.sure-electronics.net/download/LE-LL007.pdf

Would it be OK to rely on pure PWM to
control the LED power?
---
Yes, but with current limiting.
---

That's what the
LED controller boards seem to be doing.

It says "max voltage 2.8" for red but I
figure that's max continuous voltage.
---
That's not what it means; it means that with 350mA of forward current
through the diode the maximum voltage it'll drop will be 2.8V.

But, according to the data sheet, it could be anywhere from 2.2 to
2.8V.
---

The example circuits they show with
the LED in them are 12V with a controller
board to limit the current. The boards
seem to be using PWM.
---
Since the green and blue LEDs can have a maximum drop of 3.8V (with
350mA through them) you'll need more than 2AAs to drive them.

Something like this would work: (View using a fixed-pitch font)

Vs>--------------+-----+-----+
| | |
[RSr] [RSg] [RSb]
| | |
[LED] [LED] [LED]
| | |
C | |
RIN>---[330]---B | |
R1 Q1 E | |
| C |
GIN>---[330]-----|---B |
R2 | Q2 E |
| | C
BIN>---[330]-----|-----|---B
R3 | | Q3 E
| | |
GND>-------------+-----+-----+


You can determine the value of RSx with:


Vs - (Vf(led) + Vce(sat))
RSx = --------------------------
If(led)

Where Vs is the supply voltage,

Vf(led) is the LED's minimum forward voltage drop,

Vce(sat) is Q1's collector-to-emitter saturation voltage at
Vf(LED), and

If(led) is the LED's forward current.


Assuming Vs is 6V, If(LED) is 350mA, and the transistors are 2N4401s,
the value of Rs for the blue LED would be:


Vs - (Vf(led) + Vce(sat))
RSx = --------------------------
If(led)


6V - (3V + 0.4V)
= ------------------ = 7.42 ohms.
0.35A

7.5 ohms is a standard 5% value, and it would dissipate:


P = I˛R = 0.35A˛ * 7.5R = 0.919 watts,


so a 2 watt (or higher) resistor would be fine.


The base resistors were calculated assuming 5V and 15mA out of the
Arduino I/Os and a Vbe(sat) of the transistor of about 0.4V, so:


Vout - Vbe(sat) 5V - 0.4V
R = ----------------- = ----------- = 306 ohms
Ib 0.015A

330 ohms is the next higher standard 5% value, and the transistors
have high enough betas that 24 extra ohms won't make any difference,
so 330 ohms and 1/4 watt will be fine.

There's not enough data on the data sheet to work up the values for
100mA, but now you've got the procedure if you can get the data.

The other way is to do it empirically by driving the LED with a known
100mA, measuring the voltage across it, and then using the formula to
determine the resistance you'll need with the supply voltage you've
chosen.


--
JF
 
On Sep 25, 7:14 pm, John Fields <jfie...@austininstruments.com> wrote:
Would it be OK to rely on pure PWM to
control the LED power?

---
Yes, but with current limiting.
I was thinking a bit more about that...what
if the Arduino crashes and switches everything
on. Without any resistors it'll burn out, possibly
overloading the batteries (I think battery current
will be the limiting factor...)


It says "max voltage 2.8" for red but I
figure that's max continuous voltage.

---
That's not what it means; it means that with 350mA of forward current
through the diode the maximum voltage it'll drop will be 2.8V.
Ok, that makes sense. I'm still getting my mind
around this electronics thing... :)

Since the green and blue LEDs can have a maximum drop of 3.8V (with
350mA through them) you'll need more than 2AAs to drive them.
To drive it directly from the battery you'd probably
need four AAs - depending on the voltage needed
after the final calculation.

The other option is to put something like this in the box:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230659577272


Something like this would work:
... <snip
Yep. That looks good, thanks!

I don't think there's any way to put the 330 ohm
resistors into the Sparkfun board but I assume
it just works as-is for switching things on/off.

The schematic for the board is on the product page:

http://www.sparkfun.com/products/9627


There's not enough data on the data sheet to work up the values for
100mA, but now you've got the procedure if you can get the data.
So ... hook one up with a potentiometer, dial "100mA"
(carefully, don't fry the pot) and measure the voltage
drop across the LED. Got it.
 
On Sun, 25 Sep 2011 11:44:58 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

On Sep 25, 7:14 pm, John Fields <jfie...@austininstruments.com> wrote:

Would it be OK to rely on pure PWM to
control the LED power?

---
Yes, but with current limiting.

I was thinking a bit more about that...what
if the Arduino crashes and switches everything
on. Without any resistors it'll burn out, possibly
overloading the batteries (I think battery current
will be the limiting factor...)
---
That's why you use resistors in series with the LEDs to limit current.
---

It says "max voltage 2.8" for red but I
figure that's max continuous voltage.

---
That's not what it means; it means that with 350mA of forward current
through the diode the maximum voltage it'll drop will be 2.8V.


Ok, that makes sense. I'm still getting my mind
around this electronics thing... :)

Since the green and blue LEDs can have a maximum drop of 3.8V (with
350mA through them) you'll need more than 2AAs to drive them.


To drive it directly from the battery you'd probably
need four AAs - depending on the voltage needed
after the final calculation.
The other option is to put something like this in the box:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230659577272
---
The problem with that approach is that it isn't a constant current or
a current-limited supply, so you still have to use current limiting
resistors in order to keep from destroying the LEDs.
---

Something like this would work:
... <snip

Yep. That looks good, thanks!

I don't think there's any way to put the 330 ohm
resistors into the Sparkfun board but I assume
it just works as-is for switching things on/off.
---
I think you misunderstood.

The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.

This:

+-----+-----+------+
| | | |
[RSr] [RSg] [RSb] |
| | | |
[LED] [LED] [LED] [1.5V]
| | | |
C | | [1.5V]
RIN>---[330]---B | | |
R1 Q1 E | | [1.5V]
| C | |
GIN>---[330]-----|---B | [1.5V]
R2 | Q2 E | |
| | C |
BIN>---[330]-----|-----|---B |
R3 | | Q3 E |
| | | |
GND>-------------+-----+-----+------+

_is_ the controller, and (except for the boost converter) a low-cost
equivalent to the Sparkfun board!

RIN, GIN, and BIN are the red, green, and blue PWM'ed outputs from the
Arduino, and Q1, Q2, and Q3 are the LED drivers, so if you build this
you won't have to buy a board.
---

The schematic for the board is on the product page:

http://www.sparkfun.com/products/9627


There's not enough data on the data sheet to work up the values for
100mA, but now you've got the procedure if you can get the data.


So ... hook one up with a potentiometer, dial "100mA"
(carefully, don't fry the pot) and measure the voltage
drop across the LED. Got it.
---
STOP!!!!

That's a very dangerous way to do it, since you could destroy the pot
_and_ the LED without even knowing why.

More about that later, if you're interested, but first; what kind of
test equipment do you have access to?

--
JF
 
On Sun, 25 Sep 2011 04:18:36 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

The next project I have in my head is to make a
small gizmo with a big RGB LED which responds
to sound.

It has to be battery powered and SMALL. I'm
thinking of having two 3xAA battery boxes
joined by a wire, one with batteries and the
other with the control circuitry and a LED
fixed to it.

It also has to be programmable so you can
select colors, brightness, etc. on the fly.
I'm thinking of using an Arduino Pro with
add-on FET board to switch the LEDs
with Arduino PWM output:

https://www.sparkfun.com/products/9627

The question is how to drive the LEDs?

I'm probably not going to run them at full
power because of cooling and limitations
on how much current the batteries can
supply (I doubt they can supply an amp!)

If I can get 100-125mA per color that's
probably enough.

If needed I could put in a little DC boost
board to get an accurate starting voltage
for driving the LED (eg. 5V).

So...

The datasheet for the LED I'm looking at
is here:

http://www.sure-electronics.net/download/LE-LL007.pdf

Would it be OK to rely on pure PWM to
control the LED power? That's what the
LED controller boards seem to be doing.

It says "max voltage 2.8" for red but I
figure that's max continuous voltage.
The example circuits they show with
the LED in them are 12V with a controller
board to limit the current. The boards
seem to be using PWM.


nb. I'm more of a programmer then an
electronics guy...
Go here http://www.duracell.com/oem/productdata/default.asp to
determine how long your choice of batteries will last at the current
loads you're talking about.

I don't think AA's will be adequate for very long.

John
 
On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com>
wrote:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230659577272

---
The problem with that approach is that it isn't a constant current or
a current-limited supply, so you still have to use current limiting
resistors in order to keep from destroying the LEDs.
Yes, I understood that. At least you have a constant
voltage to work with so you can calculate the
current limiting LEDs properly.


I think you misunderstood.

The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.  
No, I understood that. The 330 ohm resistor
is to limit the current going from the Arduino
output to the transistor.

(I'm unsure how you calculate the 330 ohms
but I know why it's there...)


_is_ the controller, and (except for the boost converter) a low-cost
equivalent to the Sparkfun board!
It would probably be bigger though...I need this to
fit in a very small space (it has to go inside
a musical instrument). The Arduino Pro Mini
with one of those boards is *very* small.

So ... hook one up with a potentiometer, dial "100mA"
(carefully, don't fry the pot) and measure the voltage
drop across the LED. Got it.

---
STOP!!!!

That's a very dangerous way to do it, since you could destroy the pot
_and_ the LED without even knowing why.
If I start off with a high resistance and use my ten-turn
wire pot I bet I can do it...it goes down to single Ohms.


More about that later, if you're interested, but first; what kind of
test equipment do you have access to?
I've got a multimeter and a very old (1970s) 'scope
 
On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com>
wrote:
The Sparkfun board doesn't need the 330 ohm resistors
because the LED drivers are MOSFETs,
So...MOSFETS have high resistance from
gate to source?

A BJT needs the resistor because from base to
emitter it's basically a diode. Once you pass
the breakdown voltage the resistance from base
to emitter is more or less zero and things will get
hot without a limiting resistor.
 
On Sun, 25 Sep 2011 16:06:25 -0700, fungus wrote:

The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.  

No, I understood that. The 330 ohm resistor
is to limit the current going from the Arduino
output to the transistor.

(I'm unsure how you calculate the 330 ohms
but I know why it's there...)
The required collector current divided by the transistor's minimum current
gain will dictate the required base current, which determines the maximum
value for the base resistor. Above this value, you may not be able to
obtain the required collector current.

The output voltage and maximum output current from the uC's logic pins
will dictate the minimum value for the base resistor.

If the calculated minimum value ends up greater than the maximum, you need
to use a transistor with more current gain or a FET.
 
On Sep 26, 8:06 pm, Nobody <nob...@nowhere.com> wrote:
On Sun, 25 Sep 2011 16:06:25 -0700, fungus wrote:
The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.  

No, I understood that. The 330 ohm resistor
is to limit the current going from the Arduino
output to the transistor.

(I'm unsure how you calculate the 330 ohms
but I know why it's there...)

The required collector current divided by the transistor's minimum current
gain will dictate the required base current, which determines the maximum
value for the base resistor. Above this value, you may not be able to
obtain the required collector current.
I've been trying to educate myself on this today.
This is the bit I was missing: A transistor
needs a minimum amount of current to flow
between base/emitter for it to work. I thought
it was just voltage...

Best links:

http://www.satcure-focus.com/tutor/page4.htm
http://www.youtube.com/watch?v=w9cd7B5QRRo

MOSFETs seem to work like my previous idea of
a transitor - only the voltage counts.

I didn't find a good "MOSFETS for dummies" page
yet... they all launch off into substrate types and
formulas before the end of the second sentence.
 
On Sun, 25 Sep 2011 17:25:53 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com
wrote:

The Sparkfun board doesn't need the 330 ohm resistors
because the LED drivers are MOSFETs,

So...MOSFETS have high resistance from
gate to source?
---
Essentially infinite once you charge up the gate capacitance.
---

A BJT needs the resistor because from base to
emitter it's basically a diode.
---
Yes
---

Once you pass the breakdown voltage
---
The "knee", using the BJT in common emitter mode
---

the resistance from base
to emitter is more or less zero and things will get
hot without a limiting resistor.
---
More or less true, but not really, since if that resistance was close
to zero the base to emitter junction would never get very hot.

In truth, the voltage drop across that junction varies with the
current through it, and the power it dissipates will be:


P = IE,

Where P is the power dissipated, in watts,
I is the current in the junction, and
E is the base-to-emitter voltage drop.



--
JF
 
On Mon, 26 Sep 2011 17:43:18 -0500, John Fields
<jfields@austininstruments.com> wrote:

On Sun, 25 Sep 2011 17:25:53 -0700 (PDT), fungus
openglMYSOCKS@artlum.com> wrote:

On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com
wrote:

The Sparkfun board doesn't need the 330 ohm resistors
because the LED drivers are MOSFETs,

So...MOSFETS have high resistance from
gate to source?

---
Essentially infinite once you charge up the gate capacitance.
---

A BJT needs the resistor because from base to
emitter it's basically a diode.

---
Yes
---

Once you pass the breakdown voltage

---
The "knee", using the BJT in common emitter mode
---

the resistance from base
to emitter is more or less zero and things will get
hot without a limiting resistor.

---
More or less true, but not really, since if that resistance was close
to zero the base to emitter junction would never get very hot.

In truth, the voltage drop across that junction varies with the
current through it, and the power it dissipates will be:


P = IE,

Where P is the power dissipated, in watts,
I is the current in the junction, and
E is the base-to-emitter voltage drop.
---
Oops...

Hit the send key too soon, please disregard.

--
JF
 
On Sun, 25 Sep 2011 16:06:25 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com
wrote:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230659577272

---
The problem with that approach is that it isn't a constant current or
a current-limited supply, so you still have to use current limiting
resistors in order to keep from destroying the LEDs.

Yes, I understood that. At least you have a constant
voltage to work with so you can calculate the
current limiting LEDs properly.


I think you misunderstood.

The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.  


No, I understood that. The 330 ohm resistor
is to limit the current going from the Arduino
output to the transistor.

(I'm unsure how you calculate the 330 ohms
but I know why it's there...)
---
OK.

Generally, in a common emitter switching circuit, one forces a beta of
ten in order to swamp out the vagaries between transistors.

That means that for every 100mA of collector-to-emitter current drawn
from the supply there will be 10mA through the base-to-emitter
junction.

Then, for 150mA of collector current there should be 15 mA of base
current.

With a 150mA load on the collector of the LED driver, and assuming the
Arduino outputs can get pretty close to the 5V rail when they go hot
means that with 15mA into the base of the driver, and with about a
0.5V drop across the b-e junction the base current limiting resistor
should be:

5V - 0.5V
R = ----------- = 300 ohms
0.015A
---

_is_ the controller, and (except for the boost converter) a low-cost
equivalent to the Sparkfun board!


It would probably be bigger though...
---
you only need three TO-92's, three 1/4 watt resistors, and three 2
watt resistors on a little bitty piece of perfboard.

In all fairness, though, the boost converter will suck out all of the
energy available from the battery until it (the boost converter) craps
out, which may mean longer life from fewer cells.
---

I need this to
fit in a very small space (it has to go inside
a musical instrument). The Arduino Pro Mini
with one of those boards is *very* small.
---

So ... hook one up with a potentiometer, dial "100mA"
(carefully, don't fry the pot) and measure the voltage
drop across the LED. Got it.

---
STOP!!!!

That's a very dangerous way to do it, since you could destroy the pot
_and_ the LED without even knowing why.


If I start off with a high resistance and use my ten-turn
wire pot I bet I can do it...it goes down to single Ohms.
---
If your pot is rated for 1 watt, has an end-to-end resistance of 1000
ohms, and you use it like a rheostat, that means that you can only put
31.6mA through any part of the winding before you start overheating
it, so pushing 150mA through it isn't a good idea.

Do you have the spec's for the pot or the manufacturer and part
number?
---


More about that later, if you're interested, but first; what kind of
test equipment do you have access to?


I've got a multimeter and a very old (1970s) 'scope
---
Excellent!

Now how about parts?

Any 2N2222s or 2N4401s or similar around?

--
JF
 
On Sep 27, 12:43 am, John Fields <jfie...@austininstruments.com>
wrote:
On Sun, 25 Sep 2011 17:25:53 -0700 (PDT), fungus

openglMYSO...@artlum.com> wrote:
On Sep 25, 10:51 pm, John Fields <jfie...@austininstruments.com
wrote:

The Sparkfun board doesn't need the 330 ohm resistors
because the LED drivers are MOSFETs,

So...MOSFETS have high resistance from
gate to source?

---
Essentially infinite once you charge up the gate capacitance.
Yes. I've been reading up some more and the thing people
seem to worry about with MOSFETS is gate capacitance
(the gate acts like a capacitor).

Seems that to get it to switch quickly you have to fill/drain
the gate as fast as possible.
 
On Sep 27, 2:41 am, John Fields <jfie...@austininstruments.com> wrote:
...
With a 150mA load on the collector of the LED driver, and assuming the
Arduino outputs can get pretty close to the 5V rail when they go hot
means that with 15mA into the base of the driver, and with about a
0.5V drop across the b-e junction the base current limiting resistor
should be:

         5V - 0.5V
    R = ----------- = 300 ohms
           0.015A  
An Arduino can source/sink 40mA on any pin.

you only need three TO-92's, three 1/4 watt resistors, and three 2
watt resistors on a little bitty piece of perfboard.
In theory I don't even need the perfboard, the Mini Arduino
has holes in the PCB for soldering wires to it.

http://arduino.cc/en/Main/ArduinoBoardProMini

The transistors and resistors could go directly
onto to the Arduino.

One other thing I was wondering: Is the actual transistor
inside a TO-220 bigger than a (eg.) TO-92 or is it all just
extra packaging to absorb heat?

In all fairness, though, the boost converter will suck out all of the
energy available from the battery until it (the boost converter) craps
out, which may mean longer life from fewer cells.
Lifetime...if it can go for an hour that's probably enough.
Colors will mostly be saturated (not white) so that's a
maximum of two LEDs lit up, call it 250-300mA power
draw for the whole thing. A 2500mA/h battery should
be able to power it for quite a few hours.

OTOH the LEDs will only be at full power for short pulses.
Most of the time they'll be under PWM control so
that could easily double/triple the battery life (assuming
the circuit is reasonably efficient).

If I start off with a high resistance and use my ten-turn
wire pot I bet I can do it...it goes down to single Ohms.

---
If your pot is rated for 1 watt, has an end-to-end resistance of 1000
ohms, and you use it like a rheostat, that means that you can only put
31.6mA through any part of the winding before you start overheating
it, so pushing 150mA through it isn't a good idea.

Do you have the spec's for the pot or the manufacturer and part
number?
It's 5K, 2W, one of these:

http://datasheet.octopart.com/3590S-2-502-Bourns-datasheet-9539.pdf

I would have thought it could survive 100mA
with no problems (hey it's MIL-spec!). Maybe
I don't understand how the "2W" is calculated.

More about that later, if you're interested, but first; what kind of
test equipment do you have access to?

I've got a multimeter and a very old (1970s) 'scope

---
Excellent!

Now how about parts?

Any 2N2222s or 2N4401s or similar around?
I looked in my box and I've got a few 2N2222s
left over from something else I did.

I think the thing I understand _least_ about
transistors is that there's so many different parts.

Seems to me that half a dozen well chosen
variations should cover everything.
 
On Tue, 27 Sep 2011 00:52:40 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

On Sep 27, 2:41 am, John Fields <jfie...@austininstruments.com> wrote:

...
With a 150mA load on the collector of the LED driver, and assuming the
Arduino outputs can get pretty close to the 5V rail when they go hot
means that with 15mA into the base of the driver, and with about a
0.5V drop across the b-e junction the base current limiting resistor
should be:

         5V - 0.5V
    R = ----------- = 300 ohms
           0.015A  

An Arduino can source/sink 40mA on any pin.
---
Any I/O pin, I think, but why use more than necessary?
---


you only need three TO-92's, three 1/4 watt resistors, and three 2
watt resistors on a little bitty piece of perfboard.


In theory I don't even need the perfboard, the Mini Arduino
has holes in the PCB for soldering wires to it.

http://arduino.cc/en/Main/ArduinoBoardProMini

The transistors and resistors could go directly
onto to the Arduino.
---
Only one end of the base resistors and, conceivably, the transistor
emitters and either one end of the LED current limiting resistors or
the LED Vcc input.
---

One other thing I was wondering: Is the actual transistor
inside a TO-220 bigger than a (eg.) TO-92 or is it all just
extra packaging to absorb heat?
---
Yes, there's more silicon in a TO-220 transistor.
---

In all fairness, though, the boost converter will suck out all of the
energy available from the battery until it (the boost converter) craps
out, which may mean longer life from fewer cells.

Lifetime...if it can go for an hour that's probably enough.
Colors will mostly be saturated (not white) so that's a
maximum of two LEDs lit up, call it 250-300mA power
draw for the whole thing. A 2500mA/h battery should
be able to power it for quite a few hours.
---
http://www1.duracell.com/oem/primary/alkaline/alkcapacity.asp

---

OTOH the LEDs will only be at full power for short pulses.
Most of the time they'll be under PWM control so
that could easily double/triple the battery life (assuming
the circuit is reasonably efficient).

If I start off with a high resistance and use my ten-turn
wire pot I bet I can do it...it goes down to single Ohms.

---
If your pot is rated for 1 watt, has an end-to-end resistance of 1000
ohms, and you use it like a rheostat, that means that you can only put
31.6mA through any part of the winding before you start overheating
it, so pushing 150mA through it isn't a good idea.

Do you have the spec's for the pot or the manufacturer and part
number?

It's 5K, 2W, one of these:

http://datasheet.octopart.com/3590S-2-502-Bourns-datasheet-9539.pdf

I would have thought it could survive 100mA
with no problems (hey it's MIL-spec!). Maybe
I don't understand how the "2W" is calculated.
---
The 2 watts is given, so there's no need to calculate it.

Calculating for the current allowed, since P = I˛R

where P is power in watts,
I is current in amperes, and
R is end-to-end resistance in ohms,

rearrange to solve for I:

P 2W
I = sqrt --- = sqrt ------- = 0.02 ampere
R 5000R

Then, since P = IE,

rearrange to solve for the end-to-voltage, like this:

P 2W
E = --- = ------- = 100 volts
I 0.02A

Then, just to check:


P = IE = 0.02A * 100V = 2 watts.

What matters here is that with 20mA in the winding the heat generated
will be the maximum allowed for the pot to stay in spec.

It's actually rated for 2 watts at an ambient temp of 40C and 0 watts
at 125C, so doing a linear extrapolation to 25C yields about 2.35
watts, which is about 22mA.


More about that later, if you're interested, but first; what kind of
test equipment do you have access to?

I've got a multimeter and a very old (1970s) 'scope

---
Excellent!

Now how about parts?

Any 2N2222s or 2N4401s or similar around?


I looked in my box and I've got a few 2N2222s
left over from something else I did.

I think the thing I understand _least_ about
transistors is that there's so many different parts.

Seems to me that half a dozen well chosen
variations should cover everything.
---
Dunno... there's a huge number of applications out there.

Anyways, how to use your pot to set the LED current?


O----> | S1
| |
| O-------------+
| | |
|+ | [AMMETER]
[1.5V] | |
| | |
|+ | [LED]
[1.5V] | |
| | |
|+ | C
[1.5V] [POT]<--[1k]--B 2N2222
| |CCW E
| | |
+------+-------------+

1. With S1 open, turn the pot CCW until it hits the stop, then close
S1 and turn the pot CW until the ammeter reads 150mA.

2. Without disturbing the setting of the pot, open S1, remove the
ammeter and connect a length of wire in its place.

3. Connect a voltmeter across the LED, close S1, and record the
voltage reading.

4. Open S1

4. Repeat 1 through 4 for each LED.

--
JF
 
On Sep 27, 2:11 pm, John Fields <jfie...@austininstruments.com> wrote:
rearrange to solve for the end-to-voltage, like this:
So the 2W is end-to end, not what can come
out of the wiper thingy?

I think the thing I understand _least_ about
transistors is that there's so many different parts.

Seems to me that half a dozen well chosen
variations should cover everything.

---
Dunno... there's a huge number of applications out there.
Yeah, but:

* One which is really good at switching on/off
* One which is quite linear
* One which is more exponential
* ...what else?

After that it's just maximum ratings and
changing the external resistors.

Anyways, how to use your pot to set the LED current?
I'll give it a go...
 
On Sep 26, 4:25 pm, fungus <openglMYSO...@artlum.com> wrote:
On Sep 26, 8:06 pm, Nobody <nob...@nowhere.com> wrote:





On Sun, 25 Sep 2011 16:06:25 -0700, fungus wrote:
The Sparkfun board doesn't need the 330 ohm resistors because the LED
drivers are MOSFETs, but the LED current limiting resistors are still
needed.  

No, I understood that. The 330 ohm resistor
is to limit the current going from the Arduino
output to the transistor.

(I'm unsure how you calculate the 330 ohms
but I know why it's there...)

The required collector current divided by the transistor's minimum current
gain will dictate the required base current, which determines the maximum
value for the base resistor. Above this value, you may not be able to
obtain the required collector current.

I've been trying to educate myself on this today.
This is the bit I was missing: A transistor
needs a minimum amount of current to flow
between base/emitter for it to work. I thought
it was just voltage...

Best links:

http://www.satcure-focus.com/tutor/page4.htmhttp://www.youtube.com/watch?v=w9cd7B5QRRo

MOSFETs seem to work like my previous idea of
a transitor - only the voltage counts.

I didn't find a good "MOSFETS for dummies" page
yet... they all launch off into substrate types and
formulas before the end of the second sentence.
If you like electronics, you should buy a copy of "The Art of
Electronics" by Horowitz and Hill.

George H.

- Hide quoted text -
- Show quoted text -
 
On Sep 27, 3:52 am, fungus <openglMYSO...@artlum.com> wrote:
On Sep 27, 2:41 am, John Fields <jfie...@austininstruments.com> wrote:



...
With a 150mA load on the collector of the LED driver, and assuming the
Arduino outputs can get pretty close to the 5V rail when they go hot
means that with 15mA into the base of the driver, and with about a
0.5V drop across the b-e junction the base current limiting resistor
should be:

         5V - 0.5V
    R = ----------- = 300 ohms
           0.015A  

An Arduino can source/sink 40mA on any pin.

you only need three TO-92's, three 1/4 watt resistors, and three 2
watt resistors on a little bitty piece of perfboard.

In theory I don't even need the perfboard, the Mini Arduino
has holes in the PCB for soldering wires to it.

http://arduino.cc/en/Main/ArduinoBoardProMini

The transistors and resistors could go directly
onto to the Arduino.

One other thing I was wondering: Is the actual transistor
inside a TO-220 bigger than a (eg.) TO-92 or is it all just
extra packaging to absorb heat?

In all fairness, though, the boost converter will suck out all of the
energy available from the battery until it (the boost converter) craps
out, which may mean longer life from fewer cells.

Lifetime...if it can go for an hour that's probably enough.
Colors will mostly be saturated (not white) so that's a
maximum of two LEDs lit up, call it 250-300mA power
draw for the whole thing. A 2500mA/h battery should
be able to power it for quite a few hours.

OTOH the LEDs will only be at full power for short pulses.
Most of the time they'll be under PWM control so
that could easily double/triple the battery life (assuming
the circuit is reasonably efficient).

If I start off with a high resistance and use my ten-turn
wire pot I bet I can do it...it goes down to single Ohms.

---
If your pot is rated for 1 watt, has an end-to-end resistance of 1000
ohms, and you use it like a rheostat, that means that you can only put
31.6mA through any part of the winding before you start overheating
it, so pushing 150mA through it isn't a good idea.

Do you have the spec's for the pot or the manufacturer and part
number?

It's 5K, 2W, one of these:

http://datasheet.octopart.com/3590S-2-502-Bourns-datasheet-9539.pdf

I would have thought it could survive 100mA
with no problems (hey it's MIL-spec!). Maybe
I don't understand how the "2W" is calculated.
In general you don't want to push much current through the wiper of a
pot.
Though when used as a variable resistor you don't have a lot of
choice.

George H.

More about that later, if you're interested, but first; what kind of
test equipment do you have access to?

I've got a multimeter and a very old (1970s) 'scope

---
Excellent!

Now how about parts?

Any 2N2222s or 2N4401s or similar around?

I looked in my box and I've got a few 2N2222s
left over from something else I did.

I think the thing I understand _least_ about
transistors is that there's so many different parts.

Seems to me that half a dozen well chosen
variations should cover everything.
 
On Tue, 27 Sep 2011 10:35:49 -0700 (PDT), fungus
<openglMYSOCKS@artlum.com> wrote:

On Sep 27, 2:11 pm, John Fields <jfie...@austininstruments.com> wrote:

Anyways, how to use your pot to set the LED current?

snip

The results are in, all components seem to
have survived...

I measured the voltage drop on each color
at three different currents, 100mA, 125mA
and 150mA because I'm not sure what the
final current will be yet.

\ 100mA 125mA 150mA

R 2.10V 2.16V 2.21V

G 3.04V 3.13V 3.28V

B 2.81V 3.23V 3.45V

The results fit the LED specs quite well.
The rest of the math is easy now I have
these numbers.

Thanks for the help!
---
My pleasure! :)

--
JF
 
On Sep 27, 2:11 pm, John Fields <jfie...@austininstruments.com> wrote:
Anyways, how to use your pot to set the LED current?

snip

The results are in, all components seem to
have survived...

I measured the voltage drop on each color
at three different currents, 100mA, 125mA
and 150mA because I'm not sure what the
final current will be yet.

\ 100mA 125mA 150mA

R 2.10V 2.16V 2.21V

G 3.04V 3.13V 3.28V

B 2.81V 3.23V 3.45V

The results fit the LED specs quite well.
The rest of the math is easy now I have
these numbers.

Thanks for the help!
 

Welcome to EDABoard.com

Sponsor

Back
Top