Here is the situation, I’m using a 3.7V battery to energize the photon, I want to know the battery level using the ADC, if the supply input voltage is lower than 3.3V, the internal ADC reference voltage also decreases or it will be 3.3V? I mean if the power supply intput is 1.65V the internal ADC Reference voltage is 1.65V??
Sounds correct. The ADC reference voltage is the same as the Vdd…
Wow, this has had me scratching my head all day today. It doesn’t make sense to me as to why the reference voltage tracks the supply voltage. I mean I can understand why that is, but it makes it very difficult to work with ADC in that case.
Seeing that I’m using the 3V3 pin, it makes it impossible to use the ADC features correctly. I feel this should be documented if that is in fact the case. That is the voltage at the 3V3 pin is used as the Reference voltage for ADC.
@shiv, the STM32 does not have an internal reference voltage source like Arduinos. In order to limit parts count (I suspect), Particle chose to connect Vref (external) to Vdd. I agree that this is not very accurate and a proper external voltage reference would be ideal. Take a look at this app note as it might help.
Thanks for the application note @peekay123 Interesting read for sure.
so if i am using lm35 with photon adc( photon is powered in VIN pin)will it give false value? actually i am getting fale values at last half hour of battery.when it is fully charged everything is perfect.at last points it will give wrong values
@anas, the lm35 is designed to operate from 4v to 30v. As your battery drops below 4v, the lm35 will no longer be in its operating range.