Using Wi-Fi to track gym occupancy

· 6 min read



A busy gym is a motivating environment, but a very busy gym is a frustrating problem. When I returned to campus for my senior year, I discovered that the school gym had fallen into this latter category.

For one thing, it closed a few hours earlier in the evening. And it was now much busier overall compared to before the pandemic. I was now spending a lot of time waiting for equipment – either because it was already occupied, or because I was sharing it.

The solution to this problem is supposedly simple: if you don’t want to wait for things in the gym, then you must work out when the gym isn’t busy.

So I’ll just have to work out at a weird time nobody else would think of!

Well, this strategy often backfired: my perception of the gym’s busiest hours was far too predictable, and the gym’s busiest hours on any given day was far too unpredictable. I would like to think that my planning was often so predictable that a bunch of people had the same idea, and we ironically ended up converging at the same time to work out anyways.

What could the gym do to solve these problems? There are some naïve, blunt approaches that technically work but actually suck. Let’s examine and eliminate these options:

But I digress. The point is that the gym should be a freely available resource, and people should be empowered to make smarter decisions about when to go. Unfortunately, there isn’t a way at Carnegie Mellon to know if the gym is busy unless somebody is there to tell you, or you observe the gym yourself. If there was a 24/7 livestream of the gym, then it would be easy to remotely check if the gym is busy or not with just a glance. But there are glaring security and privacy sacrifices with this livestream proposal, so we need to think of other methods.

If we distill this problem, then we understand that the gym’s busyness is tightly correlated with a single metric: the number of people in the gym. So if we can count the people in the gym, then we can infer the probability of having to wait for equipment.

So with our goal of counting people established, we can consider many technical approaches:

But there is a far cheaper approach we can use. We can make two specific and critical assumptions about our situation that simplifies the problem greatly.

Let’s illustrate this from a CMU perspective:

  1. A CMU student carries their phone in a pocket or bag. This phone is connected to the campus Wi-Fi network.
  2. The CMU student enters the gym. The phone’s Wi-Fi antenna roams to one of the wireless access points (WAPs)1 in the gym.

Therefore, if you know the number of clients connected to the WAPs in the gym, you can approximate the number of people in the gym.

The number of clients connected to a particular WAPs is most likely already available to CMU network admins. Getting this number published as an API is the hard part. This step will probably require a few emails and meetings with university administrators. Once you have client population figures, the fun begins.

You could browse to a website like cmugyms.com2 and see a live figure of estimated people in the gym. As people workout en masse, the number of devices connected to the gym’s WAPs surges. And as they leave, the number of devices decreases. We would need to calibrate the initial count by observing the number of persistent devices connected to gym WAPs, such as printers or office computers, that do not belong to gymgoers. We would also need to account for some individuals carrying more than a single Wi-Fi device into the gym: people not only carry their phones, but also their backpacks containing laptops or tablets. The average number of Wi-Fi devices somebody brings into the gym is likely greater than one.

The advantage of this ‘Wi-Fi heuristic’ is how technically simple it is. This not only makes it cheap, but also universal. This method could work at any institution and at any specific location with WAPs nearby, like dining halls, libraries, or lounges.

At this point, I would have continued on with a proof-of-concept. But I am sadly forced to leave this proof as an exercise for the reader.

You see, I unfortunately thought of this idea about a week before I graduated this past May. But fortunately for you, this idea remains plausible and awaits a proper implementation.


2

cmugyms.com could be for tracking campus gyms as cmueats.com is for tracking campus food

← Return to home