Close

Logging my physical activity

A project log for keyboard controlled treadmilldesk

Build a treadmill desk that can be controlled from your PC

PixJuanPixJuan 10/04/2017 at 09:320 Comments

Now that the treadmill is working and can be controlled from my PC, there is one more feature I need, logging how long I use my treadmill everyday and what distance I walk.

This feature requires modifications both on the Arduino and python code:

Let's not reinvent the wheel and use CSV to store our data. But wait, there is one problem: in what format will we store the date?
I was going to store it in the European format, dd/mm/yy, but what if an American user (imaginary user of course, I'm not sure anybody else than me will use this)  wants to import the data in LibreOffice or Excel?

Well, according to Stack Overflow, it looks like there is an unambiguous format  that works with every locale : yyyy-mm-dd
So even if it doesn't matter for this project, I learned a useful trick next  time I need to deal with both sides of the Atlantic.

Here is a line of my CSV file:

#   date   ,hours,minutes,seconds,distance, duration,calories
2017-10-04, 10  ,   44  ,   42  ,  1845  ,    23   ,  53

Now to draw the chart, I had a look at the web based solutions, but for now I think I'll stick with Python, I don't want to use JS for this project. So here is what it looks like with matplotlib

I could just bind a key to generate this graph and display it with eog, but I'd rather serve it through a web page, so I think it will be the next step.


Discussions