You are on page 1of 11

Caraga State University

College of Engineering and Geosciences


CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

LABORATORY ACTIVITY 4

MULTISENSING CIRCUIT WITH ARDUINO AND LCD: SIMULATION


AND HARDWARE IMPLEMENTATION

John Fred Celmar


Kenneth Mae Jumawan
Clark Leonard Rivera
Electronic Systems and Design, Sec BJ1
Engr. Rovil S. Berido, MSEE
20 February 2024
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

OBJECTIVES

To simulate the system with a rain sensor, soil moisture sensor, gas sensor, and
LCD using Proteus, the process begins by adding the necessary components to the
Proteus workspace and interfacing them with a microcontroller. Code is then
developed to read sensor values and display information on the LCD using Arduino
IDE. After running the simulation to validate the system's behavior, the hardware
implementation follows. Gathering components like sensors, LCD, microcontroller,
and utilizing a breadboard, the circuit is set up to mirror the Proteus simulation.

EQUIPMENT/ APPARATUS

The equipment and apparatus utilized for this project include essential components
for environmental monitoring and data collection. The Proteus software serves as a
crucial tool for simulation and design and Arduino IDE for the programming. The
project incorporates specific sensors to measure key environmental parameters,
namely the FC-37 or YL-83 Rain Sensor for rainfall detection, the YL-69 or HL-69
Soil Moisture Sensor for monitoring soil moisture levels, and the MQ-2 Gas/Smoke
Sensor for detecting gas and smoke concentrations. These sensors are integrated
with an Arduino UNO microcontroller, facilitating data processing and
communication. The LCD display provides a user-friendly interface for real-time data
visualization. To establish the necessary connections, jumper wires and a
breadboard are employed, ensuring a reliable and organized setup for effective
environmental monitoring and sensor data analysis.

THEORY

I. Basic Principles of the Sensors

The basic principles of the given sensors are described below:

a. FC-37 or YL-83 Rain Sensor


The rain sensor is designed to identify the presence of water and has a
capability beyond that of a humidity sensor. The FC-37 rain sensor, or
alternative versions like the YL-83, comprises two components: the
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

electronic board and the collector board, which gathers water droplets.
This configuration is illustrated in figure below.

Figure 1: Rain Sensor with Pin Description

The rain sensor comes equipped with an integrated potentiometer that


allows users to adjust the sensitivity of the digital output (D0).
Additionally, it features a power LED that illuminates when the sensor
is activated and a digital output LED.

b. YL-69 or HL-69 Soil Moisture Sensor

The soil moisture sensor, also known as a hygrometer, is commonly


employed for assessing soil humidity levels. It is particularly well-suited
for creating automated water systems or monitoring the soil moisture of
plants. The sensor consists of two components: the electronic board
and the probe with two pads, which detects the water content.
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

Figure 2: Soil Moisture Sensor with Pin Description

c. MQ-2 Gas/Smoke Sensor

The MQ-2 smoke sensor exhibits sensitivity to both smoke and various
flammable gases, including LPG, butane, propane, methane, alcohol,
and hydrogen. The sensor's resistance varies based on the type of gas
present. Additionally, it is equipped with a built-in potentiometer,
enabling users to adjust the threshold of the sensor's digital output
(D0).

Figure 3: Gas/Smoke Sensor with Pin Description

II. Information obtained through a sensor connected to an Arduino offers


various presentation options. It can be showcased on a computer through
the Serial Monitor, transmitted to another Arduino, or sent to an internet
server for accessibility on devices like smartphones or tablets. An
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

economical and straightforward method to display this data is by using an


LCD (liquid crystal display), commonly found in everyday electronic
devices like vending machines, calculators, parking meters, printers, etc.
These displays are well-suited for presenting text or small icons, as
depicted in the figures below illustrating the front and back views of a 16×2
LCD.

The pin interface consists of 16 pins, sequentially numbered from 1 to 16.


In certain displays, such as the one mentioned, the connectivity code is
imprinted on the printed circuit board. It is important to highlight that the
presence of a 220 Ω resistor between the 5V and pin 15 is essential. This
resistor serves the purpose of lowering the voltage supplied to the
backlight LED to 3.3V.

Figure 4: Front View of a Classic 1602A LCD with 16-pin Interface


Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

LABORATORY PROCEDURE

I. Setup the schematic diagram of the system using proteus.

a. Schematic Diagram

Figure 6: Schematic Diagram Simulated Using Proteus


The schematic diagram shows the design of the laboratory simulated
in Proteus. It is composed of 3 sensors namely: Rain Sensor, Soil
Moisture Sensor, and Gas/Smoke Sensor that are all connected to
the analog pins of the Arduino. Speakers and LEDs were a used for
the output that were connected to the digital pins of the Arduino. A
1602 LCD were used to visually represent the output or information
generated by the simulated circuit to display the sensor readings
such as Moisture Content in percentage and Gas Value. LCD showed
text if there is rain and gas detected above the set threshold.

