Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By RogerClark
#4476 I just tried to wire onto my chip on my ESP-03

but I'm not sure if its actually attached


it appears to be attached

but I'm not seeing any useful readings using system_adc_read();

Is there something I need to initialize before calling system_adc_read(); ???

Or perhaps I have not made a good contact to the pin (aka a dry joint) :-(

Edit. I just looked in the sdk and I can't see anything else with _adc in its name, so perhaps it doesnt need to be initialized

Interestingly in the assembler code, its clear that its putting the device into low_power mode etc

40217bdd: fbe1f1 l32r a15, 40216b64 <ram_pbus_set_rxgain+0xc8>
40217be0: e508c1 l32r a12, 40211000 <_irom0_text_start>
40217be3: fff601 l32r a0, 40217bbc <low_power_set+0x4c>
40217be6: e589e1 l32r a14, 4021120c <read_macaddr_from_otp+0x200>

and later
40217c4a: ffde31 l32r a3, 40217bc4 <low_power_set+0x54>


Does anyone know if this pin actually reads voltages, there has been some speculation on the forum that it doesn't read voltages but reads PWM related to voltages.

i.e I have attached a 10k potentiometer (pot) between 3.3V and GND and connected the wiper to the TOUT pin but I still just get random values e.g.

75
76
76
74
113
77
77
76
76
77
77
77
91
76
77
77
77
76
77
77
75
100
78
78
78
User avatar
By uhrheber
#4488 The Lua firmware has ADC support, you might want to try that.
I didn't actually apply a voltage to the ADC, but when I connect it to ground it reads back zero.
I'll try it later.
User avatar
By gerardwr
#4498 Testrun printing ADC value every second, in Lua. NO input applied to TOUT (I have no wire on my ESP-01 TOUT pin).
> tmr.alarm(1,1000,1,function() print(adc.read(0)) end)
> 371
372
372
402
401
402
372
371
372
402
401
402
370
402
371
371
372
371
371
User avatar
By uhrheber
#4521 So I made some real measurements, using a Labjack U12 (USB measurement box) as a voltage source for the ESP8266's ADC.
The result looks good.
A little bit of noise, although I used a 10nF capacitor at the ADC input, but nothing serious. Also, a breadboard with air wires isn't an ideal measurement environment, and a notebook's USB port not an ideal power supply.
The ADC is pretty linear, except at the beginning and the end (which is normal), also it has some threshold at low voltages.
The ADC's reference voltage isn't really 1V, it's more like 1.06V. But that may vary between several chips.
The first column shows the ADC's input voltage, the second one the minimum ADC reading, the third one the maximum, and the fourth one the (calculated) mean value.
I'd say, it's not the best ADC that I've seen, but it's usable.

Wireless voltmeter, anybody?

ESSP8266_ADC.png
You do not have the required permissions to view the files attached to this post.