0% found this document useful (0 votes)
6 views4 pages

Intelligent Power Source Selector

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Intelligent Power Source Selector

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CHAPTER FOUR

DESIGN AND CONSTRUCTION OF AN INTELLIGENT POWER SOURCE


SELECTOR SWITCH USING GSM MODULE

CHAPTER FOUR: IMPLEMENTATION, TESTING AND DISCUSSION

4.7 Detailed Circuit Schematic Diagram


Here is the detailed schematic diagram description.

Circuit Components:
- Arduino Uno: Controls the switching logic.
- SIM800L GSM Module: Communicates with the Arduino over serial to receive SMS.
- Relays (2 x 12V): One relay for utility grid, one for backup generator.
- Transistor Drivers (2 x NPN - 2N2222): Used to drive relay coils from Arduino.
- Diodes (2 x 1N4007): Flyback diodes to protect transistors from back EMF.
- Resistors (2 x 1kΩ): Base resistors for transistors.
- Power Supply: 5V regulated supply for Arduino and relays; 4V-5V supply for GSM
module.
- Load: Your home or device powered by selected power source.

Explanation of Key Parts:

- Arduino to Relay Drivers:


Arduino digital pins 8 and 9 connect through 1kΩ resistors to the bases of 2N2222
transistors.
Emitters are grounded; collectors connect to relay coil negative terminals.
Positive relay coil terminals connected to 12V supply.
Diodes placed in parallel with relay coils (cathode to +12V, anode to collector) prevent
voltage spikes.

- Relay Outputs:
Relay 1 switches utility grid power; Relay 2 switches backup generator power.
Normally Open (NO) contacts connect each power source to the load.

- GSM Module Connection:


SIM800L RX connected to Arduino pin 7 (TX from Arduino SoftwareSerial).
SIM800L TX connected to Arduino pin 8 (RX to Arduino SoftwareSerial).
Power supply for SIM800L stabilized with a capacitor to handle current surges.
4.8 Complete Arduino Sketch (Code)
cpp
#include <SoftwareSerial.h>

SoftwareSerial gsmSerial(7, 8); // RX, TX pins for GSM

const int relayGridPin = 8;


const int relayGenPin = 9;

String incomingSMS = "";

void setup() {
[Link](9600);
[Link](9600);

pinMode(relayGridPin, OUTPUT);
pinMode(relayGenPin, OUTPUT);

// Default to grid power ON


digitalWrite(relayGridPin, HIGH);
digitalWrite(relayGenPin, LOW);

delay(1000);
[Link]("AT"); // Test communication
delay(500);
[Link]("AT+CMGF=1"); // SMS text mode
delay(500);
[Link]("AT+CNMI=2,2,0,0,0"); // SMS direct to serial
delay(500);
}

void loop() {
if ([Link]()) {
incomingSMS = [Link]();
[Link]("SMS Received: " + incomingSMS);
parseSMS(incomingSMS);
}
}

void parseSMS(String sms) {


[Link]();
if ([Link]("SWITCH TO GRID") >= 0) {
switchToGrid();
sendSMS("Power source switched to Utility Grid.");
} else if ([Link]("SWITCH TO GEN") >= 0) {
switchToGenerator();
sendSMS("Power source switched to Backup Generator.");
}
}

void switchToGrid() {
digitalWrite(relayGridPin, HIGH);
digitalWrite(relayGenPin, LOW);
[Link]("Switched to Utility Grid.");
}

void switchToGenerator() {
digitalWrite(relayGridPin, LOW);
digitalWrite(relayGenPin, HIGH);
[Link]("Switched to Backup Generator.");
}

void sendSMS(String msg) {


[Link]("AT+CMGF=1"); // Text mode
delay(100);
[Link]("AT+CMGS=\"+1234567890\""); // Replace with your phone number
delay(100);
[Link](msg);
delay(100);
[Link](26); // CTRL+Z to send
delay(500);
}

4.9 Hardware Component Details


