NodeMCU ESP8266 / Problem with Analog input...

Discussion in 'Embedded Systems and Microcontrollers' started by Jesus_Reyes, Sep 8, 2017.

  1. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
    Hello everyone,

    I´m engineering student in electronic and I´m use the NodeMCU ESP8266 for a project. This embedded system is based on the ESP8266 microcontroller, and I know that I can programing it whit Arduino IDE, I download the libraries and I have already installed correctly it. So, It is already possible configured it, I have used this parameters:

    - Device: NodeMCU 1.0 (ESP-12E Module)

    - CPU Frequency: 80 MHz

    - Flash size: 4M (3M SPIFFS)

    - Upload speed: 115200 bps or 92600 bps


    And obviously I select the port in my case is the COM4. Then already I can program the NodeMCU for example with the “Blink” program and this is loaded completely and works correctly. Until there all works correctly. But the problem is when I try to program the only analog input that has. I used the example that is in the Arduino IDE, and It is assumed that I should see what has read the analog input in form of bit and it is correct, but if I put 3.3V in the analog input I should see on the monitor serial 1023 (or 1024) because the analog port of the NodeMCU works 0V to 3.3V so if I put 0V in the analog input I should see 0 and now if I put 3.3V also in the analog input I should see 1023 but this doesn’t happen, I don’t kwon why happen this. The only that I see is 4 or 6 when I put 0V and I see 980 when I put 3.3V. I thought that the problem was in the level of voltage so I tried put 5.0V in the analog input but didn´t work, the reading gave me 0.

    So guys, I don´t know why I have this problem, I think that the problem is on the analog port but I´m not sure because if I change the levels of voltage in the analog input you can see the different values that’s reading in the port. If any know how solved this problem please tell me.

    Thanks…
     
  2. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    You maybe killed your adc pin really need a link to witch nodeesp you have but it can't take 5 volts on that pin.
     
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,579
    725
    If you have the code, I can try it on my NodeMCU ESP8255 (ESP-12-E).

    I have tried the blink example and it worked. I have not done anything else to my boards.
     
  4. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    Some of these have the adc pin setup with a voltage divider for 3.3 volts some not
     
  5. philba

    Active Member

    Aug 17, 2017
    959
    302
    980 is within 5% of 1023, I would have called it good enough. Go back and test 3.3V again to see if you let the blue smoke out. If you are lucky there is a voltage divider in there somewhere and you didn't overvolt the input pin.

    Real world electronics aren't like a simulation. All parts have tolerances. Typical power supplies claim %5 accuracy so that 3.3VDC you applied could be anywhere between 3.15 or 3.46. Similarly the Vref of the ADC could be a bit off as well. Your multimeter has a tolerance - it's not perfect either. Read your datasheets - they usually have tolerance info.

    Since you may have killed your ADC pin, a lesson to be learned is to design your circuits to be resilient. In this case, the designer of the circuit could have used a Vref of 2.5 and a voltage divider that would have brought a 5V input down to about 3.3 (1K, 470, for example). Or just pick a processor that is 5V tolerant (which is why I like the Teensy 3.2 - 3.3V operation but 5V tolerant).
     
    Jesus_Reyes likes this.
  6. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    Whats really bad is that some of these have the one adc pin headered out to 2 pins one raw and one with divider for 0 to 3.3 volts
    the ADC pin is only 0 to 1.1 volt
     
  7. philba

    Active Member

    Aug 17, 2017
    959
    302
    sounds like the blue smoke is long gone!
     
  8. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
    I think so, because If I vary the voltage 0 to 3.3V in the analog input I can see on the monitor serial the values associated to these changes of voltage, but these values vary only 0 to 973. So I think that the problem was put the 5V in the analog input.
     
  9. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
    ...
     
    Last edited: Sep 8, 2017
  10. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
    You are right, I saw the datasheet of the NodeMCU and as you say this device has a tolerance of voltages and for the analog port the range of voltages is 0 to 1.1V but by the divisor of voltage that this include, the range of voltage increases 0 to 3.3 V. So lesson learned. Thanks...
     
  11. DNA Robotics

    Member

    Jun 13, 2014
    453
    171
    On the Adafruit HUZZAH ESP8266 breakout board
    There is also a single analog input pin called A. This pin has a 1.8V maximum voltage, so if you have an analog voltage you want to read that is higher, it will have to be divided down to 1.8V
     
  12. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
     
    Last edited: Sep 8, 2017
  13. Jesus_Reyes

    Thread Starter New Member

    Aug 24, 2017
    7
    0
    Thanks a lot Guys. I’m new in this platform and it has been a lot help for me. Today I probed again the port and the true is that it has damaged.
     
  14. philba

    Active Member

    Aug 17, 2017
    959
    302
    Don't feel too bad. Show me an electronics engineer or hobbyist that claims to have never killed a part and I'll show you a liar!
     
  15. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    This is what to do test the pin as in short video one shows how to test the pin
    One shows the adc reading using the lua loader https://benlo.com/esp8266/



     
  16. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    1.8 volts is not in any esp8266 datasheet but the datasheet is not much but most ever one I've seen tells you that it's 1.1 volts
    and the nodeEsp 8288 has it using a divder that's set to output 0 to 1.1 volts witch works fine for a 0 to 1024 reading
    This is the spec's for Huzzah esp8266 it's not 1.8 it shows 1 volt max
     
    Last edited: Sep 9, 2017
  17. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,737
    346
    Here what you need to add if the pin doesn't have a divider
    espadc.png

    The people who make the esp show it using 220k and 100k divider it works seem big values but seems to work ok.
     
    Last edited: Sep 9, 2017
  18. philba

    Active Member

    Aug 17, 2017
    959
    302
    I'm surprised by the size of the resistors for their divider. Most sample and hold circuits need fairly low impedance sources. I think PICs and AVRs are like 10K max.
     
  19. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,579
    725
    Overcurrent protection?
     
Loading...