How to Build DIY Alexa Supported Smart Switches for Home Automation

In this tutorial, you’ll learn how to create DIY smart switches that you can control with an app, web browser, or voice commands through an Alexa smart speaker, such as the Echo dot. You can also password-protect these DIY smart switches for added security and prevent unwanted users from accessing or controlling them even when connected to your local Wi-Fi network.

You can further integrate these DIY smart switches with Home Assistant or HomeKit to add automation based on time of day or data received from other compatible smart sensors you may have installed. in your home or office.


Why build a DIY smart switch?

While you can buy smart switches online that work out of the box, integrate with Alexa and Google Assistant, and so on, most lack manual controls or overrides, meaning you can just turn ON/OFF. them by app. This is inconvenient for many users, especially the elderly in the family or those who are not tech-savvy.

However, the ones that come with manual override controls cost you extra. More importantly, these switches also require you to register and share your data with their cloud servers. Every time you turn the device on or off, the information is recorded and transmitted through the manufacturer’s cloud server. This also slows down the response time and it won’t work if the internet is down.

MAKE A VIDEO OF THE DAY

However, when you build your own, your activities are not logged or recorded anywhere. It’s local, faster and works regardless of internet access. Therefore, if you have privacy considerations, follow this guide and “Do it yourself”.

Your devices and activity data is completely local and is not recorded or logged if you are not using it with Alexa or Apple Homekit. Integrating DIY smart switches and sensors with these services allows you to control your devices from the Internet at the expense of sharing activity data.

Steps to build a do-it-yourself smart switch

Follow the instructions below to create your DIY smart switches and deploy them to control different devices.

Things you will need

  • One NodeMCU, ESP-01 or D1 Mini board.
  • A transition module. Depending on how many switches you want to automate, you can purchase single, double, quad or higher channel relay modules. You can also build a solid state relay yourself.
  • A 220V to 5V Hi-Link or similar power supply module. You can also use micro USB to supply 5V power.
  • Micro USB cable.
  • 3D printed carrying case to enclose all components (optional). You can also use any general box that fits a DIY smart switch.


If you want to use ESP-01, purchase the additional components mentioned below:

  • One Micro USB module.
  • One 5V to 3.3V voltage regulator.
  • One CH301 module for installing firmware.
  • A common PCB for soldering these components.

Step 1: Flash the firmware

To build a smart switch that is compatible with Alexa and other home automation software, we will be using the Tasmota firmware. It’s a tried and tested firmware that works reliably with ESP8266 boards such as NodeMCU, ESP01, D1 mini etc. We are currently using them in production environment for control various appliances, such as lights, fans, water pumps, TVs, etc., for the past 3 months without any problems or complaints.

  1. Download Tasmotizer tools and Tasmota.bin firmware file.
  2. Launch Tasmotizer and connect NodeMCU or D1 Mini to your PC using Micro USB Cable.
  3. Choose COM port and click Browse to choose Tasmota.bin firmware file.
  4. Click Transaction and wait for the flashing to complete.
  5. After flashing, click Submit configuration.
  6. Import WiFi SSID and unlock password and click Submit configuration.
  7. The device will connect to your WiFi network.
  8. Click Get IP to see the IP address and copy it.


That’s it. You can now move on to configuring the smart switch.

Step 2: Configure the Switch

Open a web browser window on your PC and enter the copied IP address. This will open the Tasmota website. Now, follow the steps below:

  1. Click Configuration > Module Configuration.
  2. Choose General (0) from Module Type drop down and click Assist.
  3. The device will reboot and automatically reload the web page. Click Configuration > Module Configuration.
  4. Selection Relay 1 in GPIO4 and Move 1 above GPIO5 and click Assist.
  5. After rebooting, you will see a toggle to On or Off. This will control a single channel relay. To build a smart switch with multiple channel relays, you need to select Relay 2, Relay 3, Relay 4 and Switch 2, Switch 3 and Switch 4 in GPIO.

Once done, save the changes and disconnect the USB cable.

Step 3: Connect the Relay Module to the Board

Refer to the following diagram to interface the relay module to the NodeMCU or D1 Mini using jumpers or DuPont wires. You can power this using any 5V smartphone adapter and micro USB power supply.

If you are using a 220V to 5V power supply module, the connections are as follows:

Step 4: Turn on and check

Once everything is connected, you can power on to turn on the DIY smart switch. Once enabled, go to the same IP address and use the switch to enable/disable it. The relay will turn on/off when you press the toggle switch on the site.

We recommend assigning a static IP to your device via DHCP IP reservation in your router settings. This will keep the IP always the same.

If the test is successful, you can put it in a 3D printed box. You can find many of these cases on Thingiverse based on the transition module you used.

Step 5: Enable WeMo conversion emulation for Alexa integration

You can emulate your smart switch as a Philips Hue or WeMo device, natively compatible with Alexa. The steps are as follows:

  1. Open Tasmota site using the device’s IP address and click Configure > Configure More.
  2. Check the box Belkin WeMo one device options and then click Assist. If you are using two or more channel forwarding modules, turn on Philips Hue multi-device emulation.

Step 6: Add Smart DIY Switch to Alexa

Configuring your new DIY smart switch with Alexa is a pretty easy process. Here’s what you need to do:

  1. On your Alexa app, go to Devices and tap + icon at the top
  2. Choose Add device.
  3. Selection Convert > Other and then click Device discovery.
  4. Wait for the process to complete. It will take about 2 minutes.

You can also request an Echo or Alexa-enabled smart speaker—Alexa, discover devices. This will automatically find your smart DIY switch and list it under Devices. You can now control this DIY smart switch with voice commands or the Alexa app. Just make sure that both devices are connected to the same network.

Moreover, you can automate your home or office by installing such DIY switches and using the Alexa process. This is a detailed guide on Set up home automation using the Alexa App.

Alternatively, if you want to keep your activities private, set up a Home Assistant server for home automation. It will also let you use the Smart DIY switch with the Apple HomeKit or Eve app on iOS, iPadOS, and macOS devices.

Smart home with added privacy

The DIY smart switch does not require you to sign up for any services. It is completely local and therefore does not log or record your activity data anywhere. And instead of relying on Alexa for home automation, you can set up a local Home Assistant server, add your own or purchased smart switches, and control them all from one dashboard. control.

You can also create multiple rooms, group devices, and add automation without worrying about your data. Everything works locally and your data never leaves your premises.


Snapshot of PIR and relay module for motion sensor light switch

How to build a smart motion sensor light switch

Continue reading


https://www.makeuseof.com/build-diy-alexa-smart-switches-home-automation/ How to Build DIY Alexa Supported Smart Switches for Home Automation

Sarah Ridley

USTimesPost.com is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – admin@ustimespost.com. The content will be deleted within 24 hours.

Related Articles

Back to top button