Skip to the content
2 layers56.5 × 66.8 mmTracker v1, the printed circuit board in 3D

LoraWan soil sensor

Size
56.5 × 66.8 mm
Copper layers
2
Thickness
1.6 mm
Parts
45
Nets
35
Pads
203
Tracks, vias
787, 68
Pours
2
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
21 Jun 2020
Updated
21 Jan 2024

Overview

Tracker v1 is an open-source printed circuit board by angelnu, from the angelnu/LorawanSensor repository on GitHub, published under the MIT licence. It is a 2-layer board of 56.5 × 66.8 mm with 45 parts on 35 nets, routed with 787 tracks and 68 vias.

It is built around the STM32L412KBT6, LIS3DH and RFM95W-868S2, with the AO3401A among its other parts. Its parts include 12 capacitors, 4 ICs, 2 resistors, 2 connectors and 1 diode. It belongs with the radio and wireless and sensors and measurement boards and the STM32 boards of this library.

Main components

4

README

README.md

STM32 Low Power LoraWan Sensors

This project provides a framework to easily build LoraWan devices. The requirements are:

  • sensors that could run without replacing batteries during the life cycle of the device
  • small size
  • easy to build and program (need a 20-30)
  • simple to create a new type: just a new file
  • cost bellow 20€
  • resist the outside weather with easy to 3D print cages

The sensor can work on a CR123 battery for 20 years (self-discharge of the battery being the main factor). It sends the battery voltage and (optionally) the temp of the MCU (using factory calibration).

For each new detected device it generates unique LoraWan keys and upload them to flash. This way the same firmware can be used for multiple instances of the same board.

NOTE: Do not put the config directory in a public repository. Instead save as extra home/private repository so you have versioning while keeping your keys private!

Download commands might be used to query or modify the configuration. See the commands section bellow.

Bill of Materials

Devices can be built for ca 10-20€ ussing the following parts:

  • STM32 MCU - any of the following:
    • STM32L412KB (3 €) - prefered: 128KB RAM for a future firmware OTA update
      • STM32L412KBT6 128K Flash, 8K RAM, LQFP-32
    • STM32L412K8 (2.5 €) - same as STM32L412KB but only 64K Flash
      • STM32L412K8T6 64K Flash, 8K RAM, LQFP-32
    • STM32L010K8 (1.5 €) - cheaper MCO+, slower, less memory, not tem and slightly higher consumption
      • STM32L412K8T6 64K Flash, 8K RAM, LQFP-32
  • RFM95W (3.5 € via Aliexpress, 3x this price if bought in Europe)
  • RC123a battery and holder (2€ via Aliexpress, 2x this price if bought in Europe)
  • PCB (2-5 € when ordering 12 from Aisler ) - see Devices folder for the sources and the uploaded PCBs to Aisler
  • 3D-printed boxes - see cages in Devices folder
  • some SMT components (1 €) - see schematics in Devices folder

Downlink commands

Downlink commands are used to query and/or modify the device settings without having to reprogram the flash. Each command uses one byte plus optional data depending on the command. The commands are implemtented in the lorawan_process_command at lorawan.cpp

Commands will be queued and transferred to the device after the next uplink transfer. Multiple commands can be queued but be carefull not to exceed to the watdown timeout or the device will get reset.

Commands:

  • 0x00 - READ configuration
    • Description: Returns the configuration of the device. See device_config_t for more details on the struct
    • Additional downlink bytes: none
    • Example output: 02 03 3C00 05 3C 6400 5802 01 0A 05 FF
  • 0x01 - Reset config to the default
    • Additional downlink bytes: none
  • 0x02 - Sets the configuration
    • Additional downlink bytes: config as returned by the 0x00 command
    • Example input: 02 02033C00053C64005802010A05FF
  • 0x05 - Read Device UID
    • Additional downlink bytes: none
    • Output: 12 bytes with STM32 UID
  • 0x06 - Read firmware GIT commit
    • Additional downlink bytes: none
    • Output: ASCII string
  • 0x07 - Read firmware BUILD date
    • Additional downlink bytes: none
    • Output: ASCII string

Firmware

This project requires Platformio and the STM32 Cube Programmer. Both need to be installed and available in the PATH.

Keys for each detected device will be stored under config/devices.ini. Before you run for the first time please create the file and include your app EUI (or modify afterwards). You can create this by registering a new app at the TTN console. The file should have:

text
[global]
appeui = <your app EUI>

If you run without creating the file first then the programmer will create a dummy APPEUI which you will need to modify. You can keep the config folder into its own git repository but please keep it private! On checkout you might use the this script to check it out.

For programming either use the platformio UI or any of the CLI commands proposed for the device.

If you connect a serial interface while booting you should see the following:

text
Settings unchanged
DEVICE VERSION: 3
DEVICE CONFIG: 0x02033C00053C64005802010A05FF
Device UID: 0x3200230006504D3843353720
BUILD DATE: Jun 21 2020
BUILD TIME: 18:07:48
COMMIT ID: e3d1d3b5d34d39d88d90022d6fe365ebce3887b5
APPEUI: 0x.....
DEVEUI: 0x....
Starting
7579 Sending.. 18248 TX_COMPLETE

