everywhere I look, if it comes to MQTT messaging, it is all over Ethernet. Unfortunately, I do not have Ethernet wires available.
I am automating my home, wanting to use mqtt as messaging service. My buttons give a signal (like light 'on') to an arduino board running a mqtt client. How do i put out the mqtt message on the serial lines so the transmitted message can be straight forwardly be picked up by an mqtt broker, without using the ethernet cables?
Here are some possibilities for using MQTT over serial communication: Use SLIP between the Arduino and the gateway. It may be possible to implement MQTT directly over serial, without TCP/IP, although I am not aware of any gateways to do this.
It may be possible to implement MQTT directly over serial, without TCP/IP, although I am not aware of any gateways to do this. MQTT-SN (a slightly different protocol to MQTT) was designed for sending messages over unreliable transport, and may be better suited to a serial line.
These principles also turn out to make the protocol ideal of the emerging “machine-to-machine” (M2M) or “Internet of Things” world of connected devices, and for mobile applications where bandwidth and battery power are at a premium. Actually you can use MQTT with an Arduino board using Arduino Ethernet Client api.
Those messages are formed by a topic and a payload A device can publish messages to the LAN and it can subscribe to messages on the LAN. Now when I say "publish to the LAN" that is a bit of a eufemism, because in fact a node will be publishing its messages and subscribing to messages from a so called MQTT broker.
As I was looking for the same answer and didn't find anything to my liking, I decided to write an implementation that enables any Bluetooth, USB or pure serial port communication to send MQTT message. You can find the result here : https://github.com/vortex314/serial2mqtt It enables any linux machine ( Raspberry Pi 1, Raspi 3 , PC ) to act as a gateway. It's written in C++ so should be lightweight enough for small devices. Hope this helps.
Update 27/6 : build folder contains pre-build version for Linux Intel and Raspberry.
I am trying to achieve similar goals for my house automation, although I do have Cat5e in the walls, so could use Ethernet.
Here are some possibilities for using MQTT over serial communication:
I did start looking at MQTT over serial implementations but one of the problems I didn't resolve was how to deal with multiple devices:
So I am current looking at implementing MQTT-SN for the ENC28j60 ethernet controller...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With