Donor for the case was a timer plug that was in the house. After I've removed its content, I've added my stuff.
IoT plug |
- power supply (220V-3v3 1A)
- 5V relay ( is working fine on 3.3 V)
- ESP-01 covered in blue tape
And the final IoT plug:
IoT final plug |
The ESP-01 is accepting JSON over MQTT from my mosquitto broker.
To control the plug from my phone, I've created an android application that connects over
websockets to mosquitto broker and is sending commands.
Plug is sending status every 15 seconds to its subscribers and a status after every command its receiving.
Cool.....now I can turn on or off my lamp with my IoT device.
For Android application I've used for rapid development a template, but I am planning to build a totally new application that will discover the IoT devices and add them automatically to the control screen.
This looks interesting!
ReplyDeleteI am playing with a few esp03 modules, going in the same general direction: esp, lua, mqtt_client, mqtt_broker, home automation. I have some questions, you may have more experience in this. As a long term plan, where would you host the mqtt broker? How do you plan to reconfigure the clients firmware?
Were you able to reuse anything from the programmable plug?
Marius
Hi Marius,
DeleteRight now the MQTT broker is on a PogoPlug NAS that was converted to a debian arm linux. I've have it also on my Raspberry Pi B/2 because later I want to test to connectivity between brokers. In the future I will use the ESP with 4M of flash since I am am on the edge right now. With 4Mb I will use OTA update for reconfigure (firmware updates). My code can address multiple sensors, so obtaining the firmware for one of them is just a matter of compiling it.
Regards,
Catalin
I have yet to play with OTA update but it seems like a clean way of doing it if the updates are accepted only from an internal network server. So the device once installed would not need a serial input in case minor things happen (let's say the broker IP or AP password changed).
ReplyDeleteIt makes more and more sense to have a dedicated Raspberry PI as server to handle internal MQTT chatter and then interface that one with REST API with web pages or apps. I've seen some configurations using nodejs on top of the mqtt but the overhead doesn't seem necessary unless you need to handle tens or hundreds of devices.
You were mentioning that you want to have it control the sprinkler system, did you run into range limitations so far with ESP01?
Marius
My plan to configure the IoT devices is to start device in AP mode, connect to it and setup the MQTT IP address, port, user, password in a web page served by the ESP. After that the next reboot will put device into Station mode and will work normally. If the IP or password is changing then be reseting device with a button pressed will start again in AP mode and a new config will be set up. For this I need more memory on ESP.
DeleteFor sprinkler system I am using ESP201 with and external antenna because I need to control 4 valves. This week end I will put the system in place. Give me an email and I'll let you know about the range issues.
Great job. Take a look at the Sonoff devices. They're cheap and already have an ESP8266 already built in. Already setup to reflash it with your own code. Many have changed the memory chip out to be able to do OTA updates and larger programs.
ReplyDeleteThanks Michael. I've made this on Monday, April 20, 2015 when Sonoff didn't exist :-) I have some Sonoff, I need to find some time o flash them. Mine are 1Mb.
DeleteI saw this and it's very remarkable!
ReplyDeleteMy question is, your MQTT are you able to control lamp WAN or just LAN?
Thanks and great job!
-mike
Sure. It can control the lamp over the Internet also. Check the blog and iotcentral.eu. I've also wrote a book on how to create any smart device, how to create your cloud and your mobile application. Check the latest articles on the blog.
DeleteIn the past 4 years, the ESP8266 is the most popular Wifi solution for Makers, the good spec and cheap price make the competitors, such as RTL8710, hard to grow up.
ReplyDeleteBut sometimes plan B is indeed needed. Recently the W600 Arm SoC Wifi solution, released by Winner Micro, we think would be an evenly matched competitor for ESP8266.