# toggle 12v as high and 11v as low for arduino

a little diff question, have googled to get clues but apparently I don't know what exactly to seats for.

Im trying to turn on a led with arduino when a external source triggers 12v. basically that ext source swaps between 12v when active and 11v when inactive. I hoped for that 11v to be 0v so I could use transistor or relay with arduino but unfortunately the low state on external device is 11v.

how can I check with arduino when the ext source is at 11v and how do I tell arduino that this is the low state. I just want to light up a led with arduino whenever the ext source is 12v and kill the led light when it's 11v. I tried with 2 1M resistors on that 11v but I got it down to 9v and I don't like the idea of chaining resistors.

is there any other possible components that I could use for this purpose ?

• but does the arduino analog handle 11-12v ? I'd assume it doesn't :/ – Deko Sep 14 '15 at 11:26
• A couple of resistors wired as a potential divider should bring the voltage into range. – HandyHowie Sep 14 '15 at 12:04
• I had no success with 1M resistor didtnt even get supply down below 12v :S – Deko Sep 14 '15 at 12:08
• One resistor wont do what you want see - en.wikipedia.org/wiki/Voltage_divider – HandyHowie Sep 14 '15 at 12:12

The part you're looking for is a comparator. Set a threshold with resistors at 11.5 volts. The arduino is not required here, but could still be used if additional behavior is desired. simulate this circuit – Schematic created using CircuitLab

Alternatives:

• There is probably a diode-based option, but the comparator will be simpler.
• As mentioned by others, you can use a resistor divider into an A/D and then do the threshold logic in software.
• which comparator would be suitable for me ? – Deko Sep 14 '15 at 11:13
• What voltages do you have handy? – Houston Fortney Sep 14 '15 at 11:14
• arduino runs on 5v and the external device is 13.8v Max and I assume somewhere around (Max) 5-10amp... is the turning signal light that I what to get that signal from into arduino – Deko Sep 14 '15 at 11:28
• @DanelK When the external device is running at 13.8 volts is the "operating good" output at 12V or 13.8 volts? – Andy aka Sep 14 '15 at 11:48
• @DanelK would you like to eliminate the arduino from the design if possible? – Houston Fortney Sep 14 '15 at 11:49

Use a voltage divider and sense the voltage state using and analog to digital converter. If your paranoid place a 5.1v zener diode on the pin to protect it just in case. Also remember that sampling does take some current. The current is minuscule but it does limit the maximum value of the divider.  simulate this circuit – Schematic created using CircuitLab

Use the above voltage divider schematics,,you should now be able to map 11v and 12v to some analog values in arduino,,you will have to do R&D with code to pull this off

Vr2=(Vin*R2)/(R1+R2)

Vr2=(12*10000)/(10000+100000)=1.0909V

Vr1=(Vin*R1)/(R1+R2)

Vr1=(12*100000)/(10000+100000)=10.909

hope this helps

• correct me if I get this wrong, the 100k R reduces the +ve (12v) down to 10v... but arduino analog can handle Max 5V ? – Deko Sep 15 '15 at 23:52