Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
×1
Atmel ATMega328
×1
Stmicroelectronics l7805cv image
Linear Regulator (7805)
×1
11026 02
Jumper wires (generic)
×20
Mfr 25frf52 10k sml
Resistor 10k ohm
×5
Mfr 25frf52 1k sml
Resistor 1k ohm
×5
Kemet c315c220k1g5ta image
Capacitor 22 pF
×6
160 20
16 MHz Crystal
×3
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
×3
09590 01
LED (generic)
×6
Panasonic eca1hm2r2
Capacitor 10 µF
×6
Panasonic eca 1hm471 image
Capacitor 470 µF
×3
Terminal Blocks
×1
Adafruit industries ada80 image 75px
9V to Barrel Jack Connector
×1
SparkFun DC Female Jack
×1
R8326274 01
Raspberry Pi 2 Model B
×1
Relay (generic)
×1
Software apps and online services:
Ide web
Arduino IDE
webiopi
Vs2015logo
Microsoft Visual Studio 2015
Microsoft Windows Speech Recognition Macros
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)
PCB Milling Machine

Schematics

ATmega328 based slaves
This is a schematic file. Which is supported in eagle or other PCB designing softwares.
Slave Chips.sch
ATmega 328 based PCB board
This is PCB board, which may be supported in Eagle or other PCB designing software.
Slave Board.brd

Code

Master CodeC/C++
This is master arduino code.
int state;
#include <Wire.h>
#include <Password.h> 
#include <Keypad.h>

Password password = Password( "1234" );

const byte ROWS = 4; // Four rows
const byte COLS = 4; // columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 2, 3, 4, 5 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 6, 7, 8, 9 };


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );


void setup() {
 Serial.begin(9600);
 delay(200);
 pinMode(13, OUTPUT);  
 keypad.addEventListener(keypadEvent);
 Wire.begin(); // join i2c bus (address optional for master)
}


void loop() 
{

keypad.getKey();
state = Serial.read();
switch(state)
{
  
  // Drawing room controlling, device id 1
  
  case '1':                   //Drawing Room Fan On
  Wire.beginTransmission(1);
  Wire.write("1");
  Wire.endTransmission();
  delay(500);
  break;

  case '2':                  //Drawing room Light on
  Wire.beginTransmission(1);
  Wire.write("2");
  Wire.endTransmission();
  delay(500);
  break;

  case '3':                  //Drawing room Curtain open
  Wire.beginTransmission(1);
  Wire.write("3");
  Wire.endTransmission();
  delay(500);
  break;
  
  case '4':                  //Drawing room Fan off
  Wire.beginTransmission(1);
  Wire.write("4");
  Wire.endTransmission();
  delay(500);
  break;

  case '5':                  // Drwaing room light off
  Wire.beginTransmission(1);
  Wire.write("5");
  Wire.endTransmission();
  delay(500);
  break;

  case '6':                  //Drawing room curtain off
  Wire.beginTransmission(1);
  Wire.write("6");
  Wire.endTransmission();
  delay(500);
  break;

  // Bed room controlling , device id 2
  
  case '7':                   //Bed Room Fan On
  Wire.beginTransmission(2);
  Wire.write("1");
  Wire.endTransmission();
  delay(500);
  break;

  case '8':                  //Bed room Light on
  Wire.beginTransmission(2);
  Wire.write("2");
  Wire.endTransmission();
  delay(500);
  break;

  case '9':                  //Bed room Curtain open
  Wire.beginTransmission(2);
  Wire.write("3");
  Wire.endTransmission();
  delay(500);
  break;
  
  case 'A':                  //Bed room Fan off
  Wire.beginTransmission(2);
  Wire.write("4");
  Wire.endTransmission();
  delay(500);
  break;

  case 'B':                  // Bed room light off
  Wire.beginTransmission(2);
  Wire.write("5");
  Wire.endTransmission();
  delay(500);
  break;

  case 'C':                  //Bed room curtain off
  Wire.beginTransmission(2);
  Wire.write("6");
  Wire.endTransmission();
  delay(500);
  break;


  // Kitchen controlling
  
  case 'D':                   //Kitchen Fan On
  Wire.beginTransmission(3);
  Wire.write("1");
  Wire.endTransmission();
  delay(500);
  break;

  case 'E':                  //KitchenLight on
  Wire.beginTransmission(3);
  Wire.write("2");
  Wire.endTransmission();
  delay(500);
  break;

  case 'F':                  //Kitchen Curtain open
  Wire.beginTransmission(3);
  Wire.write("3");
  Wire.endTransmission();
  delay(500);
  break;
  
  case 'G':                  //Kitchen Fan off
  Wire.beginTransmission(3);
  Wire.write("4");
  Wire.endTransmission();
  delay(500);
  break;

  case 'H':                  // Kitchen light off
  Wire.beginTransmission(3);
  Wire.write("5");
  Wire.endTransmission();
  delay(500);
  break;

  case 'I':                  //Kitchen curtain off
  Wire.beginTransmission(3);
  Wire.write("6");
  Wire.endTransmission();
  delay(500);
  break;

  
}
}