Adding new devices

  1. Add a section to platformio.ini for your device. The key part is to have a dedicated -D SENSOR_<PCB name>_<sensor name>_<MCU name> (such as -D SENSOR_GENERIC_DISTANCE_SMT32) -> this will be needed in the next step.
  • If you are just using the generic PCB then you can copy Basic v1 and modify to your needs
  • If you are creating your own PCB based on the STM32 MCU then you can copy Generic v1 and modify to your needs
  • If you use a different MCU then you will need to create your own target extending base and base_debug. Please notice that you will in this case have to add support for the new MCU in multiple areas of the code where the MCU is relevant: the code has been tested with STM32 (mainly) and atmega32.
  1. Add a new cpp file to src/devices/ for your new device. The namming convention is .cpp. If you are using a STM32 CPU you should consider copying generic_basic_stm32.cpp which does not depend on any external sensors to work and then add your own sensors to it. You need to make this file to only get included and compiled when SENSOR_<PCB name>_<sensor name>_<MCU name> is defined.
  2. Add to devices.h a section for your device where you set your device_config_device_t. This struct includes what persistent settings your device needs. These settings can later be modified via a LORAWAN command.
  3. Documment your device in the devices folder. This folder structure is:
      • cages: instructions and files to 3D print cages for devices
      • KiCad: Schematics and PCBs created with KiCad
      • pictures: pcitures embedded in markdown readme
      • README: instructions, pictures and links for devices. It is structured with a chapter for each device sharing the same PCB and a subcharter for each mayor version of the device.

ToDos

  • Firmware OTA update

Parts

45
QtyValueFootprintReferences
8PUResistor_SMD:R_0805_2012MetricRA0, RA1, RA8, RA9, RA15, RB3, RB4, RB5
7100 nFCapacitor_SMD:C_0805_2012MetricC3, C4, C5, C6, C7, C9, C12
5MountingHoleMountingHole:MountingHole_2.2mm_M2H1, H2, H3, H4, H5
21 uFCapacitor_SMD:C_0805_2012MetricC8, C10
210 pFCapacitor_SMD:C_0805_2012MetricC1, C2
212KResistor_SMD:R_0805_2012MetricR3, R7
2SolderJumper_2_BridgedJumper:SolderJumper-2_P1.3mm_Bridged_Pad1.0x1.5mmJPC0, JPC3
2SolderJumper_2_OpenJumper:SolderJumper-2_P1.3mm_Open_Pad1.0x1.5mmJPO0, JPO3
110 uFCapacitor_SMD:C_0805_2012MetricC11
132KHzCrystal:Crystal_SMD_3215-2Pin_3.2x1.5mmY1
1AO3401APackage_TO_SOT_SMD:SOT-23Q1
1Antenna_ChipRF_Antenna:Texas_SWRA416_868MHz_915MHzAE1
1BOOTButton_Switch_SMD:SW_SPST_TL3342BOOT1
1Battery_CellBattery:BatteryHolder_HALJIA_2xAABT1
1Conn_01x06_MaleConnector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_VerticalJ1
1Conn_01x09_MaleConnector_PinSocket_2.54mm:PinSocket_1x15_P2.54mm_VerticalJ2
1Ferrite_Bead_SmallResistor_SMD:R_0805_2012MetricFB1
1LEDDiode_SMD:D_0805_2012MetricD1
1LIS3DHPackage_LGA:LGA-16_3x3mm_P0.5mm_LayoutBorder3x5yU4
1RESETButton_Switch_SMD:SW_SPST_TL3342RESET1
1RFM95W-868S2RF_Module:HOPERF_RFM9XW_SMDU2
1STM32L412KBPackage_QFP:LQFP-32_7x7mm_P0.8mmU1
1ublox_SAM-M8QRF_GPS:ublox_SAM-M8Q_HandSolder_planeU3

More from angelnu/LorawanSensor

3
  • 2 layers25 × 59.7 mmGenericSensor v2, the printed circuit board in 3D

    GenericSensor v2

    angelnu/LorawanSensor

    LoraWan soil sensor

    35 parts22MIT
  • 2 layers26 × 133.4 mmSoilSensor, the printed circuit board in 3D

    SoilSensor

    angelnu/LorawanSensor

    LoraWan soil sensor

    27 parts22MIT

Similar boards

  • 2 layers72 × 52 mmGarageNotifier, the printed circuit board in 3D

    GarageNotifier

    zbockaj/GarageNotifier-PCB

    Helium-network device for reporting open/closed status of (garage) door.

    78 parts
  • 2 layers44.5 × 31.7 mmS3Basic, the printed circuit board in 3D

    S3Basic

    Uspizig/BTSpeaker

    Small replacement PCB for a BT Speaker

    95 parts
  • 4 layers39 × 92 mmChaac ng, the printed circuit board in 3D

    Chaac ng

    alvarop/chaac

    This is a work in progress for a wireless weather station project.

    82 parts21MIT
  • 2 layers87 × 30.8 mmEbus2usb, the printed circuit board in 3D

    Ebus2usb

    jkyprian/ebus2usb

    1TE DIN Rail eBus to USB Type-C Adapter

    59 parts10
  • 2 layers24 × 24 mmSX1280 module, the printed circuit board in 3D

    SX1280 module

    dabit20/ExpressLRS-SX1280-module

    SX1280 based 2.4GHz module for the ExpressLRS radio system

    50 parts
  • 2 layers57 × 57 mmSensor node, the printed circuit board in 3D

    Sensor node

    henriheimann/prosper3-monitor

    Repository of the Prosper III Environment Monitor project ☀️🌱

    52 parts
  • 4 layers102 × 52 mmVape MK16, the printed circuit board in 3D

    Vape MK16

    SirBramble/Vape-MK16

    104 parts

Questions

How big is the Tracker v1 PCB?

It measures 56.5 × 66.8 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Tracker v1 use?

45 parts, built around the STM32L412KBT6, LIS3DH, RFM95W-868S2 and AO3401A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Tracker v1 KiCad files?

From the angelnu/LorawanSensor repository on GitHub, at the commit this page was made from: the board is devices/tracker/KiCad/tracker_v1.kicad_pcb and its schematic devices/GenericSensor/KiCad/GenericSensor_v2.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Tracker v1 design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).