I’m powering one of my projects from 3 x AA batteries connected to the Vin , which shouldn’t be a problem, because my 3 batteries only add up to about 4.7 volt maximum.
I`ve set up a voltage divider from two 1 k resistors , which gives me a reasonable indication of battery state.
a/ What is a safe low voltage for Vin and what happens below that ?.
b/ If I connect a analog pin to 3.3 volt . which should just a result of 4090-+ , can I use that to say my batteries are getting flat ? eg below 3.3 volts
@peter_a, the Photon power specs are in the documents, here. Basically, 3.6v is the lowest voltage at which the onboard buck regulator can produce the necessary 3.3v.
Using an analog pin to measure the 3.3v would work great except that the STM32 processor used in the Photon uses the 3.3v supply as it reference, making measurements unreliable. You could, however, measure the battery voltage using a voltage divider. You could trigger a deep sleep mode when the battery voltage drops below 3.7v for example (again, through a voltage divider). There is another recent topic with this exact problem and solution if you do a search!
@peekay123 3.6 volts minimum that sound about right , I tried a test with the sparkfun battery shield and when the battery fell down 3.60 volts I start to get some strange results.
My device is in deep sleep most of time, but want to know the battery state , it the end I`ve fitting an external adc ,
which in the end will use less current than the voltage divider.
So I now monitor the battery with a accuracy drop to .001 volts .
Regarding your potential divider, your batteries will last a lot longer if you increase the value of the two resistors so that the current drain is less. I seem to get perfectly useable measurements with 50k or 100k resistors - you might need a small capacitor (say 0.1uF, usually labeled 104) between the analog pin and ground. Bear in mind that because of the uncertainty in the resistor values the accuracy is going to be poor but the repeatability good.
You can further reduce the rate of drain by using a data pin instead of ground - there is quite a long discussion here:
With 50k resistors your current drain will be 40uA through the divider.
With 1k resistors I was getting random results , but never tried a capacitor to ground.
This is a snip showing my battery voltage for the last 24 hrs or so - the blue line. The red line is WiFi signal strength. It serves its purpose. I’ve used 100k resistors here. Up until a few days ago I was running it as a 3 AA cell system. I’m comparing the two options to see which extracts most energy from a pair of 5v 50mA solar cells in poor light.