| Component | Function | Notes
|
|----------------------|------------------------------------------------------|------------------------------
----------------------|
| Arduino Uno | Main controller for relay switching and GSM control | Popular
microcontroller, easy to program |
| SIM800L GSM Module | Receives and sends SMS to control power source |
Requires stable 4V-5V power supply, supports GSM bands |
| Relay (12V, SPDT) | Electrically switches the power source to load | Coil driven
by transistor, isolates MCU from high voltage |
| NPN Transistor (2N2222) | Acts as a switch to drive relay coil | Amplifies
MCU output current for relay coil |
| Diode (1N4007) | Protects transistor from voltage spikes | Placed across
relay coil in reverse bias |
| Resistors (1kΩ) | Limits current to transistor base | Protects transistor
and MCU pin |
| Power Supply | Powers microcontroller, relays, GSM module | Must handle
relay surge current, stable voltage |

4.10 Testing Procedures and Troubleshooting


4.10.1 Testing Procedure

1. Power up the system and check all connections.


2. Send SMS commands like “SWITCH TO GRID” or “SWITCH TO GEN” from a
registered phone.
3. Observe relay switching: Verify the relay clicks and that the power source changes.
4. Check SMS response: Confirm receipt of confirmation SMS.
5. Simulate power failure: Disconnect utility grid and observe automatic switch to
generator if implemented.
6. Verify SMS notification for automatic switching.

4.10.2 Troubleshooting Tips

| Problem | Possible Cause | Solution


|
|-----------------------------------|-----------------------------------------|------------------------------
------------------|
| GSM module not responding | Incorrect wiring or power supply issues | Check
RX/TX wiring, ensure 4V-5V stable supply |
| No SMS received by Arduino | GSM not set to text mode or no network | Send AT
commands manually, check SIM balance |
| Relay does not switch | Insufficient transistor base current | Verify resistor
values and transistor orientation |
| Arduino reset when relay activates | Power supply insufficient or noisy | Use separate
power supplies or add capacitors |
| SMS confirmation not sent | Incorrect phone number or AT command | Verify
phone number format and command syntax |

Common questions

Powered by AI

Software serial is used in the Arduino sketch for handling SMS because the Arduino Uno has only one hardware serial port, which is typically used for debugging via the serial monitor. Software serial allows communication over different pins without conflicts, enabling simultaneous debugging and GSM communication .

The SMS-based control mechanism provides a straightforward method for remote operation, leveraging existing mobile networks. However, it may suffer from latency and potential service outages. Introducing an IoT-based control mechanism using cloud services could enhance real-time interaction and reliability by offering more robust and responsive control options .

The Arduino Uno serves as the main controller in the intelligent power source selector switch design, orchestrating the switching logic between power sources based on input received from the GSM module. Its advantages include ease of programming and its widespread popularity, making it an accessible choice for developers .

Relays function as switches that control the connection of either the utility grid or the backup generator to the load. Flyback diodes are placed in parallel with relay coils to prevent voltage spikes from damaging transistors by providing a path for induced current when the relay is de-energized .

Design considerations for reliable relay switching include ensuring adequate insulation and isolation for voltage and current levels, using flyback diodes to protect against voltage spikes, and selecting relays with sufficient contact ratings. Furthermore, incorporating redundancy, robust power supplies to handle surges, and weather-proofing for external environments enhances overall reliability in dynamic power conditions .

Transistor drivers, specifically NPN-type in this design, act as switches to control the relay coils. NPN transistors are used because they can effectively amplify the small current from the Arduino to a sufficient level to drive the relay coils, providing necessary isolation between the low-voltage Arduino and high-voltage relay control circuits .

A regulated power supply is crucial to ensure all components receive consistent voltage levels, essential for the stable operation of the Arduino, GSM module, and relays. Unregulated power supplies can introduce noise and voltage fluctuations, potentially causing system resets or erratic behavior, which can compromise system reliability .

The troubleshooting steps include checking the RX/TX wiring and ensuring a stable 4V-5V power supply. These are effective because incorrect wiring or inadequate power are common issues that can prevent the GSM module from functioning correctly. Additionally, these steps address basic connectivity problems, which are often the simplest root causes to diagnose and fix .

The SIM800L GSM Module connects to the Arduino via SoftwareSerial, with its RX connected to Arduino pin 7 and TX to pin 8, enabling it to send and receive SMS commands. For reliable operation, it requires a stable 4V-5V power supply and a capacitor for handling current surges .

The testing procedure includes sending SMS commands to manually request switching, observing relay performance, and simulating utility grid failures to verify automatic switching to backup power. This comprehensive approach ensures both manual control and automated responses are assessed for functionality, response timing, and reliability .

You might also like