Optimizing the time-tracking interface

Ivan Lesar
Apr 15, 2019 · 4 min read

There’s a certain joy in over-engineering…

All we do is devote a chunk of our brains to the process of tracking time before proceeding to lunch — focus our time-tracking tool, change the active tab and switch to the time-off task.

As we return to the workstation, we repeat the process to return the time-tracking tool to its previous state.

Let’s rewind that process and apply an unneeded micro-optimization just for the sake of learning something new.

All we do is assemble our custom physical interface for faster switching between the current task and the time-off task, since the time-tracking tool provides an API.

The software

Building the whole codebase as a blog post would be too long, so I provided libraries you can use, along with basic usage. You can find the final product feature list at the bottom of the post.

The hardware

  • 🧠 NodeMCU board — integrated ESP8266 WiFi microchip
  • 🖥 16x2 LCD display
  • ⇥ I2C Serial Interface Adapter
  • 👆🏼 Touch sensor — Arduino/NodeMCU compatible
  • ☊ Jumper wires
  • ⚡USB cable

Wiring of the I2C adapter is pretty direct. We managed to get a hold of some LCD screens with pre-soldered adapters. Now we just have to connect the adapter to the NodeMCU using the following wire mapping:

I2C adapter -> NodeMCU mapping

… and connect the touch sensor to the NodeMCU using the following wire mapping…

Touch sensor -> NodeMCU mapping

That’s it. Let’s fire up the Arduino IDE and send some impulses through that NodeMCU brain.


Firstly, we must connect it to the local WiFi network. This is an example usage of the ESP8266WifiMulti library, which helps us achieve that.

For handling HTTPS API requests, the ESP8266HTTPClient will jump in. By providing the SHA1 certificate fingerprint and the embedded BearSSL library, we’ll be able to communicate with the API server.

We’ll obtain the fingerprint by targeting the API endpoint from the browser and finding it in the security part of the developer tools.

Once we obtain the data, it should be properly parsed. In our case, the API server returns a JSON payload, for which we’ll use the ArduinoJson library.

Ok… at this moment we should be able to print out the current task from the time-tracking tool.

For that, we’ll use the LiquidCrystal library to talk to the LCD screen. This library handles the LCD screen well and gives us a bunch of methods to control it with. This is an example usage of the library…

This is all we need for the presentational part of the project. Since we are using a touch sensor, we can implement a couple of interactions like tap, hold and double-tap. The basic usage would just include reading the touch sensor state like in the preview below.

And that’s it. You are aware of all the hardware modules needed for this project and their associated libraries. You can build your own project on top of this.


The final features of our product include:

  • periodical synchronization of data
  • task menu for switching between tasks
  • tap the touch sensor to go to next task in the menu
  • hold the touch sensor to start tracking the current project shown in the menu
  • double-tap the touch sensor for two seconds to toggle between the current task and the time-off task

We have successfully optimized our task-switching workflow from 10 seconds to 3 seconds. The need for over-engineering is satisfied and we can continue with our work knowing that in a year we will save 4–5 hours of our precious time. 😎

__________
We’re available for partnerships and open for new projects. If you have an idea you’d like to discuss, share it with our team!

Distant Horizons

Interesting bits & pieces from all of us at Bornfight.

Ivan Lesar

Written by

A creator amongst rules. software_dev@Bornfight

Distant Horizons

Interesting bits & pieces from all of us at Bornfight.

More From Medium

More from Distant Horizons

More from Distant Horizons

More from Distant Horizons

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade