If you want to build a smarter house for yourhome, like a scheduled garden lighting, a remote gate opener, even create oropen a door lock with an application via internet connection, then perhaps asmart switch from Sonoff can be the answer for that.
What is Sonoff and Sonoff Basic
Sonoff (https://sonoff.itead.cc/en/) is a brand thatfocuses on creating IoT (Internet of Things) devices for home appliances.Sonoff has various devices such as smart sockets, smart lamp switches, etc andthe most basic one is the Sonoff Basic.
Sonoff Basic isbasically a wire switch that is connected to a homes wifi and can be accessedvia internet connection to turn the power on or off.
You can get Sonoff Basic from Amazonfor $5 US. Let’s try to configure this device and we will see the widepossibilities on the application in your home.
Open the input and output covers from yourSonoff device, and put the wires in both sides of the input and outputsections.
After you have installed the Sonoff Basicwith the cable power input and output like shown above, you are then ready topair the device with your wifi network. To do that open the eWeLink appyou have installed on your smartphone, register a new account, and the app willsend you the link to finalise the registration. Follow the steps shown thenafter you successfully login to the app, prepare the cable installation byplugging it to the power outlet.
Press the black button on the device near theLED lamp for about 5 seconds until the LED is blinking. It indicates that thedevice is ready to be paired. Open the eWeLink app, and click the ‘+’button on the bottom center of the app, then click ‘Quick pairing’ button tocontinue the steps.
Set the wifi connection name and password inthe next step then click the ‘Next’button and let the app pairing between device and wifi begin. When the appsucceeds in pairing, you can name the device in the last step to identify itlater. When you have more than 1 device registered in the eWeLink appdevice with meaningful naming will really help identify your IoT device.
Controlling the Device
After you successfully add Sonoff Basic intothe eWeLink app, the device will be listed. You can now turn the switch On andOff by the tap of a button!
The eWeLink has the other useful options likeSchedule, Timer, and Loop Timer.
What’s next from here?
You can create another similar remote controlproject based on the above concept, for example a simple door lock system usingelectromagnetic/selenoid door lock that can lock and unlock based on power.
You can also integrate eWeLink further with home assistant devices like Google Assistant, Amazon Alexa, or Mi Home. This would enable you to activate the Sonoff device with voice commands.
If you are looking for a harder challenge, you can install a hacked version of the firmware that is ready to read data from additional sensor modules such as aa humidity sensor. Better yet, use your own local WiFi to pair it with a local nodejs webserver that you can put on a Raspberry Pi.
This means you don’t need eWelink to act as a cloud server anymore enforcing device and data security. Just set the wifi of your server as your new Access Point, pair Sonoff to that AP, and create your app that will control the device inside the new network.
Or if you just want to create your own presentation layer app but without creating a whole new server, you can still use eWelink but just access the eWeLink server via webhooks. Check out IFTTT (https://ifttt.com/discover) it has some applets/code snippets that is ready to be used to access your Sonoff device that is already paired and stored inside your eWelink account.