Professional Documents
Culture Documents
Peripheral features
a. Two 8-bit Timer/Counters with separate prescaler and compare mode
b. One 16-bit Timer/Counter with separate prescaler, compare mode, and
capture mode
c. Real time counter with separate oscillator
d. Six PWM channels
e. 8-channel 10-bit ADC in TQFP and QFN/MLF package
f. Temperature measurement
g. Programmable serial USART
h. Master/slave SPI serial interface
i. Byte-oriented 2-wire serial interface (Phillips I2C compatible)
j. Programmable watchdog timer with separate on-chip oscillator
k. On-chip analog comparator
l. Interrupt and wake-up on pin change
Operating voltage:
a. 2.7V to 5.5V for ATmega328P
Temperature range:
a. Automotive temperature range: –40°C to +125°C
Speed grade:
a. 0 to 8MHz at 2.7 to 5.5V (automotive temperature range: –40°C to
+125°C)
b. 0 to 16MHz at 4.5 to 5.5V (automotive temperature range: –40°C to
+125°C)
The BME680 is a digital 4-in-1 sensor with gas, humidity, pressure and
temperature measurement based on proven sensing principles. The sensor module
is housed in an extremely compact metal-lid LGA package with a footprint of
only 3.0 × 3.0 mm² with a maximum height of 1.00 mm (0.93 ± 0.07 mm). Its
small dimensions and its low power consumption enable the integration in
battery-powered or frequency-coupled devices, such as
handsets or wearables.
Typical applications
Indoor air quality
Home automation and control
Internet of things
Weather forecast
GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning,
slope detection)
Indoor navigation (change of floor detection, elevator detection)
Outdoor navigation, leisure and sports applications
Vertical velocity indication (rise/sink speed)
Target Devices
The BME680 is specially developed for mobile applications and wearables where
size and low power consumption are critical requirements. The BME680 has
features like specific operating mode, optimized power consumption, long-term
stability, and high EMC robustness. In order to measure air quality, the gas sensor
within the BME680 can detect a broad range of gases such as volatile organic
compounds (VOC). To learn more about the BME680 Sensor, you can check
BME680 Datasheet.
Most of the BME680 Breakout board has 6 pins which some of the boards like
Grove BME680 Board, BlueDot BME680 Board or Pimoroni BME680 has more
or less pins. But overall funtionality of the pins remains same.
The BME680 breakout has a default I2C address of 0x76. But you can change the
I2C Address so that you can use up to two breakouts on the same Raspberry Pi or
Arduino. To change the I2C address to 0x77 simply connect SDO to GND.
C. Datasheet MQ-136
TECHNICAL DATAMQ-136 GAS SENSOR
FEATURES
Fast response and High sensitivity
Stable and long life Simple drive circuit
APPLICATION
They are used in air quality control equipments for buildings/offices,
are suitable for detecting of H2S.
SPECIFICATIONS
A. Standard work condition
Symbol Parameter name Technical condition Remarks
Vc Circuit voltage 5V±0.1 AC OR DC
VH Heating voltage 5V±0.1 ACOR DC
RL Load resistance can adjust
RH Heater resistance 31Ω±5% Room Tem
PH Heating consumption less than 800mw
B. Environment condition
Symbol Parameter name Technical condition Remarks
Tao Using Tem -10℃-45℃
Tas Storage Tem -20℃-70℃
RH Related humidity less than 95%Rh
O2 Oxygen concentration 21%(standard condition)Oxygen minimum value is
concentration can affect sensitivity over 2%
C. Sensitivity characteristic
Symbol Parameter name Technical parameter Ramark 2
Rs Sensing 30KΩ-200KΩ (10ppm Detecting concentration
Resistance H2S ) scope:
1-100ppm H2S
α Concentration
(20/5) Slope rate ≤0.65
H2S
Standard Temp: 20℃±2℃ Vc:5V±0.1
Detecting Humidity: 65%± 5% Vh: 5V±
Condition 0.1
Preheat time Over 24 hour
D. Structure and configuration, basic measuring circuit
Parts Materials
1 Gas sensing layer SnO2
2 Electrode Au
3 Electrode line Pt
4 Heater coil Ni-Cr alloy
5 Tubular ceramic Al2O3
6 Anti-explosion Stainless steel gauze
network (SUS316 100-mesh)
7 Clamp ring Copper plating Ni
8 Resin base Bakelite
9 Tube Pin Copper plating Ni
Fig. 1 Fig.2
Configuration A Configuration B
A A
向 向
Temp : 20℃、
RL : 20kΩ
SENSITVITY ADJUSTMENT
D. Datasheet MQ-7
TECHNICAL DATA MQ-7 GAS SENSOR
FEATURES
* High sensitivity to carbon monoxide
* Stable and long life
APPLICATION
They are used in gas detecting equipment for carbon
monoxide(CO) in family and industry or car.
SPECIFICATIONS
A. Standard work condition
Symbol Parameter name Technical condition Remark
Vc circuit voltage 5V±0.1 Ac or Dc
VH (H) Heating voltage (high) 5V±0.1 Ac or Dc
VH (L) Heating voltage (low) 1.4V±0.1 Ac or Dc
RL Load resistance Can adjust
RH Heating resistance 33Ω±5% Room temperature
TH (H) Heating time (high) 60±1 seconds
TH (L) Heating time (low) 90±1 seconds
PH Heating consumption About 350mW
b. Environment conditions
Symbol Parameters Technical conditions Remark
Tao Using temperature -20℃-50℃
Tas Storage temperature -20℃-50℃ Advice using scope
RH Relative humidity Less than 95%RH
O2 Oxygen concentration 21%(stand condition) Minimum value is over 2%
the oxygen concentration can
affect the sensitivity
characteristic
c. Sensitivity characteristic
symbol Parameters Technical parameters Remark
Rs Surface resistance In 100ppm
Of sensitive body 2-20k Carbon Monoxide
а(300/100ppm) Concentration slope rate Less than 0.5 Rs (300ppm)/Rs(100ppm)
Standard working Temperature -20℃±2℃ relative humidity 65%±5% RL:10KΩ±5%
condition Vc:5V±0.1V VH:5V±0.1V VH:1.4V±0.1V
Preheat time No less than 48 hours Detecting range:
20ppm-2000ppm carbon monoxide
layer
2 Electrode Au
3 Electrode line Pt
A
A
向
Standard circuit:
1
0
Rs/Ro
CO
H2 LPG
0.
CH4
1
Alcohol
air
0. pp
01 1 10 100 m
0 0 0
100
00 Fig.3 sensitivity characteristics of the MQ-7
Fig.3 is shows the typical sensitivity characteristics of the MQ-7 for several gases.
1.
MQ
5 -7 33%RH Fig
1. 85%RH .4
4
1.
3
1.
2
1. Tem
1 p
- 0 1 2 3 4
1
10 0 0 0 0 50
0.
9
8
0.
7
0.
6
0.
5
OPERATION PRINCIPLE
. The surface resistance of the sensor Rs is obtained through
effected voltage signal output of the load resistance RL which
series-wound. The relationship between them is described:
Rs\RL = (Vc-VRL) / VRL
Fig. 5 shows alterable situation of RL signal output measured by using Fig.
2 circuit output
In 100ppmCO In air
In air
VH5v
60s 90s
1.4 v
Signal
Fig.5
signal when the sensor is shifted from clean air to carbon monoxide
(CO) , output signal measurement is made within one or two
complete heating period (2.5 minute from high voltage to low
voltage ).
Sensitive layer of MQ-7 gas sensitive components is made of
SnO2 with stability, So, it has excellent long term stability. Its
service life can reach 5 years under using condition.
SENSITVITY ADJUSTMENT
Resistance value of MQ-7 is difference to various kinds and various
concentration gases. So, When using this components, sensitivity adjustment is
very necessary. we recommend that you calibrate the detector for 200ppm CO in
air and use value of Load resistance that( RL) about 10 KΩ(5KΩ to 47 KΩ).
When accurately measuring, the proper alarm point for the gas detector should be
determined after considering the temperature and humidity influence. The
sensitivity adjusting program:
// 41155040170018
// Teknik Elektro - C
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#define SEALEVELPRESSURE_HPA (1013.25)
// https://thingspeak.com/channels/1428342
// asriefrizki@gmail.com
// Mawar.07
/*-----------------------------------------------------------*/
// global Variables
int error=0;
boolean wificonnect;
float gas_reading;
int pin_mq7 = A0;
int pin_buzzer = 2;
int pin_led1 = 5;
int pin_led2 = 6;
int pin_fan = 7;
void setup()
pinMode(pin_buzzer, OUTPUT);
pinMode(pin_led1, OUTPUT);
pinMode(pin_led2, OUTPUT);
pinMode(pin_fan, OUTPUT);
pinMode(pin_button, INPUT_PULLUP);
// tampilan awal
lcd.clear();
lcd.setCursor(0,0);
lcd.print("STARTING");
digitalWrite(pin_led1, 1);
digitalWrite(pin_led2, 1);
digitalWrite(pin_buzzer, 1);
delay(1000);
digitalWrite(pin_led1, 0);
digitalWrite(pin_led2, 0);
digitalWrite(pin_buzzer, 0);
if (!bme.begin()) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("BME680 ERROR!");
delay(1000);
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
// cek esp01
Serial.println("AT");
// feedback
if(Serial.find("OK")){
void loop(){
start:
if (error==1){
goto start; //go to label "start"
void updateTemp(){
cmd += IP;
cmd += "\",80";
Serial.println(cmd);
run_with_delay(20);
if(Serial.find("Error")){
return;
cmd = msg ;
cmd += val_mq7;
cmd += val_mq136;
cmd += "&field3="; //field 3
cmd += gas_reading;
cmd += "\r\n";
Serial.print("AT+CIPSEND=");
Serial.println(cmd.length());
if(Serial.find(">")){
Serial.print(cmd);
else{
Serial.println("AT+CIPCLOSE");
//Resend...
error=1;
// konek ke wifi
boolean connectWiFi(){
Serial.println("AT+CWMODE=1");
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" STARTING WIFI ");
delay(2000);
String cmd="AT+CWJAP=\"";
cmd+=SSID;
cmd+="\",\"";
cmd+=PASS;
cmd+="\"";
Serial.println(cmd);
lcd.clear();
lcd.setCursor(0,0);
delay(1000);
if(Serial.find("OK")){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("CONNECTED");
delay(1000);
return true;
}else{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("NOT CONNECT!");
delay(1000);
return false;
int lock=0;
int lcdclear=0;
// baca sensor2
if (! bme.performReading()) {
return;
//val_mq7 = ppm_mq7;
//val_mq136 = ppm_mq136;
val_bme = gas_reading;
//val_bme = aqi_;
if(++lcdclear>10){
lcdclear=0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("STATUS: ");
lcd.print("DANGER");
if(lock==0){
digitalWrite(pin_fan, 1);
digitalWrite(pin_buzzer, 1);
digitalWrite(pin_led1, 1);
digitalWrite(pin_led2, 0);
lock=1;
else {
digitalWrite(pin_fan, 0);
digitalWrite(pin_led1, 0);
digitalWrite(pin_led2, 1);
digitalWrite(pin_buzzer, 0);
lock=0;
lcd.print("GOOD ");
if(digitalRead(pin_button)==0){
digitalWrite(pin_buzzer, 0);
lcd.setCursor(0,1);
lcd.print("CO : ");
lcd.print(val_mq7);
lcd.print(" ug/m3");
lcd.setCursor(0,2);
lcd.print("SO2 : ");
lcd.print(val_mq136);
lcd.print(" ug/m3");
lcd.setCursor(0,3);
lcd.print("GAS R: ");
lcd.print(val_bme);
lcd.print(" ohm");
delay(100);
}
}