IoT Air Quality Sensor

MQ2 and MQ9 gas sensor both have four pins:

  • VCC
  • GND
  • DO (Digital Control)
  • AO (Analog Output)

The analog output of MQ2 and MQ9 is between 0V to 5V whereas the analog pin of nodemcu can only read between 0V to 3.3V. That means nodemcu cannot read the data if MQ2 or MQ9 sensor output is above 3.3V. The data read is not accurate. Therefore, voltage is needed step down.

In this project, voltage divider by two resistors is used. The voltage output is determined by the ratio of the value of two resistors. I use 180ohm as R1 and 330ohm as R2 so that Vout is 3.3V.

So, Vin is connected to AO pin of MQ gas sensors. Vout is connected to channels of the multiplexer.

Only three pins of each sensor are used:

  • Vcc to 5V supply
  • GND to nodemcu GND pin
  • Vout of voltage divider to CD4051BE channel 1 and channel 2(pin14 and 15)

Multiplexer connection:

  • Vdd (pin 16) to 5V supply
  • INH, Vee, Vss (pin 6, 7, 8) to nodemcu GND pin
  • common out/in (pin 3) to nodemcu A0 pin
  • A, B, C (pin 11, 10, 9) to nodemcu D0, D1, D2

A, B, C (pin11, 10, 9) are used to select channel for output.

A, B, C are digital input which means only read 0 and 1.

3-digit binary number is formed in the order of CBA.

As we use channel 1 and 2, denary number of 1 and 2 in 3-digit binary number are 001 and 010 respectively.

Therefore, when we want output of channel 1, D0 output 1, D1 and D2 output 0.

When we want output of channel 2, D0 output 0, D1 output 1 and D2 output 0.

from Instructables: exploring – featured http://ift.tt/2tZpPGP
via IFTTT

Advertisements
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s