So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By james.willetts
#80566 Hi All can you help? when I read the ADC pin on all of my ESP8266 8 pin boards I get a reading of 36 to 40 regardless of the input voltage on gpio 0
I have re uploaded the firmware numerous times including using modeMCU custom build by frightanic.com and still get the same results I've tried a different batch of chips in case the ones I have are bum. I'm at ripping my hair out point! I have tried the following code.

-- in you init.lua:
if adc.force_init_mode(adc.INIT_ADC)
then
node.restart()
return -- don't bother continuing, the restart is scheduled
end


print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))
print("System voltage (mV):", adc.read(0))

Answer:
System voltage (mV): 36
System voltage (mV): 36
System voltage (mV): 36
System voltage (mV): 36
System voltage (mV): 36

If I change to
-- in you init.lua:
if adc.force_init_mode(adc.INIT_vdd33)
then
node.restart()
return -- don't bother continuing, the restart is scheduled
end
print("System voltage (mV):", adc.readvdd33(0))
print("System voltage (mV):", adc.readvdd33(0))
print("System voltage (mV):", adc.readvdd33(0))

Answer:
System voltage (mV): 3423
System voltage (mV): 3420
System voltage (mV): 3418

I've tried;
Rebooting then trying a read adc
new chips
adding a 2 amp 3.3 volt psu
all joints are soldered so no bread board faults
Has anyone had this before?

Any help much appreciated
User avatar
By schufti
#80582 there is only one analog input on nodemcu and it is definitely not D0 or gpio0.
It is the pin marked A0 (see bottom right corner on attached picture)
You do not have the required permissions to view the files attached to this post.
User avatar
By james.willetts
#80632
schufti wrote:there is only one analog input on nodemcu and it is definitely not D0 or gpio0.
It is the pin marked A0 (see bottom right corner on attached picture)


Thank you, It was a bit confusing in the mode MCU documentation it was saying read 0 which i had confused gpio0 with ADC 0. I am using the 8 pin board with only gpio 0 and gpio 1 available hence why i didn't see the ADC pin. I have a pin out of the IC and have added a wire to the ADC pin and all is well

Many thanks
James