Home

Awesome

DucatiPanigaleCanBus

What is DucatiPanigaleCanBus?

If you are a motorcycle rider/racer, you might want to log data from your bike to improve your riding style. This project connects a small device based on ESP32 to the CAN Bus on a Ducati Panigale (or other Ducati bikes with similar ECU), it monitors and extracts RPM/speed/gear/temperature, and it broadcasts the collected data via Bluetooth Low Energy to Harry Lap Timer 'Engine sensor'. Other apps can be supported (for example, NBP in TrackAddict), not available today.

This code is specialized for messages generated by the Mitsubishi ECU used in some models like

Right now this is compatible only with BLE which is the preferred option if you are using an iOS device with Harry Lap Timer: extending to regular bluetooth or WiFi/TCP-IP is not complicated, yet not on the priority list right now - please log a request if you are really interested and willing to help in the extension.

What data is collected?

The choice of data is a combination of what could be useful and what is supported by HLT channels, right now:

Transmitted at 20Hz

Transmitted at 1Hz

Measurements are mapped to the channels built in HLT, so you can inspect data directly there and export it in other formats for analysis outside of the app (think VBO format for example, or CSV).

As of Jun 2021, Gear collected from the engine is not exported by HLT even if collected.

Engine Throttle Temperature

Setup of Harry Lap Timer

At this time, the script running on Harry Lap Timer needs to be made available with instructions that are described in the HLT developer forum.

There is no further configuration required on HTL: once the script is available and your ESP32 flash and connected, HLT will discover the device (based on the device ID naming convention, the BLE Service, and the Characteristics IDs defined in the ESP32 code and in the LUA script)

When asked for a PIN, use 123456

Device found Sensor info Sensor live data

Connect to a specific unit

HLT will connect to any nearby device matching a name of "DuCan-...." where the 4 dots match an id unique to your device.

If you need to connect to a specific device

Expert Settings > Custom peripheral name

In this way, if other riders have this same unit nearby your phone will only connect to the device you specify.

Building the software in Platform IO and Arduino IDE

This project is best handled with Platform.io. Nonetheless, it uses the Arduino framework so you can use the Arduino IDE as well.

Steps required to compile this in the Arduino IDE

OTA updates with DoubleResetDetector

When the unit is tucked away, updates via USB are inconvenient. The "Double Reset Detector" library will be triggered after a double "reset" activity within 5 seconds (configurable), with these series of actions

The AP name is based on the DEVICE_ID macro, and it includes the 4 digits identifying the unit. At that point, mDNS starts and after connecting to the ESP32 Access Point you can upload to the ducan.local device.

Schematics

schematics

The most complicated and hard to source part is the 4 pin adapter to the DDA port (check monocilindro.com for a nice article on connections

You can also buy an ODBII adapter and use th ODBII pin schema convention.

In a nutshell:

Since you can use any pin for TWAI, there are 2 options

Hardware

Parts: U<x> refers to the schematic reported above. Links to sources are examples, these are very generic components.

Misc parts from your HW bin

U2 U3 U4 U5

An example based on common DevKit ESP32 module

The most common ESP32 is the DevKit: the box is 3d printed, here the source files for DevKit of which you should print box and lid. You will need 4 M1.7 screws 4 to 6 mm long, and a lot of patience:

open

An example of a compact unit based on Wemos D1mini 32

The smallest esp32 readily available is the D1 mini ESP32: fitting everything in a box that can go in the tail section of the Panigale has been tediously meticolous, but the result works: the box is 3d printed, here the source files for D1 Mini of which you should print box and lid. You will need a few M1.7 screws 4 to 5 mm long, and a lot of patience:

open

Once closed

closed

Credits

Other projects that inspired this work are