Tutorial: DIY devices

RaceChrono offers couple of APIs that you can use to connect your own devices, and input your data. The DIY devices are configured from RaceChrono > Settings > Add other device > Add other device > RaceChrono DIY

RC2/RC3 and NMEA 0183 streaming data

The oldest way to connect your DIY devices are the $RC2 and $RC3 data formats. It is a streaming clear-text protocol, that is sort of a RaceChrono extension to NMEA 0183 protocol that is a standard for ordinary GPS receivers. You can mix the NMEA 0183’s $Gxxxx sentences with your $RC2 and $RC3 sentences, or have your own sentences stand-alone.

The connection methods supported by this API in Android are Bluetooth RFCOMM and TCP/IP (Wi-Fi). The connection method supported in iOS is TCP/IP only, as the others are not supported by the operating system.

Data format description (pick either $RC2 or $RC3 format, not both):

  • $ is message start character
  • RC2 and RC3 are message identifiers
  • [time] Timestamp field should be empty, if your device doesn’t have GPS and does not output NMEA 0183 sentences mixed with the $RCx sentences
  • [time] Optional timestamp in NMEA 0183 format, for more accurate data timing, when mixed output with NMEA 0183 sentences.
  • [count] Count is an overflowing line counter 0-65535
  • [count] Count field is empty, when mixed output with NMEA 0183 sentences
  • [xyzacc] acc fields: -1.000 = -1G, 1.000 = +1G
  • [gyroxyz] gyro fields: degrees per second, -1.000 = -1 deg/s, 1.000 = +1 deg/s
  • [rpm/dx] digital channel fields, range -2000000.000 – 2000000.000
  • [ax] analog channel fields, range -2000000.000 – 2000000.000
  • * is message separator character
  • [checksum] NMEA 0183 type checksum, with two uppercase hexadecimal digits (one byte)
  • Each line is terminated with CR plus LF

Notice: If you’re not using mixed NMEA 0183 sentenced, a steady update rate is needed for this format due to the algorithm that RaceChrono uses to synchronize with GPS time. So pick update rate that is close as possible to 1/5/10/20/30/40/50/100 Hz. If you have to skip an update due to data overflow, make sure you add the ‘count’ field even for the skipped updates.

Here’s an example output using counter field (timestamp omitted):


And here’s the NMEA 0183 checksum calculation, it’s just simple XOR:

char* sentence = ... // characters between $ and *, not including them
unsigned byte checksum = 0; 
for (int i = 0; i < sentence.length; i++) { 
  checksum = checksum ^ (unsigned byte)sentence[i];

Bluetooth LE protocols

RaceChrono also supports couple of Bluetooth DIY protocols. These protocols are very new and they may be changed (improved) in the coming releases. The “Bluetooth LE” connection type needs to be selected in the device configuration. There are currently “GPS” and “CAN-Bus” APIs available.

The APIs and reference devices are documented here: https://github.com/aollin/racechrono-ble-diy-device

Once the CAN-Bus device is configured in settings (through the RaceChrono DIY device as described in the first chapter), there will be CAN-Bus channels section available in the Vehicle profile. You will need to add CAN-Bus channels to translate the raw CAN-Bus data that you feed to the app. The equations are described in here: https://racechrono.com/support/equations