Work From Home Time Recorder Using a Raspberry Pi

by Simon Culverhouse in Circuits > Raspberry Pi

467 Views, 3 Favorites, 0 Comments

Work From Home Time Recorder Using a Raspberry Pi

time-recorder06.jpg

Over the past year, I have had the opportunity to work from home. For which I needed to keep track of the hours that I work.

Starting by using an excel spreadsheet and entering the ‘clock-in’ and ‘clock-out’ times manually, I soon found this to be quite tedious (and I would forget to enter times).

I have a Raspberry Pi on my desk, and so decided to set up a work time recording solution using it and a few components from my son’s Arduino starter projects kit.

Supplies

- Raspberry Pi

- 450ohm resistor x3

- 2 LED

- Mini Arduino button

- Breadboard for prototype

- Dupont connectors

Prototyping

time-recorder01.jpg

I started by building a prototype of the time recorder on a half-size breadboard. Once I was happy with the way it works the plan was to put together a boxed version using a 3d printed case and soldered connections.

The components are connected using Dupont wires as shown by the fritzing diagram.

Setting Up the Raspberry Pi

time-recorder02.jpg
time-recorder03.jpg

I produced a short python script that would detect the button push and switch the LED states. On switching, the time is recorded in an excel workbook.

I’ve used the Openpyxl Library to interact with the workbook(which I created manually in the home folder on the Raspberry Pi).

The script enters a start time, end time, and a total for the work period.

Create a script in the home directory using your preferred editor(I used Thonney Python IDE) and save as clockin.py


Install LibreOffice on the Pi, if it’s not installed already, and create a blank workbook named hours.xlsx Run the script from the terminal using the terminal command python3 clockin.py. Or run it in Python shell or Thonney.

The red LED should light up to show that it’s running. When the button is pressed the blue LED lights up, the red one goes out, and the time is recorded in the spreadsheet.

Python Script

Downloads

Boxing It Up

time-recorder10.jpg

The Raspberry time recording device is working how I want, so it’s time to make it look more professional.

Using SketchUp to model a simple box to hold the button and two LEDs, with a hole for the wires to enter.

The design and print files can be found on Thingiverse


I printed the box in black PLA+, as it blends in well with my desktop. The STL file was sliced using CURA software. The design needs to be printed with support.

Soldering

time-recorder05.jpg

Again using Dupont wires, solder the components in place in the printed box.

Sealing With Candle Wax

time-recorder07.jpg

Adding a piece of heat-shrink at the exit of the box to pull the wires together and finishing off the unit by filling it with candle wax.

The addition of the candle wax protects and holds the connections in place, at the same time adding weight to help stop it moving around during use.

Connect to the Raspberry Pi

time-recorder04.jpg
time-recorder09.jpg
time-recorder08.jpg

The finished unit connected and running

At the end of the week, I copy the worksheet into another workbook to format and add up my hours worked.

This set-up is great for keeping track of ‘work from home’ hours, much better than manually entering times.

See this project on my website myprojectcorner.com/raspberry-pi-time-recorder/