Está en la página 1de 9

Arduino Internet Web Switch

This wonder kit allows you to control any electric appliance from the internet.
What does that mean ?
That means you can turn ON/OFF any appliance at your home from your iphone, Android, ipad, PC or laptop
the world..As long as you have access to a web browser.
Woooo..aint that an amazing power to lay your hands on.
What would I do with a Web Switch ?
I would do these:
Boil water for my coffee right from my bed with my Iphone
Turn on my Home heatpump when I leave to home from Work,
My home is warm and cozy by the time I arrive :)
Water my garden when I am on vacation
Rest I leave to your creative imagination to fill in............
What does the kit consist of ?
Arduino UNO
This is the CPU where the code and the webserver runs
1.
Cool kit which gives life to the lights and makes them dance to the tune of the music..

Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
1 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Ethernet shield
This shield allows the Arduino to talk to any other device connected via Internet.
The shield has an ethernet port which will be later used to connect the ethernet cable.
1.
Sensor Shield
This shield provides modular plugins to connect loads of things you want to control
For this example we will interface a Relay module to control power appliances
1.
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
2 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Relay Module
This module allows the Arduino to turn ON/OFF power appliances
Read more about relays here
1.

Building the Arduino Web Switch
Stacking the shields
Place the Arduino at the bottom as below
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
3 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Plug the Ethernet Shield on top of the Arduino ( this is also called stacking , as we keep building a stack of sh
Arduino )
Once thats done it would look like this.
Next step is to stack the height extender pins into the Ethernet shield ( This is necessary to ensure we dont s
sensor shield pins on to the Ethernet shield )
Once the height extender pins are plugged into the Ethernet shield it will look like the pic below:
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
4 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Stack the Sensor Shield on top of the Ethernet shield, as shown in pic below.

Wiring the Relay Module
Use the cable provided and connect it to the relay module as shown below
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
5 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Connect the other end to the Sensor shield pin number 8, VCC and GND
TEST: Power up the arduino and you should see the GREEN led on relay module glowing. If you dont see that
and make sure everything is correct.
Relay testing
We are about to test if the wiring is good and the relay turns ON and OFF.
Load this program into the arduino from this link.
What does this program do?
This program turn ON the RELAY module for a 3 secs and turns it OFF for another 2 secs and keeps doing tha
How do you know if the relay is turning on?
You hear a click every time the relay operates and you see the RED led glowing every time it is turned ON.
This test should test if the wiring it good and the arduino is able to control the relay.
Getting your Internet Web Switch to go.......
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
6 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
Now that all the modules are tested, we are almost there..
The last bit which needs doing is to load the Web Switch code and turn your kettle on!
Follow the steps below in order
Download Ethernet shield library into libraries folder present in Arduino IDE installation
This step adds the library for getting the Ethernet Shield to work
Connect a Ethernet cable from the Arduino Ethernet shield to your PC/Laptop
Load this code (link provided on purchase) onto the Arduino.
Open up your favorite browser and copy this address onto it:
http://192.168.1.25

You will see the webpage shown below on the browser. This page is hosted on your Arduino,
yes that tiny little piece of hardware can host a webpage :)
Now you can click the button on the page and hear your relay turn ON/OFF,
You are now able to control the Arduino via the Browser.

Turning the kettle ON!
Now we have a working Arduino Web Switch which can be controlled from a browser,
To control the Kettle you will need to connect the Relay as a switch for the Kettle.
Disclaimer: any modification work that involves high voltages should be done by a certified electrician. This W
provided by Hobbyist Ltd "as is" with no warranty of any kind whatsoever. It is your responsibility to ensure y
proper functioning of your devices and applicances. Should you have any concern about health and safety ple
professional for advice.
The wiring is as below:
Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
7 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)


VIDEO of the completed kit in action

Get a WebSwitch for yourself?




Arduino Web Switch : Turn your kettle ON via Internet | www.hobbyist.... http://www.hobbyist.co.nz/?q=web-switch-tutorial
8 of 8 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)
#def i ne RELAY_PI N 8 / / Some damn pr obl emwhen i use 13, swi t ched t o 8 whi ch wor ks!
voi d set up( ) {

/ * Set up Ser i al */
Ser i al . begi n( 9600) ;
pi nMode( RELAY_PI N, OUTPUT) ;
di gi t al Wr i t e( RELAY_PI N, 0) ; / / swi t ch on LED
del ay( 10) ;
}
voi d l oop( ) {
i f ( di gi t al Read( RELAY_PI N) == LOW)
{
di gi t al Wr i t e( RELAY_PI N, 1) ;
del ay( 3000) ;
} el se {
di gi t al Wr i t e( RELAY_PI N, 0) ;
del ay( 2000) ;
}
}
http://www.hobbyist.co.nz/sites/default/files/webswitch/code/Test_Rela...
1 of 1 9/20/2014 5:36 PM
Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

También podría gustarte