As the title says... Chat on...

User avatar
By guttso
#35843 I use a LM35 sensor, wired it with 5V power and I got 0.23 Vout. It's correct with my room temp( 10mV per Celsius temp). But when I wire pin out with ADC pin of esp7 and call print(adc.read(0)), console print out 167. I cannot find relationship between 0.23V and result 167 of adc.read. I found some article said that ESP's ADC have range 0 ~ 1V input, in this case adc.read should return 0.23*1024 = 235.
By the way, is there any reason cause adc.read alway return 65535?
Thank you for any support in advance :)
User avatar
By guttso
#36047 Modify app/include/user_config.h and adc.read will work properly
Code: Select all// Byte 107 of esp_init_data_default, only one of these 3 can be picked
//#define ESP_INIT_DATA_ENABLE_READVDD33
#define ESP_INIT_DATA_ENABLE_READADC
//#define ESP_INIT_DATA_FIXED_VDD33_VALUE 33
User avatar
By blavery
#44048 Oh dear what a debacle. All I want to do is to use a frightanic.com custom build, and then read the adc.read(0) function.
Here is my solution, but I need to patch one byte in the frightanic binary each time I get a fresh build:

http://www.blavery.com/iot/misc/readadc.pdf

Hope that helps some.
Brian
User avatar
By xraynaud
#44203 Dear brian, Thanks for your doc. I'm trying to make adc.read work again, and followed your doc. However, it doesn't work, and I'm not completely sure why. I have modified a byte set to FF (underlined) after the second RNJD@8:
52 4E 4A 44 40 38 00 00 01 01 02 03 04 05 01 00
00 00 00 00 02 00 00 00 00 00 00 00 00 00 E1 0A
00 00 00 00 00 00 00 00 01 93 43 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 52
52 4F

Is this the correct byte ?
Once the bin file patched, I uploaded the new firmware using esptools.py with the command
Code: Select allpython ./esptool.py --port /dev/tty.SLAB_USBtoUART --baud 115200  write_flash -fm=dio -fs=32m 0x00000 nodemcu-master-11-modules-2016-03-28-13-48-40-float-adcread.bin

However, adc.read(0) still returns 65535. Am I missing something ?
Thanks for your help.