I'm using voltage division to read the voltage of a 12 volt battery. This gives me a voltage between 3 and 4 volts to an analog pin. But I'm running out of analog pins.
I'd like to use a digital pin instead to trigger at say 3.7 volts.
Is there a way to set this level using say resistors in combination with the internal pullup resistor?
If it is 0.6 x supply voltage and the supply voltage is 5 volt, does this mean that if the input voltage is 2 volt, it will not trigger, but if it is 4, it will?
Then, I can adjust my voltage division to suit this level.
I'm monitoring the state of charge of a battery in a rough and simple way.
If the voltage is too low, i'd like to trigger a digital pin to low.
If the voltage is high enough, i.e fully charged, i could trigger another pin (or perhaps even the same pin) to high.
For my battery this means 11 volt as empty and perhaps 14 volt as fully charged
Based on the above, by having a suitable voltage division, I could match these levels to the digital input pins, so they reach the trigger levels.
If going to high is 0.6x5, i would voltage divide so that 14 volts means 3 volts over the pin.
Going to low I understand is at another level 0.4x5 or so, so this means another division.
Hope this could work, because it would be really simple to implement, using only resistors.