Skip to content
j-e-f-f-williams edited this page Apr 12, 2019 · 12 revisions

Why this project exists

The primary motivation is trackday riding of my motorcycle. In 2016 after about 14 years away I returned to the track with a 2000 ZX-6R motorcycle and I wanted to track lap times. I found Race Chrono app and installed it on my old Galaxy Nexus Android phone. I quickly realized I needed a better GPS than what the phone includes and started to look at BlueTooth GPS units. I work for a software company and was noodling around with Arduinos etc at the time and looking into the BT GPS I started to wonder if I could make something rather than buy something and that was the start of what became my data logger...

My Data Logger history

Each winter I update my logger ideas with the idea to implement them in the coming track season. Below I document each version I have created to date and the good or bad parts of each.

2016 Version 0.5 - GPS Only

  • Board: Arduino Uno
  • BT Board: HC-05
  • GPS: Some Adafruit 10Hz GPS board

The main purpose of this version was just to take in the GPS serial input and put it back out the BT connection. Has to use a software serial on the Uno for the BT. It kinda worked but wasn't great. GPS accuracy was hampered by the GPS being under fairings etc.

2016 Version 1.0 - GPS + RC3

  • Board: Arduino MEGA 2560
  • BT Board: HC-05
  • GPS: Venus 838 based GPS board from Tindie (No Longer Available)
  • IMU: MPU6050 breakout board from Adafruit?

This version was the first time I noticed the $RC sentences you can send to Race Chrono to log additional data. First I moved to a Mega 2560 board so that I had multiple hardware serial ports. Next I added an I2C connected IMU with the hope to get my lean angles etc. Converting the accelerometer and gyro results into pitch, roll, yaw was problematic for me. Doing the calculations for that as well as sending the data and injecting RC3 sentences was problematic for me. I was not used to dealing with the minimal resources of Arduino at the time. Most of the season on the track I never enabled the RC3 output and just kept it as GPS feeding Race Chrono.

2017 Version 2.0 - GPS + RC3

  • Board: Teensy 3.2
  • BT Board: RN42 XBee breakout
  • GPS: Venus 838 based GPS board from Tindie
  • IMU: BNO-055 breakout board
  • ADC: External ADS1115 breakout board

This is the first season where I got some extra data. The BNO-055 IMU has a built in mechanism to calculate the pitch, roll, yaw. The Teensy board was much smaller and easier to put on the bike and it had more power so I had less issues with lost serial data etc. I also wanted to start to figure out how I could monitor my throttle and brake application. In hind sight I should have used the Teensy ADC but instead I used an external 5V capable ADC. I used it to monitor the TPS sensor of the bike and had hoped to monitor a sensor for brake pressure though never made it that far. Best I did was connect a digital pin to the brake light switch on the front brakes so I at least knew when I was on or off the brakes. I also finally mounted the GPS antenna external to the fairing and it seemed to get better GPS signal.
I was using GPS at 25hz (the chip will support 50hz though accuracy seems to be less) and was trying to do RC3 sentence at 50hz. I was not able to keep up with that bandwidth over the BT using the HC-05 so I switched to the RN42 BT board as it supported RTS/CTS though looking back not sure how I thought that would help as you don't want the latency of RTS/CTS when sending the data to Race Chrono. I was also having problems getting everything timed correctly using the simple Arduino loop programming structure and had started to look into RTOS options so that I could use Queues to handle input and outputs etc.

Overall this version was the first that I think actually helped me learn a few things about what I was doing on the track. And it also helped me understand what I did to end my season when I crashed and gave myself a concussion. I don't remember applying the brakes in the corner when the other rider was there but the logs can't lie, the brake switch was triggered.

2018 Version 3.0 - GPS + RC3

  • Board: ESP32
  • BT Board: Built-in with ESP32
  • GPS: Venus 838 based GPS board from Tindie
  • IMU: BNO-055 breakout board
  • ADC: External ADS1115 breakout board

