-->
Page 1 of 2

ADC module always returning 1024

PostPosted: Sat Jan 10, 2015 2:47 pm
by Fr4gg0r
Can someone confirm if the adc module works in the latest firmware?
I always get 1024. I also added a 10nF capacitor but it did not help.

Re: ADC module always returning 1024

PostPosted: Sat Jan 10, 2015 4:24 pm
by jankop
Code: Select allNodeMCU 0.9.5 build 20150107  powered by Lua 5.1.4
> =adc.read(0)
70
> =adc.read(0)
177
> =adc.read(0)
170
> =adc.read(0)
59
>


Pin TOUT is floating here.

Re: ADC module always returning 1024

PostPosted: Sat Jan 10, 2015 4:38 pm
by Fr4gg0r
For a floating adc pin I also get random values.
However, when I apply a voltage around 0.5V I get 1024..

That is odd. I checked the voltage with my multimeter and it is < 1V.

Re: ADC module always returning 1024

PostPosted: Wed Jan 14, 2015 7:09 am
by gwizz
I just checked my olimex breakout board and ADC function worked fine - I read 516 for 0.50V and ~1000 for ~1V.

Just for reference,
Code: Select allcount = 0
repeat
  count = count + 1
  print(adc.read(0))
  tmr.delay(10000)
  tmr.wdclr()
until(count > 1000)