Home /Office Automatioin with Arduino control
and without Arduino control update
Previous version of article Here

The system can also control lights in the home/office based on the natural light. The lights will also be motion activated meaning that the lights will only be on when people are in the area. The system will be easy to use as well as cost effective. The power for this system will be provided by the mains but in future by renewable energy. The renewable energy that will be used in this system is solar power via solar panels.
Parts List
· Arduino Nano
· Android Cell phone
· AC-DC power adapter, 9v @0.5a
· Project Case
· 1 x 10Kohm Potentiometer
· HC-05 Bluetooth Module
· Relay Module
Tools Required
· Soldering iron and solder
· Power Supply
· Wire stripper
· Computer loaded with the Arduino IDE
Features
5 mechanical relays with status indicator LED
Both “NC” and “NO” ports for each relay
Specifications
Module Type: Control
Weight: 130.00g
Board Size: 9.1 x 7.2 x 2cm
Version: 1.1
Operation Level: Digital 5V
Power Supply: External 12V
(you can only use for relay IC Power and arduino power with the help of 7805)
(you can only use for relay IC Power and arduino power with the help of 7805)
Method of using the relay module
The power source is connected to the input circuit of the relay. When a small current flows in this circuit, the relay will activate its output circuit, allowing a much bigger current to flow which will switch on the electrical appliances. By connecting the power source to the input of the relay and the electrical appliance is required to be active it must be connected to the normally open pin (NO), otherwise it should be connected to the normally closed pin (NC).
Features:
· Epoxy encapsulated
· Small dimensions
· Operating temperature -25°C-+75°C.
Applications:
· Contrast control in TV sets
· Auto flash for cameras
· Room light control
· Electronic toys
· Industrial control
You can control appliances with andriod app or simply Push Button
Code:
// Prepare by Iteam.coLiquidCrystal lcd(A0, A1, A2, A3, A4, A5); //_____________Button 1 start int stateRelay1 = LOW; int stateButton1; int previous1 = LOW; long time1 = 0; long debounce1 = 500; //_____________Button 1 End //_____________Button 2 start int stateRelay2 = LOW; int stateButton2; int previous2 = LOW; long time2 = 0; long debounce2 = 500; //_____________Button 2 End //_____________Button 3 start int stateRelay3 = LOW; int stateButton3; int previous3 = LOW; long time3 = 0; long debounce3 = 500; //_____________Button 3 End //_____________Button 4 start int stateRelay4 = LOW; int stateButton4; int previous4 = LOW; long time4 = 0; long debounce4 = 500; //_____________Button 4 End //_____________Button 5 start int stateRelay5 = LOW; int stateButton5; int previous5 = LOW; long time5 = 0; long debounce5 = 500; //_____________Button 5 End //_____________Button ALL start int stateRelay6 = LOW; int previous6 = LOW; //_____________Button ALL End long tem=0; char junk; String inputString=""; void setup() { digitalWrite(12, HIGH); Serial.begin(9600); pinMode(2, INPUT); pinMode(9, OUTPUT); pinMode(3, INPUT); pinMode(10, OUTPUT); pinMode(4, INPUT); pinMode(11, OUTPUT); pinMode(5, INPUT); pinMode(12, OUTPUT); pinMode(6, INPUT); pinMode(13, OUTPUT); pinMode(8, OUTPUT); lcd.begin(16,2); lcd.print("Powered By"); lcd.setCursor(0,1); lcd.print(" Iteam.co "); delay(2000); lcd.clear(); lcd.begin(16,2); lcd.print(" In the Name of"); lcd.setCursor(0,1); lcd.print(" ALLAH "); delay(2000); lcd.clear(); lcd.print(" Most Beneficent"); lcd.setCursor(0,1); lcd.print(" & Merciful "); delay(2000); lcd.clear(); lcd.print(" Start Working "); lcd.setCursor(0,1); for(int i=1;i<16;i++) {lcd.print("."); delay(200);} lcd.clear(); lcd.begin(16,2); lcd.print(" Waiting Signal "); } void loop() { if (tem==10000) { if(stateRelay1 == HIGH) { lcd.setCursor(0,1); lcd.print(" Switch 1 ON "); } } else if (tem==15000) { if(stateRelay2 == HIGH) { lcd.setCursor(0,1); lcd.print(" Switch 2 ON "); } } else if (tem==20000) { if(stateRelay3 == HIGH) { lcd.setCursor(0,1); lcd.print(" Switch 3 ON "); } } else if (tem==25000) { if(stateRelay4 == HIGH) { lcd.setCursor(0,1); lcd.print(" Switch 4 ON "); } } else if (tem==30000) { if(stateRelay5 == HIGH) { lcd.setCursor(0,1); lcd.print(" Switch 5 ON "); } tem=0; } //Serial.print(tem); //Serial.println(); tem++; if(Serial.available()){ while(Serial.available()) {char inChar = (char)Serial.read(); inputString += inChar; } Serial.println(inputString); while (Serial.available() > 0) { junk = Serial.read() ; } if(inputString == "0") { if(stateRelay1 == HIGH) {stateRelay1 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 1 OFF "); } else {stateRelay1 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 1 ON "); } digitalWrite(9, stateRelay1); } else if(inputString == "1") { if(stateRelay2 == HIGH) {stateRelay2 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 2 OFF "); } else {stateRelay2 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 2 ON "); } digitalWrite(10, stateRelay2); } else if(inputString == "2") { if(stateRelay3 == HIGH) {stateRelay3 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 3 OFF "); } else {stateRelay3 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 3 ON "); } digitalWrite(11, stateRelay3); } else if(inputString == "3") { if(stateRelay4 == HIGH) {stateRelay4 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 4 OFF "); } else {stateRelay4 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 4 ON "); } digitalWrite(12, stateRelay4); } else if(inputString == "4") { if(stateRelay5 == HIGH) {stateRelay5 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 5 OFF "); } else {stateRelay5 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 5 ON "); } digitalWrite(13, stateRelay5); } inputString = ""; } //-------------Button 1 Start stateButton1 = digitalRead(2); if(stateButton1 == HIGH && previous1 == LOW && millis() - time1 > debounce1) { if(stateRelay1 == HIGH) {stateRelay1 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 1 OFF "); } else {stateRelay1 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 1 ON "); } time1 = millis(); } digitalWrite(9, stateRelay1); previous1 == stateButton1; //-------------Button 1 End //-------------Button 2 Start stateButton2 = digitalRead(3); if(stateButton2 == HIGH && previous2 == LOW && millis() - time2 > debounce2) { if(stateRelay2 == HIGH) {stateRelay2 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 2 OFF "); } else {stateRelay2 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 2 ON "); } time2 = millis(); } digitalWrite(10, stateRelay2); previous2 == stateButton2; //-------------Button 2 End //-------------Button 3 Start stateButton3 = digitalRead(4); if(stateButton3 == HIGH && previous3 == LOW && millis() - time3 > debounce3) { if(stateRelay3 == HIGH) {stateRelay3 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 3 OFF "); } else {stateRelay3 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 3 ON "); } time3 = millis(); } digitalWrite(11, stateRelay3); previous3== stateButton3; //-------------Button 3 End //-------------Button 4 Start stateButton4 = digitalRead(5); if(stateButton4 == HIGH && previous4 == LOW && millis() - time4 > debounce4) { if(stateRelay4 == HIGH) {stateRelay4 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 4 OFF "); } else {stateRelay4 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 4 ON "); } time4 = millis(); } digitalWrite(12, stateRelay4); previous4== stateButton4; //-------------Button 4 End //-------------Button 5 Start stateButton5 = digitalRead(6); if(stateButton5 == HIGH && previous5 == LOW && millis() - time5 > debounce5) { if(stateRelay5 == HIGH) {stateRelay5 = LOW; lcd.setCursor(0,1); lcd.print(" Switch 5 OFF "); } else {stateRelay5 = HIGH; lcd.setCursor(0,1); lcd.print(" Switch 5 ON "); } time5 = millis(); } digitalWrite(13, stateRelay5); previous5== stateButton5; //-------------Button 5 End }
#include <LiquidCrystal.h>
Comments
Post a Comment