100%
letterbox-sensor-v2 letterboxsensor view
Description

Imported from GitHub: hierle/letterbox-sensor-v2 · commit b3c91ce · license GPL-3.0

Description

LoRa / LoRaWan letterbox sensor v2

README

LoRaWan EU868MHz Letterbox Sensor v2

sensing letters in your letterbox via two infrared proximity sensors (HSDL9100), sending out status via lora / lorawan, using RAK3172 (based on STM32WLE5CC) CPU/RF, powered by a CR2032 battery.

Lorawan letterbox sensor v2 Lorawan letterbox sensor v2

This project was inspired by the heise ct briefkasten sensor project https://www.heise.de/ratgeber/IoT-Netz-LoRaWAN-Briefkastensensor-mit-hoher-Reichweite-selber-bauen-4417179.html https://github.com/jamct/radio-mailbox and is a direct successor of version 1: https://github.com/hierle/letterbox-sensor

Contents:

  • ./PCB/ : kicad PCB files
  • ./letterbox-sensor-v2/ : lorawan letterbox sensor sketch
  • ./misc/ : payload decoder, sample http integration cgi

An extended web ui by Peter is available here: https://github.com/pbiering/letterbox-sensor-web

A nice alternative software by Henrik, using Lora P2P mode is available here: https://github.com/HonkStonk/MightyMailbox

Compiled and flashed with ArduinoIDE with RAKWireless STM32 extensions

Features:

  • using RAKWireless RAK3172 based on STM32WLE5CC
  • deep sleep at (measured) 5uA including battery voltage divider and tantalium caps
  • two proximity sensors HSDL9100
  • USB-C interface for flashing and serial monitor, via FT230XS-R USB-UART
  • onboard 868MHz PCB antenna after TI document http://www.ti.com/lit/an/swra227e/swra227e.pdf
  • lorawan activation either ABP or OTAA
  • battery voltage measurment thru voltage divider (2x 10MOhm)

Changes to v1:

  • replaced ATTiny and RFM95 with RAK3172, much more CPU power and memory, much simpler code
  • support for OTAA lorawan activation
  • much simpler software stack, using ArduinoIDE with RAKWireless STM32 extensions and API usage
  • added USB-C interface, no more special programming interface needed
  • added second HSDL9100 for better physical letterbox coverage
  • added two (optional) supporting tantalium caps for extended battery life
  • removed temperature, as not easily avail on STM32WLE5CC / RAK API
  • removed trimmers

BOM (digikey.de):

CountPart numberDescriptionUsage
1RAK3172-8-SM-NICPU/RF-Lora NO IPEX!CPU/RF module
2CS1213AGF260Tactile switchBoot/Reset
2HSDL-9100-021/024Proximity SensorProximity sensors
2CRGCQ1206F33RRES 33 Ohm 1206Proximity sens LED
2CRGCQ1206F1M0RES 1M Ohm 1206Proximity sens diode
1BU2032SM-FH-GTRCR2032 COIN CELL HOLDERBattery
2TAJE477M010RNJCAP tant 470uBattery supporting caps
1LQG18HN1N8S00DIND 1.8NH 0603Antenna matching
1GRM1885C1H2R7CA01DCAP 2.7PF 0603Antenna matching
3GRM188R72A104KA35DCAP CER 0.1u 0603Suppressor caps
2GRM188D71A106KA73DCAP CER 10u 0603Suppressor caps
1RAHUC31AUTRUSB-C connectorUSB
1FT230XS-RFTDI USB Serial UARTUSB UART
1MI0805K601R-10Ferrite bead 0805USB power
2AC1206FR-075K1LRES 5.1k Ohm 1206USB power sens
2CRGCQ1206F22RRES 22 Ohm 1206USB lines
1GRM188R72A104KA35DDIP switchPower switch USB/Battery
2AA3528LSECKT/J4LED orangeStatus/USB status
2CRGCQ1206F220RRES 220 Ohm 1206Status LEDs
2RC1206FR-0710MLRES 10M Ohm 1206Battery voltage measure

RAK3172 documentation:

https://docs.rakwireless.com/Product-Categories/WisDuo/RAK3172-Module/Overview/

How to compile:

Follow the instructions on https://docs.rakwireless.com/Product-Categories/WisDuo/RAK3172-Module/Quickstart/ in short:

  • install ArduinoIDE from arduino.cc
  • add the following URL to the boards manager URLs section in preferences: https://raw.githubusercontent.com/RAKWireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless.com_rui_index.json
  • install the "RAKwireless RUI STM32 Boards" from the Boards Manager
  • select "WisDuo RAK3172 Evaluation Board" board
  • on Mac you might need to install pyserial: sudo pip3 install pyserial
  • on Linux you might need to install python3-pyserial
  • connect the board, make sure it's powered on (DIP switch)
  • select the corresponding serial port
  • open the sketch folder
  • adjust config.h and lorawan.h
  • compile and flash

For configuration adjust config.h and lorawan.h

config.h:

  • PERIOD: the time intervall you want the sensor to send it's data, in minutes, default is 30 minutes
  • THRESHOLD: the threshold for the sensor readings (empty/full), can later be "overwritten" in e.g. HTML integration
  • USE_OTAA: if true, OTAA will be used instead of ABP, so we do not have to worry about frame counters after reset / battery change
  • DATARATE and TXPOWER: adjust to your needs, your packets should be reliably received, w/o wasting to much power
  • see also the comments for each entry in config.h

lorawan.h:

  • set your lorawan keys for either ABP or OTAA
  • OTAA_APPEUI or JOINEUI is only needed to select a specific JOIN server, in private networks can be set to any value

Additional notes:

  • you will need a DATA USB-C cable, a charging only cable will not work, as it's missing the data pins ;-)
  • the DIP switch allows to power the device directly from USB, but when using the battery in production environment (letterbox), it should be switched off, not to waist power on the FT230 USB-UART chip

Letterbox sensor v2 lorawan payload package byte structure:

byte01 23 45 67
0x00=emptybatterysensor1sensor2threshold
0xFF=fullvoltagerawraw

Todos:

Have fun!

Comments
Sign in to comment

No comments yet. Be the first to ask about this board.