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

Arduino and ESP8266-Based Battery Monitoring and Temperature Control System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino and ESP8266-Based Battery Monitoring and Temperature Control System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to monitor and display various parameters such as voltage, current, temperature, and fan status. It uses an Arduino UNO as the main microcontroller, interfaced with an ESP8266 WiFi module for wireless communication, multiple voltage sensors, a temperature sensor, a flame sensor, an INA219 current sensor, an LCD display, a buzzer, and a fan. The circuit is powered by three 3.7V batteries.

Component List

  1. ESP8266 ESP-12F WiFi Module

    • Description: WiFi module for wireless communication.
    • Pins: GND, GPIO15, GPIO2, GPIO0, GPIO4, GPIO5, RXD0, TXD0, RST, ADC0, EN, GPIO16, GPIO14, GPIO12, GPIO13, VCC, SCLK, MOSI, GPIO10, GPIO9, MISO, CS0
  2. 3.7V Battery

    • Description: Power source for the circuit.
    • Pins: +, -
  3. Arduino UNO

    • Description: Main microcontroller for the circuit.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  4. Voltage Sensor DC 25V

    • Description: Measures voltage up to 25V.
    • Pins: +, -, output, gnd, vcc
  5. MKE-S04 IR Infrared Flame Sensor

    • Description: Detects flame presence.
    • Pins: SIG, 5V, GND
  6. INA219

    • Description: Current sensor.
    • Pins: VCC, GND, SCL, SDA, VIN -, VIN +
  7. LED: Two Pin (red)

    • Description: Indicator LED.
    • Pins: cathode, anode
  8. Fan

    • Description: Cooling fan.
    • Pins: GND, 5V
  9. Rocker Switch

    • Description: On/Off switch.
    • Pins: 1, 2
  10. 16X2 LCD

    • Description: Displays information.
    • Pins: VSS, VDD, V0, RS, RW, E, D1, D0, D2, D3, D4, D6, D5, D7, A, K
  11. TEMP

    • Description: Temperature sensor.
    • Pins: 5V, D3, GND
  12. Buzzer

    • Description: Audible alert.
    • Pins: PIN, GND

Wiring Details

ESP8266 ESP-12F WiFi Module

3.7V Battery

Arduino UNO

Voltage Sensor DC 25V

MKE-S04 IR Infrared Flame Sensor

INA219

LED: Two Pin (red)

Fan

Rocker Switch

16X2 LCD

TEMP

Buzzer

Documented Code

#include <Wire.h>
#include <Adafruit_INA219.h>
#include <LiquidCrystal.h>
#include "DHT.h"

int vval;
int cnt=0;
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
Adafruit_INA219 ina219;
float R1 = 30000.0;  // Adjust these values if needed for correct scaling
float R2 = 7500.0;
// Reference voltage for ADC (use 3.3V for ESP8266)
float ref_voltage = 3.3;
#define DHTPIN 2      // DHT sensor pin
#define DHTTYPE DHT11 // DHT sensor type
DHT dht(DHTPIN, DHTTYPE);
int buz = 5;
int rly = 2;
int mot1 =A3;
int fs = 3;

void setup(void) {
  Serial.begin(9600);
  pinMode(mot1, OUTPUT);
  pinMode(rly, OUTPUT);
  pinMode(fs, INPUT);
  lcd.begin(16, 2);
  pinMode(buz, OUTPUT);
  digitalWrite(buz, 0);
  lcd.print("  WELCOME ");
  dht.begin();

  if (!ina219.begin()) {
    Serial.println("Failed to find INA219 chip");
    while (1) { delay(10); }
  }
}

void loop(void) {
  cnt++;
  // Read main voltage, current, power from INA219
  float shuntvoltage = ina219.getShuntVoltage_mV();
  float busvoltage = ina219.getBusVoltage_V();
  float current_mA = ina219.getCurrent_mA();
  float power