Working with the Cayenne Dashboard - Internet of Things (Part 2)

In the Internet of Things there are various ways of communication that are more or less suitable for battery operation. The following diagram shows several ways in which an IoT device can be connected to a dashboard.

Let's start with a device that communicates directly via MQTT. We have two options for this.

In the simplest case, the device is connected to a server on the local network (red line). On this server, the measured values can be processed and actions can be triggered in the device.

  • Advantage:High data security, flexibly customizable, very affordable
  • Disadvantage: Own server required, low range, relatively high power consumption

We can also connect the device to an IoT server in the cloud via a Wi-Fi router and the Internet (as in Part 1 of this blog series). On the IoT server, the metrics can then be processed and actions can be triggered.

  • Advantage: No local server required, very affordable
  • Disadvantage: Reduced data security (Internet), low range, relatively high energy consumption

The second variant is a device that supports LoRa (Long Range) transmission. This radio transmission is characterized by long range and low energy consumption.

The easiest way is to connect the device to TheThingsNetwork (TTN) a worldwide network for IoT. However, a gateway should be available within a radius of 5 km. If this is not the case, you can operate a gateway yourself. Since such gateways are not quite cheap (>100 €) I tried to build a simple 1-channel gateway with ESP32 + LoRa. Although there are corresponding Online_Projekte, my attempts were only partially successful. When using the TTN, the data is sent via LoRa to the gateway, which then sends the data to the TTN via MQTT. Cayenne can be connected to the TTN via another gateway and display the data on the dashboard. In my experiments, however, I was sometimes able to connect from the device to my gateway and on to the TTN. However, the LoRa connection with the protocol used by TTN was not stable. I had been connected to Cayenne by the TTN but not from my LoRa device.

  • Advantage: Long range, low energy consumption, can be used anywhere with TTN coverage
  • Disadvantage: Complex LoRa transmission protocol (multi channel), still poor network coverage, fair use allows only 1 second per hour to transfer data, LoRa devices are relatively expensive.

Since I was not successful with the TTN Gateway, I developed a simple gateway that receives data via a fixed LoRa channel and passes it asynchronously to the MQTT server (Cayenne). Conversely, actions are received from the MQTT Server and transmitted asynchronously via LoRa to the corresponding device. This gateway will be featured in the next part of this blog series.

  • Advantage: Long range, low power consumption, direct connection to mqTT server
  • Disadvantage: Propitarian gateway does not work with commercial LoRa devices, limited number of parallel devices, LoRa modules are relatively expensive.

The third variant is a device that ESP-Now uses for transmission. This protocol is also energy-saving, as the data is sent directly to the gateway using the MAC address using the MAC address, eliminating the time-consuming connection and thus the WLAN transmitter is only active for a few microseconds per data packet. This protocol does not require a LoRa module, but can be used directly with any ESPxxx controller, which makes very inexpensive devices feasible. The extension of the LoRa gateway to support ESP-Now is presented in a later post in this blog series.

  • Advantage: low energy consumption, low price
  • Disadvantage: range (Wi-Fi), not compatible with commercial systems.

In the next article we will introduce a gateway based on the ESP32 with LoRa and OLED display.

Basics software

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN