Unfortunately I don't quite understand the math behind the voltage divider. My question is this: I want to use the circuit provided by user Nick Gammon in the third post however My power supply is 12V 2.5 Amps instead of 12V 0.5Amps. Would I need to change the resistor values to avoid damaging my arduino? I would be happy if someone told me what resistor values I need instead, but I would be even happier if I could also get a more thorough explanation of how this works and how to calculate it in the future. I tried googling "voltage divider" but I didn't quite understand the explanations. Thanks in advance.
Yes. I think It is more clear now.
vout = 10K/(10K + 20K) * 5V = 1.66666V
vout = 10K/(10K + 20K) * 12V = 4V
However I think I must have misunderstood something about how the switching works and which powersource is the default because the voltage is always around 1.3V with both the USB and the external power plugged in. When I unplug the USB so it is just running on the external power the LED light I have set to switch when A0 reads more then 1.8V never comes on.
Just to clarify I am using the Vin pin on the arduino to take the measurements.
OK. I figured this out. Everything worked perfectly I just made a total noob mistake and had the wire hooked to pin 2 instead of pinA2. Thanks for all your help.
Let's hope you never actually run from mains AC power though..... 8)
My power supply is 12V 2.5 Amps instead of 12V 0.5Amps
Since things only draw the current they need, using a 2.5A supply rather than 0.5A, just means you spent more money than necessary and have one that's over spec'd.
A while ago I coudn't find a supply to test a 12V computer fan, so I opened the car bonnet (or hood, depending where you live) and stuck the wires on the battery. Fan needs under an amp, a car battery can supply two orders of magnitude more than that. No harm done....