Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By tytower
#19199 Hmm I'm going to have to solder another chip up and have a look at that . I just found out that the ADC pin can only read to 1V not 3.3V like 3.3V arduinos. See the chart in the wiki under pin allocations and here on the forum http://www.esp8266.com/posting.php?mode=edit&f=15&p=19197
User avatar
By tytower
#19421 Nothing connected using torntrousers program above

Vdd: 4.09
Vdd: 4.09
Vdd: 4.09
This is directly from the ftdi power supply which is 3.3 V. So thats .8 of a volt high at least(EDIT turned out to be 4.76V Yikes 3 chips all powered with this have not blown up and work well?))

Nothing connected using gr0b's program
VCC:4094
Battery:4694
(he added 600 to it

So I don't think you have it fellas . maybe you could fudge it by reducing the output by 800 , .8 of a volt but what makes you think this is a valid reading of the running voltage?
Last edited by tytower on Thu Jun 04, 2015 3:58 pm, edited 1 time in total.
User avatar
By torntrousers
#19440
tytower wrote:Nothing connected using torntrousers program above

Vdd: 4.09
Vdd: 4.09
Vdd: 4.09
This is directly from the ftdi power supply which is 3.3 V. So thats .8 of a volt high at least

Nothing connected using gr0b's program
VCC:4094
Battery:4694
(he added 600 to it

So I don't think you have it fellas . maybe you could fudge it by reducing the output by 800 , .8 of a volt but what makes you think this is a valid reading of the running voltage?


The testing i've done with a multimeter connected while running readvdd33 have it accurate to about a tenth of a volt. Thats been on several different types of ESP. The readvdd33 value seems like it can only go as high as 4094 though, so running with a voltage higher than that will still just return 4.09 volts. Maybe you need to check your ftdi output voltage?
User avatar
By tytower
#19474 Jeeze I just double checked and I have been running all mine with 4.76 Volts . OOps Thanks hey.

Added a couple of diodes and some resistors on the RX and TX lines and all good

Shows 3655 now and that agrees with multimeter
Changed the code a bit to put decimal points in
Code: Select all//used samples from http://www.esp8266.com/viewtopic.php?f=33&t=2485
//Use a silicone diode to drop the voltage from the Lithium battery to within a safe range for the ESP module (should be between 2.5-3.6v)
//readvdd33() does not return correct values if anything is connect to the ADC pin

extern "C" {
uint16 readvdd33(void);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println();
 
}


void loop() {
  float value=readvdd33();
 
  Serial.print("Vcc:");
  Serial.println(value/1000);
 
 
  Serial.print("Battery:");
  Serial.println(value/1000 + 1.2);  //drop from 2diodes back to give us an idea of the battery voltage
  Serial.println();
 
  delay(5000);
 
}