DIY data collection (with link to working code for Arduino and Bluetooth )



  • show someone a link to the working code for arduino, please. It was written in the title, but I don't see it
  • Difficult to say without code
  • Sorry for the late reaction, but the links to the code still work for me. On page 2, there are links to version 0.75. You need to read on from there, to fix some small errors.
  • Reviving an old discussion... We still use this old DIY device, but now with STM32CubeIDE rather than Arduino. Here is a recent on-board video with overlay ((warning: It's loud so adjust your volume)): . This is on a bumpy track with fast turns, 360 deg turn, hairpin turn, bridge, tunnel, a jump and approx. 90 km/h average speed.
  • Outstanding DrMotor

    Are you so kind to share source code and possible schematics, maybe even schematics?

    Possible by Dropbox?



  • Hi,

    First of all, great work! Thanks to all who have contributed to this. Great to know there is some kind of alternative to the (expensive) monopoly of Alfano and MyChron!

    I am interested in getting something up and running for my son who races in cadet katrs.I am initially interested in RPM measurements so that I'm better able to set the gear ratios.

    I've read through the thread and had a few questions about 0.75b. I'm new to this so please forgive the basic questions!

    1) For those who've implemented this, do you have your phone attached to the kart steering wheel? What did you use to secure the phone to the kart steering wheel?
    1a) If you don't want to use a phone, is it possible to store the dat to a SD card and then retrive it later for analysis in racechrono?
    2) I'm looking at the drawing and just want to understand what the black circular/cylindrical discs are? Are these the ferrite filter beads? Sorry if that's an obvious question!
    3) I intend on using this on a kart, would a LiPo battery as power source suffice?
    4) What's the purpose of the schottky diode? Is it to reduce noise signals when readiing the RPM signals?
    5) Can a Teensy be used instead of a STM32F103? Any benefit in using a Teensy over a STM32F103?
    6) What kind of breadboard did you guys use for the prototype?
    7) What kind of breadboard did you use for the final product?
    8) What kinds of enclosures are you guys using? Any links or pictures?


  • edited August 2023
    Nice that someone is still interested in this old project :-) ...much time and many changes since that 0.75b, but I still use it. My latest updates are here:

    1) There are some pictures in the Mech-folder.
    1a) I use a phone on the steering wheel because of delta-times helps for improving lap times. SD-card and many things are possible -- one can even use wifi for telemetry to a track-side phone (but that is not according to karting regulations).
    2) you don't need those -- it works fine without
    3) yes, and see 1)
    4) voltage spikes from the ignition can damage microcontrollers (and also cause noise on other channels)
    5) Teensy, it has a NXP, right? I have only compiled the latest code for a WeAct BlackPill with STM32F411. If you are not happy with F1 of F4, then I think it might be easier to select another STM32 than a NXP.
    6) I used a strip-board (PCB with copper stipes)
    7) what final product? I guess -- no breadboard for a "final"
    8) see Mech-folder

  • Thanks for taking the time to respond DrMotor and apologies for not responding sooner! I've started to take a look at what you have in the github repo and that's awesome! I think I'll stick with the WeAct BlackPill with STM32F411. There's some long lead times on AliExpress so might take me some time to acquire all the items.
    Out of interest, when you were testing the RPM signals, did you always test directly on the kart engine or did you ever use some kind of simulator when/if the kart was unavailable?
  • @jade about testing:
    I only tested RPM with the kart, but it should work also on other noisy gadgets like a mower/trimmer/blower/chain saw.

    AFR/Lambda was tested on a car (4 stroke).

    The WiFi / ESP01S was used after updating AT-firmware, I think it was V2.2.0
  • Ok Thanks. I'm a bit confused as to should I now solely refer to the 911RSR repo or should I use it conjunction with 0.75b?
  • Try to follow the 6 points at the last section in the file. It is more complicated than Arduino.
  • Ok. Thanks. One more thing, I know you mentioned that you are using a rugged phone (Oscal S80), but I would be using my iPhone. I have read in several places that the vibrations from the kart would just wreck the iPhone and that it's a bad idea to try and secure a phone to a kart steering wheel and to just use a MyChron instead! e.g. -
    The thing is, there aren't any cheap MyChrons (even a MyChron 3, if you can find one for sale).

    I don't intend on using the camera whilst the phone is on the kart. I didn't want to buy another phone as I'm trying to keep costs down so that the overall price does not approach the cost of a MyChron.

    I'm not sure if I'm best not using my iPhone and somehow trying to get hold of an old phone which is still powerful enough to run RaceChrono?
  • I have had old phones (not iPhone) on the wheel for >10 seasons, and never lost one to vibration damage. I even had a kart jumping up/over and leaving tyre marks on the middle of the screen. The phone was still OK, but many other parts wrecked, including the steering wheel. Welcro tape is OK as vibration damper, ducktape and/or cable ties for safety....

    That Oscal is waterproof and its battery lasts "forever" (some weeks between charging).

  • Thanks! Glad to know you've not had any issues with vibration damage in 10 years. Sounds like I should be fine! That must have been quite a moment having another kart jumping up and over as you described....That Oscal sounds awesome!
  • Nice to see this is still active. I never got mine beyond the prototype stage, so probably a nice project for the coming winter.
    I like your approach and the scope of the add-ons you used!
  • edited October 2023
    I had a question about sourcing the parts as I'm a bit confused! For example, I was looking at aliexpress for the ESP8266 and I see them being sold for C$5 for 5 On sparkfun, I see a single unit being sold for US$20 Why would I buy the sparkfun version over the aliexpress version?

    Similarly, on aliex, I see the STM32F4 going for C$1.56 but on sparkfun, it's US$32.50 Again, why would I go for the sparfun version over the aliexpress version?

    Lead/delivery times may be longer on aliexpress, but if I didn't care about that, is aliexpress a viable option?

    Also, is the wifi module ESP01 (ESP8266) in now to be used in place of the bluetooth module JDT30/HC06 from 0.75b?

  • Hi jade, I bought my ESP01, STM32F4 and Oscal via aliexpress.
    I use ESP01, but code for JDT30 and HC06 is still there (commented out) in case someone wants to use it. I am not 100% happy with the ESP01 -- hassle with FW upgrade, all those unnecessary AT+CIPSEND delays, and too often loss of data/connection...

    About vibration & phone: The Oscal is clamped to the leather/padded section of the steering wheel (not directly to the metal hub). The padding reduces vibration.
  • Thanks DrMotor. Are you saying that the bluetooth method is more reliable than the wifi method? Also, are you able to post a picture of the oscal clamped to the steering wheel? Just want to see your setup to give a better idea of how I would set mine up.
  • Hi Jade, I do not know which (wifi or BT) is currently more reliable. The occasional loss of connection might be due to ignition noise, software or hardware (e.g. a bad connection) -- maybe I figure it out before next season.

    Picture with Oscal on wheel:
    Another driving video:
  • Thanks @DrMotor for the picture and video - awesome! I'm just trying to get all the parts ordered. I've got most parts ordered now. Only remaining bits are the GPS and battery. What capacity 18650 battery (mAh) would you say is sufficient? I've ordered all from AE. I'm just debating with myself whether to get the GPS from AE or to get one from SparkFun! I guess you have found the GPS you got from AE accurate enough...
  • I had another question about GPS modules....Has anyone heard of Beitian? Does anyone know if these are a decent alternative to Ublox? Will the Beitian BK450 be compatible with the code? I saw this on AE at a good price...
  • Just don't trust battery capacity figures at Aliexpress :-) Probably better to buy from a Chinese brand with a good reputation.
    The Beltian module looks to me like Ublox implementation from one of the better brands. Not sure about the price and specs.
  • Ok, noted about battery capacity from AE - Thanks!

    About the schottky diode, what particular specifications (forward voltage/current). I had a look on and there about 5000 types! Will this one do -

    Also, do I need a specific kind of LED?

    In the Elec folder at, it mentions "All wires entering the circuit boards should (at entry) have both a 100 nF connected to GND and a TVS diode (also to GND)". I don''t see these showing on the last schematic posted on v0.75b. Are these still needed? Are these instead of the ferrite beads? What specification of TVS diode is needed?

  • GPS modules/receivers for karting: Find one with high accuracy while at 5 Hz or higher update rate! My DIY project uses an ublox M9N module. I also like the racebox mini as an off the shelf GPS--BLE module. It is annoying when one is analyzing lap times and laps shift a meter or two as satellites go in and out of view.

    About electronics: The engine ignition emits electronic noise that can disturb communication and sensors (GPS, WiFi, BT and even wired serial links and analog signals), so yes -- you might need some components to reduce the noise. You do not need a LED for the ignition pickup (I once used a LED there only because I did not have any other diode). Also: The software flashes an on-board LED when ignition is detected.
  • Update: I checked in (at github) a version using an ESP32s3 as UART to WiFi bridge (instead of the ESP8266 or HC05). Initial bench tests are promising -- seems stable, and it can send >500 $RC3 messages per second (each approx. 130 bytes). I considered also running the whole code on the ESP32s3 -- it has much more processing power than the STM32f4, but the analog to digital converters appears to be much less precise...

    Note: The CJ125 (wideband lambda controller) only works when using the "Debug" build configuration (and not "Release"). I don't know how to debug this -- the problem is gone as soon as I try to debug. Temporary solution: Use the "Debug" build config.
  • AFAIK the newer ESP32 variants like the S3 have much improved precision in ADC compared to the utter crap precision of the first generation ESP32. But I'm not surprised if STM32 still is better.

  • Hello, greetings, first of all, congratulate the author of this excellent project, it is a great job that I would like to do for my motorcycle. I would like to make it simple with 2 linear potentiometers for the suspension travel and an Esp32s3 send to racechrono, any advice would be appreciated, thanks

  • edited March 8
    @May675: I would use the ESP32s3 via Arduino and send $RC3-messages via WiFi. UART2WiFi.ino (from this project) shows an easy way to use the WiFi. Just connect the potentiometers to the s3, add code for reading the ADC and printing $RC3 to that .ino-file, and it should work. Code for printing $RC3+checksum can be copied from RaceTemp.c
  • edited March 30
    @DrMotor, thank you very much for the help and information provided, go through your repository and take the corresponding notes, make a code in Arduino but the Racecrhono app cannot connect. I'll leave it here, maybe I left out some details. If you can help me, I'll be very grateful.
    // Include the necessary libraries to set up the WiFi access point

    // Define the credentials for the WiFi access point
    const char *ssid = "RaceChronoESP32";
    const char *password = "yourPass";
    const uint16_t port = 333;

    // Create a server object on the specified port
    WiFiServer server(port);

    // Declare the 'count' variable that will be used in the RC3 messages
    unsigned long count = 0;

    void setup() {
    // Start serial communication at 115200 bits per second

    // Configure the WiFi access point
    Serial.print("\nConfiguring access point\n");
    if (!WiFi.softAP(ssid, password)) {
    log_e("Soft AP creation failed.");

    // Print the IP address of the access point
    IPAddress myIP = WiFi.softAPIP();
    Serial.print("AP IP address:");

    // Print the data port
    Serial.print("Data port: ");

    // Start the server
    Serial.print("Server started\n");

    void loop() {
    // Check if any client is available and handle it
    WiFiClient client = server.available();
    if (client) {
    Serial.print("New Client.\n");
    while (client.connected()) {
    if (Serial.available()) {
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);
    client.write(sbuf, len);
    Serial.write(sbuf, len);
    Serial.print("Client Disconnected.\n");

    // Read the analog value of the rear potentiometer (from 0 to 1023)
    int valorPotenciometroTR = analogRead(33);

    // Read the analog value of the front potentiometer (from 0 to 1023)
    int valorPotenciometroFRT = analogRead(34);

    // Map the potentiometer value to the desired range (0.08V to 3.42V -> 0cm to 12.5cm)
    float voltajeTR = valorPotenciometroTR * (5.0 / 1023.0);
    float longitudEnCmTR = map(voltajeTR * 100, 1, 2000, 6, 125) / 10.0;
    float voltajeFRT = valorPotenciometroFRT * (5.0 / 1023.0);
    float longitudEnCmFRT = map(voltajeFRT * 100, 1, 2000, 6, 125) / 10.0;

    // Print the voltage and length in centimeters
    Serial.print(voltajeTR, 2); // Print with 2 decimals
    Serial.print("TR "); // name of the rear potentiometer
    Serial.println(longitudEnCmTR, 2); // Print with 2 decimals
    Serial.print(voltajeFRT, 2); // Print with 2 decimals
    Serial.print("FRT "); // name of the front potentiometer
    Serial.println(longitudEnCmFRT, 2); // Print with 2 decimals

    // Generate and send an RC3 message
    char rc3Message[128];
    sprintf(rc3Message, "$RC3,,%lu,,,,,,,%1.1f,%1.1f",
    count++, // $RC3,time,count[-]
    longitudEnCmTR, // a1 [cm] = length of the rear potentiometer
    longitudEnCmFRT // a2 [cm] = length of the front potentiometer

    // Send the RC3 message over the WiFi connection

    delay(100); // Small pause to avoid rapid readings
  • @May675: I edited your code and checked that it works with RaceChrono. Please check it here:
Sign In or Register to comment.