Skip to content
Raspberry Pi based facial recognition punch clock
Branch: master
Clone or download
dekunukem fixed some typos
Latest commit 8a1502a Jan 26, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources updating README Dec 6, 2017
software removed the dlib typo fix Jan 11, 2018
LICENSE added pictrue Dec 4, 2017

facepunch: A facial recognition punch clock

facepunch tracks how many hours you spend sitting in front of your desk.

Alt text

The concept is rather simple: the picamera takes a photo every 15 seconds, if my face is found, current time is recorded.

The logged time is then added up to calculate my exact working hours every week. The result is displayed on an OLED screen.

What you need

OLED is optional, skip related steps if you're not using one.

Get it working

Set up Raspberry pi

Install the latest Raspbian here

Wire up OLED display and camera

OLED install guide

Camera install guide

I placed the camera and OLED together on a perf board that plug into the header, of course you can put them somewhere else or design your own PCB.

Alt text

Install required libraries

luma OLED library, install for python3.

face_recognition library

Provide your photo

The program needs a picture of your face in order to learn what you look like. Get a picture of your well-lit face with a clean background, name it me.jpg and place it in the software folder. The resolution should be around 400x400 otherwise the processing time is going to be long. An example is already provided so just replace it with your own.

Run the program

Run python3 to start face detection and logging.

Run python3 to display time statistics on the OLED.

Or if not using an OLED, run python3 to print the statistics to the terminal.

You might have to play with camera.rotation and camera.brightness at the beginning of depending on how your camera is oriented and your lighting condition. You can open up image.jpg to see the latest photo taken.

Default OLED reset pin is 17, change it to what you use in


  • All timestamps are in UTC. I'm in UK so this isn't a issue, but you can play with python datetime timezones if it bothers you.

  • It only keeps track of a single face since I made it for myself. However it's trivially easy to change it to recognize multiple faces.

You can’t perform that action at this time.