Introduction: The Universal MQTT Remote
Hi everyone,
First of all, I'm french, so that's possible that some sentences make no sense, I'm sorry, I'm working hard to improve.
I currently work on home automation in my condo. I used OpenHab2 and mosquitto as software. I'm not an expert in these two softwares but I know how they work generally. OpenHab is the user side, with a graphic interface made to control the house. Mosquitto is a software made to make things talk together. For example, OpenHab is able to talk with my hardware easily.
For the people who don't really know the MQTT protocol, here's a website that explains the basic.
My problem is that I want to control my hardware ( 4 smart wall plugs ) with real switches, not only with OpenHab's web interface .I designed, programmed and created a remote that is able to send MQTT requests to the devices I choose. The best thing in my remote is that I have 4 buttons, for a menu, and I can add the number of device that I want to.
Here's how I did it.
Step 1: Parts
-Esp8266. I use a NodeMCU. Banggood
-Mini breadBoard. I use that because I want to be able to reuse my component when I will make a V2 of the remote with a pcb. Banggood
- LCD. I use 16x2 LCD but 20x4 work also. Important to have i2c module on you LCD. Banggood
-Buttons. I use 4 buttons, Up, Down, Enter and Exit. Bangood
-Resistors. 4.7K resistor for pull-up the switch
- M3 screw.
- Hot glue.
-PCB. not necessary but I solder my buttons and resistor on it.
Step 2: Wiring Diagram
Follow the shematic for the buttons.
Buttons :
UP ---------- D5 or GPIO 1
Down ------- D6 or GPIO 12
Enter ------- D7 or GPIO 13
Exit --------- D4 or GPIO 2
LCD :
SDA --------D2 or GPIO 4
SCL --------D1 or GPIO 5
5V ----------Vin
GND -------GND
Step 3: Arduino Code
You need to change some information in the sketch.
The MQTT_SERVER is just the IP address of where your MQTT server is running.
SSID and password of your Wifi.
The last thing to change is your topics. What is your topics? Well, you choose want you want. I have four topics but you can add a lot more if you want. The only thing to remember is that you need to update the number of topic ( int NombreTopic = 4; ) in the code. It should match with the number of topic you write.
Attachments
Step 4: Construction
I designed a 3D printed case for my remote. I print it at 1.015 scale, 20% infill with white PLA and the result is very good.
If you dont have a 3D printer, you can made a simple case with thin wood or plexiglass.
Once the case was made, I started by glued the buttons. I pushed hard on the back of the button to be sure that we can use it correctly. I glued the screen with hot glue. Before putting the breadboard in the enclosure, I glued the wire to be sure that they don't move.
Finish with the two screw and the back plate.
note: You can write with a pencil on the box like : UP , DOWN, ENTER and EXIT.
Step 5: Enjoy!
In the video, you can see 4 windows for my four topic. In those windows you can see the MQTT message that the remote send to the topic.
Your remote is now complete, you need to ajust your smart hardware to listen to your topic and you can use your remote for control your home!
If you have any questions about this remote, I'll be here to answer you.
If you appreciate this little project, feel free to like and vote for me in the Remote Contest!
Thanks