Starting out with an Arduino Uno and Dragino LoRa shield

Hi, new LoRa user here.

I’ve got the following hardware that was provided to me. I have checked on TTNMapper and there’s multiple gateways within range, so I should be covered.

  • Arduino Uno
  • Dragino LoRa-shield (version 1.4).

I’ve created an application in the EU1 Cluster. I am however getting stuck on adding my end device to that application. For now, my goal is just to try and add it to the application and send some dummy data.

I have tried to find some documentation online, but I think I’m searching for the wrong stuff since I’ve been unable to find anything that explains the process to add an Arduino Uno with Dragino LoRa-shield to an application within TTN.

Especially the stuff like DevEUI, AppEUI etc are confusing me. Where do I find these? Is it OK to use a random string as some people online suggested? Do I need to use the device repository or manual?

If anyone could put me in the right direction with some links or an explanation, that would be really helpful.

Thanks in advance.

Almost everyone starts out thinking in terms of their hardware, but this is actually a mistake, because LoRaWAN is a software-level protocol. In actuality, registration on TTN has to be thought of in terms of the software that your node is running - what the hardware does is govern what your software options will be.

With modern TTN, really your only viable software choice on that hardware is a recent checkout of MCCI LMiC (or something wrapping it), carefully set to a minimal configuration to fit within the Uno’s memory constraints (the Uno/ATmega328 is no longer a recommended platform for LoRaWAN at all, but it can still barely fit). Older software Dragino, etc may be offering is no longer viable as it does not correctly implement the protocol.

The MCCI LMiC documentation and related threads here an elsewhere will provide what you need to know about registering a node.

I saw this library and have attempted to use it. I do unfortunately keep receiving “noJoinAccept” messages when I look at the serial monitor. I’ve read online that this most likely has to do with using the wrong values for the frequency plan, regional paramaters and/or lorawan version.

I also read that this should be provided in a datasheet, I’ve found the datasheet for the LoRa shield v1.4 but it does unfortunately not contain that information.

Do you know the correct regional parameters (for EU), or know where I can find them?

EDIT: I did replace all the necessary information (AppKey etc) in the sketch with the values of the end device that I created in TTN.

Thanks in advance.

The hardware has no clue where in the world it is going to be used or what software is going to be used, so this isn’t good info.

You’d be best off starting out with the best documented stack in the world - LMIC-node - the instructions are very detailed:

I am struggling for a few days already on figuring out how to get my Dragino Arduino Uno connected to The Things Network. I ordered a The Things Indoor Gateway and that’s perfectly up and running and connected and visible in the The Things Network console.

At first I thought I needed a new Arduino board, as TTN sells the Things Uno (seems to be a Leonardo). Googling hinted that I could also use my Dragino Arduino Uno board together with the Dragino LoRa Shield.

I looked at the LMIC-node GitHub example and installed platform.io as plugin for my Visual Studo IDE. First I started by making sure that I can blink the on board LED:

platform.ini:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_port = /dev/ttyUSB0

main.cpp:

#include <Arduino.h>

void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);

  // wait for a second
  delay(250);

  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);

   // wait for a second
  delay(250);
}

Builds and uploads fine. The Arduino onboard LED starts blinking. So far so good to make sure that works.

Then the first problem I face is that when looking at the LMIC-node repository I don’t see my board being supported and I can’t seem to find any examples on Google on how to use this with my Arduino Uno.

I tried to extend my platform io configuration:

 PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;

