Skip to content

AmedeeBulle/TTNMkrWanNode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TTN MKRWAN Node Build Status

Background

Proof of concept for an "ultra low power" LoRaWAN / The Things Network node using the Arduino MKR WAN 1300.

The MKR WAN 1300 uses too much power in sleep mode to be used as ultra low power device (a bit more than 1mA).

This proof of concept uses a Texas Instrument TPL5110 Ultra Low Power Timer to bring the sleep current under 50nA.
As the device is completely powered off during sleep time we use a FRAM module to save the LoRaWAN session keys and frame counters.

Two test nodes:
Top left: display and Maxim DS18B20 temperature sensor
Bottom left: Bosch BME280 temperature humidity and pressure sensor
Nodes
Top right: sleep current
Bottom right: running current (node with the display)

Theory of operation

  1. TPL5110 wakes up and power on the MKR WAN 1300
  2. Read saved data from FRAM
  3. Join the network
  4. OTAA the first time (no data in FRAM)
  5. ABP using the saved session keys and frame counters afterwards
  6. Collect data from sensors
  7. Send LoRaWAN payload in Cayenne LPP format
  8. Check for downlink message
  9. Enter sleep mode (raise the Done pin of the TPL5110)

Hardware requirement

The code relies on the following hardware:

Any similar hardware should work, but might need some code change.

Software dependencies

The Arduino IDE with following libraries (all available from the Arduino Library Manager):

Sample setup

Sample setup with an SH1106 OLED display and a DS18B20 sensor:

Fritzing

Operations

Software configuration

  • Copy arduino_secrets_distr.h to arduino_secrets.h and enter your keys obtained from TheThingsNetwork console
  • In TTNMkrWanNode uncomment the defines for your sensors.
    The Voltage sensor is always available, it uses the built-in divider. Note that givent the fact that the divider is 1/3rd and the voltage reference is 1.0v, the maximum you can measure is 3.0v...
  • In debug.h choose your debugging option:
    • #define DEBUG commented out: no debug code generated
    • #define DEBUG uncommented: debug on the (USB) serial console. The node will wait for the console!
    • #define DEBUG and #define OLED uncommented: debug messages on the OLED display.
  • In ttn.h you can set your LoRaWan default port and data rate

Power

Disconnect power coming from the TPL5110 (DRV) when powering from USB.

Initialisation

If the FRAM does not contain valid data or if the button is pressed when the MKR WAN 1300 starts, the device will perform an OTAA join.

Downlink messages

Before sleeping the node will check for downlink message:

  • 0x01: Reset. The node will perform an OTAA join during next cycle
  • 0x02 0xpp: Set port. The node will use port pp when sending data
  • 0x03 0xdd: Set data rate. The node will use the requested data rate.

Sleep time

  • When powered from USB, the node will idle for 5 minutes then reset itself
  • When powered through the TPL5110 the sleep time is driven by a resistor (on the Adafruit breakout you can use the trimpot on the board)

Releases

No releases published

Packages

No packages published