-->
Page 1 of 9

ADC ??

PostPosted: Wed Dec 10, 2014 2:35 am
by RogerClark
Can anyone tell me the current status of ADC ??

As far as I can gather, the esp8266 has and ADC that can measure between 0V and 1V with 10 bit resolution, however there are problems because the ADC can't be read when the device is transmitting, as it seems to read 1024 decimal at this time

I've looked in the SDK docs and there doesnt seem to be an API for the ADC, so I presume that it needs to be implemented by code in the driver folder.

I think the IoT example may have this code, though I have not managed to totally track it down.

ADC seems to be via pin TOUT on the esp8266, but this pin on the chip doesn't seem to be connected to a pin on the outside of the board on any of the modules including the ESP-07 (as far as I can tell)
I have several ESP-03's and I know TOUT is not connected to a pin on my module. So I presume that if I want to use ADC that I'm going to need to solder directly onto the chip.

If anyone could confirm or elaborate on any of the above, that would be fantastic ;-)

Re: ADC ??

PostPosted: Wed Dec 10, 2014 4:47 am
by igrr
IIRC, SDK 0.9.3 has a system_adc_read() function that takes care of issues related to WiFi.

Re: ADC ??

PostPosted: Wed Dec 10, 2014 5:25 am
by RogerClark
Thanks

I had already written some test code using that and was getting random values around 70

e.g. in my timer function

myTimer(void *arg)
{
uint8_t buffer[16];
uint16 adc = system_adc_read();
ets_sprintf( buffer, "%d\r\n", adc );
uart0_sendStr(buffer);
}

BTW
Are there docs for 0.9.3 or are you doing the same as me, looking in the headers and the assembler code ?

Re: ADC ??

PostPosted: Wed Dec 10, 2014 5:34 am
by uhrheber
ESP-12 has the tout signal connected to a module pin.
If you want something more convenient, there's a cheap development kit for the ESP-12 available:
http://www.aliexpress.com/item/ESP8266- ... 33472.html

I made my own breadboard adapter for an ESP-04, and soldered a wire directly to the tout pin of the ESP:
viewtopic.php?f=13&t=644&p=3461#p3461