In this tutorial we will show how to build ESP8266 gas sensor with EasyIoT server. We will show how to add new sensor types even if not supported in EasyIoT server.
-gas sensor module
|MQ-2 Gas Sensor Module Smoke Methane Butane|
|MQ-7 Carbon Monoxide CO Gas Sensor Detection Module|
|MQ-3 Alcohol Ethanol Sensor Breath Gas Detector Ethanol Detection|
|MQ-4 Natural Gas Methane Detection Sensor|
|MQ-5 Methane Gas Sensor mosule|
|MQ-6 Liquefied Petroleum Gas Sensor|
|MQ-135 Air Quality Sensor Hazardous Gas Detection Module|
|ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module|
|ESP8266 Lua Nodemcu WIFI Network Development Board|
-2N2222 NPN transistor
|100Pcs NPN Transistor TO-92 2N2222|
|400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm|
-10uF electrolytic capacitor
|210Pcs 25 Value 0.1uF-220uF Electrolytic Capacitors Assortment Kit Set|
There are different gas sensor modules on the market. Dependent on model it can be used to detect different gases. See buying guide for details.
Add Virtual node in EasyIoT server interface. Currently there is no support for gas sensor so we will select Digital input (DI) type of sensor. Remember Virtual node address because we will need it later in program.
We want picture to represent gas sensor in EasyIoT user interface. We will add custom icon to EasyIoT server.
Add custom property "SettingsIcon" and set value to gas.png. Also save gas.png picture in custom icon folder.
Connections are very simple. Use gas sensor digital output and connect it to ESP8266 GPIO2 pin. Because ESP8266 operates on 3.3V and gas sensor operates on 5V we will add additional NPN transistor, two resistors and capacitor for voltage level sifter. Don't forget to add capacitor - it helps to set GPIO2 pin high during power on, to boot ESP8266 in correct state.
For power supply we recommend AMS1117 regulator or AMS1117 regulator module. See power supply in store.
Program can be found on GitHub. Correct following lines in program (AP username password, server IP address, node address, EasyIoT server username and password):
#define AP_SSID "your AP SSID"
#define AP_PASSWORD "your AP password"
// EasyIoT server definitions
#define EIOT_USERNAME "admin"
#define EIOT_PASSWORD "test"
#define EIOT_IP_ADDRESS "192.168.1.5"
#define EIOT_PORT 80
#define EIOT_NODE "N8S0"
Compile and load program with ESP8266 Arduino IDE. Read tutorial for direct ESP8266 programming in Arduino IDE.
See more tutorials at http://iot-playground.com/build
To support this site and EasyIoT framework development please buy in our store.
YES, with GPIO12 on ESP-12 it works.
How to make Icon1 works on ON status? I've named Sensor.Icon1 as Mr.EasyIoT describe...
Here is Icon1 for ON status...