Cloud-based smart switches are easy to set up, but they come with risks. Here’s how to take matters into your own hands.
To make a home smart, you need smart switches and sensors to control Wi-Fi, RF or Zigbee connections. There are many brands that offer smart keys that you can simply unlock and publish using their cloud services.
But if you want to build a completely private smart home, you don’t want to rely on a third party. You never know when they might close their cloud services. Hence, security and reliability are major concerns. Fortunately, creating smart keys that work with Alexa and smart home automation software, such as Home Assistant, is a lot easier.
What you need to build a smart key
Let’s say you want to make a 5 channel smart switch that you can use to control up to 5 different devices up to ~2A at either 220V or 110V. To create this smart key, you will need the following:
- One D1 Mini
- One Hi-Link 5V 5W or 10W PSU
- Two 6-pins screw terminals
- 2-pin screw terminal
- Five resistors 220 ¼ watts
- Five 1KΩ ¼ Watt resistors
- Five MOC3021 ICs optocoupler
- Five triacs, such as BTA12, BTA16, or similar. We have used BTA16.
- Fabricated or generic PCB for mounting and soldering of all components
- Soldering iron and tin
- Wires to deliver your cargo
We already designed the PCB and did the hard part (new and improved). All you have to do is Download the gerber file, which you can use to print or manufacture PCBs from any PCB manufacturer or supplier. FYI, we got 10 fabricated PCBs for $7 and paid $5 for shipping.
Solder the components on the PCB
Install all components on the PCB as shown on the PCB. You can also use the generic PCB and follow the common connection diagram below to manually install and solder all components.
Do not install and solder the D1 Mini directly to the printed circuit board. Follow these instructions to install the D1 Mini on the printed circuit board.
- The D1 Mini comes with both male and female berg straps. Solder the male tower tape to the D1 Mini.
- Solder the female screw bar onto the PCB where we need to place the D1 Mini.
- Place the D1 Mini on the soldered female strips on the PCB board to secure it to the board.
This will help you quickly disconnect or replace the D1 Mini if it goes bad.
If you don’t know or have never been welded before, we highly recommend that you do it Learn how to weld before proceeding.
Once the components are installed and soldered to the printed circuit board, follow these steps to download, flash, and configure the firmware on the D1 Mini to control the onboard 5-Solid State Relay.
- Download Firmware Tasmota (tasmota.bin file) on your system and install the . file Tasmotizer tool (Available for Windows only). You can also use files house stripper A tool if you are using macOS or Linux.
- Launch the Tasmotizer tool and connect the D1 Mini to your computer using a micro USB cable.
- tap on refresh button.
- select file COM The port where the D1 Mini is connected.
- click to open Then browse for the Tasmota firmware you downloaded (.bin file).
- click understand. Wait for the process to complete. It will take less than a minute to finish.
- Once you have finished flashing, tap send configuration button.
- Choose WIFI And enter the SSID and password for your Wi-Fi network.
- click unit / model and choose qualitative.
- click Memorizes. You will see a messageSent configuration. The device will restart“.
- tap on Get an IP button after a few seconds. This will show you the IP address of the device when it has successfully connected to your network.
- open the internet browser and enter this IP address. The Tasmota web interface will open.
DIY Smart Switch Configuration
Once the Tasmota Web UI (Web UI) is open, follow the steps below to configure the 5 keys to control Wi-Fi and Alexa.
- click ranking > Configuration unit. Then refer to the screenshot below to choose rotation And the converts Options followed by channel number.
- Once you have selected all the channels required for rotation And the converts Options, click Memorizes. The device will save the configuration and restart. The web user interface will be updated automatically.
- You will see 5-Controls on the Tasmota web user interface. They can be used to power and control solid state relays on the board to turn on/off the connected load.
- 1 Indicates that the switch is on while 0 Indicates turning off.
Enable Alexa support
To control this 5-channel smart switch using Alexa, follow these steps:
- In the Tasmota Web User Interfaceclick ranking > Other configuration.
- In the the device nameGive your smart key a cute name, like smart living room switch. Also, enter the name of the 5 devices you will control with this DIY smart switch. Since we use it to control lighting, we have named it accordingly.
- Make sure to select a file Hue Bridge radio button and then click Memorizes.
- The device will restart. You can now ask your Echo to detect devices with the command,”Alexa, discover devicesYou can also use the . file Alexa app > Hardware To add this DIY smart switches.
- Devices will display the name you entered in the Friendly Name field in the Tasmota Web User Interface. However, you can edit or change the names in the Alexa app according to your needs. They are recognized as Royal Philips Smart Electronics.
- You can now control the smart switches with the Alexa app or with your Echo device. Just say, ‘Alexa, turn on the LED strip.”
Add to Home Assistant
To add this DIY smart switch to Home Assistant (HA), you need to enable MQTT on Home Assistant and then enter MQTT details via Tasmota Web UI by following these steps:
- In the Tasmota UI, tap ranking > MQTT Configuration.
- Entry host IP (HA your IP), user, And the password. Keep other things as default and click Memorizes.
- If auto-detect is enabled on your HA (by default it is), you can see 5 new smart switches in Settings > Hardware and Services.
- You can select and add them to your HA dashboard and control switches right from the HA web UI with real-time switch status updates.
Deploying DIY switches and noiseless private smart switches
You can build and use this 5-channel smart switch to control a fan, lights, or other home appliances that require up to 200-300 watts of power. Since we built this switch using Solid State Relays (SSR), this switch will operate silently without clicking noise. Besides, you can control it locally even if there is no internet, or if you are connected to the internet, from anywhere in the world using the Alexa app.