void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
  case PRESSED:
  
  Serial.print("Enter:");
  Serial.println(eKey);
  delay(10);
  
 
  
  switch (eKey){
    case '*': checkPassword(); delay(1); break;
    
    case '#': password.reset(); delay(1); break;
    
     default: password.append(eKey); delay(1);
}
}
}

void checkPassword(){
  
if (password.evaluate()){  //if password is right open
    
    Serial.println("Accepted");
    delay(10);
    //Add code to run if it works
    digitalWrite(13, LOW);//turn on
    
    
}else{
    Serial.println("Denied"); //if passwords wrong keep locked
  delay(10);
    //add code to run if it did not work
    digitalWrite(13, HIGH); //turn on
    
}
}
Second slave codeC/C++
We are using total three slaves. ut I am just uploading only first slave's code, because other slaves have just same code except NODE_ADDRESS.
#include <Wire.h>

#define NODE_ADDRESS 2  // For 1st slave, it is 1 and for third slave it is 3 
#define PAYLOAD_SIZE 2 

byte nodePayload[PAYLOAD_SIZE];
int t;
void setup()
{

  Serial.begin(9600);
  Serial.println("System made by K.V.J");
  Serial.print("Node address: ");
  Serial.println(NODE_ADDRESS);
  Serial.print("Payload size: ");
  Serial.println(PAYLOAD_SIZE);
  Serial.println("***********************");
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  Wire.begin(NODE_ADDRESS);  
  Wire.onReceive(receiveEvent); 
}

void loop()
{
  delay(100);
}


void receiveEvent(int howMany)
{
  t = Wire.read();    
  Serial.println(t);

  if (t == 49)
  {
    digitalWrite(2, HIGH);
  }

  else if (t == 50)
  {
    digitalWrite(3, HIGH);
  }



  else if (t == 51)
  {
    digitalWrite(4, HIGH);
  }


  else if (t == 52)
  {
    digitalWrite(2, LOW);
  }

  else if (t == 53)
  {
    digitalWrite(3, LOW);
  }



  else if (t == 54)
  {
    digitalWrite(4, LOW);
  }




}

Credits

Cachedimage 1366 768 pos0 c5vivntill
Keval Pankhaniya
1 project • 5 followers
cout << "Electronics Enthusiastic" <<endl;
Contact
D348e5ed8bc1368bc9f20131de698e53
Jainam shah
1 project • 1 follower
Contact
E388945aba84093f54d74e7687330d02
Viraj rawal
1 project • 1 follower
I am working at Hitachi -Hirel power Electronics Pvt. Ltd as Research and Development Engineer since june 2016
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog