Friday, November 10, 2017

IoT - power it up!




Intro

Many devices uses current on standby mode. So we like to plug them into a power stripes with a switch on it. And we hide it behind some furniture because it's quite ugly to look at some cables. But now it's hard to reach. So.. if we could control the switch remotely within the comport of our couch? That's what IoT is made for.

Wiring





Video



Attention!



Working with 110V AC or 230V AC is very dangerous and should be done only by a professional! Not only can it kill you, you also suffer incredible pain while you die!

Configure MQTT-Client

The MQTT broker and your client device has to be either in the same network or at least reachable through the internet (not really recommended).
You enter the IP and port of your broker to connect to it.
Add a new widget for on/off mode.
Then you subscribe to the channel the ESP is sending it's status to. It is: "esp/3/power/out" in this code.
You need now to enter the channel, where you want to publish commands to. The ESP subscribes messages from this channel. I used "esp/3/power/in" for this case.
Now, the only thing left to do is to define the messages for on and off. Usually it would be best to use 1 for on and 0 for off. I go for 10 for off and 11 for on.

Links

ESP 8266 NodeMcu @ Amazon
Relay @ Amazon
Simple Power strip @ Amazon
Finding a Smartphone @ Amazon

Update

Code for the ESP 8266
https://bitbucket.org/Remnis/mqtt-iot-switch

 
 Banggood 11.11 Global Shopping Carnival Electronic Special -- https://goo.gl/zHEiJW