DIY Data Logger

An easy to build wireless data logger that I'm using to analyze mountain bike suspension performance

Similar projects worth following
I've been wanting to build a data logger for analyzing bicycle suspension systems for quite some time. Ever since I worked in R&D in the bicycle industry many years ago I've had a keen interest in the design and manufacturing of bicycle suspension systems. Some pro teams and several manufacturers have used data acquisition but these systems have been quite expensive and thus out of the reach of mere mortals- the least expensive system I'm aware of runs around $800 for a two channel system and the cost increases exponentially from there. I figured with modern low cost microcontrollers and sensors I could build my own system for substantially less money and maybe even add a few features along the way.

Based on my needs I quickly narrowed down my design requirements:

1) It should definitely have wireless capability. I wanted to be able to upload code via WiFi for ease of use but I also wanted to be able to stream data to a laptop when a WiFi connection would not be available.

2) It should be able to log data to a SD card at times when a wireless connection would not be practical.

3) It should be very easy to build using off the shelf components and be easy to use/program.

4) It should be portable (rechargeable battery powered, small and light weight) and weather resistant.

5) I wanted a minimum of six analog channels for monitoring four accelerometers and two linear position sensors for my bike project.

System Design

With these requirements in mind I decided to use a Spark Core to read the sensor inputs and then data is logged to a SD card using an OpenLog. The Spark Core takes care of the WiFi requirement and the wireless data transmission is handled by a pair of XBee Pro radios. This way I can wirelessly upload code and send data to the cloud using WiFi or send data directly to a laptop for viewing in a serial monitor or visualize graphically in real time using Processing

The system is powered by a single cell LiPo battery using a 5V boost converter. There is also a battery monitor circuit as well as a USB charging circuit. 

Here's a short video overview of the system-

The goal of this project is to be able to generate data that will help me analyze the performance of my own suspension designs as well as testing designs already on the market and allow for a greater understanding of what is actually happening when tuning suspension systems. I know a lot of people on various bicycle forums have been looking for an inexpensive, easy to use tool like this for some time so it will be really neat to see what other people do with it.

The other really interesting bit is all of the other applications for this project. 

My kids are really interested in science and experimentation so I also view this project as a great way to introduce them to electronics, programming, sensors and scientific testing by gathering data relevant to their interests. We'll be able to use this for all sorts of projects like monitoring weather, garden conditions, school science projects or monitoring our turtle Krebbs (the conditions of his environment- water temp, water pH, how often does he bask and for how long, etc.)

This is going to be fun! Krebbs sure looks like he's excited. :)

