Bike Suspension Tracker

I love mountain biking!

Embarrassingly enough, when I got my last mountain bike, I did not check the full functionality of the front suspension. To my dismay, I found that the front lockout feature didn’t work. Of course, it was long outside the manufacturer’s warranty…

On a good note, it got me thinking about how you could use a Raspberry Pi Zero and JuiceBox Zero with bike suspension systems. One company already makes a sweet looking add-on o track your ride overall, but I wanted something to monitor the suspension itself. I didn’t need anything fancy, and I knew I could get the data later and put it into a fun chart to show off on a future day. I just wanted a datalogger to tell me how my suspension reacts as I roll around or ride down a cliff at the RedBull Rampage.

I got thinking and realized I needed to track only the movement between the two moving portions of the front fork. To do this, I merely mounted one accelerometer to the lower portion of the fork and another to the handlebars. At this point, all I needed to do was log the X, Y, and Z components of the accelerometers, but I figured I could do a little more.

To get only the movement between the moving portions I needed to figure out a way to remove all other aspects of the ride from the readings. I had a stroke of inspiration and realized a relatively simple and generally good solution was to use the following equation:

where X1, Y1, Z1 are the readings from the first accelerometer and X2, Y2, and Z2 were the readings from the second accelerometer. Taking the square root of the sum of the squares is basic vector math, i.e., using the Pythagorean theorem in 3 dimensions. Then, taking the difference between the two measurements would result in only the movement between the two pieces of the suspension.

I don’t think it accounts for any roll rotation, but I’m hoping I  don’t have much movement like that since that would probably mean I just fell over…

At any rate, the method seemed to track my suspension reasonably well while being simple to implement.

Most of these items are exactly what I used, and some are basically the same thing, just a different brand or something inconsequential. Also, the links are affiliate links, but that doesn’t affect you at all, I’m just required to say that.


I’m going to assume you have basic soldering equipment and solder. If you don’t have the basics or don’t know how to solder, here’s a link to an excellent guide for anyone getting started.

Putting it together: Software

Go to our Github repository and follow the instructions to install the software.  If you have any additions to how you’d like the software to work, please submit a pull request! The code is intentionally simple right now.

The logged data is in a .csv file which can be imported into any data visualization software (excel, bokeh(python), google sheets, etc.).

Putting it together: Wiring

  • First you’ll need to get your wire ready.
  • You’ll want to make your cables long enough to reach from your bike bag, along your bike frame and to the location where you want to mount the sensor.

  • Then take the jumper wires, cut ans strip half-way so you can solder the phone cable wires to the jumper wires.
    • At this point I think it’s a good idea for me to mention that while jumper wires are easier to use and quick to remove, they aren’t as reliable as a solder joint connection. On the other hand, a good solder connection to the Raspberry Pi pins is more difficult to make. This is a trade-off you’ll want to consider when putting it together.
  • Solder your wires and cover with heatshrink.
  • now solder the other end of the phone cable to the accelerometers. You can also refer to the schematic for a complete wiring diagram.
  • You’ll need to make sure one accelerometer is wired with the default address, and one is wired with another address. See the Adafruit guide for how to select a different address other than the default.
  • In the next photo I connected SDO to 3v3 to select the 0x19 address.

  • Then make the solder connections to the RTC.

  • then connect the wires with the I2C configuration to the Raspberry Pi/JuiceBox Zero.


  • Lastly, you’ll need to plug in a battery.

That’s all the electrical!


Putting it together: Mechanical

  • Pry the reflector off the front of the frame. (The reflector will probably break in the process, but who uses them anyway?)

  • Drill two holes in each reflector base in the same locations as the mounting holes for the accelerometers.

  • Mount the accelerometers, to your new bike electronics mount.

  • Carefully mount the sensors to the bike: one on the lower fork and one on the handle bar.
    • Orientation doesn’t actually matter because the math above takes all vectors into account to get one!
    • Just make sure they are secured and out of harms way of the spokes or brakes, etc.

  • The Raspberry Pi/JuiceBox Zero and battery will all go in the bike bag.

  • Use zip ties periodically to make sure the cables don’t get caught in any moving parts.

You’re ready to take mountain biking to level NERD.

That’s it. You just need to switch on JuiceBox Zero when you arrive at your trail and it will automatically start recording!


The Squiggly Lines

Everyone loves charts, graphs, or anything else with a squiggly line. Here are two screenshots of the G force tracked over time (I didn’t worry about time step at this point, I just wanted to see if it looked like what I would expect).

This first graph shows me just standing still and jumping on the bike suspension to see how it looks when I’m a little more in control of the movements.


This second graph shows the first half riding on a street, with the second half showing when I transitioned to off road.