

The circuit in question is designed to control a series of relays, interface with an IR receiver, and communicate via a SIM800L GSM module. It is powered by a 12V battery, which is also connected to a solar panel and a battery charger for energy sustainability. The circuit includes a step-down converter to provide the necessary 5V power to some of the components. User interaction is facilitated through pushbuttons and an IR receiver, allowing for manual control and remote control, respectively. The Arduino UNO serves as the central microcontroller, managing the inputs from the IR receiver and pushbuttons, controlling the relays, and communicating with the SIM800L module for call and SMS handling.
3.3V connected to SIM800L VCC.5V connected to 12V to 5V Step Down Power Converter GND, Relay 4 Channel 5V VCC, and VS1838B IR Receiver VCC.GND connected to SIM800L GND, VS1838B IR Receiver GND, and 12V to 5V Step Down Power Converter 5V OUTPUT.D13 connected to Relay 4 Channel 5V IN1.D12 connected to Relay 4 Channel 5V IN2.D11 connected to Relay 4 Channel 5V IN3.D10 connected to Relay 4 Channel 5V IN4.D8 connected to Pushbutton Pin 1.D7 connected to Pushbutton Pin 1.D6 connected to Pushbutton Pin 1.D5 connected to Pushbutton Pin 1.D4 connected to VS1838B IR Receiver OUT.D3 connected to SIM800L RXD.D2 connected to SIM800L TXD.GND connected to 12V to 5V Step Down Power Converter VIN+.COM1, COM2, and COM4 connected to 12V Battery (Mini) +.COM3 connected to Water Pump Negative.NC1 connected to Water Pump Positive.NC2, NC3, and NC4 connected to Bulb +VE.GND connected to Arduino UNO GND.VCC connected to Arduino UNO 3.3V.RXD connected to Arduino UNO D3.TXD connected to Arduino UNO D2.OUT connected to Arduino UNO D4.GND connected to Arduino UNO GND.VCC connected to Arduino UNO 5V.Pin 1 of each pushbutton connected to Arduino UNO D8, D7, D6, and D5 respectively.Pin 2 of all pushbuttons interconnected.Positive connected to Relay 4 Channel 5V NC1.Negative connected to 12V to 5V Step Down Power Converter VIN-.+ connected to Relay 4 Channel 5V COM1, COM2, and COM4.- connected to 12V to 5V Step Down Power Converter VIN-.+ connected to 12V Battery Charger.- connected to 12V Battery Charger.VIN 9V-36V and VIN+ connected to 12V Battery (Mini) +.VIN- connected to Water Pump Negative and 12V Battery (Mini) -.5V OUTPUT connected to Relay 4 Channel 5V GND.V+ connected to 12V Battery (Mini) +.V- connected to 12V Battery (Mini) -.+VE connected to Relay 4 Channel 5V NC2, NC3, and NC4._VE interconnected among all bulbs./*
* ******************************************************************
* Created By: Tauseef Ahmad
* Created On: September 25, 2021
* Tutorial Link: https://youtu.be/uLJqNfX81C4
* My Channel: https://www.youtube.com/channel/UCOXYfOHgu-C-UfGyDcu5sYw/
*
* ******************************************************************
* IR Remote Version 3.3.0
* https://github.com/Arduino-IRremote/Arduino-IRremote
* ******************************************************************
*/
#include <SoftwareSerial.h>
#include <IRremote.h>
//sender phone number with country code
const String PHONE = "ENTER_YOUR_PERSONAL_PHONE_NUMBER";
String smsStatus,senderNumber,receivedDate,msg,buff;
boolean isReply = false;
String dtmf_cmd;
boolean is_call = false;
#define rxPin 2
#define txPin 3
SoftwareSerial sim800L(rxPin,txPin);
const byte IR_RECEIVE_PIN = 4;
#define button1_pin 5
#define button2_pin 6
#define button3_pin 7
#define button4_pin 8
#define relay1_pin 9
#define relay2_pin 10
#define relay3_pin 11
#define relay4_pin 12
boolean relay1_state = 0;
boolean relay2_state = 0;
boolean relay3_state = 0;
boolean relay4_state = 0;
void setup()
{
pinMode(button1_pin, INPUT_PULLUP);
pinMode(button2_pin, INPUT_PULLUP);
pinMode(button3_pin, INPUT_PULLUP);
pinMode(button4_pin, INPUT_PULLUP);
pinMode(relay1_pin, OUTPUT);
pinMode(relay2_pin, OUTPUT);
pinMode(relay3_pin, OUTPUT);
pinMode(relay4_pin, OUTPUT);
Serial.begin(115200);
Serial.println("IR Receive test");
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
sim800L.begin(9600);
sim800L.print("AT+CMGF=1\r");
delay(1000);
sim800L.println("AT+DDET=1"); //Enable DTMF
delay(500);
smsStatus = "";
senderNumber="";
receivedDate="";
msg="";
}
void loop()
{
//****************************************
while(sim800L.available()){
buff = sim800L.readString();
handle_sim800_response();
}
//****************************************
while(Serial.available()) {
sim800L.println(Serial.readString());
}
//****************************************
listen_ir();
listen_push_buttons();
}
void handle_sim800_response()
{
Serial.println(buff);
//MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
if(is_call == true){
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
if(int index = buff.indexOf("+DTMF:") > -1 ){
index = buff.indexOf(":");
dtmf_cmd = buff.substring(index+1, buff.length());
dtmf_cmd.trim();
Serial.println("dtmf_cmd: "+dtmf_cmd);
if(dtmf_cmd == "1") control_relay(1);
else if(dtmf_cmd == "2") control_relay(2);
else if(dtmf_cmd == "3") control_relay(3);
else if(dtmf_cmd == "4") control_relay(4);
}
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
if(buff.indexOf("NO CARRIER") > -1){
sim800L.println("ATH");
is_call = false;
}