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?