Relay switch based on Sonoff

As a many others enthusiasts I’ve started my game from existing hardware solution and I bought couple of Sonoff modules from China.

When I received my modules I even didn’t want to use their solution and immediately flashed them to NodeMCU and then uploaded my Lua code. They worked stable and switched my floor lamps in the house, but using NodeMCU I wasn’t able to use reliable Over The Air (OTA) updates and also was hard to bring easy way to initial setup of the device. Finally I decided to switch to native C and Android Studio, it was simple for me as I have huge experience in different programming languages.

Now those devices works on my own firmware, have initial mode to setup them and connect to MQTT server. The button on device allows manually switch light if you are not able to use application. The same button is using to clear settings of device and make initial setup again in cases when you changed your MQTT server or WiFi credentials.

Here is an Arduino code

Leave a Reply

Your email address will not be published. Required fields are marked *