Arduino based MQTT-SN Client
- ESP8266 ✅
- ESP32 ❎
- Arduino Mega ❎
- Arduino Uno ✅
| UDP | TCP | Ethernet | WiFi | ZigBee | LoRa | BLE | |
|---|---|---|---|---|---|---|---|
| Arduino ESP8266 | ✅ | ✅ | ✅ | ❎* | ❎* | ||
| Arduino ESP32 | ❎ | ❎ | ✅ | ❎* | ❎* | ❎ | |
| Arduino Mega | ❎* | ❎* | ❎* | ❎* | ❎* | ||
| Arduino Uno | ✅* | ✅* | ✅* | ❎* | ✅* |
* needs additional transmission hardware
- ✅ implemented and tested
- ❎ not implemented yet
For UDP we use the WiFiUdpMqttSnClient example with a ESP8266 (e.g. NodeMCU v1.0).
You do not need additional hardware as mentioned in Transmission Technology to Platform Matrix. We tested it with the following Hardware:
- NodeMCU v1.0
We only need the arduino-mqtt-sn-client library.
Perform the following steps for the ESP8266 UDP MQTT-SN Client:
- Download this library.
- Extract the archive and rename the folder to
arduino-mqtt-sn-clientthen copy it to your Arduino library directory. - Restart your Arduino IDE if open.
- Select a ESP8266 board in the Arduino IDE.
- Open the example in
examples -> arduin-mqtt-sn-client -> esp8266 -> WiFiUdpMqttSnClient. - Adapt
ssidandpasswordto your WiFi network. - Change
gatewayIPAddressandlocalUdpPortto your MQTT-SN gateway's IPAddress and UDP port - Upload and try :)
For TCP we use the TcpMqttSnClient example with a ESP8266 (e.g. NodeMCU v1.0).
You do not need additional hardware as mentioned in Transmission Technology to Platform Matrix. We tested it with the following Hardware:
- NodeMCU v1.0
We only need the arduino-mqtt-sn-client library.
Perform the following steps for the ESP8266 TCP MQTT-SN Client:
- Download this library.
- Extract the archive and rename the folder to
arduino-mqtt-sn-clientthen copy it to your Arduino library directory. - Restart your Arduino IDE if open.
- Select a ESP8266 board in the Arduino IDE.
- Open the example in
examples -> arduin-mqtt-sn-client -> esp8266 -> TcpMqttSnClient. - Adapt
ssidandpasswordto your WiFi network. - Change
gatewayIPAddressandlocalTcpPortto your MQTT-SN gateway's IPAddress and TCP port - Upload and try :)
For LoRa we use the RF95DatagramMqttSnClient example with a Arduino Uno. LoRa on the physical layer and the RHDatagram on the data link layer.
As mentioned in the Transmission Technology to Platform Matrix you need additional Hardware. We tested it with the following Hardware:
- Arduino Uno + Dragino LoRa Shield
- Arduino Uno + Dragino LoRa/GPS Shield
We only need the arduino-mqtt-sn-client library and the airspayce RadioHead library.
Perform the following steps for the Arduino LoRa MQTT-SN Client:
- Download this library.
- Extract the archive and rename the folder to
arduino-mqtt-sn-clientthen copy it to your Arduino library directory. - Download the airspayce RadioHead library from homepage. I tested it with version 1.87. Copy it into your Arduino Library directory.
- Extract the archive, then copy
RadioHead-1.87/RadioHeadinto to your Arduino library directory. - Restart your Arduino IDE if open.
- Select the
Arduino/Genuino Unoboard in the Arduino IDE. - Open the example in
examples -> arduino-mqtt-sn-client -> rf95 -> RF95DatagramMqttSnClient. - Adapt
OWN_ADDRESSto your your MQTT-SN client'sRHDatagramaddress. - Configuration LoRa by changing
FREQUENCY,TX_POWERandMODEM_CONFIG_CHOICE - Change
MqttSnGateway_Addressto your MQTT-SN gateway'sRHDatagramaddress. - Upload and try :)