0% found this document useful (0 votes)
23 views

220V Appliances Interfacing Arduino

This document describes an Arduino code to control 220V appliances using a switch and provide feedback on the appliance status. The code uses an Arduino, switch input pin, output pin connected to the appliance, and light dependent resistor to sense if the appliance is on or off. It sends SMS notifications using a GSM module to notify the status when the switch state changes.

Uploaded by

Eysha qureshi
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)
23 views

220V Appliances Interfacing Arduino

This document describes an Arduino code to control 220V appliances using a switch and provide feedback on the appliance status. The code uses an Arduino, switch input pin, output pin connected to the appliance, and light dependent resistor to sense if the appliance is on or off. It sends SMS notifications using a GSM module to notify the status when the switch state changes.

Uploaded by

Eysha qureshi
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
You are on page 1/ 5

220V appliances with Arduino and switch:

Arduino code:

const int inputpin = 7;


const int outputPin = 8;

// variables will change:


int buttonState = 0; // variable for reading the pushbutton status

void setup() {

pinMode(outputPin, OUTPUT);

pinMode(inputpin, INPUT);
}

void loop() {

buttonState = digitalRead(inputpin);

if (buttonState == HIGH) {

digitalWrite(outputPin, HIGH);
} else {

digitalWrite(outputPin, LOW);
}
}
220V appliances with Arduino and switch (Feedback status of appliances):

#include<SoftwareSerial.h>

#include<String.h>

SoftwareSerial mySerial(2,3);

int sensorPin = A0; // select the input pin for the LDR

int sensorValue = 0;

const int inputpin = 7;

const int outputPin = 8;

// variables will change:

int buttonState = 0; // variable for reading the pushbutton status

int lastButtonState = 0;

void setup() {

mySerial.begin(9600);

Serial.begin(9600);

pinMode(outputPin, OUTPUT);

pinMode(inputpin, INPUT);

void loop() {

buttonState = digitalRead(inputpin);

if (buttonState != lastButtonState)

if (buttonState == HIGH) {
digitalWrite(outputPin, HIGH);

} else {

digitalWrite(outputPin, LOW);

delay(1000);

sensorValue = analogRead(sensorPin);

Serial.println(sensorValue);

if (sensorValue > 600)

mySerial.print("AT+CMGF=1\r");

delay(300);

mySerial.println("AT+CMGS=\"+9233615*****\"");

delay(300);

mySerial.println("Feedback notification: your bulb is now on");

delay(300);

mySerial.println((char)26);

delay(300);

mySerial.println();

else{

mySerial.print("AT+CMGF=1\r");

delay(300);

mySerial.println("AT+CMGS=\"+9233615*****\"");

delay(300);
mySerial.println("Feedback notification: your bulb is now offf");

delay(300);

mySerial.println((char)26);

delay(300);

mySerial.println();

delay(sensorValue);

lastButtonState = buttonState;

You might also like