After the Pycom IoT hackday earlier this month I immediately ordered a pair of ESP32 LoRa boards so I could do some exploration to better understand how a LoRa solution is built. The boards promptly arrived this weekend and I spent the last few days putting together a test LoRa node, a LoRaWAN gateway with connection to The Things Network (TTN).
For the gateway I set up the Pycom FiPy board using the detailed LoRaWAN Nano Gateway guide. This acts as a single channel gateway to connect the LoRa node to TTN. The gateway configuration needs to be set in the config.py and since I am based in Europe, I only needed to set my WiFi SSID and password details so the gateway can connect to the internet. All other LoRaWAN configurations were left at their default values: EU868 frequency, data rate DR5, spread factor SF7, bandwidth of 125kHz. This corresponds to a bit rate of 5,470 bits/s with a maximum payload of 230 bytes.
Since I am using a single channel gateway it is important to match the LoRa node setup exactly with the gateway settings. The node is programmed from the Arduino IDE and uses the Arduino-LMIC library and the ttn-otaa example by Matthijs Kooijman.
Setting up the TTGO LoRa boards took a little time as details from the manufacturer are incomplete. To get the LMIC library to communicate with the onboard SX1276 LoRa transceiver use the following pin mapping.
Since I am using a single channel gateway it is important to match the LoRa node setup exactly with the gateway settings. The node is programmed from the Arduino IDE and uses the Arduino-LMIC library and the ttn-otaa example by Matthijs Kooijman.
Setting up the TTGO LoRa boards took a little time as details from the manufacturer are incomplete. To get the LMIC library to communicate with the onboard SX1276 LoRa transceiver use the following pin mapping.
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = {26, 33, 32} // Pins for the Heltec ESP32 Lora board/ TTGO Lora32 with 3D metal antenna
};
I am using TTN OTAA (Over The Air Activation) and it is important to pay attention to the format of the device and application EUI. These need to be copied from the TTN console in little-endian format, LSB first. The application EUI is in big-endian and can be copied directly from the TNN console.
Since my LoRaWAN has only a single channel I need to force the LoRa node to use a single channel with the same frequency (channel 0, 868.1MHz, SF7BW125) and disable all other device channels.
I will add a link to my code once I tidy it up on github.
Some useful references:
Since my LoRaWAN has only a single channel I need to force the LoRa node to use a single channel with the same frequency (channel 0, 868.1MHz, SF7BW125) and disable all other device channels.
I will add a link to my code once I tidy it up on github.
Some useful references:
- Arduino-LMIC library by Matthijs Kooijman
- LoRaWAN quick guide build by Mobilefish.
- Mobilefish also has an excellent LoRa/LoRaWAN tutorial playlist on his Youtube channel.
No comments:
Post a Comment