Wi-Fi based Smart switch, local network - No internet - #privacy

Let's say you are looking for a simple home-automation device, i.e. a switch that is controlled by a device on the network. The control device maybe a smartphone, PC, tablet, etc. Here we have a lot of options from the market such as Alexa, google home and many others. Some network based switches are also offered by many sellers from china. However, they have one thing in common; they all require an internet connection and a dedicated server provided by the service provider. The security breach and privacy breaches are not anything new in the world of IoT. This brings me to the purpose of this post, i.e. to make a Wi-Fi based switch that works only on the local network of a home or office. I could also opt for the Ethernet but since every appliance does not have an Ethernet outlet nearby, let's just stick with Wi-Fi.

The concept is simple; I used an ESP-12F module (ESP8266), a mains to 5V power supply module and a 10A relay with coil rated at 5V. The gerber file's image and the schematic is as below:




The PCB has a slot between HV and LV sides of the board to minimize voltage and noise being induced in the low voltage DC components. The schematic is simple; it uses an opto-coupler to switch the relay using the esp8266 pinout signal. I used an opto-coupler to reduce the feedback voltage spike of the relay to the ESP module. i know this from experience that without using the opto-coupler, sometimes 8266 module might reset itself due to voltage variation when relay is switched. A few LEDs are added on board which are used as a night light. These lights can be turned on and off and used as a small source of light while sleeping. 

I tested the module in my home for more than three months and the only problem i found that the relay contacts might weld which prevents it from switching. A simple solution was found online which was to tap the relay to introduce vibration to break the welded contacts free. However a better solution was to replace the MPS2222 transistor with a mosfet so that the relay sees maximum voltage possible across its coil to ensure a strong switching magnetic field. Below is a picture of hand soldered SMT components on the module.


Lastly, below is a picture of the android app that i used  to test the module.

ESP code and android code is available on request. Shoot me an email!

No comments:

Post a Comment