STATSulator : Training Log

by joe in Outside > Bikes

8924 Views, 26 Favorites, 0 Comments

STATSulator : Training Log

dsc_2887.jpg
dsc_2891.jpg
dsc_2892.jpg
dsc_2862.jpg
stats-multi.jpg
stats-month.jpg
The STATSulator is a php/mysql app and bs2 lcd desktop display that keeps track of all your training. It allows you to see what your training buddies are also putting in, raw hours, not the details for your friends activity...

This STATulator was born around new years 07, I was talking with some bike riding buddies and they were looking at their end of year spreadsheets. How many miles they rode, how little they used their mountain bike... And the inner geek in me decided to write the STATSulator.

After a full year of use it has turned out really useful for me. It has shown me how much I rode my commuter bike, after that the mountain bike... But now I carried my craziness over to a new level and track my weight in it as well.

As a project I thought it would be neat ot also make a physical desktop display for it that at a glance would display my stats, to see if I could skip riding that day. :)

Supplies

imgp3027.jpg
I used the following for this project, but you could use a ton of things for this.

- Plexiglass small sheet
- Allthread (I used #6/32)
- 16 nuts ( I used #6/32)
- 16 washers (I used #6)

- Basic Stamp 2
- Basic Stamp Board
- Parallax 4 x 20 LCD (I used the 4x20 backlit model)

- Wall Wart

-Linux box ( I use fedora core 8)
-- Have PHP/Apache/Mysql Installed
-- Install the BSTAMP Package from sourceforge to compile bs2 code
-- JPGraph

Tools

imgp3026.jpg
To cut the plexi glass you will need:
- a utility knife or x-acto knife
- Straight Edge (sXe)
- Clamps

To make the case you will need:
- Dremel
- I used the Dremel Workstation and can't recommend it highly enough.

App Walkthrough 1

stats-home.jpg
This is the welcome page, this is all written in PHP and should be on sourceforge in the next few days.

Whats of note here is the table on the left I call the peer pressure module so you and your friends can motivate each other to ride.

App Walkthrough 2 - Add Data

stats-add.jpg
Adding data is done through the apps "Add" button. It will pre populate the fields where it can based on activity.

Also this page can take uploads from MotionBased exports. So you don't have to key in info twice if you are using a garmin. MotionBased if you are not paying will only allow you to view the last few activities.

App Walkthrough 4 - View Time Reports

stats-month.jpg
stats-weather.jpg
You can view data by week/month/year/month to date.

On these screens you can see your time, breakdown of activities, breakdown of weather and the details of each activity.

App Walkthrough 4 - View Details

stats-data.jpg
This detail view will show the fields for the time frame you are viewing. All of the activities can be selected for viewing more details and editting/updating.

Also this exports to a CSV file so you can do your own graphs in excel.

App Walkthrough 6 - View Activity by Month

stats-multi.jpg
stats-act-pie.jpg
The page I use more than anything else is this one that shows me my activity by month in pie chart and bar graphs. there is a pie chart for each month, and then two that show just bike riding times. The bike one can be turned on and off if you are not a bike rider.

App Walkthrough 7 - User Prefs

stats-prefs.jpg
On the Preferences page you can turn on and off reports, maybe you don't track distance or heart rate, so you can disable those.

Also on this page you can choose to get monthly status reports and choose to make your info public or not. And by public it just show your total hours in the peer pressure chart on the left.

App Walkthrough 8- Healthy Eating Disorder

stats-weight.jpg
On this page you can track your weight. It has two graphs that can display your weight and your weight with workout time. It throws in some info like you max/min/avg too.

WARNING: Remember this is a geeky little web page, don't give yourself an eating disorder... seriously.

The Desktop Version

dsc_2892.jpg
For the desktop version of this I used a Basic Stamp 2 from Parallax along with their Board of Education and 4x20 Backlit LCD. If you have never checked them out, they have a really nice website with tons of information making it easy to get in to programming your first microcontroller.

Desktop Version - Plexi Glass 1

imgp3022.jpg
Lay the Board of Education on your sheet of plexiglass and figure out how big you want to make the plexiglass base and cover. I made it 1/2" longer than the board. Trace it out.

Clamp your straight edge (shout out to minor threat!) to the plexiglass and score it with your x-acto knife.

Desktop Version - Plexi Glass 2

imgp3024.jpg
To get a nice good edge, score the plexiglass with your x-acto knife then clamp it to the edge of a surface right on the line your scored. Then push the plexiglass down and it will crack nice and straight.

Desktop Version - Base 1 - Four Corners

imgp3030.jpg
You will need to have your four corners marked out to run the allthread through. I lined up the Board of Education and marked four spots.

Use the first one you make to template the bottom one.

Desktop Version - Base 2 - Drilling

imgp3031.jpg
I used the Dremel Workstation to drill my holes. I find with plexiglass and a large 18v rechargeable drill *I* tend to crack the corners from the weight of the drill.

With the dremel, set the speed to high and slowly lower the bit through the plexi.

Desktop Version - Base 3- Board of Education

imgp3027.jpg
imgp3028.jpg
imgp3030.jpg
Drop the board on the base and mark your four holes and drill. The same goes for the LCD on the top.

Desktop Version - Base 4- Allthread

imgp3032.jpg
Attach the BoE with 4 screws and nuts, attach the LCD the same way.

Line them up on top of each other and see how much room you will need for the althread. I needed about 2 3/4".

Cut the allthread to length.

Desktop Version - Base 5- Attach

imgp3033.jpg
imgp3034.jpg
I attached the allthread to the top first, run your nut out to the end of the allthread, use a washer on each side of the plexiglass and see if your holes line up.

If it does attach them, once again using a washer on each side of the plexi glass.

Desktop Version - Base 6- Rubber Feet

dsc_2900.jpg
I used rubber feet to keep the metal nuts off of the surface you lean lay this one.

Desktop Version - Program

dsc_2891.jpg
I used a linux box to do the programming of the bs2.

The nice people over at http://bstamp.sourceforge.net/http://bstamp.sourceforge.net/ have created a suite to use.

The code has place holders for values that will get inserted when the PHP script runs to hit the database.

Desktop Version - PHP

dsc_2862.jpg
To get the data into the bs2 file I use a php script which queries the db, then replaces place holders in the bs2 template file using sed. Then it runs the bstamp package to load the data on to the bs2.

Props

100_0474.jpg
I'd like to give thanks to my buddy Craig S for the sweet logo. Mine was weak..

I totally tried to bite radiorental's style and use an analog gauge like his really cool analog network meter instructable.

I purchased a neat looking gauge off of ebay but it required more amps than the stamp could deliver so I grabbed the LCD and think it worked out ok. You can see the analog prototype below.

Thanks for looking at this.
-Joe