ADC strange issue

leenowell
Posts: 9
Joined: Wed Feb 24, 2016 9:54 pm

ADC strange issue

Postby leenowell » Thu Feb 25, 2016 1:06 am

Hi All,

Firstly sorry if this appears as a duplicate. I posted it earlier but it seems to have disappeared....

I have an ESP12F which I am looking to use as a thermometer. The wiring is essentially

+3.35v ------ 400k resistor ------ (A)------ 100k thermistor ------- GND

With point (A) connected to the ADC pin and the power supplied by a ftd1232. Looking at the voltage across (A) and GND I get a steady approximately 0.726v (+/- 0.003) however when reading the ADC value using system_adc_read I get values varying from around 740 to 650 and sometimes over 800.

Anyone any idea what could be causing this level of variation?

thanks

Lee.

Espressif_Kelly
Posts: 140
Joined: Mon Oct 27, 2014 10:40 am

Re: ADC strange issue

Postby Espressif_Kelly » Fri Feb 26, 2016 5:18 pm

Hi,

Please help provide the following information.

1.SDK version

2.Reference Codes and Log Output

You can also send e-mail to our feedback@espressif.com for further communication.

Thanks.

Triacon
Posts: 7
Joined: Sun Apr 12, 2015 4:48 am

Re: ADC strange issue

Postby Triacon » Sat Feb 27, 2016 6:15 am

Hi Lee
My guess would be that your sensors resistance is to high and can't supply the ADC with the current needed during sampling to fully charge the sampling capacitor. Resistors of at least a factor 10 lower resistance should help. Other things that help is lowering the sample speed if possible as this gives the sampling capacitor longer time to charge (Not sure if that is possible or enough on the ESP8266). Or If you can have some pause between measurements you can add your own capacitor between GND and (A) and let it charge up and then start the ADC sampling (Don't forget to take into account that your effectively creating a low pass filter so mind the R to C ratio).
Good luck.
Kind regards
Jimmy

leenowell
Posts: 9
Joined: Wed Feb 24, 2016 9:54 pm

Re: ADC strange issue

Postby leenowell » Sat Feb 27, 2016 4:14 pm

Hi

As promised please find attached a tar with code, output and version number which exhibits the behaviour. There is a README.txt file which details the cut down test as well as version number (which I believe is 1.3.0_15_08_10p1).

@Jimmy - thanks very much for your reply. A couple of thoughts
1. in terms of the resistance, good thought. I will set up a new circuit with much smaller resistors and post the results. I will have to use fixed resistors though
2. Your capacitance point is interesting. I have a delay of 5 seconds between reads so think we should be fine? However, in my real situation I want to wake out of deep sleep, read temperature then send it to a server. Would I need to have a delay to ensure the ADC is charged?

thanks all for your help

Lee.
Attachments
leeplaytest.tar
(140 KiB) Downloaded 190 times

leenowell
Posts: 9
Joined: Wed Feb 24, 2016 9:54 pm

Re: ADC strange issue

Postby leenowell » Mon Feb 29, 2016 3:30 am

Hi All,

There is definitely something very strange going on. As you could see from the output I attached earlier, it keep randomly crashing with an exception. Following this test, I tried to do some further analysis by moving to remove the ardunio libs and only use the SDK. The board became completely bricked and would immediately crash on boot and keep doing this continuously.

I have now spent all weekend trying to get it up and running again. After a lot of trial and error, I managed to recover it by erasing the flash using esptool.py and then reloading new firmware posted by someone else who had the same problem. I then uploaded some code which simply printed out debug statements on setup and in the loop. This worked fine with no crash (only run for a minute or so). I then added one line which was to read the ADC, uploaded it and it went back into the bricked state.

Based on this and my initial experience, it seems that reading the ADC seems to corrupt the memory somehow. I have repeated my "fix" above (including removing the ADC read line) but unfortunately have not got it working again.

