Presence detector on Microchip PIC and TSOP1833

Some years ago I participated in a startup that was aimed to create some sort of vending machine. Those machines had to sell internet access for people in places like airports, railroad stations and malls.
At that time (2005-2006) smartphones had just started to become popular and access to the Internet wasn’t so easy as it is nowadays and those machines might have became popular, but…
But they died 🙂

Machines looked like ATM – a PC inside a large, steel protective case. They had a steel qwerty keyboard with a trackball, thick protective glass over the monitor and a cache receiver.

This is the best photo of our machine that I have.


Our team developed specialized software for these internet-vending machines, including own browser (using IE libs, but anyway), remote control and billing systems.


My part in this project was to develop three devices and to integrate them with the rest of software.
I had to develop and produce a few examples of
– audio amplifier
– hardware filter for keyboard
– presence detector

There is nothing interesting in audio amplifier. I’ve just used some TDA and that’s all.

10 or so audio amplifiers


Audio amplifier with mic


Amplifier was connected to an ATX power supply and PC’s LINE IN/LINE OUT soundcard ports.
Just in case, here is schematic diagram in Splan format.

Hardware keyboard filter was some sort of firewall for a keyboard.
We used almost standard qwerty keyboard and standard PC, so we needed to be able to switch off a keyboard during reboot, to disable CTRL+ALT+DEL and so on.
These functions with a decent quality, until the death of the project, had been performing by “the keyboard interceptor” device, which I will describe in the next post.

This post is about presence detector.
It is obvious that such a detector is a good thing for a vending machine. Machine can change a picture on the screen or make some sound to draw attention if it “knows” that somebody is nearby.
Our device worked well enough, but sometimes it could not detect a person, clad in a specific clothes. As we have noticed some clothes do not reflect IR although for human eyes it looks like general clothes. Particularly, my friend and colleague had undetectable trousers 🙂

Our detector continuously sent “bursts” of IR impulses in front of the machine, using high power IR LED, and tried to receive some reflections of these “bursts”, using TSOP1833 IR receiver. After some period (50 bursts) detector sent to PC the quantity of the lost packets.
From the PC viewpoint, detector is a device which constantly send data to the com-port, and the closer those data to zero (in the main mode it’s a 1-byte messages) the closer is something to the machine.

Detector can also receive data from PC via com-port and has 2 adjustable parameters – the length of the burst and the impulse width inside burst.
For better understanding (if it is required 🙂 please see the comments inside the ASM file and TSOP1833 datasheet)

I can’t create Proteus simulation of this project so only schematic diagram and ASM code is placed here.

presence detector


A few comments to the schematic diagram:
– Switches SAx and connector XT2 have never existed in reality and I don’t quite remember their meaning.
– XT3 is a connection to PC’s ATX power supply
– As you can see, we used usb-to-uart converter FT232BM. It was powered from a usb port.
On the PC side we used drivers for virtual com port, of course.

FTDI low-tech crucifixion: