README.md (1831B)
1 # Eculocate 2 3 Read data from the K-line of a Honda motorbike ECU and publish it 4 using UDP over Wifi. 5 6 Comprises: 7 8 * some code for an ESP32-C3 wich can be connected (via level 9 shifters and other electronics, don't plug it straight in) to the 10 bike's ECU, 11 12 * a very PoC implementation of an android client, using Termux 13 14 ## Building 15 16 The repo is split into two crates in a cargo workspace: code in 17 ecu-portable can be built and run using the native compiler, hence is 18 unit-testable, and code in ecu-esp32 depends on all the esp32 gubbins 19 so you can test it only by running it. 20 21 ``` 22 cargo test -p ecu-portable --target x86_64-unknown-linux-gnu 23 make BUILD_ID=$(date +%y%m%d-%H%M%S) install 24 ``` 25 26 27 ## How it works 28 29 The ESP32 is connected to the diagnostic port of the ECU and can 30 interrogate it to dump its "tables". This is based on "K-line", a 1 31 wire 10400 baud serial connection operating with 12V logic. 32 33 On first boot, or if it can't connect to a Wifi network, it will 34 function as a Bluetooth LE peripheral: you can connect to it, 35 choose a wifi network and provide the password. 36 37 In normal operation it will connect to the configured Wifi network and 38 open TCP and UDP sockets, The client connects first to TCP and 39 provides a digitally signed session key, then (provided the signature 40 is valid) to the UDP socket to send a subscription requests. When the 41 device receives a subscription request, it starts to periodically 42 query the ECU for the requested tables and sends the value using UDP 43 back to the subscriber. 44 45 To avoid using hardcoded IP addresses, it uses multicast DNS/DNS 46 service discovery to advertise itself as providing the 47 `_keihin._udp.local` service, so a client can use 48 zeroconf/bonjour/avahi to find where it is. 49 50 There is a prototype/example client in client/. Consult 51 the README in that directory for details.