In short, people counters allow you to measure the foot traffic (typically in malls and retail environment). Traditionally, these used infrared technology by the door to measure the amount of people coming through (two beams if you wanted to track the direction).
In recent years, we've seen the raise of video based people counting. In short, this means that by you can tap into the existing video feeds from the surveillance cameras and run an image processing algorithm to detect movement. This will provide more granularity than traditional equipment, but it also requires a lot more processing power.Enter Sonar
Wouldn't it be great if you could do something similar with just a Raspberry Pi? Turns out you can. Instead of tapping into the video feed, Sonar passively listens for wireless devices and produces simple graphs.
Using the built-in Bluetooth Low Energy (BLE), Sonar can give you a rough approximation of the amount of people in the proximity. You can even dial in the sensitivity if needed.
Also, given that the Raspberry Pi uses wireless technology, the installation becomes easy. You can simply put a device in the ceiling and still be able to gather data.
A live demo is available here.Installing Sonar
To install Sonar, you need two things:
- A Raspberry Pi 3 Model B
- A resin.io account (Raspbian support coming later)
You now need to create a new app in resin.io and flash out the disk image. Once you have your Raspberry Pi talking to resin.io, you can deploy the app using the following commands:
$ git clone firstname.lastname@example.org:databat-io/sonar.git $ cd sonar $ git remote add resin email@example.com:ssmit/mysonarapp.git $ git push master resin
The app should now start building on resin.io's build farm, and when done, it will be automatically deployed to your Raspberry Pi.The future
In the future, Sonar aims to also collect data using WiFi. Moreover, it would also be possible to aggregate data from multiple Raspberry Pis, which would enable triangulation of the visitors.Frequently Asked Questions (FAQ)
What counts as "people"?
Sonar's notion of a "person" is a single BLE device. This means that if you are carrying an Apple Watch, an iPhone and an iPad all with Bluetooth enabled, you will count as three "people." This of course is not an accurate count, but on average it will give you a good indicator of the trends. Moreover, with sufficient data, it might be possible to distill patterns and filter out duplicates.
Historically, using BLE for counting people wasn't a very good method. Recently however, that changed. Not only do we carry more Bluetooth devices around, but with Apple's removing the headphone jack in recent iPhones, more and more people started to have Bluetooth permanently enabled.