Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« on: March 11, 2012, 12:20:46 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #1 on: March 11, 2012, 12:30:05 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #2 on: March 11, 2012, 12:31:13 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« Reply #3 on: March 11, 2012, 05:09:50 pm » |
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
|
|
|
|
« Last Edit: March 11, 2012, 05:12:12 pm by patrick »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #4 on: March 11, 2012, 05:16:09 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« Reply #5 on: March 11, 2012, 05:22:31 pm » |
This may be the first time, things get less complicated, the more I learn about them  Thank you Lefty, for helping me out on this matter!
|
|
|
|
|
Logged
|
|
|
|
|
Australia
Offline
Sr. Member
Karma: 7
Posts: 317
Arduino rocks
|
 |
« Reply #6 on: March 11, 2012, 07:22:10 pm » |
There is a good diagram of the wiring at the start of this post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288614795 You would use a digital pin on the Arduino rather than an analogue one. You would probably need to change the value of the resistors.
|
|
|
|
|
Logged
|
|
|
|
|
Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« Reply #7 on: March 12, 2012, 04:01:12 am » |
Thanks for the diagram lemming, but using an analogue pin here never was a subject to my case.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 73
Posts: 6631
Arduino rocks
|
 |
« Reply #8 on: March 12, 2012, 06:18:17 am » |
Yes, that's why he said "You would use a digital pin on the Arduino rather than an analogue one."
Electrons behave the same for analog and digital pins!
|
|
|
|
|
Logged
|
|
|
|
|
Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« Reply #9 on: March 12, 2012, 06:31:57 am » |
You're right. I wasn't looking close enough on the Terminals of the Arduino.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 73
Posts: 6631
Arduino rocks
|
 |
« Reply #10 on: March 12, 2012, 01:48:40 pm » |
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
Actually for the supply voltages used in Arduinos the input thresholds are 0.3Vdd and 0.6Vdd (ie 1.5V and 3.0V for a 5V supply). In particular 3.3V will reliably be recognised as high. These values apply to normal I/O pins (not Xtal or Reset) and only if the supply is 2.4V or greater.
|
|
|
|
|
Logged
|
|
|
|
|
Frankfurt am Main
Offline
Newbie
Karma: 0
Posts: 26
|
 |
« Reply #11 on: March 12, 2012, 05:26:58 pm » |
Good to know! Can this be found on the Arduino playground? If not, it should be pinned here or elsewhere.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #12 on: March 12, 2012, 05:34:50 pm » |
Good to know! Can this be found on the Arduino playground? If not, it should be pinned here or elsewhere.
These specifications (along with many many more) are from the AVR datasheet for a 328p chip, of which every Arduino user should download a copy to have avalible at all times. http://www.atmel.com/Images/doc8025.pdfLefty
|
|
|
|
|
Logged
|
|
|
|
|
|