View all 13 components

  • Build Log 4- accelerometers

    jeromekelty08/14/2014 at 06:13 2 comments

    The linear sensors will measure the suspension travel vs. time but I also need four accelerometers to measure the vertical axis g-forces at the front and rear axles and at two points of the main frame- near the steerer tube and crankset. The axles will see upwards of 40 g so I'll use an ADXL78 accelerometer mounted as close to the axle as possible. The accelerometers mounted to the two frame positions will be the ADXL326 since the frame will see a much lower vertical force at these points.

    With this setup I'll be able to take readings that reflect the difference in suspension settings relative to what is happening at the wheels. If I ride over a specific course over and over I can compare the the accelerometer readings in the frame and axles at any given point in time and immediately see what changes are created by altering compression and rebound damping settings.

  • Build Log 3- More circuit testing

    jeromekelty08/13/2014 at 19:04 0 comments

    I assembled the charging and battery monitoring circuit and tested my circuit (minus the XBee radio, which I don't have yet) and checked out the low voltage warning as well as current draw. The Sparkfun Uh-Oh battery monitor is super simple to use - just adjust the trim pot to the voltage cutoff you want and the big green LED turns on when the battery voltage drops to that point. It's possible to solder a couple of wires to the Uh-Oh board and connect it to the Spark Core and have the Spark Core send my phone a message when the battery voltage drops but really that's kind of overkill- the big green LED tells me everything I need to know and it'll be easy for my kids to see when using this for their projects. 

    I also checked the current draw and it's just under the specs on the Spark Core data sheet since I was getting 280mA draw with the OpenLog writing at full speed. The OpenLog draws around 6mA at full speed. The XBee Pro is supposed to draw around 215mA so I should see a bit north of 500mA total current draw when the circuit is fully assembled. The Pololu 5V boost regulator is good for about 700mA so I have a little bit of headroom there. Right now the battery monitor is set to turn on at 3.2V so I may play around with that a bit once the circuit is finished.  Here's the current output vs. voltage input graph of the Pololu 5V boost regulator.

  • Build Log 2- linear sensors

    jeromekelty08/13/2014 at 04:56 2 comments

    Two readings I want to take are the position of the suspension fork and rear shock. This will show me the amount of suspension compression as well as the rate of compression and rebound. This is typically measured using a linear potentiometer but it has also been done using an acoustic transducer or linear velocity transducer. A good quality linear pot would be the Active Sensors CLS 1322 series and a 100mm sensor cost is around $180- and I need two pots. While that is a very competitive price it's still too high for me so I've been working on a less expensive solution.

    My idea is to use a Spectra Symbol SoftPot membrane potentiometer and a small Igus linear slide to create a low cost linear pot. I'll make an Aluminum backing plate and the SoftPot wiper will attach to the sliding block on the Igus linear slide. I'll also have to figure out some way to make a cover...

  • Build log 1- prototyping

    jeromekelty08/12/2014 at 18:52 0 comments

    The first thing I did was play around with the Spark Core and OpenLog with a bit of code and a few random sensors to see what kind of data rates I could get. I quickly stuck everything on a breadboard and wrote a bit of code to log some data. The Tx line from the Spark Core was connected to a FTDI adapter so I could view the data in a serial monitor as it was being written to the OpenLog SD card. Worked like a charm! I was logging data at 200Hz (one reading per sensor every 5 milliseconds.) To put that in perspective, the RaceTech ShockClock data logger logs 2 readings approximately every 4 milliseconds. Given that it takes roughly 25ms @30mph for a 26" wheel to absorb the upward impact of a 4" tall square edged bump I think 200Hz will be fine.

     For the sake of comparison I also tried logging with an Arduino Uno and I was able to get data logged on average around 500Hz (it would start out around 1KHz and then drop to around 700Hz before settling down to an average of 500Hz.) I also tried an Arduino Pro Mini 3.3V I had on hand and it wasn't any faster than the Spark Core. Interestingly the Pro Mini would slow down dramatically as I logged more channels.

    I removed the SD card and renamed the .TXT file as a .CSV file and plotted the data on a graph using -piece of cake!

View all 4 project logs

  • 1

    Here's the wiring diagram for the data logger- it's pretty simple. For the sake of clarity I'm only showing one accelerometer connected but the other sensors are connected in a similar fashion. As I go through the build instructions I'll show how to solder all of the components on a proto board, mount everything in a weatherproof enclosure and build a wiring harness for the sensors step by step so this will be really easy to build.

  • 2

    Here's the code for the Spark Core. The programming for this is very similar to an Arduino. Once you go to the Spark website and get your Core setup you just click on the BUILD tab, create a new App and paste in the code and it'll upload the code over your WiFi network. 

    Here's the code-

    // Define the pins we're going to call pinMode on
    int sensorPin1 = A0; //analog pin 0
    int sensorPin2 = A1;
    int sensorPin3 = A2;
    int sensorPin4 = A3;
    int sensorPin5 = A4;
    int sensorPin6 = A5;

    int sensorValue1 = 0; // variable to store the value coming from the sensor
    int sensorValue2 = 0;
    int sensorValue3 = 0;
    int sensorValue4 = 0;
    int sensorValue5 = 0;
    int sensorValue6 = 0;

    // This routine runs only once upon reset
    void setup() {


    // This routine gets called repeatedly, like once every 5-15 milliseconds.
    // Spark firmware interleaves background CPU activity associated with WiFi + Cloud activity with your code.
    // Make sure none of your code delays or blocks for too long (like more than 5 seconds), or weird things can happen.
    void loop() {

    // read the value from the sensor:
    sensorValue1 = analogRead(sensorPin1);
    sensorValue2 = analogRead(sensorPin2);
    sensorValue3 = analogRead(sensorPin3);
    sensorValue4 = analogRead(sensorPin4);
    sensorValue5 = analogRead(sensorPin5);
    sensorValue6 = analogRead(sensorPin6);

    // print the results to the serial monitor:


View all instructions

Enjoy this project?



gavrilenko.andrey wrote 04/07/2016 at 07:53 point

Really like the project. Tring to build similar myself. I do not understand why do you need accelerometers near axles as you can easily calculate acceleration from shafts velocity. Do you know any software with which it would be possible to analyze data. Something like filtering, patterns find, etc. Thanks

  Are you sure? yes | no

jeromekelty wrote 04/12/2016 at 18:26 point

The reason is that you can log the change in acceleration from the frame relative to the suspension. This makes it very easy to see the effect from suspension tuning with regard to bump inputs. 

I don't currently know of any software that makes it easy to analyze the data other than generating plots. Sorry!

  Are you sure? yes | no

mark wrote 11/20/2015 at 15:13 point

Just what I'm looking for - great project, big demand for this type of thing I think!  Have you managed to get it running?  

  Are you sure? yes | no

jeromekelty wrote 11/25/2015 at 06:42 point

Everything works- I just have to get it mounted on the bike. My work has kept me very busy these last few months.

  Are you sure? yes | no

Chris Hoey wrote 05/17/2015 at 00:25 point

Sweet project. I did not think to check this before starting up the picorico project. I probably should have. You have lots of good ideas and similar goals. 

  Are you sure? yes | no

jeromekelty wrote 05/18/2015 at 18:37 point

Thanks! I should be back to working on this very soon. Much like yourself I think finding an inexpensive method to accurately measure the suspension travel is key. I should have my linear sensors finished soon so we'll see how my idea works out! I'm betting it's going to be pretty noisy... 

  Are you sure? yes | no

klares wrote 12/12/2014 at 02:44 point
Any updates? I've been looking for something like this, is it running yet?

  Are you sure? yes | no

jeromekelty wrote 12/13/2014 at 06:03 point
I'm still working on it but the code certainly works. I'm changing it up a bit and I've had a couple of other big projects take priority over the last couple of months.

  Are you sure? yes | no

klares wrote 12/15/2014 at 22:54 point
Do you think it could be adapted to work with a higher speed vehicle, say a cross country snowmobile, mainly 50-60mph but up to a 100?

  Are you sure? yes | no

mr.jb.swe wrote 08/24/2014 at 07:32 point
check this out

If you don't need live access I'm working on a simple converter log2plotly

  Are you sure? yes | no

jeromekelty wrote 08/25/2014 at 13:57 point
That's pretty cool!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates