Hydrogen Reader Through ESP32 (Mobile App Based)
The Hydrogen Gas Monitoring System project aims to create a wireless system that can monitor hydrogen gas levels and upload the data to a Firebase database for remote monitoring and analysis. The system utilizes an ESP32 development board, a hydrogen gas sensor, and Firebase's real-time database. The objective is to provide an efficient and reliable solution for monitoring hydrogen gas levels in an environment.
Project : 41
Introduction:
The Hydrogen Gas Monitoring System project
aims to create a wireless system that can monitor hydrogen gas levels and
upload the data to a Firebase database for remote and analysis. The
system utilizes an ESP32 development board, a hydrogen gas sensor, and Firebase's real-time database. The objective is to provide an efficient and
reliable solution for monitoring hydrogen gas levels in an environment.
Apparatus Required:
·
ESP32 Development Board: The ESP32 serves
as the main controller and provides the necessary processing power and Wi-Fi
connectivity.
· Hydrogen Gas Sensor: A hydrogen gas sensor
is used to measure the concentration of hydrogen gas in the environment.
· Custom-Designed PCB: A custom-designed PCB
is used for circuit connections and mounting the components.
·
Liquid Crystal Display (LCD): An LCD is
used to display the hydrogen gas readings.
Pin Configuration:
· trigPin:
Connected to pin 5 of the ESP32 board. It is set as an output pin to send the
trigger signal for the ultrasonic sensor.
· echoPin:
Connected to pin 18 of the ESP32 board. It is set as an input pin to receive
the echo signal from the ultrasonic sensor.
· MOTOR1:
Connected to pin 27 of the ESP32 board. It is set as an output pin to control
the direction of Motor 1.
· MOTOR2:
Connected to pin 26 of the ESP32 board. It is set as an output pin to control
the direction of Motor 2.
· MOTOR3:
Connected to pin 25 of the ESP32 board. It is set as an output pin to control
the direction of Motor 3.
· MOTOR4:
Connected to pin 33 of the ESP32 board. It is set as an output pin to control
the direction of Motor 4.
· sensor pin:
Connected to pin 34 of the ESP32 board. It is set as an input pin to read the
analog output from the hydrogen gas sensor.
Libraries Used:
·
Arduino.h:
The standard Arduino library for general-purpose functions and communication
with the ESP32 board.
·
WiFi.h:
The library for connecting to a Wi-Fi network and establishing an internet
connection
·
FirebaseESP32.h:
The Firebase library for interfacing with the Firebase real-time database.
Program:
//Copy the blynk credential from your
acoount device and paset it here
#define
BLYNK_TEMPLATE_ID "TMPL670BbO1Nl"
#define
BLYNK_TEMPLATE_NAME "Data Monitoring"
#define
BLYNK_AUTH_TOKEN "4Q5w-qYfY3jO82qXBaL3O0E3irLFfDwb"
#define
BLYNK_PRINT Serial
#include
<BlynkSimpleEsp32.h>
#include
<Wire.h>
#include
<WiFi.h>
#include
<LiquidCrystal_I2C.h>
LiquidCrystal_I2C
lcd(0x27, 16, 2);
#define
Sensor_PIN 34
char
auth[] = BLYNK_AUTH_TOKEN;
char
ssid[] = "nepatronix_2.4";
//Enter your WIFI SSID name
char
pass[] = "CLB269DA03";
//Enter your WIFI password
BlynkTimer
timer;
void
notify() {
int value = analogRead(Sensor_PIN);
value = map(value, 0, 4095, 200, 700);
Serial.println(value);
Blynk.virtualWrite(V1, value);
display(1, 1, String(value));
// if
(value == 800) { // If 1 receive then turn ON
//
display(1, 1, "Toxic Air");
//
Blynk.logEvent("intruder_alert", "Intruder
Detected");
// }
else {// Else turn OFF
//
display(1, 1, "Noraml air");
// }
delay(100);
}
void
setup() {
Serial.begin(9600);
Wire.begin();
lcd.begin();
lcd.clear();
lcd.backlight();
lcd.setCursor(1, 0);
lcd.print("**NEPATRONIX**");
delay(2000);
lcd.clear();
pinMode(Sensor_PIN, INPUT);
display(1, 0, "Hydrogen: ");
Blynk.begin(auth, ssid, pass); //Connecting
to Blynk Server with ssid and password
delay(500);
Serial.println(WiFi.localIP());
timer.setInterval(100L, notify);
}
void
loop() {
Blynk.run(); //run the blynk function in loop
timer.run();
}
void
display(int col, int row, String msg) {
lcd.setCursor(col, row);
lcd.print(msg);
}
Working:
·
Initialization: The
ESP32 development board is powered on and the necessary pins are configured.
Wi-Fi connectivity is established by connecting to the specified network.
·
Sensor Reading:
The hydrogen gas sensor's analog output is read using the ‘analogRead()”
function. The raw sensor value is then mapped to a meaningful range of hydrogen
gas concentrations.
·
Data Upload:
If the specified delay has clapsed, the system uploads the hydrogen gas reading
to the Firebase database using the "Firebase.setInt() function.This allows
for real-time monitoring and analysis of the hydrogen gas levels.
·
LCD Display:
The hydrogen gas reading is displayed on the LCD screen using the
“led.print()" function. The LCD backlight is also turned on using the
“led.backlight()" function.
·
Delay:
The system waits for a specified delay of 500 milliseconds before repeating the
process. By continuously reading the hydrogen gas sensor, uploading the data to
Firebase, and displaying the reading on the LCD screen, the system provides
real-time monitoring of hydrogen gas levels. The Firebase integration allows
for remote access and analysis of the data, making it a valuable tool for
monitoring and managing hydrogen gas environments.
·
Initialization:
The ESP32 development board is powered on and the necessary pins are
configured. Wi-Fi connectivity is established by connecting to the specified
network.
·
Sensor Reading:
The hydrogen gas sensor's analog output is read using the “analogRead()"
function. The raw sensor value is then mapped to a meaningful range.
Testing:
·
To ensure the proper functioning of the
Hydrogen Gas Monitoring System, the following testing steps can be performed.
·
Power up the system: Connect the power
supply to the system and ensure that all components are properly powered.
·
Wi-Fi connectivity: Verify that the system
successfully connects to the specified Wi-Fi network. Monitor the serial output
to check for any error messages related to Wi-Fi connectivity.
·
Sensor readings: Observe the LCD display
to ensure that the hydrogen gas readings are being displayed accurately. The
readings should update every 5 seconds according to the specified delay.
·
Data upload: Monitor the serial output to
check if the system successfully uploads the hydrogen gas readings to the
Firebase database. Cross-reference the readings displayed on the LCD with the
data stored in the Fircbase database to verify their accuracy
·
Remote access: Access the Firebasce
database using the specified credentials and verify that the hydrogen gas
readings are being stored correctly. Check if the readings correspond to the
values displayed on the LCD.
·
Continuous monitoring: Keep the system
running for an extended period of time and observe its performance. Ensure that
the system maintains stable Wi-Fi connectivity and consistently uploads
accurate hydrogen gas readings to the Firebase database.
·
System reliability: Test the system's
reliability by subjecting it to different environmental conditions and
monitoring its performance. Introduce varying levels of hydrogen gas in the
vicinity of the sensor and verify if the system responds accordingly and
provides accurate readings.
·
User interface: Evaluate the user
interface provided by the LCD display. Check if the hydrogen gas readings are
clearly visible and if the LCD backlight is functioning properly.