Facial Recognition Switch

I ordered my components for class, but unfortunately I do not have any wires or other equipment lying around my apartment, and, living north of the Washington Square campus, I couldn’t find time between work and school to make the trip down to Tandon to get components to make an electrical switch. Instead, I offer up a slightly different answer to the assignment: a story of a handless “switch” hack in the form of a facial-recognition device I made a while ago.


This story requires some background: I was in a Stern class being taught by a professor who was a notable VC in tech. Now in that class, we were required to make ourselves name tags (as the class was 50+ people). Most students made simple little name tags of the paper-tent type. But, wanting to impress this professor with the hopes of either funding for whatever startup idea I was occupied with at the moment or a job at his company, I decided to get creative.

The concept was simple: equip a Raspberry Pi with a camera, that would recognize faces and print out a name tag (with a photo, full name, and title) for everyone it saw. The execution was a little more tricky. 
Getting the facial recognition program to run on the Pi wasn’t altogether too difficult. The actual facial recognition component I used was AWS’s Rekognition, which is astoundingly good. After that, a project I found on Github mostly got my Pi’s camera and Rekognition talking to one another without me having to do much work there. I trained my network to recognize photos of myself, my professor, and the handful of students that sat around me in class, and tagged these photos with details like their names. My Pi recognized faces really well at this point, so it was time for the printing component. 

The cheapest, most compact printer I could find on Amazon was a handheld Chinese point-of-sale receipt printer. This “POS” was truly a piece of shit, and I spent most of my time getting this little guy to work. This cheap and shitty thing required it’s own fucking driver (in the form of a mini-Compact Disk!) to be able to accept my Raspberry Pi’s input. Not having a CD reader in my apartment, I hoofed it down to the Staples off of Union Square that’s open 24 hours at 12:30am to buy one. This printer was also limited to printing only ASCII characters, so I had to convert my images to ASCII art.

An all-nighter later, the POS <-> Pi communication bugs were mostly solved, and I managed to get my little gadget working remarkably well!


 I even managed to get it working on non-human faces, like this stuffed-animal cat I have.

For the purposes of this class, I don’t have a working model of this anymore (was cannibalized for parts soon after demoing it), and my documentation isn’t the most comprehensive. But I did get a job as a developer at my professor’s because of that build, so I’ll let that speak for its quality. And it was a fully-handless “switch” – it wouldn’t be hard to mount the Pi & camera on a door and have it operate a servo motor, effetely becoming a facial-recognition lock.

(Nowdays, I’m a little more swanky in the facial-recognition department and own an AWS DeepLens, which lets me directly hook up to AWS’s crazy amount incredible IoT offerings. Hoping to get to use this in class a bit in the future!)