Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino and GSM-Based Power Monitoring and Wi-Fi Controlled Lighting System

View and Edit Project In Cirkit DesignerImage of Arduino and GSM-Based Power Monitoring and Wi-Fi Controlled Lighting System

Circuit Documentation

Summary

The circuit in question is designed to monitor voltage and current using sensor modules, control lighting via relay modules, and communicate alerts and status through GSM and WiFi modules. It includes an Arduino Uno R3 as the central microcontroller, which processes sensor data and controls peripherals. The circuit features current sensors (ACS712), voltage sensors, LED bulbs for lighting, a circuit breaker for protection, an AC supply as the power source, a relay module for controlling the lights, a GSM module (sim 800l) for cellular communication, a WiFi module (ESP8266 ESP-01) for wireless connectivity, a mini AC-DC converter module, a TP4056 for battery charging, a step-up boost converter, and a 3.7V battery. Additionally, resistors are included for current limiting or voltage division as needed.

Component List

ACS712 Current Sensor

Voltage Sensor

LED Bulb AC

AC Supply

Circuit Breaker

5V 2-Relay Module (JD-VCC)

SIM800L GSM Module

Mini AC-DC 110V-230V to 5V 700mA Module

TP4056

Arduino Uno R3

ESP8266 ESP-01 WiFi Module

Step Up Boost 3V-5V

3.7V Battery

Resistor

Wiring Details

ACS712 Current Sensor

Voltage Sensor

LED Bulb AC

AC Supply

Circuit Breaker

5V 2-Relay Module (JD-VCC)

SIM800L GSM Module

Mini AC-DC 110V-230V to 5V 700mA Module

TP4056

ESP8266 ESP-01 WiFi Module

Step Up Boost 3V-5V

3.7V Battery

Resistor

Documented Code

Arduino Uno R3 Code

/*
 * This Arduino Sketch reads voltage and current from two sets of sensors,
 * calculates power, and sends alerts via GSM if power is below a threshold.
 * It also connects to WiFi using ESP-01 and controls lights via a relay module.
 */

#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>

// Pin definitions
#define VOLTAGE_SENSOR_1 A0
#define CURRENT_SENSOR_1 A1
#define VOLTAGE_SENSOR_2 A2
#define CURRENT_SENSOR_2 A3
#define RELAY_1 7
#define RELAY_2 8
#define GSM_TX 2
#define GSM_RX 3
#define ESP_TX 4
#define ESP_RX 5

// Predefined power values
const float PDF_power_1 = 500.0;
const float PDF_power_2 = 500.0;

// Threshold for alert
const float POWER_THRESHOLD = 400.0;

// GSM and WiFi credentials
const char* phoneNumber = "+237671693917";
const char* ssid = "suh";
const char* password = "davadeli2";

// Software serial for GSM and ESP
SoftwareSerial gsmSerial(GSM_RX, GSM_TX);
SoftwareSerial espSerial(ESP_RX, ESP_TX);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  gsmSerial.begin(9600);
  espSerial.begin(9600);

  // Initialize pins
  pinMode(RELAY_1, OUTPUT);
  pinMode(RELAY_2, OUTPUT);
  digitalWrite(RELAY_1, LOW);
  digitalWrite(RELAY_2, LOW);

  // Connect to WiFi
  connectToWiFi();
}

void loop() {
  // Read sensors
  float voltage1 = analogRead(VOLTAGE_SENSOR_1) * (5.0 / 1023.0);
  float current1 = analogRead(CURRENT_SENSOR_1) * (5.0 / 1023.0);
  float voltage2 = analogRead(VOLTAGE_SENSOR_2) * (5.0 / 1023.0);
  float current2 = analogRead(CURRENT_SENSOR_2) * (5.0 / 1023.0);

  // Calculate power
  float power1 = voltage1 * current1;
  float power2 = voltage2 * current2;

  // Check power and send alert if below threshold
  if (power1 < POWER_THRESHOLD)