[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_port = /dev/ttyUSB0
lib_deps = mcci-catena/MCCI LoRaWAN LMIC library@^4.1.1

; --------------------------------------------------
; |  MCCI LoRaWAN LMIC library specific settings   |
; --------------------------------------------------

[mcci_lmic]
; LMIC-node was tested with MCCI LoRaWAN LMIC library v3.3.0 and v4.0.0.
; Some changes have been announced for future versions of the MCCI library
; which may be incompatible with LMIC-node. In case of problems just
; use mcci-catena/MCCI LoRaWAN LMIC library@4.0.0 below which will
; explicitly use v4.0.0 of the library.
; Perform 'PlatformIO: Clean' after changing library version and
; in case of issues remove the old version from .pio/libdeps/*.

; Note: LMIC_PRINTF_TO is defined for each board separately
;       in the board specific sections. Don't define it in this section.

lib_deps =
    ; Only ONE of below LMIC libraries should be enabled.
    mcci-catena/MCCI LoRaWAN LMIC library           ; MCCI LMIC library (latest release)
    ; mcci-catena/MCCI LoRaWAN LMIC library@4.0.0   ; MCCI LMIC library v4.0.0

build_flags =
    ; Use platformio.ini for settings instead lmic_project_config.h.
    -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS

    ; Ping and beacons not supported for class A, disable to save memory.
    -D DISABLE_PING
    -D DISABLE_BEACONS

    ; -D LMIC_DEBUG_LEVEL=1            ; 0, 1 or 2
    
    ; -D CFG_sx1272_radio=1            ; Use for SX1272 radio
    -D CFG_sx1276_radio=1              ; Use for SX1276 radio
    -D USE_ORIGINAL_AES                ; Faster but larger, see docs
    ; -D LMIC_USE_INTERRUPTS           ; Not tested or supported on many platforms
    ; -D LMIC_ENABLE_DeviceTimeReq=1   ; Network time support

    ; --- Regional settings -----
    ; Enable only one of the following regions:    
    ; -D CFG_as923=1
    ; -D CFG_as923jp=1   
    ; -D CFG_au915=1
    ; -D CFG_cn490=1                   ; Not yet supported
    ; -D CFG_cn783=1                   ; Not yet supported
    ; -D CFG_eu433=1                   ; Not yet supported
    -D CFG_eu868=1
    ; -D CFG_in866=1
    ; -D CFG_kr920=1
    ; -D CFG_us915=1

When I try to build it fails about a missing SPI header file, I looked that up in the platform io registry, but have no clue which dependency to include/choose. Anyway it fails with the following:

Processing uno (platform: atmelavr; board: uno; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: docs platformio org /page/ boards/ atmelavr/ uno html
PLATFORM: Atmel AVR (4.0.1) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> bit ly / configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- MCCI LoRaWAN LMIC library @ 4.1.1
Building in release mode
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/hal/hal.cpp.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/lmic_us_like.c.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/lmic_util.c.o
.pio/libdeps/uno/MCCI LoRaWAN LMIC library/src/hal/hal.cpp:14:10: fatal error: SPI.h: No such file or directory

*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SPI.h"
* Web  > registry . platformio . org / search?q=header:SPI.htp
*
*************************************************************

 #include <SPI.h>
          ^~~~~~~
compilation terminated.
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/oslmic.c.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/radio.c.o
Archiving .pio/build/uno/libFrameworkArduinoVariant.a
Indexing .pio/build/uno/libFrameworkArduinoVariant.a
Compiling .pio/build/uno/FrameworkArduino/CDC.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial0.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial1.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial3.cpp.o
Compiling .pio/build/uno/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/uno/FrameworkArduino/PluggableUSB.cpp.o
Compiling .pio/build/uno/FrameworkArduino/Print.cpp.o
*** [.pio/build/uno/lib161/MCCI LoRaWAN LMIC library/hal/hal.cpp.o] Error 1
Compiling .pio/build/uno/FrameworkArduino/Stream.cpp.o
================================================================================================ [FAILED] Took 0.38 seconds ================================================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

I find it very hard to find information on how to get my Arduino Uno up and running with the new TTN v3. I had my Arduino Uno running for two years on the ‘old’ V2-network, that was using the Arduino IDE.

What steps can I take to get my board running with LMIC-node?

Have you been able to figure it out?

I’m currently looking for a way to set up a node using Arduino UNO and Dragino LoRa Shield, I have an up and running gateway using a Raspberry with an ic880a-SPI concentrator.

I’ve looked up some information and I found this github repo: https://github.com/matthijskooijman/arduino-lmic

I haven’t tried it yet because I’m waiting for my Dragino to be delivered to me, but I hope it helps.

That is a very old and unmaintained implementation. Better to look at the MCCI-LoRaWAN-LMIC implementation as something more up to date.

Also take a look at

As one of the better documented frameworks supporting either MCCI or IBM LMIC (for under resourced boards/MCU’s) based implementations.

Just like wot I said directly above the previous last post. :man_shrugging:

Indeed, good advice always worth repeating :slight_smile: As poster looking at arduino (vs PlatformIO) thought worth giving direct MCCI link… :+1: