Hi all,
I am looking at building myself a data acquisition module for use with race chrono using the following hardware:
Arduino (I have an Uno and a Mega, If I need the extra functionality I will go mega)
Adafruit ultimate GPS module
MPU6050
HC-05 Bluetooth module
I am looking sending across to race chrono :
GPS data
Engine RPM
Brake switch
Throttle Position
G force
and possible lean angle at a later date
Before I plough on, someone must have already done this before me, rather than reinvent the wheel can anyone point me in the direction of the code for a previously built logger?
Any help much appreciated, and when I am done I will happy to share my code and findings etc.
thanks
Ian
Comments
Many race cars, like vintage cars or cars without digital EFI, don't have OBD, so there is no RPM input for RaceChrono. Please keep us informed and build a lot of them if it works!
V1 I started with a Arduino Mega doing just BT and GPS. Adding RPM I started to loose data. I am trying for a minimum of 25Hz GPS and 50Hz data
V2 I moved to a Teensy 3.6 as it has on board SD card and still uses Arduino for programming so could use what I already knew. With this I added Accelerometer/Gyro, Brake on/off and throttle position sensor reading
V3 I moved to a ESP 32 using FreeRTOS and moved from Arduino. This let me use the on-board BT module so less components. Thought I could move the GPS to WiFi so that I had more bandwidth for BT data since I was getting a bandwidth bottle neck pushing higher rates to the phone. This version I had code for 9 DOF sensor with lean angle calcs etc, TPS, RPM, Wheel speeds, brake on/off. Bunch of stuff. Though I only connected sensors for about 1/3 of it all. It worked pretty well.
V4 I have moved to a Raspberry Pi as an experiment. Its this winter's project. I am going to expose the data to Race Chrono but also going to store it on the device in a Influx DB. Then run Grafana on it directly so that I can view graphs of the session from my tablet straight from the DB at the track. I have gyro/lean/accelerometer data at 100hz with 25hz GPS logged at the moment to the DB. Need to start to add additional sensors and see where things fall down. But I also upgraded my track bike so looking if I can get data straight from the ECU at a reasonable rate
I may move back to a version of my ESP32 if my rPi testing doesn't go well. I have ot published any of my code or designs publicly, but might be willing to work collectively on something if we find the right common platform.
TTYL, Jeff
If you want to use Arduino teensy 3.6 did me very well. I just didn't like having separate BT module but the built-in SD Card was good. Up to 25hz it did everything I wanted. If I wasn't also doing this to tinker in winter I would probably have stayed at this solution and designed a custom board to mount it all on vs the home made board I used.
I like the RTOS aspect of ESP32 for controling whats going on in the solution the best so far. Though the ESP32 itself has limitations. For example it's ADC are pretty bad so I used an I2C based ADC for TPS and was going to add analog suspension sensors. I did all the code in 'C' using queues, tasks etc which I find much better vs Arduino.
I feel my biggest limitation to logging lots of data is the BT. I started just wanting lap timing but then I started to lear from the extra data and want more sensors. For example I know why 2017 season ended in a crash, data shows I hit brakes though don't remember doing so in the corner.
I am not getting rid of RaceChrono, I like it for the timing etc. But what I am currently playing with is sending GPS data over wifi as it's simple with GPSd on the Raspberry Pi. That gets me lap timing and quick look at speeds etc. Then I am currently thinking of putting data as fast as possible to Influx DB (currently around 100hz). Then once I get that data sorted I may add BT capabilities as well and see if I can still log some data in RC3 format to RaceChrono just for video overlay options. The data would only be at the same rate as the GPS which is enough for video. Also logging to a DB on Raspberry Pi lets me log more data than RC3 can handle, though I am technically not there yet. I think I had one field available with my ESP32 solution (though not all my sensors were in place on the last bike)
logging at 100Hz the raw data seems to let me smooth out the noise and get closer to a real 50hz data set. Though I have only done 2 car trips of 20min each so far logging GPS & IMU data. I am currently working on an RPM/TPS/Gear emulator so that I can fake the inputs into the system while driving it around town in the car when I go somewhere.
I guess I should find some time some night to try to setup a wiki or something somewhere to explain things a bit if there is interest in the community here.
Jeff
But if you have a 12V coil, you might reduce it to 5V and use it as an analog input for Arduino (https://forum.arduino.cc/index.php?topic=10219.0).
Grab the tachometer-signal, measure the ignition, use an optical/magnetic measurement or whatever your car can give you out of its controlunit/diagnostic
I have done a full 360 on my logging device of choice. Back to using Arduino system with a Teensy 3.6 and a RN42 BT module. The ESP32 seemed to just be flakey and I couldn't ever know if it was my code or the ESP side of things. The Teensy boards a much better supported and seem to 'just work' once you get the details. By moving some things to DMA etc the CPU is not hit as hard as well. The BT bandwidth is still the bottleneck for more than 50Hz sensor logging but that sounds like it's being worked on for the next major release.
@DonC, RPM is one of the things I am monitoring. I have not had it on the bike yet but from the test bench it seems to be able to handle up to 600Hz which is 18,000 RPM for wasted spark. The library I am using is https://github.com/PaulStoffregen/FreqMeasure on a Teensy MCU with a BT module currently using $RC3 output.
Jeff
I know it works at 5V DC and I am 90% sure I tested it at 12V DC as well on the high side. And Also tested it passing through the signal for measurement
Jeff
Sorry, but the is only the ignition coil for a signal. I considered using a magnet, but it would not last long, and would fall off.
First thought is what is firing your coil? Usually there is a 12V signal that triggers the coil to fire.
Whats your car? Does it have EFI? Usually there is a crank position sensor for the ECU. It will have more than 1 pulse per rotation but there is a pattern which could be tracked to note the rotation speed.
Then there are several circuits and howto items on the web to sense based on wrapping a wire around your spark plug lead.
http://www.sportdevices.com/rpm_readings/index.htm
http://forum.arduino.cc/index.php?topic=324145.0
Are you just trying to get RPM into your RaceChrono data? You are probably looking at a bunch of work just to send RPM. Makes more sense to do the work if you have more things to log. Unless you already have a solution to reporting other data using $RC3 sentences?
Jeff
I hope to update the wiki in the coming days with details on the current design (and how I got to this design). The code probably already needs a bit of a re-work as closer it is to track season the more I just add code without a thought for maintenance. And I never thought I would release it externally so readability and code consistency kinda sucks...
https://github.com/j-e-f-f-williams/TrackDAQ
Jeff