We used 4 Pax-Counters to count people in different Places in Freiburg.
One at the Wiwili Bridge:
One at the Place of the old Synagoge close to the University:
One at the Fountain of Bertholdt:
And the last one at the Münster Place:
I mapped the Results on a Streamsheet:
What you need:
1.) A LoraWAN PAX Counter (TTGOv2.1)
2.) Computer with VisualStudio Code
3.) Installation of Streamsheets (Professional or Private)
4.) TheThingsNetwork (TTN) Account
How to do it
1.) TTN (The Things Network)
First of all create an Application on TTN. Give it an ApplicationID and remember the ID, it’s needed later.
Next register a new Device in your Application and give it a DeviceID (You will also need this one later). For DeviceEUI click on the arrows so that it will be generated automatically.
Also you will need the ApplicationEUI, both the AppEUI and DevEUI must be in the 0x00 Format, you can change to that format by clicking on “<>” on the left of the field.
Also go to the “Payload Formats” Tab of your application and copy the hole text of this file inside
https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/TTN/packed_decoder.js
2.) VSCode
1.) when your Pax-Counter is not recognized by your Machine, install these Drivers: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
2.) Download this Github repo and Unzip it: https://github.com/cyberman54/ESP32-Paxcounter
3.) Install the Platform.ino add-on in VSCode
4.) Open the previously extracted Folder in VSCode
5.) Inside of the Folder, there is an platform.ini file, open it and comment the “halfile = generic.h” by adding a “;” in front of the line. Also uncomment the line “halfile = ttgov21new.h” by deleting the “;” in front of it. Then save the File.
6.) Change to the src folder and open the “loraconf.sample.h” file. Now copy the Device EUI, Application EUI and Application Key from your TTN Application and paste it in the loraconf.sample.h under DEVEUI, APPEUI and APPKEY.
7.) Save the file as “loraconf.h”
8.) Rename the “ota.sample.conf” in “ota.conf”
9.) Now search for the small buttons from the Platform.ino add-on on the bottom and click the trashcan to clean the code, the check to check your code and the right-arraw to upload your code on the PAX-Counter.
If everything went well, the pax-counter should show a Number and on the Data Tab of your TTN Application you should see the Data from the PAX-Counter slowly coming in.
Getting the Data to Streamsheets
Access the Data from Streamsheets is pretty simple now, because of the built-in mqtt function of TTN.
1.) Just create a new MQTT_Connector with following settings:
URL=eu.thethings.network
UserName=ApplicationID
Password=default Access Key (found on the main application page on the bottom)
baseTopic=Application ID/devices/Device ID/up
2.) Create a Consumer with the Connector just created. In my Example the Topic for the Consumer is just /wifi.