Basically what I am asking is, what are the voltage thresholds? For my project, I need a +12VDC signal to = HIGH, and I need +.350VDC to = LOW. Will the arduino recognize .350V as LOW by default? If not, how would I program it to recognize this voltage as LOW? Thank you!
From the TTL wikipedia page:
A TTL input signal is defined as "low" when between 0 V and 0.8 V with respect to the ground terminal, and "high" when between 2.2 V and 5 V
You're going to need to condition your signal so that it falls in the 0-5V range. A voltage divider would do the job.
Thank you! Excellent info.
Do you mean that you have an external device outputting 12V as HIGH and 0.35V as LOW, and you want to read that with a digital pin?
Arduino treats voltages 3V to Vcc as HIGH. Vcc is around 5V. Anything below 3V is considered LOW by digital pins.
dmc0162:
For my project, I need a +12VDC signal to = HIGH
Arduino cannot handle 12V, as most Arduinos operate at 5V. If you have a 12V input as HIGH, you can use a voltage divider with 3 resistors of the same value:
[Vin] [GND]
| |
| |
[R] ---- [R] ---- [R]
|
|
[Digital Pin]
Or with 2 resistors. One resistor must have twice the resistance of the other:
[Vin] [GND]
| |
| |
[R] ---- [2R]
|
|
[Digital Pin]
Both methods are very similar. Formula for calculating the Vout (digital pin): Vout = R1 / (R1 + R2) * Vin. R2 is nearest to GND.
When your input is HIGH (12V), there will be 4V at the digital pin. The Arduino will read that as HIGH. When your input is LOW (0.35V), there will be 0.0875V at the digital pin. The Arduino will read that as LOW.
Thank you, I appreciate your response. What value resistors should I use?
dmc0162:
What value resistors should I use?
I would use three 10K ohm resistors. But it doesn't matter. Use larger values to waste less power, because the circuit will draw more current if the resistor values are low.
Thanks again! One more question, do you think it would be wise to put a diode between my 12v/.350v signal source, and my arduino/voltage divider circuit? Or would it not really matter?
dmc0162:
One more question, do you think it would be wise to put a diode between my 12v/.350v signal source, and my arduino/voltage divider circuit? Or would it not really matter?
Why do you need that diode? Can you show a schematic with the diode?