Tether
From Hackstrich
I keep leaving my backpack behind and would like to stop doing that using technology (because I can't come up with a non-tech solution that works).
Contents
Project Status
- 2018-04-11: Bought a TrackR after a bunch of research, it doesn't work very well at all. Started putting together idea for something that will work better. Next steps are to finish figuring out the sequences, especially for when one or both portable units go into/out of base station range. Re-syncing time slots when just the RX unit leaves and comes back seems to be the hardest problem.
Functionality Desired
- Unit that goes in backpack has long battery life, don't want to have to worry about charging it or replacing batteries often
- This unit can be heavier as my backpack is always heavy
- Unit that goes in other bag can require charging more often but needs to be smaller
- Base station unit that the other units can detect and go into a low power mode when at home/work
- Should be able to leave my backpack at home (and maybe at work) without any alarm going off, as I do this intentionally
- Don't want to have to build too much custom hardware, going to try to build this around COTS stuff
Basic Overview
System Components
- RX Unit - Carried in bag that never gets left behind
- TX Unit - Carried in bag that sometimes gets left behind
- Base Station - Installed at home and at work
- Puts RX/TX into a power-saving mode when nearby
- Keeps track of accurate time and gives time updates to nearby RX/TX units
Hardware
- RX Unit
- Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz - RadioFruit
- FeatherWing OLED - 128x32 OLED Add-on For All Feather Boards
- Beeper of some kind
- TX Unit
- Adafruit Feather M0 with RFM95 LoRa Radio - 900MHz - RadioFruit
- FeatherWing OLED - 128x32 OLED Add-on For All Feather Boards
- Base Station
- Adafruit Feather HUZZAH with ESP8266 WiFi
- Adafruit LoRa Radio FeatherWing - RFM95W 900 MHz - RadioFruit
- DS3231 Precision RTC FeatherWing
- FeatherWing OLED - 128x32 OLED Add-on For All Feather Boards
- FeatherWing Doubler (CPU and LoRa on one side, RTC and OLED on the other)
Concepts/Ideas
- A time slot opens every BEACON_TIME-DRIFT_SAFETY seconds, lasts at least DRIFT_SAFETY/2 seconds or until a beacon is heard
- Receiver normally synchronizes to transmitter, and listens for only a few seconds around when it expects the transmitter to send something.
- When near a base station, everything synchronizes to the base station, listening for only a few seconds around when that sends
- If contact with base station is lost, transmitter picks up again on the same schedule that was in use from the base station
Protocol
Variables
- TIMEOUT=180
- BEACON_TIME=60
- BASE_REPORT_TIME=180
- DRIFT_SAFETY=10
- STILLHERE_MULTIPLE=5
Packet Formats
Beacon Packet
- 1 byte - B
- 1 byte - number of seconds until the next beacon will be sent
- 1 byte - voltage on battery
Base Report Packet
- 1 byte - R
- 1 byte - number of seconds until the next base report will be sent
- 1 byte - base identifier
- 1 byte - current RTC hours
- 1 byte - current RTC minutes
- 1 byte - current RTC seconds
- I'm Still Here Packet
- 1 bytes - H
Sequence (WIP!)
RX Powerup
- Listen constantly until beacon or base report heard, (or until TIMEOUT expires at which point will shut down and alert that no TX found)
- Transmit an ACK back and go to sleep until BEACON_TIME-DRIFT_SAFETY
- Wake back up, listen until next beacon or BEACON_TIME*2+10
- Listen for beacon or base report
- If beacon or base report heard, repeat from step 2.
- If beacon or base report not heard before the timeout, alert that TX has been lost.
TX Powerup
- Send beacons every BEACON_TIME/3 until we get an ACK back.
- If no ACK received by TIMEOUT, continue at normal beacon rate from step 3.
- Go to sleep for BEACON_TIME-DRIFT_SAFETY.
- Wake up and listen for DRIFT_SAFETY to see if a base station is around.
- Listen for beacon or base report
- If a base report is received, go to sleep for BEACON_TIME-DRIFT_SAFETY.
- If nothing received, send a beacon then wait a couple seconds for ACK to come back. Log if it doesn't, but don't change behaviour.
Base Station Powerup
- Listen until beacon heard from TX.
- Go to sleep until BEACON_TIME-DRIFT_SAFETY/2.
- Wake up and send a base report.
- Listen for DRIFT_SAFETY to see if we
- Go to sleep for BASE_REPRT_TIME-DRIFT_SAFETY/2.
- Repeat from step 3.