Dual voltage 9 and 12 volt nominal input

I'm a newby to electronics.

I have an Arduino Leostick that I need to be able to trigger off both 9 and 12 volt nominal from batteries. The 9 volt battery currently gives 9.3 Volts but that voltage may drop over time. I have no way of knowing what the real voltage from the 12 Volt battery is, it could be giving 12.6 or even 13.5 volts or more for all I know, it's the size of a car battery. The Leostick must NOT trigger at 3.4 volt input, or anywhere near that voltage.

Which resistors are suitable for a voltage divider? Should I be using analog or digital input?

What happens to an Arduino if the input is, say, 5.3 volts on an analog input for a period of no more than 10 seconds? Would it register as 0.3 volts or 5 volts or fry the circuits? Does the digital input switch from LOW to HIGH at 2.5 V?

How are you powering the leo? It has a usb pcb shaped plug which requires 5v...

First step down the voltage via a regulator, switching or 7805, power the leo with that. Secondly, a voltage divider to knock down the max potential voltage (15v) to 4.5v

Are electrical circuits usually designed for nominal battery voltage or actual battery voltage? It’s annoying that voltages depend strongly on load.

How are you powering the leo? It has a usb pcb shaped plug which requires 5v…

Powered 9V through VIN. That’s not the problem, according to websites VIN takes anywhere from 6 to 12 volts, 9 volts works fine.

Secondly, a voltage divider to knock down the max potential voltage (15v) to 4.5v

I was going to use a 150K and 100K voltage divider to knock 12 volts nominal down to 4.8 V but don’t know if that is safe for analog input. Then if I use an Arduino cut-off of 3.2 V (analog read 655) that translates back up to 8 V input, which is for the 9 volt nominal battery plus an allowance for voltage loss, and well above the false input of 3.4 volt. Would that be OK?

mollwollfumble: I was going to use a 150K and 100K voltage divider to knock 12 volts nominal down to 4.8 V but don't know if that is safe for analog input.

More than safe. The values may be a little high as the analog input has an effective impedance of something like 10k, but most of that is capacitive. Try it out, but you may need to use some trickery such as taking one reading, discarding it, waiting a number of milliseconds for it to re-stabilise as the internal multiplexer is now definitely switched to that input, and then taking your definitive reading.

I don't follow the rest of your description but it sounds plausible.

Paul__B:

mollwollfumble:
I was going to use a 150K and 100K voltage divider to knock 12 volts nominal down to 4.8 V but don’t know if that is safe for analog input.

More than safe. The values may be a little high as the analog input has an effective impedance of something like 10k, but most of that is capacitive. Try it out, but you may need to use some trickery such as taking one reading, discarding it, waiting a number of milliseconds for it to re-stabilise as the internal multiplexer is now definitely switched to that input, and then taking your definitive reading.

I don’t follow the rest of your description but it sounds plausible.

The analog inputs require 10k or less impedance to drive them to full accuracy, but that’s easy to
achieve, just add 100nF capacitor between the analog pin and ground. Or take two successive
readings (the time constants involved are measured in microseconds, not milliseconds, no
delay needed).

I was going to use a 150K and 100K voltage divider to knock 12 volts nominal down to 4.8 V but don't know if that is safe for analog input.

Safe, but won't work. The values are too high. Use 10K max total. About 6K and 4K for 4.8v to the analog input.

take two successive
readings (the time constants involved are measured in microseconds, not milliseconds, no
delay needed).

Safe, but won’t work. The values are too high.
Use 10K max total. About 6K and 4K for 4.8v to the analog input.

Thanks all, will do.
Just starting to read book “Arduino Internals” and note that the 5 volts has a tolerance of ±5% which gives 4.75 to 5.25 volts. But the chip won’t actually fail until 5.5 Volts. That means no failure unless the 12 Volt car battery is outputting 13.75 volts or more, which is very unlikely, fingers crossed.

That means no failure unless the 12 Volt car battery is outputting 13.75 volts or more, which is very unlikely,

Have you actually measured that when the car is running. Yes that voltage will be exceeded every time.

Which resistors are suitable for a voltage divider?

You do not mean for powering that board do you? If so you do not power anything from a resistive divider, you use a voltage regulator.

What do you mean by trigger?

Powered 9V through VIN. That's not the problem, according to websites VIN takes anywhere from 6 to 12 volts, 9 volts works fine.

I just downloaded the schematics and I can't see a Vin pin nor a voltage regulator?

according to websites VIN takes anywhere from 6 to 12 volts, 9 volts works fine.

Well according to this thread:- http://forum.freetronics.com/viewtopic.php?f=27&t=5844&sid=328ccd1f3443b3ab76c88ca7aa213b08

Quick note for anyone else reading this: even though the LeoStick pin is marked "VIN" it can only accept 5V input. Don't connect a higher voltage here!