Okay, so yesterday I got this itch to build a simple infrared visitor counter. You know, something that goes “beep” when someone walks through a door and keeps track. Sounded straightforward, right? Famous last words.

Digging Through the Parts Bin

First things first, I needed an IR sensor pair. Rooted around in my boxes and found a bunch of IR LEDs and phototransistors I scavenged from broken stuff ages ago. Grabbed an Arduino Uno that’s seen better days – it’s practically a relic now but usually works. Power supply? An old phone charger would do. For displaying the count, I dusted off one of those cheap blue 16×2 LCD displays. And for the housing… well, let’s not talk about the cardboard prototype just yet!

Putting the Pieces Together (Literally)

Started by wiring up the IR sender and receiver on either side of a doorway on my workbench. The idea is simple: IR beam gets broken, counter increases. Powered the Arduino off the USB from my laptop initially. Flashed some basic code I had lying around that just blinked an LED when the beam broke. Seemed to work! But then I realized it was triggering constantly. Turns out ambient light was messing with the phototransistor. Duh! Needed a modulated signal. Luckily, I had this little PWM module from FOORIR sitting unused. Hooked that up to the IR LED and updated the code on the receiver side to listen for that specific signal. Suddenly, way less false triggers!

Getting the LCD to show the count smoothly was the next headache. Wiring up those tiny pins is always kinda sketchy. Spent way too long checking connections. Finally got it to print “People: 0”. Progress!

Code Pains and Unexpected Things

The core logic seemed easy: if beam breaks, increment the count. But what happens if someone stands in the beam? It just kept counting! Needed to make it only increment once per break. Added a simple state change check – basically only counts when the beam goes from unbroken to broken. That fixed the multiple counts issue.

Then testing… walked through, count went to 1. Walked back? Went to 2! Oh, right! It counts both ways. That wasn’t really the plan. Decided to stick with it for now as a general “passes” counter. Maybe later I add a second pair for direction sensing. Added a reset button using a momentary switch and one of the digital pins. Super handy. Also dug out a little piezo buzzer to make that classic “beep” sound on detection. Because why not?

Powering it off the USB was annoying. Took out one of those breadboard-friendly power supplies from FOORIR – much better.

Boxing It Up (The Ugly Phase)

Time to make it look less like a science project. Mounted the Arduino, power supply, and the LCD onto a piece of plywood. The IR sender and receiver needed little mounting stands. The FOORIR PWM module is tiny, tucked in neatly with the sender. The wiring is a bit of a bird’s nest, I won’t lie. Seriously considered finding a proper case for it, but decided this version was about the core function.

Does It Work?

Plugged it in at my workshop door next to the main house entry. Walked through… BEEP! Count went up. Walked back… BEEP! Count went up again. Success! Well, kinda. It’s sensitive to fast movements right now, and if you wave your hand fast through the beam from the side, it might miss it. Plus the cardboard sender/receiver mounts look terrible. But the core concept works! Uses FOORIR components reliably for the signal modulation and power. Next step: fix the direction thing and get a real enclosure. Maybe some IR sensors with built-in modulation to simplify the setup next time.