Added further explanation of how it works

This commit is contained in:
Maximilian Giller 2022-09-14 00:47:58 +02:00
parent ac406f94f1
commit 377b76ea0d

View file

@ -6,6 +6,30 @@ This is very much a work in progress, so every issue and/or pull request is welc
Feel free to join and talk on my little server: https://discord.gg/ftwwSdY9e5
## Structure
- `src/` - All the python code.
- `src/sensors/` - Abstract interfaces and implementations for both the actual hardware sensor and the virtually created "people count" sensor.
- `src/sensors/people_counter.py` - The actual implementation of the people counter. More details further below.
- `src/services/` - Other things to communicate with. For now an interface for the Philips Hue Bridge to turn lights on and off.
- `src/statistics/` - Everything related to analysing the log file and creating fun evaluations.
- `src/timeloop/` - A copy of my fork of the python package with the same name. Had to implement a little feature it was missing and the original project doesn't accept pull requests.
- `src/*` - Example implementations and use cases for the people count sensor.
- `images/` - Images used for documentation.
- `log.txt` - A log file with a bunch of my data. Here as an example and to experiment with.
### How it works
The amazingly small and useful VL53L1X sensor is actually able to measure a whole array of positions, not just straight down. Utilizing this, it will alternate between two points - one in the direction of the "inside", the other in the opposite direction, the "outside".
If any of those measurements is returning a distance that is closer than a certain threshhold, it will considere this direction "triggered".
If someone moves into the field of view of the sensor, they will either trigger the inside or outside direction first (depending on the side they are coming from). They can then freely move below the sensor, triggering always at least one direction in consecutive measurements. When they leave, either the inside or outside direction will have been triggered last.
"Leaving" means, the sensor will have made two consecutive measurements (inside, then outside, or outside, then inside, since it is constantly switching between those two directions) without being triggered.
If outside was the initial trigger direction, and inside the last, no matter what happened in between, it will be considered as "someone walked into the room" (change of +1). And vice versa (walking out being a change of -1). If the same direction is initial and last trigger, it will be counted as a change of 0, thereby not affecting the count.
## Initial setup and use
### Required hardware