Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By gr0b
#18932 Hello, what is the best way to monitor the voltage feed to the ESP8266?

I have created a board that is powered by a lithium cell and instead of a regulator I am using a silicone diode to step the voltage down to a safe value instead of the regulator, This means my input voltage could be anything between about 2.6-3.6V.
I have also added a voltage divider and connected to the ADC pin and the battery but not sure how to best continue from there.

For ATMEGA328 chips I read the vcc by comparing with the internal 1.1v reference voltage then I use this when calculating the battery reading via the voltage divider.

For background the board is a ESP07 with a nRF24L01+ radio and USB charger and lithium protection and i2c to drive an OLED display. Picture attached below.
You do not have the required permissions to view the files attached to this post.
Last edited by gr0b on Tue Jun 02, 2015 1:08 am, edited 1 time in total.
User avatar
By tytower
#18978 While you wait for someone knowledgeable to answer this I'll just throw in my thoughts.

That battery voltage might be still too high to feed the chip and I would just throw another diode in series on it to be sure but ,
the data sheet puts the max at 3.6V and yours could go over perhaps ?

Reading the analog pin should be just the same as reading a pin on the arduino board I would have thought but I hav'nt seen any references to an internal reference voltage in my travels yet.

Maybe there is something herehttps://docs.google.com/file/d/0B9hyK_DA6VIiSWNRZ29sdG1UOVU/edit?pli=1 and maybe in the Wiki on your page now up at the top in black
User avatar
By gr0b
#19011 OK I think I have solved it.

I found some info on using readvdd33 here viewtopic.php?f=33&t=2485

For readvdd33 to work nothing can be connected to the ADC pin, calling Serial.println(readvdd33()>>2); would give the exact value as Serial.println(analogRead(A0)); so by removing the voltage divider from the ADC pin I now get results like 3479 which is looks to be off by about 5%.
For calculating the battery voltage I might have to add the voltage drop from the silicone diode to get a final result