Esam Radwan
Created February 15, 2016

Smart Plugin

Electrical plugin that can be controlled by mobile phone.

EasyShowcase (no instructions)3 hours504
Smart Plugin

Things used in this project

Story

Read more

Code

Simple code and connections are written

Arduino
- Arduino Uno.
- Oneshield board.
- Oneshield mobile application. (install from here)
- Male and Female plugs.
- Relay.
- 3 Male female wires.
- high rating 1 m wire.
- Suitable case for the plugin.
- Put the Shield on the arduino Uno.
- Read the instructions of how to upload a code on the shield.(from here).
- Download the library of Oneshield from here and put it inside the directory of Arduino on your PC (Default : C:\Users\Essam Radwan\Documents\Arduino\libraries)
- Upload the attached simple arduino-Oneshield code.
After installing the app, Open it.
- Choose Scan. It may require to open the Bluetooth.
- Choose the available set from Bluetooth menu.
- You will be required to enter pairing password which is by default 1234.
- Choose toggle button shield.
- Connect a small led to Pin 13 and the ground. Then try to make the toggle button on and off.
- You should now see the led as if it is blinking.
- Connect Pin 13 to signal of the relay using male female wire.
- Connect Pin 5V from arduino to Pin Vcc in the relay using male female wire.
- Connect the Ground of the arduino to the ground of the relay using male female wire.

- Connect the Common (COM) of the Relay to the Male plug with 0.5 m wire and the other terminal of the plug to the female plug. Eventually the ground terminal of the female plug should be connected to the Normal open terminal (NO) with the 0.1 m wire.

All these steps are done to the arduino while attaching the shield to it. Therefore, Therefore the wiring will be with the shield not the arduino it self.
Casing :

- Put the arduino - Shield and the relay inside the box.
- Make the male plug out side the box with 0.3 m free wire.
- Adjust the female plug to be immersed in the cover of the box.

Trails :

- Put the male plug to an electric source plug.
- Try your mobile phone app and connect any thing to be tested to the female plug.
If its operation can be controlled using the toggle button, then you have your own smart plugin
int buttonPin = 12;                  // The default of toggle button pin
int buttonsig = 13;                   // Out put pin 

void setup() 
{
  pinMode(buttonPin,INPUT);             // Define P12 as an input 
  pinMode(buttonsig, OUTPUT);          // Define P13 as an output
}

void loop() 
{
  if (digitalRead(buttonPin) == HIGH)        // If the button is on 
  { 
       digitalWrite(buttonsig, HIGH);         // Set the out put high (Plug is on)
       
  }
  else if (digitalRead(buttonPin) == LOW)    // If the button is off 
  {
  digitalWrite(buttonsig, LOW);               // Set the out put low (Plug is off)
  }
}

Credits

Esam Radwan

Esam Radwan

2 projects • 0 followers
Material science undergraduate at Zewail city of science and technology

Comments