A dockerized version of gate-counter.
There's much more info in the original repo (link above) about what this people counter does, why it works that way, and how it came to be. Check that out if you have questions.
You can find this image on docker hub: carylwyatt/raspberrypi-people-counter.
There are two javascript files in this build:
counter-insight.js
is the default file and is listed as the start script in thepackage.json
filecounter-google.js
is the alternate format if you don't have access to LibInsight- you can find all of the instructions for setting up the google form in the gate-counter repo
- make sure to edit
package.json
start script to reflect google vs insight
If you're using the default LibInsight version of this counter, you will need to find the auth token for your LibInsight dataset:
- Log in to LibApps and head to LibInsight
- From the main nav up top, select Admin > Widgets and APIs
- Locate the name of your space, then under Actions click on the icon that looks like
</>
- In the code box, select the second line, and copy everything past the word
POST
(including the/
beforeadd.php?.....
) - Now you have two options:
- Update the
Dockerfile
on line 4:ENV POST_PATH [code you copied]
- During the run step (see below) add this flag after the
-it
flag:-e POST_PATH [code you copied]
- Update the
docker build -t counter .
docker run -it --cap-add=ALL --privileged -v /lib/modules:/lib/modules counter
This should create a new raspi-IO board, initialize the REPL, and calibrate the sensor. It should then remain open and start counting as people walk in front of it. Every hour on the hour, it should send the data from the previous hour to the LibInsight API. (This will be every 10 minutes in the google version.) To exit the counter, hit Ctrl-C twice. This should stop counting, close the board, and exit and stop the Docker container.
I kept a work log of my trial and error process developing this. It's quite higgledy-piggledy in nature, but might shed some light on decisions made (if you're interested): work logs from July-Oct 2018