Shares

ESP8266 Remote Controlled Sockets

Shares

In this project your’re going to build a web server with an ESP8266 that can control remotely any sockets (safely!).

Before continue reading this project, please complete the following tutorials:

If you like the ESP and you want to do more projects you can read my eBook Home Automation using ESP8266 here.

Let’s get started!

First, watch the step-by-step video tutorial below


Parts List

Here’s the hardware that you need to complete this project:

Click the image above, to see on ebay.

Click the image above, to see on eBay.

Remote Controlled Sockets (433MHz)

You can buy remote controlled sockets in any store or your can buy them on eBay. Keep in mind that they need to communicate via RF at 433MHz. Here’s my setup:

  • Remote control – channel I
  • Socket 1 – channel I and mode 1
  • Socket 2 – channel I and mode 3

remote controlled

RC Switch Library Download

Here’s the Arduino library you need for this project:

  1. Download the RC Switch library
  2. Unzip the RC Switch library
  3. Remove the “-” from the folder name, otherwise your Arduino IDE won’t recognize your library
  4. Install the RC Switch library in your Arduino IDE
  5. Restart your Arduino IDE

The RC Switch library is great and it works with almost all remote controlled sockets in the market.

Receiver Circuit

433mhz receiver circuit esp8266 - Copy

Follow the circuit above for your receiver. Then upload the code below or you can go to File > Examples > RC Switch > ReceiveDemo_Advanced.

Save the TriState Values

Open your Arduino serial monitor at a baud rate of 9600 and start pressing the buttons of your remote. Save the TriState values (highlighted in red) of each key in a notepad. tristatevalues

Schematics (3.3V FTDI Programmer)

The schematics to upload code to your ESP8266 are very straight forward. You only need to establish a serial communication between your FTDI programmer and your ESP8266 to upload some code. Flashing Firmware - FTDI Programmer

Uploading your ESP8266 code

Having the ESP8266 add-on for the Arduino IDE installed (How to Install the ESP8266 Board in Arduino IDE). Go to Tools and select “Generic ESP8266 Module”. Arduino IDE select esp8266 Copy the sketch below to your Arduino IDE. Replace the SSID and password with your own credentials. You also need to change the TriState values. After modifying my sketch upload it to your ESP8266.

ESP8266 IP Address

Open the Arduino serial monitor at a baud rate of 115200. Connect GPIO 0 of your ESP8266 to VCC and reset your board.

After a few seconds your IP address should appear. In my case it’s 192.168.1.70.

esp ip address

Final Circuit

This is the final circuit for your ESP8266 that hosts a web server and transmits RF signals to control your sockets.

esp with 433Mhz - Copy

Demonstration

For the final demonstration open any browser from a device that is connected to the same router that your ESP is. Then type the IP address and click Enter!

Screenshot_2015-09-15-18-31-33

Now when you press the buttons in your web server you can control both sockets (watch the video at the beginning of this project for a live demo).

on and off sockets

Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

Leave a Comment:

Add Your Reply