0 products
Wednesday, 28 November 2018 21:14

Interfacing Harry's Lap Timer

Harry's Lap Timer claims to be "the worldwide #1 video and timing app" for car enthusiasts taking their car to the race track. All that is needed is a Smartphone. To fully utilize all the features in the app, an OBDII reader and an external GPS is recommended.

The OBDII reader is usually needed if one would like to have overlays like rpm, oil temp etc. on the video. The most common OBDII readers used with Harry's Lap Timer seems to be based on Bluetooth.  However, Bluetooth OBDII readers for the E46 M3 tends to be slow and unstable. At the best, with OBDII, one can achieve 6-7 Hz update rate, and that only for a few of the measured values. Most commonly is 1-2 Hz update rate. This is due to the fact that for the E46 M3, the OBDII bus is slow (not CAN based), and the required handshake does not help in speeding things up.

Another fact is that in an E46, the OBDII bus is physically the same as the D/K-BUS, but with two very different communication protocols.

Having installed the airVent Display with a KBUS2CAN device,  an OBDII reader is simply out of the question, since the KBUS2CAN occupies the bus that the OBDII reader needs. The challenge was then how to feed Harry's Lap Timer with "OBD" data?

The airVent Display "eco system" utilizes a RPi3 for streaming CAN data to a database server, and since  the RPi3 comes equipped with Bluetooth LE out of the box, why not use it?

A very nice feature with Harry's Lap Timer is that it can be customized to take data from a custom device. Guided by these facts and opportunities, as well as by the Bluetooth LE GATT specification, software has been developed on the RPi3 such that all the necessary CAN data is streamed to Harry's Lap Timer via Bluetooth LE. They are not only streamed, but streamed to a rate that outperforms most OBDII Bluetooth devices.

During the development phase, streaming rates as high as 100Hz was tested, but the update rate for the fast measured values is set to 25Hz. I.e., each measured value is updated with 25Hz. 25Hz is chosen due to the fact that it is considered fast enough for all practical reasons. All temperatures are streamed at 1Hz.

Most Smartphones have a 1hz internal GPS. For the race track, at least a 10Hz GPS is recommended. The RPi3 in my car has already a 10Hz GPS device attached, hence a GPS service was added to the GATT server, as well as supported for in the Harry's Lap Timer app on my iPhone7.    

Some results from the devlopment phase is shown below.

Data (simulated) for the E46 M3 based 332ti:

GPS 10Hz support (real data):

Works also for an E46 325ti (real data)...

The BLE GATT services on the RPi3 shows up in Harry's Lap Timer app on the iPhone as airVentBLE HLT GNSS and airVentBLE HLT Engine.



The consept:



The software on the RPi3 is made as multi threaded C++ programs that uses socketCAN for the CAN data, local exchange of GPS data via sockets, as well as a Bluetooth LE GATT Server built upon the BlueZ stack. The structure is illustrated in the figure below.



For the time being the following measurements are streamed to Harry's Lap Timer (HLT) over Bluetooth LE with 25Hz:

  • RPM
  • Speed
  • Throttle Position
  • MAF

The MAF is an estimated value of MAF, based on the CAN data for engine power and torque. 

For the time being the following measurements are streamed to HLT over Bluetooth LE with 1Hz:

  • Engine Temperature
  • Oil Temperature
  • Cat temperature
  • Intake Air Temperature (IAT)
  • Fuel level
  • Battery Voltage

If future versions of HLT enables support for other measurements (like steering angle, yaw rate, oil pressure, brake pressure etc.), they will for sure be supported by airVent Display.

For the time being the following GPS data are streamed to HLT over Bluetooth LE with 10Hz:

  • Time
  • Latitude
  • Longitude
  • GPS speed
  • HDOP
  • Height
  • Number of satelites
  • Heading

This has been a fun challenge, with a very steep learning curve when it comes to Bluetooth LE, GATT on RPi, GATT specifications and Lua scripting for iOS. With excellent support from Harry's Lap Timer Developer Program, it was possible to make a solution within a reasonable short time frame and which have proven to be very stable and high performing.

How to make Harry's Lap Timer interact with custom Bluetooth LE devices? Well, that info is available via Harry's Lap Timer Developer Program...

airVent Display solutions

Discover the amazing amount of information available on the E46 CAN bus, made easily available via a touch screen embedded in the E46 air vent console.



MK60 emulator solutions

Enable the MK60 CAN bus data stream in a non-standard E46 configuration, made available by a dedicated custom made MK60 emulator.