0
votes

I'm trying to read the system voltage, adc.readvdd33() always returns 65535.

This is the code I'm using, obviously just like in the docs:

if (adc.force_init_mode(adc.INIT_VDD33)) then
  node.restart()
  return
end
print("System voltage (mV):", adc.readvdd33(0))

Output:

NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
    branch: master
    commit: 310faf7fcc9130a296f7f17021d48c6d717f5fb6
    release: 3.0-master_20190907
    release DTS: 201909070945
    SSL: true
    build type: float
    LFS: 0x0
    modules: adc,bme280,dht,enduser_setup,file,gpio,i2c,mqtt,net,node,rtcmem,rtctime,sjson,sntp,tmr,uart,wifi,tls
 build 2020-01-03 12:07 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
System voltage (mV):    65535

I've read about an issue with this in older SDK versions, is this something similar or what am I doing wrong? It's the same with an ESP01, an ESP01S and an ESP12F. Is there a limitation using adc with other packages or having something wired to a specific pin?

1

1 Answers

2
votes

Unfortunately this is a known bug. We're tracking it in issue 2925, see https://github.com/nodemcu/nodemcu-firmware/issues/2925 for details.