Pages: [1] 2   Go Down
Author Topic: Transistors and Resistors  (Read 1409 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey folks,
I have a new project where i am wanting to use an Arduino Uno to switch a few bits of electronics (including an LED) on/off. I have been reading everything on transistors and resistors and Arduino outputs and LEDs and am lost in a maze of formulas for working our what resistors i will need for the transistors and LED - i have worked out values but don't know if they are the right ones. I would greatly appreciate it if someone with more experience could help.

1) I want to use the Arduino and a 2N2222 transistor to switch a camera on/off switch. The camera will be ran off the 5v arduino pin - no info on how many mA it uses but it has a 220mA battery...
What resistor will i need for this transistor?

2) I am also going to run a 350mA 1W LED off the 5v arduino pin and want to switch it on/off hopefully with a TIP120 transistor from the arduino. What resistor will i need for this transistor? Also, i read that the 5v can supply up to 1A so 350ma LED should be fine right - will it draw the right amount of current it needs to run/ i dont really know anything about led drivers.

I have the datasheets for the transistors but they are missing some graphs from others i have seen. I worked out i would need a 185ohm for the TIP120, a 10ohm for the LED and no idea for the 2N2222. I dont know if these values are anywhere near right - i am sure it should't be this hard... On top of this, i have read on the net that some people don't use resistors with transistors and it worked fine - whats going on!  smiley-confuse

Any help would be great! Cheers
Logged

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

1) without current it is impossabe to tell, the batteries capacity is no clue. It could be that the transistor is not big enough. Base resistors are not critical, however go with 1K.

2) you can not control a power LED with a resistor you need a constant current supply.
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There shouldn't be a need for a transistor for a camera button. Any switching requirement that required a high amount of current would be a very wasteful (battery wise) design. Unless you're trying to activate a mechanical apparatus (solenoid) to press the button there is assuredly a simpler way to do it.

To clarify what Mike said, base resistors are critical but the value usually isn't; always try to limit the current from your pins to 20ma.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will be using a 2N2222 transistor as a switch for the camera just soldered to the wires where the switch would go. I have seen this done in many tutorials on the internet and apparently it works. Here is one i found: http://www.instructables.com/id/Hacking-A-Keychain-Digital-Camera-for-Arduino-Cont/

As for the LED, could i use a cheap 1W LED driver that is powered off 12v somehow? How could i control it from the arduino - another transistor perhaps!?

Cheers
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 152
Posts: 5757
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1) I want to use the Arduino and a 2N2222 transistor to switch a camera on/off switch. The camera will be ran off the 5v arduino pin - no info on how many mA it uses but it has a 220mA battery...
What resistor will i need for this transistor?

I don't know exactly aht it is you're switching but 330 Ohm should work. The resistor is mainly there to prevent the Arduino pin from letting more than 40mA out so the exact value isn't critical.

2) I am also going to run a 350mA 1W LED off the 5v arduino pin and want to switch it on/off hopefully with a TIP120 transistor from the arduino. What resistor will i need for this transistor?

Again, the resistor value isn't critical. The TIP120 is a Darlington so it has masses of gain. 330 will work here, too.

Also, i read that the 5v can supply up to 1A so 350ma LED should be fine right - will it draw the right amount of current it needs to run/ i dont really know anything about led drivers.

 ... I worked out i would need a 10ohm for the LED

Running a power LED at full wattage with just a resistor is very risky. Even a tiny error in voltage can have big consequences for amps.

If it's an eBay LED it's going to get HOT at full rating. eBay ratings are absolute maximums, not recommended working values. Keeping it cool will be a big problem.

In my personal experience it's much better to buy something like a 3W LED and run it at 60% power. The heat will be far more manageable.

Also: At that point on the LED power curve a small error in voltage isn't critical so if power efficiency isn't an issue you can get away with running it on a resistor (but make it a 10W resistor...)


On top of this, i have read on the net that some people don't use resistors with transistors and it worked fine - whats going on!

What's going on is that AVR chips are very robust and can survive a lot of abuse.

OTOH a resistor costs a couple of cents and can save you from buying a new Arduino.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks fungus! Cleared up a few things.
I ran a formula and worked out i should use a 2.5k ohm resistor for the TIP120 running a 1W LED. Does this sound in the ballpark?

Bit wary of running a led straight off the power supply - so i saw some cheap 1w led drivers on ebay. They run on 12v. Do you think i could switch one of these with another resistor and an external power supply?

Thanks for the help
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 152
Posts: 5757
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks fungus! Cleared up a few things.
I ran a formula and worked out i should use a 2.5k ohm resistor for the TIP120 running a 1W LED. Does this sound in the ballpark?

What formula, what numbers?

2.5K will probably work with a Darlington but really, it's not critical. The two dangers are:
a) Resistor value too high - doesn't fully saturate the transistor
b) Resistor value too low - lets more than 40mA out of the Arduino pin

The gain of a transistor depends a lot on temperature, voltage, etc. so trying to get it 'perfect' will often cause problem (a).

You're not designing a NASA space probe so it's better to be 100%  sure the transistor is fully saturated.

Bit wary of running a led straight off the power supply - so i saw some cheap 1w led drivers on ebay. They run on 12v. Do you think i could switch one of these with another resistor and an external power supply?

A proper power supply is always good but why 12V? I assume the LED runs a 3.6V so dropping 12V->3.6V is a big leap (and creates more heat).

