how do I get an arduino to run a 24v circuit? - Page 1
Forum section: electronics / beginners

author: matelot
author_rank: Newbie
timestamp: May 18, 2014, 11:33:24 pm
content: I am updating a monitor board (by building a new one) that consists of lots of LEDs (around 60).The board runs from a 24 volt circuit so all the LED's will have 1.2Kohm resistors in series.I want to be able to build a test unit to plug onto the board and run it with an arduino.The arduino works on 5v.Even if I use a number of shift registers (I have enough experience of writing arduino software to drive shift registers) I will still need some way of increasing the output to 24v.Is it possible to do this with NPN's (I have plenty of C945's) or other NPN/PNPs (I have lots of old boards that are populated with various transistors)?Alternatively could I do it with FET's?If not is there any other way I could do it in solid state? If I use relays I will have to buy them (more than 60) and the size of the test unit will be bigger than the board itself.I have experience of making printed circuit board and building small circuits.I am aware that 5v will still turn LED's on and I could just run it from 5v (the LED's would be dim but clear enough) I just would like to make the circuit.Thanks,Bob.

author: Stonent
author_rank: Super Contributor
timestamp: May 18, 2014, 11:45:02 pm
content: Well running the leds directly from the arduino at 5v would definitely not be a good idea because you'd likely damage the chips.If you've got enough transistors or mosfets you could just wire them to the outputs of the shift register I would think. However I will wait to hear what others think as I'm not an expert in this field but there's several people here who've worked with 24v LED lighting.Another thing to think about is dedicated LED driver chips. Ones designed for this sort of thing.

author: matelot
author_rank: Newbie
timestamp: May 18, 2014, 11:51:59 pm
content: Code:Well running the leds directly from the arduino at 5v would definitely not be a good idea because you'd likely damage the chips.Which chips?Code:Another thing to think about is dedicated LED driver chips. Ones designed for this sort of thing.I was wanting to use transistors, I have plenty of them.

author: sleemanj
author_rank: Super Contributor
timestamp: May 18, 2014, 11:59:00 pm
content: Use a transistor array to save space (eg, ULN2003)Or discrete transistors if you prefer.

author: Stonent
author_rank: Super Contributor
timestamp: May 19, 2014, 12:02:35 am
content: (In reply to the previous question before the schematic was posted)Most like the chip the LED is connected to directly without something in between to handle the voltage.So at 1.2k and 24V you're giving 20mA per LED or .48 Watts. So the first thing would be make sure your transistors are up to it.Checking a sample datasheethttps://www.fairchildsemi.com/ds/KS/KSC945.pdfmakes it look like (to me at least) that you need a beefier transitor. This one looks like it only will handle about 50% of the wattage you need if I read it correctly.

author: matelot
author_rank: Newbie
timestamp: May 19, 2014, 12:13:19 am
content: do you think it would be as easy as that sleemanj? What do you think RBase would be?I will have to try it next time I am in my workshop(tomorrow maybe).StonentCode:Most like the chip the LED is connected to directly without something in between to handle the voltage.I don't understand this?Code:So the first thing would be make sure your transistors are up to it.Your link shows a collector current of 150mA, I only need 20mA?

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 19, 2014, 12:14:56 am
content: 24V and 1K2 series resistor implies that you are running 20mA through each LED.An ordinary shift register like a 74HC595 will handle only 5mA at the outputs. Clearly that is not suitable for your circuit.However, a high-power shift register like TPIC6B595 can handle 150mA at each output which would easily handle your circuit.Note that virtually all microcontroller-controlled circuits like this have the "top" of the load connected to the supply voltage (24V in your case),and then the "bottom" side of the load (the anodes of your LEDs) is connected to ground through a transistor to turn it on.This is illustrated in sleemanj's post above.Your panel must use this scheme ("low-side switching") in order to use most microcontroller circuits.Switching the "top side" (the 24V) is possible, but the circuit is much more complex which is why we rarely do it that way.

author: Stonent
author_rank: Super Contributor
timestamp: May 19, 2014, 12:16:15 am
content: Quote from: matelot on May 19, 2014, 12:13:19 amI was looking at the 250mW part, you need about 2x that.In regards to the chip, if each LED is using 24V and 20mA you're going to overheat or damage a shift register or whatever other logic device is there so you definitely would want a transistor or something there.

author: Stonent
author_rank: Super Contributor
timestamp: May 19, 2014, 12:18:58 am
content: Quote from: Richard Crowley on May 19, 2014, 12:14:56 amHere's a sample circuit I found to drive an 8x8x8 LED cube using the tpic6b595. Not saying it's the exact circuit to use for this, but an example of one way to drive a lot of leds from an arduino that need more current.

author: Monkeh
author_rank: Super Contributor
timestamp: May 19, 2014, 12:21:21 am
content: Quote from: Stonent on May 19, 2014, 12:02:35 amPower dissipated in the load is not the same thing as power dissipated in the transistor. It should be a handful of milliwatts at most, not hundreds.

