Difference between revisions of "Tether"
From Hackstrich
(Added doubler to the base station to make it an easier shape to deal with.) |
|||
Line 2: | Line 2: | ||
= Project Status = | = Project Status = | ||
+ | * 2018-04-13: Started writing a simulator to get the protocol details worked out ahead of having hardware. RX and TX units work so far, no base station support. | ||
* 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. | * 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. | ||
Line 43: | Line 44: | ||
= Protocol = | = Protocol = | ||
== Variables == | == Variables == | ||
− | * | + | * INIT_TIMEOUT=180 |
+ | * ACK_TIMEOUT=5 | ||
* BEACON_TIME=60 | * BEACON_TIME=60 | ||
* BASE_REPORT_TIME=180 | * BASE_REPORT_TIME=180 | ||
− | * | + | * TIMESLOT_LENGTH=10 |
* STILLHERE_MULTIPLE=5 | * STILLHERE_MULTIPLE=5 | ||
Line 68: | Line 70: | ||
== Sequence (WIP!) == | == Sequence (WIP!) == | ||
=== RX Powerup === | === RX Powerup === | ||
− | # Listen constantly until beacon or base report heard, (or until | + | # Listen constantly until beacon or base report heard, (or until INIT_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- | + | # Transmit an ACK back and go to sleep until BEACON_TIME-TIMESLOT_LENGTH/2 |
# Wake back up, listen until next beacon or BEACON_TIME*2+10 | # Wake back up, listen until next beacon or BEACON_TIME*2+10 | ||
# Listen for beacon or base report | # Listen for beacon or base report | ||
Line 77: | Line 79: | ||
=== TX Powerup === | === TX Powerup === | ||
# Send beacons every BEACON_TIME/3 until we get an ACK back. | # Send beacons every BEACON_TIME/3 until we get an ACK back. | ||
− | # If no ACK received by | + | # If no ACK received by INIT_TIMEOUT, continue at normal beacon rate from step 3. |
− | # Go to sleep for BEACON_TIME- | + | # Go to sleep for BEACON_TIME-TIMESLOT_LENGTH/2. |
− | # Wake up and listen for | + | # Wake up and listen for TIMESLOT_LENGTH to see if a base station is around. |
# Listen for beacon or base report | # Listen for beacon or base report | ||
− | ## If a base report is received, go to sleep for BEACON_TIME- | + | ## If a base report is received, go to sleep for BEACON_TIME-TIMESLOT_LENGTH/2. |
− | ## If nothing received, send a beacon then wait | + | ## If nothing received, send a beacon then wait ACK_TIMEOUT seconds for ACK to come back. Log if it doesn't, but don't change behaviour. |
=== Base Station Powerup === | === Base Station Powerup === |
Revision as of 02:03, 14 April 2018
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-13: Started writing a simulator to get the protocol details worked out ahead of having hardware. RX and TX units work so far, no base station support.
- 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
- INIT_TIMEOUT=180
- ACK_TIMEOUT=5
- BEACON_TIME=60
- BASE_REPORT_TIME=180
- TIMESLOT_LENGTH=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 INIT_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-TIMESLOT_LENGTH/2
- 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 INIT_TIMEOUT, continue at normal beacon rate from step 3.
- Go to sleep for BEACON_TIME-TIMESLOT_LENGTH/2.
- Wake up and listen for TIMESLOT_LENGTH 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-TIMESLOT_LENGTH/2.
- If nothing received, send a beacon then wait ACK_TIMEOUT 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.