Can you use a 5V power supply? A nice little regulated 5V supply can power both the LED and the Arduino and the drop from 5V to 3.6V for the LED is more manageable.


What I would do,

a) Get a little supply like this one: http://www.ebay.com/itm/140729265471

(nb. I applied my rule of never running eBay stuff at maximum rating, 2A feels about right for this job)

b) Run your LED at 70-80% power with something like this: http://www.ebay.com/itm/310578065040  (nb. I don't know the exact value because I don't have your LED datasheet, but that's probably not far off).

Even better, step up to a 3W LED and run it at 60% power with a slightly lower value 10W resistor.

nb. 60% power usually means about 80% light - LEDs produce more heat than light when you get near their limits.

(all eBay items picked at random, I don't know the sellers)
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my LED: http://www.ebay.com.au/itm/1W-Infrared-IR-940NM-High-Power-LED-Bead-Emitter-with-20mm-Star-Base-/221063642644?pt=LH_DefaultDomain_0&hash=item33786b7e14&_uhb=1#ht_4040wt_1163

It doesn't have an operating voltage, i was just going to run it at 5v originally from the arduino 5v pin?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 152
Posts: 5757
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It doesn't have an operating voltage, i was just going to run it at 5v originally from the arduino 5v pin?

It says "DC forward voltage 1.4-1.7V"

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


As an aside, 5mm LEDs with 100ma forward current (e.g. TSAL5100) are quite a bit cheaper than those larger, star emitter types. You shouldn't have any problem finding those from local distributors and won't feel as bad burning up a ~$.25 part as compared to a $5 part.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used this calculator to calculate resistor values for transistors:
http://kaizerpowerelectronics.dk/calculators/transistor-base-resistor-calculator/

I thought forward voltage was not operating voltage – just the volts that drops once it’s through the LED? I could run a 1.4.1.7v drop led on 5v no?

On another note I could use 50x 5mm LEDs like these:
Forward Voltage (V) : 1.2-1.4V.
Forward Current (mA): 100mA.

Once again they have 1.2-1.4 forward voltage – could I run them from 5v? If so would the Arduino have enough milliamps to run 50 of them in series and what resistor should I have? Looks to me like they would use 5A.
So i guess i am stuck with the 350-500ma star LED!

Any ideas to get it going - no one use those cheap LED drivers for something like this??

« Last Edit: February 15, 2013, 08:22:26 pm by Finnius » Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If all you're doing is switching, use a MOSFET and skip the math.  A 220ohm resistor between the pin and gate (analogous to a BJT's base) helps prevent goof-ups and over-current from capacitance, but with a FET, the value of that resistor is not critical at all.  Anything from 10R to 10k would probably work.
Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1532
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used this calculator to calculate resistor values for transistors:
http://kaizerpowerelectronics.dk/calculators/transistor-base-resistor-calculator/

I thought forward voltage was not operating voltage – just the volts that drops once it’s through the LED? I could run a 1.4.1.7v drop led on 5v no?

With a series resistor to drop the voltage, yes.
Quote
On another note I could use 50x 5mm LEDs like these:
Forward Voltage (V) : 1.2-1.4V.
Forward Current (mA): 100mA.

50 in series would need 50 * 1.2V = 60V @100mA  (no resistors) to light up.
50 in parallel would need 50 * 100mA = 5Amps @ 1.2V to light up. You'd also need a resistor on each one so that it can be run from 5V.

Neither can be supplied from any Arduino directly. Each Arduino pin can only supply (max) 20mA @ 5V.

Quote

Once again they have 1.2-1.4 forward voltage – could I run them from 5v? If so would the Arduino have enough milliamps to run 50 of them in series and what resistor should I have? Looks to me like they would use 5A.

See above.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help guys.

I am sorted out for the 2n2222 and some 270ohm resistors that would only need 2.75mA to saturate from the arduino.

I still need to find a way to run the 1W LED. So i gather a MOSFET is a good way to do this? I have found the MOSFET IRF3205/IRF3710.
Datasheets (respectively):
http://www.taydaelectronics.com/datasheets/A-104.pdf
http://www.taydaelectronics.com/datasheets/A-105.pdf

The 3205 should be fine. Although can anyone tell me from the graphs in the datasheets how much current at 5v is required to saturate for a 350ma collector for the LED?

SirNickity said that a 220 ohm base resistor on a FET would be fine - is this for my 350/500ma LED?? Whats so good about a MOSFET - do they have low saturation values?

On a side note - i thought arduino could supply 40ma through the output pins not 20ma as Henry_Best said? And up to an Amp (although i wouldn't) out of the 5v pin?

Also what resistor should i have between the 5v arduino output and the led to stop it drawing more than 350ma? That is the real question for me!!!
My best idea at the moment is to run the LED using a 2W 10ohm resistor - will this limit it to somewhere between 350-500ma (recommended)?
But i still need a transistor to turn it off and on... smiley-sad
« Last Edit: February 16, 2013, 03:12:26 am by Finnius » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So thanks to your guys help my latest solution is thus:

2n2222 transistors with 270ohm base resistors - requires 2.75ma to saturate at 220ma load

TIP120 transistors with 2500 ohm base resistors - requires 0.25ma to saturate at 500ma load

2W 10ohm resistor for the 1w LED at 5V <500ma running from the 5v arduino pin

Questions:

Will it work?

Is 0.25ma to saturate too low a value for the TIP120, it is only small cos of lots of gain?

Thanks so much for the help
Logged

Pages: [1] 2   Go Up
Jump to: