If you’re following my email/facebook updates you know I promised more tutorials related to Home Automation.
In this tutorial we’re going to control 2 lamps with an Arduino and an Ethernet Shield. If you have an Internet connection you can control those lamps from anywhere in the world.
Watch the Video below
First make sure you watch my youtube video above, where I explain the whole process in more detail.
- Arduino UNO – read Best Arduino Starter Kits
- 1x Ethernet Shield
- 1x 433Mhz Receiver and Transmitter
- 2x Remote Controlled Sockets with a Remote Control (Controlled by 433Mhz Frequency)
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Go to Home Automation Server
Click here to go to HomeAutomationServer.com to create your free account and start editing your Dashboard with 2 new buttons. (for example: Button #1 – Desk Light and Button #2 – Desk Light)
Click here to Download the RCSwitch Library. Install it an Re-open the Arduino IDE. Then open the example “ReceiveDemo_Advanced”. Upload the code and open the serial monitor. Start pressing the buttons from the Remote you’re going to use and save them.
After you complete the transmitter circuit. Upload the Arduino code below. (Change the user_key and the if statments as shown during the video)
Click Here to Download the Arduino Code
Thanks for watching, you can contact me by leaving a comment below. If you like this project probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.
P.S. Make sure you watch the youtube video above otherwise you might not fully understand some of the steps.
61 thoughts on “Arduino – Control 220V Lamps from Anywhere in the World”
This project is working well BUT we need to now close the loop by receiving status back from the remote device.
Specifically how can we see the status of a digital input or the value on a remote analog input. Do you intend developing the dashboard to have that capability?
There are twitter examples using arduino but can we get that into the dashboard?
That’s a really good question!
The problem with this project is exactly that, We’re never sure if the Digital Pins changed.
And we can’t read the Pins from the Arduino. I don’t know exactly how to do that with an Ethernet Shield.
I might integrate this project with a Raspberry Pi or Arduino Yun. Those devices were meant for that.
The Ethernet Shield is a bit limited, it works really well as a webserver, but if you try to do some complex authentication or web requests… It’s not a good idea.
Thanks for asking,
thanks so much for your feedback!
I’ve worked really hard to create the HomeAutomationServer platform.
Have a nice day,
This is good but I find this more convenient because it adds logic and different objects manipulation
Sorry I didn’t understand what you mean…
I add a link in a second post, maybe you missed it.
I use this project for my home server http://www.jubito.org
however continue your great work! 🙂
This is great. Well done Rui
Thank you Kay!
Can I use this outside my house?
How your site know my IP address?
yes you can use from anywhere.
Basically the arduino with the ethernet shield keeps reading your unique webpage at http://homeautomationserver.com.
So when you change the state in your account, the arduino will also update his state.
I’ll never know your ip address.
Let me know if I can help you more,
Have a nice day,
Hello again Rui,
I just have cloned codes of remote outlets, but the garage gates I can’t! The receiver does not detect anything! Help… how to get?
What have you tried so far?
I have no idea what’s happening I can be anything with the information you provided…
Thanks for the excellent tutorials, much appreciated!
Thank you Oliver for your feedback!
I do not understand why my transmitter does not pick up the bytes in the Arduino Serial Monitor automatically like it appears to do for you. The code has uploaded fine… I bought the same transmitters as you and have tried two different units. My remote says its 433 Mhz and works perfectly with the power units. The only thing I can think to do is try another remote but I don’t think that is the issue. Have you got any ideas what the problem could be or any suggestions to try?
You said you’re transmitter doens’t pick up the bytes?
you meant the receiver right?
The receiver is the one who need to receive the data when you press the buttons, and you’re right that should appear in the Arduino Serial monitor instantly.
Thanks for getting back! Sorry, of course I meant the receiver, not transmitter. (I must have been at it for far too long that day!) I am hugely disappointed that I still haven’t been able to figure out what I’m doing wrong as the project has incredible possibilities!
I have tried everything exactly as instructed but still no luck. As I said I tried different RECEIVERS,different wiring,different pins, different arduino, different remotes.. reinstalled arduino ide. Still no numbers appearing in serial monitor!
The rx l.e.d on arduino lights when I send a number but nothing on tx.
I really don’t want to give up the project but am going to start tearing hair out soon and have run out of ideas!
If I bought the exact same remote controlled sockets as you, would the decimal numbers produced be the same, in which case I could use your numbers and proceed?
or do you have any other last suggestions 🙁
Hi Oliver do you have a facebook account?
Please add me
and I’ll try to personally help you with your project to see what’s missing.
Because it seems that you’ve done everything properly! and it doesn’t work..
I can’t get mine working either. Did you have any luck getting it working? Can’t say I have gone to the extent of trying it with a new Arduino or RF receiver.
With another sketch I am able to get data from the receiver via the analog pins but i get a lot of noise. I suspected this may be the cause of my issue so I tried it in the shed at the end of my garden, and still no joy! Very frustrating.
Really want to get this working.
In case anyone is struggling to get this working, I found rf-switch didn’t decode my remote signals, so I had to record them by attaching the receiver to a 3.5mm jack, which I then connected to the line-in of my soundcard. It was then a case of reproducing the signals using the Arduino.
Also found my wireless dect house phones caused major interference which didn’t help matters.
Hi, I have copied the example sketch in the arduino copied and pasted the key my changed my ip address and mac. However when I start the serial monitor I get the following: Connecting,connected The client is not available, restarting, error during connection, stop-connection was activated.
I also noticed that when I press one of the buttons either on or off the key does not appear after homeautomationserver.com but only /dashboard.
What can be the cause of that.
Thanks for a excellent service.
Sorry for taking so long to answer I’ve been really busy for the past few days…
Please try again, but don’t change the ip address and mac.
You should only change the user_key.
Tell me what you see on the serial monitor…
Have a nice day,
Hi Rui, Reading Serial monitor: Connecting,connected, client not available.
restarting, current state; error during connection, stop connection was activated.
Then the process start all over again. As it should. But it keeps on telling me client not available. By changing IP and mac I meant I put in my IP and mac. Are you saying I must leave the orginial mac and ip as per sketch. can you diagnose from that was is wrong?
Yes you must leave the original IP and mac Ben.
Please try again and tell me what’s printing on the serial monitor
Good morning Rui,
I did what you said, and put the original mac and ip in the provided spaces.
Makes no difference.
Still the same message on aerial port.
Client not available.
I copied and pasted the sketch from gibhub because
I dont see any other means of down loading.
But I don’t think that is the problem.
If it was! The IDE would have rejected it.
I sincerely hope we can come up with a solution. Because I like this sophisticated system. Want to put a webcam on it as well.
great job Rui
Thanks for your feedback tone!
have a nice day,
Is this blog still alive? Thank you for all your tutorials, they helped me a lot.
Are there also examples for the Wifi CC3000 shields?
Kind regards from ‘the Netherlands’
I’ll be back with more tutorials really soon. I’m working full time and studying at the same time…´
I don’t have examples with the CC3000 yet, but It should work just fine with that chip if you adapt the code.
Hi , your project is really cool . I want to make a device like you build . BUT i have a wi-fi sheild instead of Ehtanet sheild .
My question is, can your project be done with a wi-fi sheild ??
i have no experience of arduino wifi/Ethanet sheild . so please help me out .
thx …………… for this tutorial. that was great job
loading HAS_Control_220V_Lamps.ino – bug
sketch_nov22a:55: error: ‘RCSwitch’ does not name a type
sketch_nov22a.ino: In function ‘void setup()’:
sketch_nov22a:68: error: ‘mySwitch’ was not declared in this scope
sketch_nov22a.ino: In function ‘void updateState(String)’:
sketch_nov22a:121: error: ‘mySwitch’ was not declared in this scope
sketch_nov22a:121: error: expected `)’ before numeric constant
sketch_nov22a:126: error: ‘mySwitch’ was not declared in this scope
sketch_nov22a:131: error: ‘mySwitch’ was not declared in this scope
sketch_nov22a:136: error: ‘mySwitch’ was not declared in this scope
You have to install the RCSwitch library properly.
Please read again and watch the video carefully.
Thanks for trying my project
great idea thank u , and i want to know how i can programme the controle of PH in systeme irrigation.
Can we use a Arduino Wi-Fi shield for this?
Thanks in advance.
Hello! Downloaded RSSvich, HAS_Control_220V_Lamps got user_key. The system worked very well for many days, is stable. Who does not work, change user_key does not help. On the monitor, the following information
Current state: !DOCTYPE html
Current state: !DOCTYPE html
Current state: !DOCTYPE html
Website https -github-com where I downloaded the library is now blocked in Russia. Why does not HAS_Control_220V_Lamps do you think? whether this is due to the blocking of the site Website https-github-com ?
often on the monitor displays a message
Current state: html style=”height:100%”
The Client is not available.
Current state: Error during connection, stop_connection was activated
i’m working on home automation system project using arduino Yun, i already created an andriod application and special website to control home devices using arduino micro-controller, i successfully controlled in my LAN but i want to control them from anywhere in the world, i saw some tutorial and web sites that describe the controlling arduino Yun remotely but all ways were difficult for me and i couldn’t fix this problem, i seeing that you are using Arduino Uno with Ethernet shield for controlling devices from any where, i want to ask you if i use the arduino Yun what steps should i perform for controlling devices remotely? please help.
its Great book
Thanks for sharing It .
I have done LED Control by IR Remote
Thanks and regards
Thank you for your feedback my friend!
Have a great day,
really a breif tutorial thanxx
i made it and it work very well
Glad to hear that everything worked out!
Fantastic tutorial thank you.
I have a request, please. I would like build devices HomeKit compatibile using arduino Ethernet (by cablerai) and relays.
At moment I have homebridge running on Mac. In the future I’ll move to Raspberry. Now I’m controlling the Nest and I want add Arduino Ethernet and some relays .
Can you publish a tutorial about? YouTube shows some video about, but no on want share the how to… I’ll trust you’ll do it.
Thank you so much.
Thanks for reading,
I don’t have those devices, so right now I don’t plan to add that option.
Thanks for asking,
Do i need to connect the ethernet shield to my router?
Yes, you need to connect to your router an Ethernet cable
Your eMail about Home Automation Server…
There are a lot of alternatives already running on RP and a lot of other “iot” devices (Arduino, RP, ESP8266, Particle)
Let’s say Blynk, a cloud server but you can run a private local server too.
You can pilot your devices from iPhone or Android.
If you’re hurry to control your light from anywhere, look at Blynk
Thank you for your contact. I catfish long time in electronics, but short in using Arduino applications. I’m willing to actively participate in your action.
Thanks for reading,
Many thanks for your share on
automatic home control
Thank you …. Rui….
You’re welcome 🙂
when will be the new registrations for home automation server will start
We don’t plan opening Home Automation server.
Hi Rui and Sara.
This last comment of Sara’s is confusing. I can see that “homeautomationserver.com” is working.
We no longer work in that project.
So, it is outdated and might not be working probably.