You may (or may not) have noticed a little box that appeared over the Nova Labs front door around April 1st. This is a first effort to providing statistics on visitor traffic at Nova Labs for the recently formed membership data group. It has recently become clear that Nova Labs needs people statistics to better manage the lab’s future, and several folks looked at different ways to do this in a non-intrusive way. Some of the data collection methods suggested included using cameras, face detection, breaking infra-red beams, ultrasonic distance detectors, passive IR (PIR) detectors, and others. There were also discussions on where to detect; By the front desk/kiosk? In the lobby? At the doorway? (Which doorway?)
So I decided to try some of these things out, just as a first step to have something to critique.
First I tried using the standard PIR sensor. Unmodified, this detected movement over a wide angle, but had internal timing that prevented rapid repeat detection.
This I found could be fixed by removing a timing component from the sensor board, and obscuring all IR input except through the central Fresnel lens. This allowed a rapid repeat detection over a narrow angle, but I still had some issues to resolve with occasional double counts.
In the mean-time, Bob Coggeshall had acquired some magnetic switches and had fixed one at the front door suggesting we monitor that. So I figured the PIR science experiment could wait.
Having a simple sensor meant I could now address the remainder of the problem: sensor detection, data management and visualization. Since NovaPass had used the Wemos Di Mini ESP8266 board and I had one on loan, I decided to use this and to try the free AdafruitIO IoT data storage and visualizer rather than wait for an internal management storage and visualization solution.
Those who have viewed my prior blogs will know that I like to make little boxes with stuff in them. Here was a chance for another.
While I was at it, I decided I would implement open/closed detection for both inner and outer doors since Bob had extra switches. I decided to provide LEDs for indication of both door states and indication of power and connection to the AdafruitIO server. To power the unit I used the USB programming/power feed for the Wemos board plugged into an AC plug-in USB charging adapter. This allows software updates to be made in-place by just moving the USB cable to a laptop instead.
To save time, I did not want to have to make a box, so I got a cheap electrical box and lid, and made holes for the LEDs and Wemos USB connector access. To connect the door switches I used a section of Barrier Strip cut off a longer piece.
I wired the LEDs (secured to the lid with hot glue) and their resistors and the Barrier strip connections together on the inside of the lid and used a piece of prototype board hot-glued onto the lid to anchor the wires going to the Wemos board. A piece of ribbon cable terminated with female connectors made a convenient connection between lid and Wemos. I fastened that to the lid using double sided sticky tape.
To mount the Wemos, I could have used screws and spacers using the holes in the board, but I used a foam board spacer and double-sided sticky tape again, the REALLY HEAVY sticky tape to mount the Wemos on the foam board then bolted that into the box. It withstands the USB insertion without moving.
I used a P clip on the box exterior to secure the 9 foot USB cable to prevent stress on the USB connector. For convenience again, I used heavy duty Velcro to secure the box to the door closure mechanism.
Programming started with the Adafruit IO Arduino Digital Switch reporting example code. I got this working – reporting on/off events to Adafruit IO first then modified it to include the two switches, their feeds to Adafruit IO server, and the LED controls. I decided to report all events (i.e. each opening and each closure, and also their sums over 5 minute intervals until we got a better metric requirement.
Adafruit IO provides the ability to receive data from the feeds and display it on a “Dashboard” in various ways. Unfortunately they do not have a time graph of Logical 1’s and 0’s, so I had to use numerical values, which produces some non-ideal visualization at times (e.g. occasions where the server averages the data – (huh?). The most recent dashboard can be seen here while it lasts: https://io.adafruit.com/nickfixit/dashboards/nova-labs-front-door-monitor
AdafruitIO (free version) provides a month of feed data storage that can be downloaded as CSV or JSON files. As a visualization example I used the downloaded CSV file (which gives timestamps in UTC) in EXCEL to show door openings over a 2-week period in April (1st through 14th) including the Empower2Make weekend.
Data collection and visualization needs to be made internal to Nova Labs servers. So the Arduino code needs to be changed to route the data to the new places, and the server has to accept the data and prepare it for visualization or reporting in the ways that Nova Labs leadership needs to help plan for the future.
Since this method assumes each door opening/closing passes one person (not 100% accurate) and the actual people count is about half this (groups of people pass together and some people go in and out more than once a day), better methods are desired, although this may be accurate enough.
There has also been call for monitoring people traffic to various parts of the Lab – not just by counting badge swipes. An effective way to do this is also wanted.
If you have an interest in helping to do any of these things, please talk to Bob Coggeshall or attend the next Nova Pass/Software Developers Meetup.
The design is documented on the NovaPass GitHub site and here:
We are open! See our COVID-19 Phase III reopening guidelines.