NodeMCU v3 + FC-22(MQ135) do not working

Posted on
  • var mq = require("MQ135").connect(NodeMCU.A0);
    >console.log(mq.getPPM())
    0
    
  • Maybe the pin reference. I believe D0 may be the A0 you need. See this thread

    http://forum.espruino.com/conversations/­278217/

  • Pin is correct.

    >analogRead(0)
    =0.04203323558
    >analogRead(NodeMCU.A0)
    =0.04203323558
    >analogRead(D0)
    =0.04203323558
    >console.log(mq.getPPM())
    0
    =undefined
    > 
    

    problem.
    analogRead(); do not workign in NodeMCU v3

  • Debug:
    A0 + MQ135

    analogRead();
    =0.14369501466
    

    A0 + Empty

    >analogRead()
    =0.00391006842
    

    Resistor 4.7k over VCC and Analog

    >analogRead();
    =1.00097751710
    
  • I don't think the analogue Input on the esp8266 works properly if wifi is on, as interupts affect the reading of the adc value. If you turn wifi off, it might work...

  • Do not work.,

    connected? err= null info= {
      "ip": "10.2.1.36",
      "netmask": "255.255.255.0",
      "gw": "10.2.1.1",
      "mac": "18:fe:34:cb:33:66"
     }
    >console.log(mq.getPPM());
    0
    =undefined
    >wifi.disconnect();
    =undefined
    >console.log(mq.getPPM());
    0
    =undefined
    >console.log(mq.getPPM());
    0
    =undefined
    > 
    
  • A good practice is to take the issue apart and verify each of the items. In this case, go after the analog read first as you try to get going in your NodeMCU v3 - analogRead() conversation.

    Furthermore, from reading the data / spec sheet of ESP8266 (and NodeMCU), only voltage values from 0..1.0V are valid inputs for analog read on pin A0.

    Reading with an open input or with a voltage outside the specified range - as 3.3V over 4k7 Ohm - are meaningless... and values above 3.3V or below (usually) -0.3V - relative to GND - just destroy the MCU... and you do not even see a smoke anymore...

  • A0 is empty

    >analogRead();
    =0.00879765395
    >analogRead();
    =0.00879765395
    >analogRead();
    =0.00879765395
    >analogRead();
    =0.00879765395
    

    A0 + MQ135

    >analogRead();
    =0.31085043988
    >analogRead();
    =0.30889540566
    >analogRead();
    =0.29521016617
    >analogRead();
    =0.28152492668
    
  • I maybe found.. need get default value from analogRead()

    Default: 0.00879765395
    Sensor: 0.09775171065
    Correction: ((Sensor-Default)*1000)*3.3

  • I now found my problem .. MQ135 Analog Out is 0-5V, ESP8266 Analog Read only from 0-1V ... now please help to rising this questions.. need Resistor divider?


    2 Attachments

    • devider.png
    • mq135.png
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

NodeMCU v3 + FC-22(MQ135) do not working

Posted by Avatar for Aleksandrs @Aleksandrs

Actions