Progress Bar

Skip to main content

Jaycar
...

IoT Smart Wireless Switch

IoT Smart Wireless Switch

Difficulty
Test & Tools

Summary

Here is a great project to get started with your very own IoT (Internet of Things) home automation project. Based on the tiny yet powerful ESP8266 integrated WiFi and MCU (Microcontroller Unit) you can turn on or off appliances using your smart phone or tablet. Once you become familiar with the source code (provided with the project documentation) you will be able to create your very own innovations.

Materials Required

1
1
1
1

The figure below shows the circuit diagram, there is not much wiring to this project, only three wires between the ESP8266 and the 433MHz transistor unit, plus another wire that acts as an antenna.

The components can be constructed in any way that is convenient for your application, we have chosen to use the Wi-Fi Mini Shield XC3850 because it offers a neat way to interface to the ESP8266 D1 main board.

Step 1: Get the Source Code File

Download the project source code from here. If the source code file is zipped, then extract the file and place it in your Arduino IDE directory (normally /Documents/Arduino/Sketches/...).

Step 2: Configure Your Wi-Fi Settings

Open the project source file in the Arduino IDE. Change the following parameters to your Wi-Fi network SSID and password:

cost char* ssid = "your Wi-Fi SSID here"
cost char* password = "your Wi-Fi password here"

Note: Include the " in the above variables.

Step 3: Upload Your Source Code

Make sure you have selected the correct target board, under the 'Tools' menu:

Make sure the you have connected the ESP8266 board to your computer and you have selected the correct USB port. Now upload the source code to your ESP8266.

After the upload operation is completed, under the 'Tools' tab, click on 'Serial Monitor' to open a serial monitor window (make sure the data rate is set to 115200 baud). You will be prompted with the Wi-Fi connection status as shown below

Write down the IP address that appears on your screen, in the above example this is 192.168.10.197 (this will be different for your network).

Step 4: Go Online

On your smart phone or tablet (or any PC for that matter) open a new web browser such as Microsoft Edge, Google Chrome, etc. In the URL address enter the IP address you noted from Step 3 above. Now you should see the IoT Smart Wireless Switch control screen, as shown below.

In the sample code we called the first switch "Bedroom Lights" and the second "Kitchen Lights", you can customise these labels by locating and editing the following code:

// Display current state, and ON/OFF buttons for Switch 1
client.println("<p><i>Bedroom Lights -</i> " + output_1_State + "</p>");

// Display current state, and ON/OFF buttons for Switch 2
client.println("<p><i>Kitchen Lights -</i> " + output_2_State + "</p>");

Step 5: Pair Power Switch

Now all you need to do is to pair your IoT Smart Wireless Switch with the mains power unit. This is a very easy operation; all you need to do is follow the steps below:

1. Make sure the main power unit is unplugged.
2. Now insert the main power unit to the mains power. You will see the red light flashing, this indicates that the unit is ready to pair.
3. On your smart phone control screen click either the first or second "On" button. Wait until the command is completed. Now you should see the red light on the mains unit stay on (stop flashing).

That's it, your IoT Smart Controller is now paired with your mains power unit. You should be able to now switch the power unit on or off by clicking on the control screen button. Note that only the button you paired in step 3 above will be connected to the mains unit. You can add another mains unit and pair it to the second button, you can even modify the code to add more mains controllers.

You can continue to use the remote control unit that is provided with your RF Mains Switch MS6148, so at your convenience you can control lights or appliances ON or OFF using your IoT Smart Wireless Switch (via your phone or any browser) or using the provided remote control unit.

Similar projects you may be interested in

Jaycar-RCT-Hero
Test & Tools
Resistor & Capacitor Tester
Difficulty

Portable Soil Moisture Meter
Test & Tools
Portable Soil moisture meter
Difficulty

Test & Tools
Wireless Garden Monitor
Difficulty

Arduino Based LED Tester
Test & Tools
Arduino Based LED Tester
Difficulty