Okay, so I got interested in these foot traffic counters a while back. Needed to figure out how they actually counted people walking in somewhere, not just the theory, but like, actually doing it. I didn’t want anything fancy, just the basics.

Getting Started

First thing, I looked around. Saw all sorts of options, cameras, thermal stuff, sounded complicated and expensive. I wanted simple. I remembered those beams you see in doorways sometimes, like in spy movies but less dramatic. Figured that was the way to go. An infrared beam, basically. Break the beam, add one to the count. Easy, right?

So, I went ahead and got the parts. Wasn’t much. Needed an IR emitter (the thing that makes the invisible light) and an IR receiver (the thing that sees it). Grabbed a little Arduino board too, because I needed something to do the actual counting and maybe show the number. Oh, and wires, lots of jumper wires, and a breadboard to stick everything into without soldering first. Plus a power source, just a simple USB adapter.

Putting it Together

Alright, time to actually build this thing. Found a doorway to test in. Stuck the emitter on one side, the receiver on the other. Getting them lined up? Man, that was fiddly. Had to be pretty much straight across, otherwise the receiver wouldn’t see the beam properly. Taped them up temporarily.

Next, the wiring. Connected the emitter to power. Simple enough. Connected the receiver to the Arduino board. Had to check the pins – power, ground, and the signal pin that tells the Arduino if the beam is broken or not. Mixed them up the first time, of course. Nothing blew up, thankfully.

Then, the code part. Didn’t need anything fancy here. Just told the Arduino:

  • Listen to the signal pin from the receiver.
  • If the signal disappears (beam broken), wait a tiny moment (so one person doesn’t count multiple times).
  • Add 1 to a counter variable.
  • Check if the beam is back.
  • Maybe print the count to my computer screen just to see it working.

Fired it up. Waved my hand through the beam. Hey! The count went up on my screen. Walked through. Count went up again. Felt pretty good, honestly. A basic counter, working.

Real World Test and Oopsies

Okay, lab test passed. Put it in a slightly busier spot for a bit. And yeah, here’s where reality hits.

Accuracy wasn’t perfect. If two people walked through side-by-side, holding hands? Sometimes, just one count. If someone lingered right in the beam? Sometimes it messed up the count or missed the person behind them. People walking super fast? Occasionally missed. The alignment also got bumped easily, needed readjusting.

And it only counts entries, usually. If you want entries and exits to get a current occupancy, you need two beams or something smarter. My simple setup couldn’t do that.

So, that’s how a basic one works, based on what I messed around with. An emitter shoots an invisible light beam, a receiver catches it. When someone walks through, they block the beam. A little brain like an Arduino notices the beam is blocked and adds one to the count. Simple idea, but getting it reliable takes some tweaking. It does the job for a rough idea, though.