Skip to content

sebromero/arduino-lorawan-intro

Repository files navigation

Arduino LoRaWAN Introduction

This repository contains the example code for The Things Summer Academy workshop about LoRaWAN devices.

Provided Code

The following list explains for each sketch / code what it's intended for.

Assignment

Create your own LoRa powered environment sensor station!

Warm up tasks

  1. Create a TTS app and register your device
  2. Create your own sketch that reads from the ENV shield sensors
  3. Send the sensor values to TTS every 20 minutes. Put the board to sleep in the mean time.
  4. Add a payload decoder to decode the sensor values
  5. Round the float values to two digits in the payload decoder

Tasks

  1. Add a warning message in the payload decoder if the temperature is too high / too cold (e.g. -5 / above 34 celsius)
  2. Define approximate illuminance thresholds for: day, twilight, night and add a “daylight” property with a value according to those thresholds (changes over the day)
  3. Add a “pressureTendency” property to see if atmospheric pressure is rising / falling. Do so by calculating the tendency over the last 3 hours. (Hint: millis())
  4. Add the weekly average temperature as a “averageTemperature” property

Bonus

  1. Use a TTS downlink to maintain and synchronise a clock on the Arduino (manually).
  2. Now that you know the time, replace the twilight value of the “daylight” property with either dusk or dawn depending on the time of the day.
  3. Record the approximate sunrise / sunset times based on the daylight property and add them as “sunrise” / “sunset” properties (don’t change over the day)
  4. Think of a way of enabling/disabling the 4 sensors by sending a downlink messages with just 1 byte. (Hint: Use bit-wise operators). If a sensor is disabled, the sensor value shall not be read/sent via LoRaWAN to save energy and bandwidth. Send the same byte in your uplink message to let the payload decoder know how to decode the message. e.g. if The pressure sensor is disabled, only 3 * 4 = 12 bytes are sent for the sensor values and the bytes of the 3rd sensor in the byte stream belong now to the illuminance sensor rather than the pressure sensor.

Optional

If you have a micro SD card, save the sensor data to the SD card to prevent data loss when power goes out. Upon boot, check for existing sensor data and send it to TTS. SEE: https://www.arduino.cc/en/reference/SD

Troubleshooting

If you encounter any errors in the Arduino IDE, please refer to the Arduino help center: https://support.arduino.cc/hc/en-us

Relevant Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published