- State "PROGRESS" from "TODO" [2022-05-27 Fri 00:42]
Components needed to develop a PoC:
- BMS
- GSM (SIM800L is the cheapest and most reliable, i.e. best value for
money, but only supports GPRS)
- GPS module
- BLE module
- Accelerometer
- Flash for storing local device data (no need for more than 4M?)
Esp32 has most of these, is pretty cheap and compact and easy to
develop on.
Choose Rust ...
** PROGRESS [#A] BMS
- State "PROGRESS" from "TODO" [2022-05-27 Fri 00:44]
Find a BMS that will do good for the battery, measure all cells and
give out data needed for various measurments.
*** TODO [#A] Measure bike battery level
** TODO [#A] GPS module
Find a minimal GPS chip and read from it, test stability and tolerance.
** PROGRESS [#A] SIM module (GPRS/3G/4G/LTE)
- State "PROGRESS" from "TODO" [2022-05-26 Thu 23:57]
Find a minimal GSM chip and try to communicate with it.
- [[https://www.aliexpress.com/item/4000830117417.html?spm=a2g0o.productlist.0.0.6f9ad49ffLG35d&algo_pvid=594a04bb-8a80-4596-8025-9486269f0923&algo_exp_id=594a04bb-8a80-4596-8025-9486269f0923-28&pdp_ext_f=%7B%22sku_id%22%3A%2210000008680354389%22%7D&pdp_npi=2%40dis%21RSD%21%21288.56%21%21%21%21%21%40210318c916529073178195889e0edd%2110000008680354389%21sea][SIM800L]] - GPRS only, no 3G or 4G ([[https://github.com/lesha108/sim800_ups_monitor/blob/main/src/sim800l.rs][Rust implementation example]]) ... cheapest one there is.
** TODO [#A] Connect to SIM data (GPRS/3G/4G/LTE)
Get a library, or write minimal code that will *only connect to mobile
data* and send the coordinates retrieved from the GPS module.
** TODO [#A] Accelerometer tracking
** TODO [#B] GSM triangulation for better accuracy
** CANCELED Hardware button to switch the device on and off?
- State "CANCELED" from "WONTFIX" [2022-05-26 Thu 19:55]
In case the phone is lost or whatnot, the device needs to have a hw
switch so it doesn't bother anyone. There is an edge-case here, maybe
even an anti-feature where the bike gets stolen and the thief clicks
the hw button and disables all alerts.
** HOLD [#A] Lock/Unlock mode on the device
The device will need to store a state (lock/unlock). When locked and
the bike moves, the device will send coordinates through GPRS/3G/4G
(depends which GSM module we choose).
In this scenario an alert must be sent to the mobile app.
* Software on the device
We should consider the scenario where we send GPS data independently
from other modules (like BMS, Accelerometer ...) because if the bike
gets stolen it would be great to send the coordinates as fast as
possible. In this case I don't think that battery data would be of
much relevance.
The other way around, when the owner of the device is riding the bike,
then there's no need to send GPS, or Accelerometer data to the server.
Also, the battery status could be measured at different intervals that
The phone needs to get its own device ID as part of the registration
procedure. Some code exists in [[https://stackoverflow.com/questions/45031499/how-to-get-unique-device-id-in-flutter][this example]], needs to be verified
though.
** TODO [#A] Phone gets device ID via BLE
The phone needs to retrieve the device ID via BLE and pack it together
with the phone's ID before sending it to the server as part of the
This seems like a bigger bite at this time. Generate the certs [[https://jamielinux.com/docs/openssl-certificate-authority/create-the-root-pair.html][with
openssl]], or another tool (e.g. [[https://github.com/cloudflare/cfssl][cloudflare's cfssl]], or [[https://ocaml.org/p/x509/0.16.0][ocaml's x509]])
and continue with validation and authentication from Rust.
** TODO Generate device certificates when pushing the image on the device
No need to download certs and put ourselves to danger anymore :)