Arduino and ESP8266 Based Smart Climate Control and Lighting System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit is designed to manage and monitor an environment using various sensors and actuators. It includes a solar power management system with an MPPT SCC, a 12v battery, and a solar panel. The circuit also features a 12v to 5v step-down power converter to supply 5v to the low-voltage components. Sensing is done via a DHT11 temperature and humidity sensor, an LDR light sensor, and a PIR motion sensor. Actuation is controlled through a 4-channel relay module that switches an LED bulb and a fan. Communication is handled by an HC-06 Bluetooth module, and an Arduino UNO microcontroller is used for control logic. An ESP8266 NodeMCU provides additional connectivity options, and an RTC DS3231 module keeps track of real-time.
Component List
MPPT SCC
- Solar Charge Controller for managing solar panel charging and battery protection.
12v Battery
- Energy storage device for the solar power system.
12v to 5v Step Down Power Converter
- Converts 12v to 5v to power the 5v components in the circuit.
KY-015 DHT11
- Temperature and humidity sensor for environmental monitoring.
Sensor LDR LM393
- Light sensor for detecting ambient light levels.
Resistor (10k Ohms)
- Used for pull-up/pull-down configurations or current limiting.
PIR Motion Sensor (Wokwi Compatible)
- Detects motion within the environment for security or automation purposes.
Solar Panel
- Photovoltaic panel for converting solar energy into electrical energy.
Relay 4 Channel 5v
- Controls high power devices such as the LED bulb and fan using low voltage signals.
LED bulb AC / Bombillo AC
- Lighting device controlled by the relay module.
Power Inverter
- Converts DC power from the battery to AC for the LED bulb.
Bluetooth HC-06
- Wireless communication module for remote control via Bluetooth.
Arduino UNO
- Microcontroller board for implementing control logic and interfacing with sensors and actuators.
ESP8266 NodeMCU
- Wi-Fi enabled microcontroller for IoT applications.
RTC DS3231
- Real-Time Clock for timekeeping and scheduling tasks.
Fan
- Electric fan controlled by the relay module for air circulation.
Wiring Details
MPPT SCC
SOLAR+connected to Solar Panel+SOLAR-connected to Solar Panel-BATTERY+connected to 12v Battery+, 12v to 5v Step Down Power ConverterVIN+, and Power Inverter+BATTERY-connected to 12v Battery-, 12v to 5v Step Down Power ConverterVIN-, and Power Inverter-
12v Battery
+connected to MPPT SCCBATTERY+, 12v to 5v Step Down Power ConverterVIN+, and Power Inverter+-connected to MPPT SCCBATTERY-, 12v to 5v Step Down Power ConverterVIN-, and Power Inverter-
12v to 5v Step Down Power Converter
VIN 9v-36vnot connectedVIN+connected to 12v Battery+and MPPT SCCBATTERY+VIN-connected to 12v Battery-and MPPT SCCBATTERY-USB OUTPUT 5Vnot connected5v OUTPUTconnected to Arduino UNO5VGNDconnected to common ground net
KY-015 DHT11
5Vconnected to Arduino UNO5VSconnected to Arduino UNOD2GNDconnected to common ground net
Sensor LDR LM393
A0connected to Arduino UNOA0D0not connectedGNDconnected to common ground net and Resistorpin2VCCconnected to Arduino UNO5V
Resistor (10k Ohms)
pin1connected to common ground netpin2connected to Sensor LDR LM393GND
PIR Motion Sensor (Wokwi Compatible)
VCCconnected to Arduino UNO5VOUTconnected to Arduino UNOD3GNDconnected to common ground net
Solar Panel
+connected to MPPT SCCSOLAR+-connected to MPPT SCCSOLAR-
Relay 4 Channel 5v
GNDconnected to common ground netIN1connected to Arduino UNOD5IN2connected to Arduino UNOD6IN3not connectedIN4not connectedVCCconnected to Arduino UNO5VCOM1andCOM2connected to Power Inverter+NO1connected to LED bulb AC+NO2connected to Fan5VNC1,NC2,NC3,NC4,NO3,NO4not connected
LED bulb AC / Bombillo AC
+connected to Relay 4 Channel 5vNO1-connected to Power Inverter-
Power Inverter
+connected to MPPT SCCBATTERY+, Relay 4 Channel 5vCOM1andCOM2-connected to MPPT SCCBATTERY-, LED bulb AC-, and FanGND
Bluetooth HC-06
VCCconnected to Arduino UNO5VGNDconnected to common ground netTXDconnected to Arduino UNOD0RXDconnected to Arduino UNOD1
Arduino UNO
GNDconnected to common ground net5Vconnected to 12v to 5v Step Down Power Converter5v OUTPUT, Relay 4 Channel 5vVCC, PIR Motion SensorVCC, KY-015 DHT115V, Bluetooth HC-06VCC, and ESP8266 NodeMCUVIND0connected to Bluetooth HC-06TXDD1connected to Bluetooth HC-06RXDD2connected to KY-015 DHT11SD3connected to PIR Motion SensorOUTD5connected to Relay 4 Channel 5vIN1D6connected to Relay 4 Channel 5vIN2A0connected to Sensor LDR LM393A0A4connected to RTC DS3231SDAA5connected to RTC DS3231SCL
ESP8266 NodeMCU
VINconnected to Arduino UNO5VGNDconnected to common ground netRXconnected to Arduino UNOD1TXconnected to Arduino UNOD0- Other pins not connected
RTC DS3231
VCCconnected to Arduino UNO5VGNDconnected to common ground netSCLconnected to Arduino UNOA5SDAconnected to Arduino UNOA432K,SQWnot connected
Fan
5Vconnected to Relay 4 Channel 5vNO2GNDconnected to Power Inverter-
Documented Code
Arduino UNO Code (sketch.ino)
#include <DHT.h>
#include <Wire.h>
#include <RTClib.h>
#include <SoftwareSerial.h> // For Bluetooth
#define DHTPIN 2 // Pin connected to DHT11
#define DHTTYPE DHT11 // DHT 11 sensor
#define RELAY_LIGHT 3 // Pin connected to Relay for Light
#define RELAY_FAN 4 // Pin connected to Relay for Fan
#define LDR_PIN A0 // Pin connected to LDR
#define PIR_PIN 5 // Pin connected to PIR sensor
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor
RTC_DS3231 rtc; // Real-Time Clock instance
SoftwareSerial bluetooth(10, 11); // RX, TX for Bluetooth
void setup() {
Serial.begin(9600); // Start serial communication for debugging
bluetooth.begin(9600); // Start Bluetooth communication
// Initialize DHT sensor
dht.begin();
// Initialize relays as outputs
pinMode(RELAY_LIGHT, OUTPUT);
pinMode(RELAY_FAN, OUTPUT);
// Initialize PIR sensor as input
pinMode(PIR_PIN, INPUT);
// Initialize RTC
if (!rtc.begin()) {
Serial.println("Couldn't find RTC