Connect 14v device to arduino analog pins

Hi this have to do with a post i had wrongly posted in software session.
i have a 13V/14V power source that i want to monitor to see if its on or off..
I can make a voltage divider with 10k+1k Resistor i did it for other project where i need to check voltage levels....
But here i will only have 13v or 0v i was thinking on using a voltage regulator lm7805... to drop the 13v to 5...

Suggestions, what's the best solution, resistors and voltage divider or the voltage regulator ?

No load will pass i only want to check on/off 13v on 0v off...

regards.

Hi, im adding gsm comunication to a home alarme system.
The alarm System as a contact that i will use to see if its triggered, that on normal state gives you 13v and when alarm is triggered it opens the circuit giving 0v....
so my soft will do

loop
if analogread4>0 then no alarm
if analogread0<=0 then alarm on

i already have it on testes with 5v source to simulate and is working...
thanks

i already have it on testes with 5v source

Whatever floats your boat ::slight_smile:

but 5v its a simulation i need to bring the 14v down to arduino 5v limits.

but 5v its a simulation i need to bring the 14v down to arduino 5v limits.

Putting testes in the circuit won't produce the desired results.

PaulS, dont understand what you mean, but testing with 5v let me test all the rest, all the software logic the sms send et etc, when i have this ready then only the physical connect is missing...

richard can you make draw... i connect the 13v positive to arduino digital pin with a 20k resistor the negative/ground to the arduino ground ?
then how will be te code ?
to read the status ? 13v in means high and 0 volts LOW ?
with the resister i will have how many volts arriving at arduino pin ?

regards

oh boy ...

testes n . The reproductive gland in a male vertebrate

Given the ATmega328 spec doesn't characterize the maximum current through the input protection diodes, and that digital pins have programmable pull-ups internally, I'm not sure the single resistor idea is best:

Beware than if the internal pull-ups are active then when the 13V supply is off the digital pin might still read as a 1.

One can disable the pull up with a digitalWrite (pin, 0) - When a pin is an input a digitalWrite() controls the internal pull-up.

I think it is better to use a resistive divider so that the input diodes are not relied on and there is a stronger pull-down when the supply is off. Perhaps a divider of 10k and 4k7 (divide by about 3). When the supply is off this acts as about 3k of pull-down which should overpower the internal pull up for a digital input.

The resistive divider also works with analog pins of course, should you want to measure the voltage too.