Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Connect Gas Sensor With Bluetooth Using Arduino Mega 2560
WhatsApp
Sr Karthiga
4y
10.7k
0
1
100
Article
gasbt.zip
Introduction
In this article, I will explain about connecting the Gas Sensor to the Bluetooth.
When the gas is leaked, it can automatically send the message to the app.
We can control the gas leakage in the house.
Parts Of Lists
Arduino Mega 2560
Bluetooth
Gas Sensor
Bread Board
Hook Up wires
Connection
Step 1
Connection from Arduino Board to the Bluetooth.
Bluetooth
Board
Vcc
5v
Gnd
Gnd
RX
TX
TX
RX
Step 2
Connection from Arduino Board to the Sensor.
Sensor
Board
Vcc
5v
Gnd
Gnd
Vin
A0
Programming
const
int
AOUTpin = 0;
//the AOUT pin of the CO sensor goes into analog pin A0 of the arduino
const
int
DOUTpin = 8;
//the DOUT pin of the CO sensor goes into digital pin D8 of the arduino
const
int
ledPin = 13;
//the anode of the LED connects to digital pin D13 of the arduino
int
limit;
int
value;
void
setup()
{
Serial.begin(9600);
//sets the baud rate pinMode(DOUTpin, INPUT);
//sets the pin as an input to the arduino pinMode(ledPin, OUTPUT);
//sets the pin as an output of the arduino
}
void
loop()
{
value = analogRead(AOUTpin);
//reads the analaog value from the CO sensor's AOUT pin
limit = digitalRead(DOUTpin);
//reads the digital value from the CO sensor's DOUT pin
Serial.print(
"CO value: "
);
Serial.println(value);
//prints the CO value
Serial.print(
"Limit: "
);
Serial.print(limit);
//prints the limit reached as either LOW or HIGH (above or underneath)
delay(100);
if
(limit == HIGH)
{
Serial.println(
"Bad"
);
}
else
{
Serial.println(
"OK"
);
}
}
Explanation
We have to build the App in the App inverter
They can show the Gas level in the App
When the gas is leaked, it can be used to control the gas level through the App
When the gas is leaked, it can be printed in the Serial monitor as Bad.
Arduino Mega 2560
Gas Sensor
IoT
Up Next
Ebook Download
View all
Raspberry Pi -Sensorial Symphony of Connectivity
Read by 704 people
Download Now!
Learn
View all
Membership not found