This series documents a set of experiments to explore LoRa for a telemetry application. Note this is simple multipoint to point LoRa, it does not use LoRaWAN.
IoT – exploration of LoRa – part 1 outlined a simple direct RESTful submission to Thingspeak from the LoRa – Wifi gateway.
IoT – exploration of LoRa – part 2 outlined a simple RESTful submission to Node-Red from the LoRa – Wifi gateway.
This article describes a direct MQTT submission from the gateway. In this case the gateway converts the binary LoRa payload into more friendly MQTT key,value pairs.
The block diagram above shows the information flow between the main elements.
Above is the sensor client end of the system. The prototype sensor is a BME280 digital temperature, humidity and pressure sensor connected by I2C to a 3.3V 8MHz Arduino Pro Mini which drives a inair9b SX1276 based LoRa wireless module. The payload is binary coded for efficiency of the radio link. Node specific parameters are stored in EEPROM, so essentially the same binary runs in replicates, just the EEPROM contents vary.
The LoRa-WiFi gateway above is implemented using a Wemos D1 mini ESP8266 module (on the underside of the stack) and a Hallard RF95 LoRa shield to suit. The ESP8266 connects to the Internet by WiFi and submits sensor data directly to MQTT.
The MQTT topic name captures the hierarchy of the message source, lmg/type/gwid/src/measurement. gwid is the gateway id, and comes from an embedded 64bit GUID on the gateway shield. The MQTT server provides a convenient source for local LED display modules, logging etc (eg ESP8266 remote power display for energy monitor – EV3 – 5V display).