Go Down

Topic: Feeding +12V into digital pins (Read 1 time) previous topic - next topic

patrick

Hi all!

I'm asking you for advice to bridge the electronic sides of my project. Two light barriers will be polled for objects passing the lights, when an object passes and triggers a barrier, the barrier provides +12V on one of it's connections. The Arduino is programmed to watch for +5V on two pins.

What I need to know is a simple and reliable way to feed those two +12V signals into the Arduino. Done directly, it would damage the Arduino.

One way could be using two standard 5V regulator circuits (one circuit for one light barrier) based on a 78m05 and three capacitors, which should regulate the 12V (object detected) down to 5V.

Another approach, using a LM317K and one resistor, is described here http://www.roboternetz.de/phpBB2/konstantstrom.php.

Would you agree on either of these, is there a more straightforward solution?

TIA, Pat

Grumpy_Mike

Quote
One way could be using two standard 5V regulator circuits (one circuit for one light barrier) based on a 78m05 and three capacitors, which should regulate the 12V (object detected) down to 5V.

This is a classic beginners mistake. Do not use voltage regulators for signal voltage level translation.

Simply use two resistors in a potential divider to get the 12V down to 5V.

retrolefty

Regulators are used to power circuits not for voltage translation of signal lines, the regulator would most likely try and draw too much current from your signal source. What you can use is a simple two series wired resistor voltage divider, where the 12vdc signal wires to the top resistor the bottom resistor wires to ground of both the signal source and the arduino. The junction of the resistors would wire to a arduino digital input pin. a 10k ohm top resistor and a 5k ohm bottom resistor would result in a 4vdc signal avalible at the junction of the resistors suitable to wire to the arduino.

Lefty


patrick

#3
Mar 11, 2012, 11:09 pm Last Edit: Mar 11, 2012, 11:12 pm by patrick Reason: 1
Mike, Lefty, thanks for your swift answers.
I'm glad to read that the solution is by far simpler than I thought. Lefty, are 4V (as opposed to 5V) enough to provide a stable digital high on the pins? Would you advise to apply a 10k? pull-down resistor as recommended

when using the potential divider?

Best, Pat

retrolefty

No pull-down resistor required, the voltage divider is also acting as a pull-down as the lower resistor is wired to ground and is why the arduino ground must wire to the divider and signal source's ground. As far as what a legal HIGH voltage is the AVR data sheet says minimum voltage for a HIGH is .7 X Vcc, so with an arduino 5volt board the value is 3.5vdc to 5.5vdc.

Lefty


Go Up