This guide will help you create an IoT-based smart circuit breaker using Raspberry Pi. The system will monitor electrical circuits and allow you to control them remotely to ensure safety and automate circuit management.

Components Required

  • Raspberry Pi (Model 3 or later)
  • Relay module (for controlling the circuit breaker)
  • Current sensor (e.g., ACS712 for measuring current)
  • Connecting wires and breadboard
  • Power supply (for Raspberry Pi)
  • Cloud service account (e.g., ThingSpeak, Blynk, or AWS IoT)
  • Optional: Circuit breaker switch or automation device

Setting Up the Hardware

Follow these steps to set up the hardware:

  1. Connect the Current Sensor

    Attach the current sensor to the Raspberry Pi using GPIO pins. This sensor will measure the current flowing through the circuit, helping to detect overcurrent situations.

  2. Integrate the Relay Module

    Connect the relay module to the Raspberry Pi. The relay will be used to control the circuit breaker by switching it on or off based on the sensor readings.

  3. Power the System

    Ensure the Raspberry Pi and all connected components are properly powered using appropriate power supplies.

Programming the Raspberry Pi

Write the code to read data from the current sensor and control the relay. Below is a basic outline of the code using Python:


                import RPi.GPIO as GPIO
                import time
                import requests

                # Configuration
                CURRENT_SENSOR_PIN = 17
                RELAY_PIN = 23
                CLOUD_URL = "https://api.thingspeak.com/update?api_key=YOUR_API_KEY"
                OVERCURRENT_THRESHOLD = 5.0  # Example threshold in amperes

                # Setup
                GPIO.setmode(GPIO.BCM)
                GPIO.setup(CURRENT_SENSOR_PIN, GPIO.IN)
                GPIO.setup(RELAY_PIN, GPIO.OUT)

                def read_current():
                    # Example function to read current (replace with actual sensor code)
                    return 0.0  # Replace with actual current reading

                def send_data_to_cloud(current):
                    response = requests.get(f"{CLOUD_URL}&field1={current}")
                    print(f"Data sent to cloud: {response.status_code}")

                def control_circuit(current):
                    if current > OVERCURRENT_THRESHOLD:
                        GPIO.output(RELAY_PIN, GPIO.HIGH)  # Open circuit breaker
                    else:
                        GPIO.output(RELAY_PIN, GPIO.LOW)   # Close circuit breaker

                try:
                    while True:
                        current = read_current()
                        print(f"Current measured: {current} A")
                        
                        control_circuit(current)
                        send_data_to_cloud(current)
                        time.sleep(60)  # Wait 1 minute before next update

                except KeyboardInterrupt:
                    GPIO.cleanup()
            

This code monitors the current sensor readings. If the current exceeds a set threshold, it triggers the relay to open the circuit breaker and sends data to the cloud service.

Setting Up Cloud Integration

To monitor and control the circuit remotely, integrate the system with a cloud service. Configure the cloud service to receive data from the Raspberry Pi and set up dashboards or alerts based on the current readings.

Testing and Calibration

Test the system by simulating overcurrent conditions and verifying that the circuit breaker operates correctly. Ensure that the data is accurately reported to the cloud and adjust the sensor sensitivity and code parameters as needed for reliable performance.

Conclusion

The IoT-based circuit breaker project provides an advanced solution for monitoring and controlling electrical circuits. By integrating current sensors with Raspberry Pi and cloud services, you can enhance safety, automate circuit management, and ensure reliable operation.