This program allows us to control a relay attached to an ESP8266 (over NodeMCU board) through the MQTT protocol. With the mobile app, we can control it from anywhere.
Instructions
- ✌️ Fork this repository and clone through terminal
git clone <url>
. - 📂 Set the directory on the cloned folder
cd <folder>
. - 📝 Modify the project as you wish.
- ✨ Stage the changes
git add *
and create new commit:git commit -am "Summary of changes"
. - ⬆️ Upload your work:
git push origin master
. - 📧 Feel free to initiate a pull request :D
Si deseas aprender Git, visita mi guía sobre Git.
MQTT is a machine-to-machine "Internet of Things" connectivity protocol and a extremely lightweight publish/subscribe messaging transport.
This application connects to a MQTT broker (wich you can find for free) and listens to the topic lights
under home
(/home/lights
). If it receives '1' or '0' starting strings, the ESP will turn on or off a relay wich controls lights. It also publishes status info at the topic /home/log
.
I also made a simple Android app for this program at this repository.
You will need:
✅ To install drivers for your board depending on the system.
✅ A well installed Atom text-editor with PlatformIO environment installed.
✅ A cloud MQTT broker. (ok, take this one)
You will need the knolleary's great 📚 PubSubClient library for your own projects wich is included under the lib directory. It can also be installed via PlatformIO home
at Atom, Libraries
.
🚀 After that you can just clone this repository through atom or Git and modify and upload the main sketch. The program uses the main functions of the library but you can always check knolleary's PubSubClient documentation for more.
Finally, in case you need in depth information about hardware or library, checkout his repo 📚 PubSubClient library.