Voltage Requirement

Hello all,

I'm making a simple controller for a piece of machinery. I'm using the 328p to do this job. The controller has inputs coming in from an encoder and an opto sensor. The opto sensor runs at 12V and the encoder runs at 5 to 12v. But here's the annoying part, the input is a nice 24V. I tried to find a regulator that drops 24V to 5V directly, but there were only 24V to 12V drop regulators.

My question is, is it okay to use a 24 to 12V drop regulator, power my opto sensor, then use the 12V coming from the same regulator to drop it down again to 5V with a 7805 ?. Will this method be efficient, or will the regs burn each other ? .

Also, I have another silly problem, when the encoder or the opto sensor pulse back to the Arduino, the logic level for high will be in the range of 12V to 24V. I need to drop down the voltage state to 5V for the pulses coming in, a voltage divider is better?, or a regulator again will work better ?
Also, do I need capacitors for the regulators if my 24V input is coming from a SMPS based supply ?
Thank You
:slight_smile:

you can chain regulators like that, as long as everything is within spec it will be fine (though I bet somewhere in there is mains current that you can use screw terminals to wire in a wall wart, that is what I do)

for 24 volt signals coming in off of a sensor or whatever in a machine of any sort the best way I have found is to use a Opto-isolator and a 317

an Opto-isolator is typically a 6 pin (or multiples of) IC, inside it has an LED, the other side it has a photo transistor, I hook the higher voltage to the LED and use the 317 in series to ground set up as a current regulator to not blow the led. The transistor side is hooked between 5volts and the AVR's input.

you could use a resistor to limit the LED current, but dumping 24 volts into a single LED and dissipating that power is going to require a decent size package, and what happens if the voltage changes (I have seen these things float all over the place depending on whats happening)

Regulators are a bad idea cause you need a fairly signifigant amount of capacitance to keep them steady, which might eat your signals and be too slow to react.

Resistor dividers are a bad idea in this environment cause again the voltages float everywhere so its not going to be enough or its going to be too much on any given day

Another option is to use a Zener diode with a resistance in front of it, but when I tried that in an industrial machine they were touchy about noise

Last option is what someone might bring up, the AVR in the arduino has internal protection diodes, they are AWESOME for supressing a hit or two, but ... LOL... I once misread some Zener's to be 4.7V and they were 24V, so I was dropping 24 volts + all the noise and spikes from switches, transistors, motors and relays into the chip

it lasted about 2 weeks then went ape shit, the big ole Opto-isolator + 317 setup has worked flawlessly for almost a year now connected directly to mechanical relays switching thousands of times a day (with some back EMF protection added)

to be honest its not all that big since I sent off for some 10$ PCB's at itead studio and use SMT parts

so theres my 2 cents spread out to 3 dollars worth of words, but one of my main functions is to design and make automated equipment in a small electronics plant.

Thanks for the info, really helps. One more question, just to clarify, the opto isolator pulses 5V when there is pulses of say 12V coming from it's input?. About the 317, can you link me to the data sheet or something like that?

If I've got it clear,

  1. Using chain regulators is not an issue.
  2. Pulses coming in from an encoder or sensor, use an opto isolator since there is no physical connection between the two voltages. Also the response is much faster then a regulator.

Also, a datasheet for opto - isolator and 317 should do me real good.

Last question, my main 24V input is from a 24V SMPS. Do I require to use capacitors for the regulators even though the main DC supply is from a controlled power supply ?

  1. yea chaining regulators is fine as long as you meet the current / heat requirements of the part, a 7812 is going to drop 12 volts as heat, how much depends on how much current you draw, so far we have just talked about inputs, and no outputs or additional hardware to the arduino, which is very little current, so slap a small heat sink on there and it will run more than acceptable with some space for load growth

  2. correct

  3. yes you need caps on the regulators cause that power supply is going to bounce around quite a bit if there is mechanical devices in the system, but you should be able to cut the quantity down, the second regulator would just need some small ceramics to keep it from oscillating

datasheets

