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

Arduino-Based Anti-Electric Shock Device with ACS712 Current Sensors and Relay Control

View and Edit Project In Cirkit DesignerImage of Arduino-Based Anti-Electric Shock Device with ACS712 Current Sensors and Relay Control

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to monitor and control electrical currents using ACS712 current sensors, an Arduino UNO microcontroller, and a 5V relay. The circuit includes a power supply, a 12V fan, and a 5V battery. The Arduino UNO reads current values from the sensors and controls the relay based on predefined thresholds to prevent electric shock.

Component List

  1. ACS712 Current Sensor 5A 20A 30A

    • Description: Current sensor module capable of measuring up to 30A.
    • Pins: 1, 2, GND, OUT, VCC
  2. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • 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
  3. 5V Battery

    • Description: Power source providing 5V.
    • Pins: positive, negative
  4. POWER SUPPLY 5V 5AMP

    • Description: Power supply unit providing 5V at 5A.
    • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
  5. Power 220V

    • Description: 220V AC power source.
    • Pins: hot wire, neutral wire
  6. 40 Fan 12V

    • Description: 12V fan for cooling purposes.
    • Pins: +12V, -12V
  7. 5V Relay

    • Description: Relay module for switching circuits.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC

Wiring Details

ACS712 Current Sensor 5A 20A 30A (Instance 1)

ACS712 Current Sensor 5A 20A 30A (Instance 2)

Arduino UNO

5V Battery

POWER SUPPLY 5V 5AMP

Power 220V

40 Fan 12V

5V Relay

Documented Code

#include <Relay.h> // Include relay library (if needed)

const int phaseCurrentPin = A0;  // Pin for phase current sensor (ACS712)
const int neutralCurrentPin = A1;  // Pin for neutral current sensor (ACS712)
const int relayPin = 7;  // Pin to control the relay (connected to relay module)

float phaseCurrent = 0;
float neutralCurrent = 0;
float phaseThreshold = 1.5;  // Threshold for phase current (in amps)
float neutralThreshold = 1.5;  // Threshold for neutral current (in amps)

// Calibration values for the ACS712 sensors (assuming 5V reference)
float offset = 2.5; // Middle value for ACS712 at no current, depends on your sensor
float sensitivity = 0.185;  // For ACS712 5A model, the sensitivity is 0.185V per Amp (check datasheet)

void setup() {
  Serial.begin(9600);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH);  // Start with relay off (active low relay)
  
  // Print initial message
  Serial.println("Anti-Electric Shock Device initialized");
}

void loop() {
  // Read analog values from both current sensors
  int phaseReading = analogRead(phaseCurrentPin);
  int neutralReading = analogRead(neutralCurrentPin);

  // Convert sensor readings to voltage (assuming 5V ADC and 10-bit resolution)
  float phaseVoltage = (phaseReading * 5.0) / 1024.0;
  float neutralVoltage = (neutralReading * 5.0) / 1024.0;

  // Calculate the current from the sensor voltage
  phaseCurrent = (phaseVoltage - offset) / sensitivity;
  neutralCurrent = (neutralVoltage - offset) / sensitivity;

  // Output the measured currents to the serial monitor
  Serial.print("Phase Current: ");
  Serial.print(phaseCurrent);
  Serial.print(" A, ");
}

This code initializes the Arduino UNO to read current values from two ACS712 sensors and control a relay based on predefined current thresholds. The relay is used to prevent electric shock by disconnecting the circuit when the current exceeds the threshold.