Pages: [1] 2   Go Down
Author Topic: How can I get the 5v outputs to switch 12v outputs on this project ?  (Read 1506 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've finally finished the programming on my strobe LED project and got it working on an attiny85 and am just about ready to solder this up on some protoboard. But im going to want to replace these leds with led strips that run on 12v, but the attiny runs 5v and so are it's outputs.

I will power this off a 3s lipo which would give me the right power for the LED strips, and I guess I need to use a voltage regulator to power the tiny with 5v, but im confused as to how to send the output and power these led strips to blink. What would be the best solution here ? and how would you guys do this?

here is a photo (if that helps at all) http://i.imgur.com/jGm09mN.jpg

Thanks
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4673
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Give the LEDs their power from the external source but below the LED, ie on the ground side, put an NPN transistor of some sort. Then your digital io from Arduino switches the transistor base (thru a resistor), which in turn switches the low side of the LED circuit.

Something like ..... this.... but with the right voltages and not necessarily that model of transistor.
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use 4 discrete transistors and base current limit resisitors, or a single chip, transistor array with built in limit resistors such as ULN2003 to replace all 8 of those components.
http://www.digikey.com/product-detail/en/ULN2003AN/296-1979-5-ND/277624
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

thanks guys, so transistors are the way to go. Any idea what type / number transistor I should use?

Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4673
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any idea what type / number transistor I should use?



Well I think CR was telling you that......
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup, the ULN2003 is used in just about every appliance I have torn down for work to drive relays. It's a great little chip and the only additional advice I'd give is that there are current limits for Darlington-arrays like the 2003A.

So review the data sheet and your LED-driving current requirements carefully to ensure that you are not exceeding the current limits of the 2003A or switch to a beefier transistor or perhaps even a electromechanical relay. It all depends on what you are trying to do - for example, dimming via PWM will not play well with most/all electromechanical relays, while simple on/off may be perfect for a relay and not so perfect for the solid state relay (heating).

You will still need a chip like a 2003A to drive a electromechanical relay, however. And, unless the chip has a built-in snubber, add a snubber diode to limit inductive kickback from the relay from damaging the 2003A.
« Last Edit: April 10, 2013, 09:43:05 am by Constantin » Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How'd relays come into this?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

Well I think CR was telling you that......

Understood thank you, but I wont be needing those resistors as the led strips power direct from 12v and have their own.

Also in my sketch I am using PWM to dim the LED's, is this still possible using single transistors ?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you can PWM the transistors.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

Yes, you can PWM the transistors.

Great news, thanks all for the help!!
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How'd relays come into this?

All a function of current, no? Isn't it typically cheaper to use a electromechanical relay for higher currents as long as you don't need to PWM quickly? Hence my recommendation to have a look at the datasheet vs. the expected power draw of the LED string. The ULN2003a is usually good for up to 500mA, which typically gets you about 25-50 small LEDs. However, larger LEDs can draw 1W-3W, which limits the number of such LEDs you can drive with a ULN2003 to less than 5.

Remember, the OP gave no indication re: the power of his LED string...
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

PWM at any speed is not good with relays. The contacts are usually rated for so many closures, which PWM would quickly wear out, and the chattering would drive one mad as well.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

Im just trying to get my head around the wiring for the transistors. I figure id need NPN type for the low-side switching.

How does this look? http://i.imgur.com/BE7jniN.gif

Base +5v (arduino pwm output)
Collector -12v (led strip negative)
Emitter -12v (led strip negative)

Sorry if this is elementary stuff, im a bit new to electronics

(edit: the led strips are http://j.mp/YmLEuX I will use about 30 low power leds (50cm) and should have a draw about 200ma )
« Last Edit: April 10, 2013, 09:05:26 pm by driz » Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 545
Posts: 27353
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use the example on pin D12. Emitter connects to Arduino Gnd and to power supply Gnd.
LED strip+ goes to 12V, LED strip- goes to the collector.


* Driving_LEDs.jpg (51.09 KB, 960x720 - viewed 49 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

Use the example on pin D12. Emitter connects to Arduino Gnd and to power supply Gnd.
LED strip+ goes to 12V, LED strip- goes to the collector.

perfect thanks smiley

Can I ask why the arduino and 12v grounds are tied together, I don't quite understand how that works
« Last Edit: April 10, 2013, 09:36:21 pm by driz » Logged

Pages: [1] 2   Go Up
Jump to: