Technology Deep Dive: Software Edition

The Stata Clock Company
The Stata Clock Blog
5 min readJan 4, 2018

Two years ago, when the Stata Clock was only a dream, our founders sat down to discuss how they could use modern engineering to create something magical. A quick Google search showed them they were not the first to want to tackle this problem, but they were determined to be the best. None of the location-tracking DIY projects on the internet were robust, using both software and mechanics. In addition, none of them were production-ready, which meant the Stata Clock could never be shared with the world.

Luckily for the rest of us, these were the problems that our founders found most interesting. In the next two blog posts, we are going to take you deep into the technology behind the Stata Clock and let you see first-hand what went into creating this magical device. First up, we sat down with Kristie to talk about the computer and software systems she designed for the Stata Clock.

The small-but-mighty Raspberry Pi Zero W powers the Eta Clock

Before we start, you might be wondering why we are choosing to share this detailed information with the world? We are big supporters of the open-source movement and as any great engineer knows, its not just one person’s idea that changes history, it is years and years of hard work and information sharing that makes ideas come to life. We like to think that, by sharing this information, we are helping everyone take a step closer to a magical reality.

Tell me about the computer system in the Stata Clock

The Stata Clock computer system is made up of three components, the on-board computer, the cloud platform, and the mobile app.

What is each part of the system used for?

The Stata Clock mobile app sends geolocation information, user data, and saved user locations to the cloud environment. The cloud environment then pre-processes the data and transmits it directly to the on-board computer before deleting it from the cloud environment. The on-board computer distills the geolocation information into one of the 12 possible destinations, saves the data, and moves the mechanical hands using servos.

Was this always the plan or did the Stata Clock system start out simpler?

When I first started thinking about building the Stata Clock, I decided to start off using an open-source location tracking app called OwnTracks. This meant I only had to create two of the three systems at first — a great first step.

OwnTracks was used simply to send data to a pre-determined IP-address — our cloud environment. In our case, this meant an AWS EC2 instance that hosted a PHP API. The on-board computer was a Raspberry Pi 2 and an Arduino Uno, connected via serial cable to each of the 6 servos.

The software on the Raspberry Pi was a stand-alone PHP application and MongoDB database. The application requests location updates from the server every few minutes.

Original Software / Firmware System Architecture

What were the challenges with the first system?

While the original Stata Clock prototype worked well enough, it was missing a number of key elements. Firstly, we did not have our own app, which meant we couldn’t control the tracking accuracy and our users had no way to save their locations. Secondly, our AWS environment wasn’t scalable, which meant a lot of overhead as we rolled this out to customers. Finally, we found that our on-board Raspberry Pi and Arduino had serious stability problems and we desperately needed simplify that hardware. As a result, we designed a brand new architecture perfect for scaling and stability.

What was the new system and how was it different from the original?

A good, hard month of development time went into creating our first mobile app which allows users to save and edit their locations. The mobile app sends geolocation information to our new cloud environment, which is an AWS Elastic Beanstalk cluster and an mLab MongoDB Database. Elastic Beanstalk allows for simple scaling of our PHP API as the Stata Clock community grows and we chose MongoDB because it fit well with our data models. Our API now handles location data pre-processing and user authentication, all features required of our new app.

Our new on-board hardware is a Raspberry Pi Zero W and Adafruit Servo Hat. The Raspberry Pi Zero W is the newest, most powerful Raspberry Pi on the market today, is tiny in size, and is incredibly affordable for manufacturing. Best of all, removing the Arduino fixed the stability problems we had with the original prototype.

The onboard PHP application has grown to include both Python and NodeJS modules, but has, otherwise, remained the same.

Scalable Software / Firmware System Architecture

Is there anything you would still like to change about the current system?

Of course! An engineer’s work is never done. That’s why we are open-sourcing all of our Stata Clock code. We want to encourage the community to think about features they want in the Stata Clock ecosystem, build upon what we have done, and even contribute to our product. We hope to build a data analytics platform, allowing users to see where they spend their time. In addition, we would love to create an open API so users can get and store their own data, and package our cloud environment so users can host their own API.

Next time, we will talk to Eric and dive into the mechanical engineering that went into creating the Stata Clock.

Have a question about how the Stata Clock works? Leave a comment below!

--

--

The Stata Clock Company
The Stata Clock Blog

The Stata Clock keeps you connected to your loved ones by showing you their whereabouts in real-time.