Skip to content

2.3. Environmental Monitoring Station

Description This project combines a temperature sensor, LDR, and LCD display to monitor environmental conditions in real time.
Use case This project is connected to real-world uses such as smart agriculture and weather monitoring systems.

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires LCD Display Potentiometer Temperature Sensor LDR Sensor

Building the circuit

Things Needed:

  • Arduino Uno = 1
  • Arduino USB cable = 1
  • Breadboard = 1
  • Jumper Wires
  • Temperature Sensor
  • LCD Display
  • LDR
  • Potentiometer

Mounting the component on the breadboard and wiring the circuit

Step 1: Connect the power supply by connecting the 5V pin on the Arduino Uno to the positive rail on the breadboard and the GND pin to the negative rail.

Step 2:Place the temperature sensor and the LDR module (the sensor module with the blue potentiometer) on the breadboard.

- Connect VCC of the temperature sensor to the positive power rail on the breadboard where we connected the 5V pin on the Arduino Uno to.

- Connect GND of the temperature sensor to the negative power rail on the breadboard where we connected the GND pin on the Arduino Uno to.

- Connect the signal wire (yellow) of the temperature sensor to A0 on the Arduino Uno board using a jumper wire.

Step 3: Place the LDR module on the breadboard.

- Connect VCC of the LDR module to the positive power rail on the breadboard where we connected the 5V pin on the Arduino Uno to.

- Connect GND of the LDR module to the negative power rail on the breadboard where we connected the GND pin on the Arduino Uno to.

- Connect A0 (Analog Output) pin of the LDR module to A1 on the Arduino Uno board.

Step 4:Place the I2C LCD display on the breadboard.

- Connect VCC of the I2C LCD display to the positive power rail on the breadboard where we connected the 5V pin on the Arduino Uno to.

- Connect GND of the I2C LCD display to the negative power rail on the breadboard where we connected the GND pin on the Arduino Uno to.

- Connect SDA (Serial Data) pin of the I2C LCD display to A4 on the Arduino Uno board.

- Connect SCL (Serial Clock) pin of the I2C LCD display to A5 on the Arduino Uno board.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.


#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
lcd.init();
lcd.backlight();
}
void loop() {
int tempValue = analogRead(A0);
int lightValue = analogRead(A1);
lcd.setCursor(0,0);
lcd.print("Temp:");
lcd.print(tempValue);
lcd.setCursor(0,1);
lcd.print("Light:");
lcd.print(lightValue);
delay(500);
}


Step 3: Save your code. See the Getting Started section

Step 4: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.

Step 5: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code

CONCLUSION

LCD displays temperature readings. LCD displays light intensity values. Both values update continuously.