http://www.ti.com/lit/ds/symlink/lm117.pdf (look at fig 47 on page 20, theres a bunch of stuff you can do with this device)
http://www.vishay.com/docs/83725/4n25.pdf

quick example circuit

example.jpg

  1. You always need capacitors on the input of voltage regulators, and usually on the output as well (unless the datasheet says it isn't necessary). Exception: the output capacitor of the power supply feeding the regulator can double up as the regulator input capacitor, if the wires between the two are short enough. So you can dispense with the 7812 input capacitor only if the 7812 is connected to the SMPS through very short wires. If the 7812 and 7805 are close to each other, then the same capacitor can server as both the 7812 output capacitor and the 7805 input capacitor.

  2. To cut down your 12V signal to 5V, the simplest solution is just to use a series resistor of about 47K and let the pin protection diode do the rest. Position the resistor near the pin so that there is very little wire between the resistor and the pin to pick up noise. Alternatively, a voltage divider is OK if the input logic high voltage is constant, which it should be if it is coming from a sensor powered by your 12V regulator. You don't need to use an opto isolator unless either the input doesn't have a common ground with the Arduino, or there is a lot of ground noise.

For 24->5V drop you really really REALLY want a switching regulator, not a linear one. The heat dissipation, even with a "chain" of linear regulators, is going to be horrendous even at low currents.

I have taken to buying small UBEC devices (designed for remote-control planes, cars, etc), stripping them of all wires, and treating them like a surface mount module. Works really well and they can be nice and low-profile. Or, just use them as an in-cable "bump" to give a nice high current low heat 5V supply from a wide range of voltages. The ones I use run from between 6 and 23V, and cost just a couple of $$.

Car cigarette lighter adaptors are also good to use as well, especially as they tend to be tolerant of much higher input voltages.

If you are lucky your 24V sensors will use open-collector outputs, then you simply add a pull-up resistor
to 5V on the output and all is well (check datasheet).

dc42:
2. To cut down your 12V signal to 5V, the simplest solution is just to use a series resistor of about 47K and let the pin protection diode do the rest.

yea I accidentally did that, and as I already said its not a good idea, its a cute way to do it when your playing around on the bench but it wont last long, it lasted about 2 weeks for me sitting in the back of a 24 volt PCB conveyer before all the inputs were fried. You dont really wanna replace a board in the middle of production on a machine cause you trusted a microscopic spec on the die meant to protect against spikes as a final solution.

But here's the annoying part, the input is a nice 24V. I tried to find a regulator that drops 24V to 5V directly, but there were only 24V to 12V drop regulators.

There are inexpensive UBECs like below on ebay that should be able to do the job.

http://www.ebay.com/itm/Hobbywing-3A-UBEC-5V-6V-MAX-5A-Lowest-Parts-RF-Noise-BEC-S-/200933670824?pt=US_Radio_Control_Control_Line&hash=item2ec8947fa8

•Output Voltage: 5V or 6V (Changeable with an output-voltage select switch )
•Continuous output current: 3 Amps
•Input: 5.5V-26V (2-6 cells lithium battery pack or 5-18 cells NiMh /NiCd battery)

Osgeld:

dc42:
2. To cut down your 12V signal to 5V, the simplest solution is just to use a series resistor of about 47K and let the pin protection diode do the rest.

yea I accidentally did that, and as I already said its not a good idea, its a cute way to do it when your playing around on the bench but it wont last long, it lasted about 2 weeks for me sitting in the back of a 24 volt PCB conveyer before all the inputs were fried. You dont really wanna replace a board in the middle of production on a machine cause you trusted a microscopic spec on the die meant to protect against spikes as a final solution.

To fry your inputs when you have a 47k resistor in series with them, you would need to apply several hundred volts. Something else fried your inputs, or you used a much lower value series resistor. Or you really did apply several hundred volts.

yea its in the back of a machine with mechanical relays and motors all around it, several hundred volt spikes over time add up

One more question guys :

I'll be using two regulators in chain to get two O/Ps from an I/P of 24V, O/Ps of 12V and 5V, max current of 800ma . What capacitance and voltage capacitors should I use for the regulators ?