To fully understand the schematic diagram, a flowchart was added in


the following.
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

Start

Initializing
Microcontroller

Read rain sensor Read soil Read gas/smoke


pin moisture sensor sensor

Yellow LED No Display Display “Gas


Is Value >
is ON “Moisture: Value: [value]”
Threshold? on LCD
[value]” on LCD

Yes

Display “Rain Is Value > No


Detected!” on Threshold?
LCD

Yes

Speaker and Red Display “Gas


LED is ON Detected!” on
LCD

Speaker and Red


LED is ON

End

Figure 7: Flowchart
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

Pin Connection
Arduino Pin Other Components
5V 5V
GND GND
A0 AO (Rain Sensor)
A1 AO (Soil Moisture Sensor)
A2 AO (Gas Sensor)
D2 D7 (LCD)
D3 D6 (LCD)
D4 D5 (LCD)
D5 D4 (LCD)
D6 Red LED1
D7 Speaker1
D9 Yellow LED
D10 Red LED2
D11 Speaker2
D12 E (LCD)
D13 RS (LED

b. Code for the system controller.


#include <Wire.h> lcd.begin(16, 2);
#include <LiquidCrystal_I2C.h> pinMode(rainSensorPin, INPUT);
LiquidCrystal_I2C lcd(0x27, 16, 2); pinMode(soilMoisturePin, INPUT);
const int rainSensorPin = A0; pinMode(gasSensorPin, INPUT);
const int soilMoisturePin = A1; pinMode(ledPin1, OUTPUT);
const int gasSensorPin = A2; pinMode(ledPin2, OUTPUT);
const int ledPin1 = 5; pinMode(ledPin3, OUTPUT);
const int ledPin2 = 6; pinMode(buzzerPin1, OUTPUT);
const int ledPin3 = 7 pinMode(buzzerPin2, OUTPUT);
const int buzzerPin1 = 9;
const int buzzerPin2 = 10 lcd.print(" Group 2: ");
int Moisture; lcd.setCursor(0, 1);
lcd.print(" Multisensors ");
void setup() { delay(2000);
lcd.init(); lcd.clear();
lcd.backlight(); }
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

lcd.setCursor(0, 0);
oid loop() { lcd.print("Moisture:");
int rainValue = lcd.print(Moisture);
analogRead(rainSensorPin); lcd.print("% ");
int soilMoistureValue = delay(1000);
analogRead(soilMoisturePin); lcd.clear();
int gasSensorValue =
analogRead(gasSensorPin); lcd.setCursor(0, 1);
lcd.print("Gas Value: ");
if (rainValue < 300) lcd.print(gasSensorValue);
{
lcd.clear(); if (gasSensorValue > 50) {
lcd.setCursor(0, 0);
lcd.print(" Rain Detected!"); lcd.clear();
delay(1000); lcd.setCursor(0, 0);
lcd.clear(); lcd.print("Gas Detected!");
delay(1000);
tone(buzzerPin1, 2000);
delay (100); tone(buzzerPin2, 2000);
digitalWrite(ledPin1, HIGH delay(100);
delay(100); digitalWrite(ledPin3, HIGH);
digitalWrite(ledPin2, LOW); delay(100);
} digitalWrite(ledPin3, LOW);
else delay(50);
{ lcd.clear();
digitalWrite(ledPin1, LOW); lcd.setCursor(0, 1);
delay(100); lcd.print("Gas Value: ");
digitalWrite(ledPin2, HIGH); lcd.print(gasSensorValue);
noTone(buzzerPin1); } else {
delay(100); noTone(buzzerPin2); // Turn off
} buzzer
Moisture = map(soilMoistureValue, }
0, 1023, 100, 0); delay(1000);
lcd.clear();
Caraga State University
College of Engineering and Geosciences
CEGS Building, CSU-Main Campus, Ampayon, Butuan City, Philippines Phone (+69 85) 341-3249
(+63 85) 342-3047
(+63 85) 341-2296
Competence Service Uprightness Email address: cegs@carsu.edu.ph
Nurturing Engineers of the Future URL: httpp://cegs.carsu.edu.ph/

c. Implemented designed system in hardware testing using breadboard.

Figure 8: Hardware Set-up Using Breadboard

CONCLUSION

In summary, the multisensing circuit, incorporating Arduino and LCD, offers a versatile solution for
environmental monitoring. This project seamlessly integrates various sensors like rain, soil moisture,
and gas sensors with Arduino, showcased through simulation and hardware implementation. The LCD
interface facilitates real-time data visualization, enabling practical interpretation of environmental
conditions. This circuit not only enhances our understanding of sensor interfacing but also serves as a
foundation for automated systems in smart agriculture and safety monitoring. Bridging theoretical
concepts with real-world applications, it contributes to advancements in sensor-based technologies.
Combining soil, rain, and gas sensors creates a comprehensive environmental monitoring system,
offering valuable data for weather forecasting, pollution reduction, and agricultural optimization in a
concise and impactful manner.

You might also like