All very odd. Any thoughts/ test to perform to get to the bottom of this?

thanks

Lee

leenowell
Posts: 9
Joined: Wed Feb 24, 2016 9:54 pm

Re: ADC strange issue

Postby leenowell » Mon Feb 29, 2016 3:50 am

Sorry.... I forgot to mention the errors. When in the continual reboot cycle without executing any code I was mainly getting "exception (0)" but sometimes "exception (9)". After trying my "fix" on restart, I get the following output in the serial monitor (at 74880 baud)

Code: Select all

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
system param error
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


@Jimmy - I set up the test with much lower resistors as promised but unable to read ADC due to the above :(

thanks

Lee.

Espressif_Kelly
Posts: 140
Joined: Mon Oct 27, 2014 10:40 am

Re: ADC strange issue

Postby Espressif_Kelly » Mon Feb 29, 2016 3:24 pm

Hi,

Attached is the test bin files that based on our official SDK_V1.3.0.

We havn't reproduced your problems.

Please test again with the firmware that attached.

More informations, please let us know.

Thanks.
Attachments
bin download.rar
(139.03 KiB) Downloaded 176 times

leenowell
Posts: 9
Joined: Wed Feb 24, 2016 9:54 pm

Re: ADC strange issue

Postby leenowell » Mon Feb 29, 2016 4:22 pm

Thanks, I will try them tonight. I saw a couple of posts talking about a heap corruption issue (mainly relating to String) so wonder if this is related?

In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.

Triacon
Posts: 7
Joined: Sun Apr 12, 2015 4:48 am

Re: ADC strange issue

Postby Triacon » Wed Mar 02, 2016 5:51 am

Hi again Lee
What you could to to solve your problem with the high impedance voltage divider resistors is to use a ]voltage follower (See:https://en.wikipedia.org/wiki/Operational_amplifier_applications#Voltage_follower_.28unity_buffer_amplifier.29) . It's just one simple OP-amp, could be as small as an SOT23-5 . Make sure to use one that handles positive-only supply, has high input impedance,is unity-gain stable (And if needed low temperature coefficient and other parameters relevant to your design). A part that MIGHT work for your application (from what we've been told so far) is Micrchips MCP6031http://www.microchip.com/wwwproducts/en/MCP6031. That and a decoupling capacitor could be enough to solve your problem (If the chosen OP-amp doesn't handle capacitive loads well a 10-100 Ohms resistor in series with the OP-amp output is a good idea). Throw in a couple of more resistors and you can adjust the temperatur voltage divider to optimally match the 0-1 v input range of the ADC.

Kind regards
Jimmy



leenowell wrote:Thanks, I will try them tonight. I saw a couple of posts talking about a heap corruption issue (mainly relating to String) so wonder if this is related?

In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.

ESP_Alfred
Posts: 56
Joined: Mon Nov 10, 2014 7:31 pm

Re: ADC strange issue

Postby ESP_Alfred » Wed Mar 02, 2016 1:26 pm

leenowell wrote:Thanks, I will try them tonight. I saw a couple of posts talking about a heap corruption issue (mainly relating to String) so wonder if this is related?

In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.


hi, Lee
This is my test environment : +3.3v ------ 450k resistor ------ (A)------ 90k thermistor ------- GND
we test the point (A) without voltmeter, the value within the range of ±8. The attachment file is the original test data.

It might also be noted that the point (A) couldn't connect to other load include the voltmeter, if not ,the range of ADC value will become ±110. The attachment file is the original test data.

We have some other advice for your case:
1. May be add a capacitor between the pin ADC and GND.
2. Averaging the testing values of repeated measurements.
3. You could bring the chip into modem sleep mode, reference the API "wifi_fpm_do_sleep". then "system_adc_read".
Attachments
test1.xls
(23 KiB) Downloaded 241 times

Who is online

Users browsing this forum: No registered users and 1 guest