author: matelot
author_rank: Newbie
timestamp: May 19, 2014, 12:22:14 am
content: I don't think I explained myself there. The shift register would be the driver and as such go to the base of the transistor. I would need more outputs than the arduino could provide, hence the need for the shift registers.

author: sleemanj
author_rank: Super Contributor
timestamp: May 19, 2014, 12:24:43 am
content: Stonent, and Richard Crowley seem a little confused.If you are passing 20mA over a 1.2k resistor the drop over the resistor itself is 24v (Ohm's Law), so that's already a contradiction, you can't get 20mA through your Resistor AND LED (and transistor) with a 24v supply and 1k2 resistor and ANY led. LED's have a forward voltage drop, so you don't have 24v over that resistor any more.The power dissipated in the transistor is of course determined by the voltage drop across the transistor and the current through the transistor, it cares not what the voltage drops above or below it is, only across it.You of course don't need the led resistor at all, if your transistor can handle the full (24-VfwdLED)*Current power, and you select RBase appropriately.It sounds like you don't know a lot about transistors (or, anything), so I recommend you to have a bit of a study about Bipolar Junction Transistors, try this video:http://youtu.be/ZEDdFjvnAAo

author: Stonent
author_rank: Super Contributor
timestamp: May 19, 2014, 12:26:48 am
content: Quote from: Monkeh on May 19, 2014, 12:21:21 amOk thanks for clearing that up.

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 19, 2014, 12:27:51 am
content: With the TPIC6B595, you don't need a separate transistor. It is built into the TPIC6B595.Ohm's law says that the current through any part in the circuit is the same everywhere.Since matelot did not reveal all the necessary specifications (like the forward voltage of his LEDs), we used the stated voltage and current as a rough estimate to see what ballpark he is playing in.

author: sleemanj
author_rank: Super Contributor
timestamp: May 19, 2014, 12:30:16 am
content: Quote from: Richard Crowley on May 19, 2014, 12:27:51 amNo it doesn't.Kirchoff's Current Law does.

author: matelot
author_rank: Newbie
timestamp: May 19, 2014, 12:33:25 am
content: Code:Since matelot did not reveal all the necessary specifications (like the forward voltage of his LEDs),The LED's require 20mA max to give full brightness, to achieve this with 24v I need a 1.2k resistor in series. OHM's law.what forward voltage do you need?

author: sleemanj
author_rank: Super Contributor
timestamp: May 19, 2014, 12:34:34 am
content: Quote from: matelot on May 19, 2014, 12:33:25 amFind out forward voltage of LED.Determine voltage drop across resistor.Apply Ohm's Law.

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 19, 2014, 12:35:18 am
content: Bzzzt, yes I got the name of the Law wrong. But the facts remain the same. Apologies to Dr. Kirchhoff.Using the supply voltage and the current limiting resistor gives us a worst-case design point to use for specifying the rest of the circuit.So it doesn't really matter what the forward voltage of the LED is at this level of circuit design.The TPIC6B595 is MADE for this kind of application. It is a big favorite in the Arduino community for exactly this reason.

author: Stonent
author_rank: Super Contributor
timestamp: May 19, 2014, 12:36:22 am
content: Quote from: matelot on May 19, 2014, 12:22:14 amI understand. I was just clarifying connecting the LEDs directly to the shift register could damage the shift register unless it is rated for what you're trying to do. If you're just using it to control a transistor you're not going to have that problem.

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 19, 2014, 12:38:51 am
content: Quote from: matelot on May 19, 2014, 12:33:25 amDifferent colors (and even different constructions of the same color) LEDs exhibit quite different forward voltages at their designed operating point. It is necessary to take this forward voltage drop into account when calculating the current-limiting resistor. Apparently someone else knew the forward voltage and made this calculation for you and handed you the resistor value for 24V. But that doesn't help much if you have to design for a different supply voltage. That is why the forward voltage is specified, so you can do the calculation for yourself, and not have it handed to you by others.

author: matelot
author_rank: Newbie
timestamp: May 19, 2014, 12:41:34 am
content: The data sheet shows 20mA for the LED.sleemanj, what do you suggest the RBase would be on your schematic?

author: Richard Crowley
author_rank: Super Contributor
timestamp: May 19, 2014, 12:45:37 am
content: Quote from: matelot on May 19, 2014, 12:41:34 amThe base resistor is selected to feed enough current into the transistor to turn it on.We typically feed more than enough current to ensure that the transistor is in "saturation" and not dissipating any power itself.All transistors have published "current gain" or hFE values.If you need to switch 20mA, and you have a transistor with a gain of 100, then you need at least 200uA into the base.You can use Ohm's law to calculate the resistance needed to shove 200uA from a 5V source (i.e. the Arduino output).

author: matelot
author_rank: Newbie
timestamp: May 19, 2014, 12:52:14 am
content: ok thanks for the help I will try that tomorrow.