By this time I had some ESP32s in my micro-controller collection and the BT stack was starting to work in the dev branch. It also let me use RTOS constructs like queues to better control how the data flowed through my logger. Sounded like a perfect solution, no more external BT board. Initially no external ADC (more on that in moment) and more powerful dual core CPU. First conclusion I came to was that the ADC was not great on the ESP32 and others seem to have noticed as well in the forums. So since I had experience I moved to the ADS1115.
This version of my logger I used the ESP32 counter modules with the plan to get RPM and wheel speeds. Though it worked on the bench I never got it to work in reality. The RPM was never quite right reading and I never got sensors mounted on the wheels for wheel speed. Other than some frustrations of using the ESP32 (more in future version) where I could update the IDF and have things break (had to work off HEAD of IDF because of BT support) this solution worked rather well. By this version I had logging for GPS location, accelerator, gyro, pitch, roll, yaw, TPS, brake on/off. I also had code for RPM, wheel speed, brake pressure though sensors or code letting me down. And had a design for tire temp using I2C IR sensors.

Another season of logging data well enough to help understand what I am doing on the track. Started asking developer of Race Chrono for a higher bandwidth option for data. Wifi available for GPS but not RC3 lines.

2018-2019 Experiment - Raspberry Pi

This was an experiment I started. I thought what if I could do logging and analysis all with the computer that was on the bike instead of having to get the data from the bike and then use another program to look at the data. So I wrote a data logger that gathered the data and logged it to a InfluxDB right on the RPi and then started to design Grafana graphing pages to show the data from the track sessions. I could then connect over WiFi to the bike and access the web interface of Grafana using any device. One of the main issues I first had to solve was how to ensure that I didn't just power down the RPi and corrupt the filesystem. I ended up with a battery system that could power the RPi for upwards of an hour and the bike could re-charge it while on the track.
Everything conceptually was working and I had GPS and limited bike type data being gathered but the RPi didn't have all the inputs I wanted. So I added a Teensy 3.2 to use it's GPIO and ADC to feed the RPi. So now I had Serial between the Teensy and RPi, GPS serial into the RPi, BT or WiFi out to Race Chrono. It was getting complex.
One good thing that came out of this was I got back to looking at Teensy (hint for future version) and got ADC working using DMA which was good signal and fast.

This is when I paused and realized I was going the wrong way... back to the micro-controller side of things.

2018-2019 Version 3.5 - GPS + RC3 + SD-Card

I reverted back to my ESP32 based solution and wanted to look into logging more data faster. I had ideas to log suspension movement at 100hz and RC3 sentences over BT wasn't going to cut it. I wanted to add SD Card logging with some additional formats so I could take the file straight to Circuit Tools or Race Tech analysis app. The ESP32 has SDIO capabilities so thought this would be easier than it ended up. By this time though I was continuing with ESP32 I was also looking at other micro-controllers as a lot of things with ESP32 seemed to be 2 steps forward and 1 step back. I never did get the SDIO SD Card working correctly. 4-bit mode would work for POC and then the next morning it would stop. I got 1-bit SDIO working 80% of the time but I wanted something to work reliably. And also when I was writting to the SD Card it seems the BT communications would break down for GPS. Though I was logging to SD Card I still wanted to use Race Chrono for lap timing and quick reviews. The logged files on SD Card was for detail analysis after the track day was done.

The ESP32 work got frustrating and I stopped working on it for a bit while I thought about what I wanted to do...

2019 Version 4.0 - GPS + RC3, SD-Card, RAW logging output (DL1), VBO (RaceLogic) output

Back to Teensy! I never stopped reading their forums. I never had an issue with their products, they always seemed to just work. And the examples were detailed and worked the first time and all the time. When I compare to my ESP32 experiences the Teensy is just all around more stable. My first SD Card proof of concept worked and the card is on the board. Sure I have to go back to an external BT board but I have several anyhow but the ADC on the Teensy were good and fast and now that I understood how to use the library and DMA they can read in round-robin without the use of the CPU. Add the frequency library for RPM and wheel speed and there are libraries and examples for most of what I needed.
By this time I also had purchased 2 of the 'Ultimate Sensor Fusion' boards to calculate the pitch, roll, yaw of the bike. I never had and issue with the BNO, this was more just an experiment with a new board and I liked the results so moved forward with it.

Details on dedicated page for this: Current Logger Details