Introduction: Time Cube - Arduino Time Tracking Gadget

I would like to propose you simple but really useful arduino project to track time events by flipping some smart cube gadget. Flip it to "Work" > "Learn" > "Chores" > "Rest" side and it will count the time you spend on that activity. Time cube is built based on Arduino Nano and ADXL345 accelerometer placed to suitable-size box on which you can draw activities symbols or names. At the end of the day you can check the statistics. I hope it will motivate me to “Learn” more.

There are plenty similar products on the market like,, ZEI. You could also try nice DIY project from Adafruit However I propose you to make it much more simple. To track time data you don't need any wifi or bluetooth internet connection to the cloud services. Time Cube is powered and connected to PC by USB cable. On computer you have to run my java application which listens to serial messages from arduino and displays total spent time.

All required program sources and some not very detailed instructions you can find on my GitHub project:


    1. Arduino Micro or Nano like that:

    2. ADXL345 accelerometer:

    3. Carton / plastic cube box

    4. USB cable

    Step 1: Wire the Board and Accelerometer

    ADXL345 sensor is a 3-axis accelerometer which can measure forces of acceleration and when is static you can also read it's orientation. You have to wire Arduino Nano or Micro board and ADXL345 accelerometer like on the image.

    I will not explain in details how ADXL345 accelerometer works. All required information I found in very nice article about connection accelerometers to arduino and programming:

    Step 2: Flash Program to Arduino Nano

    In this step we have to upload program from Arduino studio to arduino board. The arduino nano will be able to read XYZ coordinates from accelerometer and send them to the serial port in some kind of data packets like

    You can download all required sources from my GitHub project page (as single archive file):

    1. Unpack downloaded zip archive to some folder like c:\program\tcube and open file tcube\arduino\tcub\tcub.ino in Arduino studio.

    2. Connect arduino board to PC using USB cable.

    3. From Tools->Board: select "Arduino Nano" (or another board which you plan to use).

    4. If you use some chinese arduino clones then you should select from Tools->Processor->ATmega328P (Old Loader)

    5. Select connected port from Tools->Port ->COM3 (in my case)

    6. Upload program to arduino

    7. From that moment it will immediately send data packets to USB serial port.

    8. To test if everything works fine you can open "Serial Monitor" in Arduino Studio. You should see packets which generated each second like ...<12:-56:231><14:-126:228><8:-104:221>... (which means actual coordinates of accelerometer).

    Step 3: Install Java Runtime Environment to Run Client Application on PC

    Before we continue you have to make sure that you have Java Runtime Environment (JRE) installed on your computer.

    The client application which I created to receive messages from Arduino and aggregate statistics is written in Java programming language. And JRE is required to run Java applications.You should have at least JRE8 installed. I suggest you to download x64 version for Windows. Please download it from Oracle site

    Step 4: Install Client Application to Read Coordinates From Arduino and Track Statistics

    Now it is time to prepare and launch client application on your PC, which will connect to USB port to listen and track time statistic.

    If you are familiar with Java you can download and compile sources of Time Cube java application from my GitHub project. However inside full project archive that you've already downloaded there is already compiled and ready to use application archive that you have to unpack to some folder (it can be c:\programs\tcube)

    If you run file run.bat it should start the application, which immediately will try to start connection to some active COM port used by Arduino board (Arduino connected to USB is automatically recognized by Windows as some virtual COM port).

    If everything is configured correctly you should immediately see time counters running according to some activity. And by flipping the cube you should be able to track different activities. Application window shows events log and you can see any connection errors that might happen.

    Step 5: Accelerometer Calibration

    It might happen that you should calibrate your Time Cube because your accelerometer is not oriented exactly like my. Just open file and edit ranges for coordinates of each cube side according to actual coordinates that you will see in application log window for each cube side.

    Or you can experiment with orientation and find accelerometer position to be exactly like my.

    Step 6: Extra Analysis

    My java application is pretty simple and just shows time spent per each activity during the day. If you want to have more analytics you can use Microsoft Excel for extra analysis.

    Application produces time-log.csv file in CSV format, which contains all events sent from arduino. Since events are generated each second you can perform detailed day analysis in MS Excel to build nice charts, graphs and extra analytics.

    In the folder that you've downloaded from my GitHub project you can find log_analytics.xlsx excel file that builds pie chart using data from time-log.csv file. You have to update chart manually by pressing "Refresh All" button in Excel.