Skip to content

nottledim/arduino-mqtt-sn-client

 
 

Repository files navigation

arduino-mqtt-sn-client

Arduino based MQTT-SN Client

Models

  • ESP8266 ✅
  • ESP32 ❎
  • Arduino Mega ❎
  • Arduino Uno ✅

Transmission Technology to Platform Matrix

UDP TCP Ethernet WiFi ZigBee LoRa BLE
Arduino ESP8266 ❎* ❎*
Arduino ESP32 ❎* ❎*
Arduino Mega ❎* ❎* ❎* ❎* ❎*
Arduino Uno ✅* ✅* ✅* ❎* ✅*

* needs additional transmission hardware

Legend:
  • ✅ implemented and tested
  • ❎ not implemented yet

Getting Started

ESP8266 (UDP)

For UDP we use the WiFiUdpMqttSnClient example with a ESP8266 (e.g. NodeMCU v1.0).

Hardware

You do not need additional hardware as mentioned in Transmission Technology to Platform Matrix. We tested it with the following Hardware:

  • NodeMCU v1.0

Libraries

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-client then 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 ssid and password to your WiFi network.
  • Change gatewayIPAddress and localUdpPort to your MQTT-SN gateway's IPAddress and UDP port
  • Upload and try :)

ESP8266 (TCP)

For TCP we use the TcpMqttSnClient example with a ESP8266 (e.g. NodeMCU v1.0).

Hardware

You do not need additional hardware as mentioned in Transmission Technology to Platform Matrix. We tested it with the following Hardware:

  • NodeMCU v1.0

Libraries

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-client then 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 ssid and password to your WiFi network.
  • Change gatewayIPAddress and localTcpPort to your MQTT-SN gateway's IPAddress and TCP port
  • Upload and try :)

Arduino Uno (LoRa)

For LoRa we use the RF95DatagramMqttSnClient example with a Arduino Uno. LoRa on the physical layer and the RHDatagram on the data link layer.

Hardware

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

Libraries

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-client then 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/RadioHead into to your Arduino library directory.
  • Restart your Arduino IDE if open.
  • Select the Arduino/Genuino Uno board in the Arduino IDE.
  • Open the example in examples -> arduino-mqtt-sn-client -> rf95 -> RF95DatagramMqttSnClient.
  • Adapt OWN_ADDRESS to your your MQTT-SN client's RHDatagram address.
  • Configuration LoRa by changing FREQUENCY, TX_POWER and MODEM_CONFIG_CHOICE
  • Change MqttSnGateway_Address to your MQTT-SN gateway's RHDatagram address.
  • Upload and try :)

About

Arduino based MQTT-SN Client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 83.4%
  • C 16.6%