smongrot SDK
Read-only Honda motorcycle ECU diagnostics over a USB K-Line cable: who the box is, live engine data, and stored fault codes (beta).
v0.1 talks to Keihin and Shindengen ECUs from JavaScript (@smongrot/sdk) and Dart (smongrot_sdk). Both are MIT. The cable session never writes the ECU.
npm i @smongrot/sdk # JavaScript (browser + Node)
dart pub add smongrot_sdk # Dart / Flutter
What you can build
- Shop diagnostic tool. On a workshop PC, open a session, show the ECM-ID and model name, a few live gauges, and stored fault codes as a hint.
- Fleet dashboard. Each bike reports its ECM-ID and a handful of live fields. Pass a free API key when you want the model name on the card. Live numbers stay on the device.
- Data logger. Poll
live()and append rpm, temperature and battery to a file. A missing field is a blank cell. Rpm0with the engine off is a real reading.
60-second quickstart
Key ON (engine off is fine). Plug an FTDI or KKL K-Line cable into the bike's diagnostic connector.
Desktop Chrome or Edge, from a button click (WebSerial needs a user gesture, on https or localhost):
import { connect, openWebSerial } from '@smongrot/sdk';
document.querySelector('button').onclick = async () => {
const port = await navigator.serial.requestPort();
const s = await connect(await openWebSerial(port));
try {
console.log((await s.identify()).ecmId); // 10 hex, read from the box
for await (const f of s.live()) {
const rpm = f.fields.rpm;
console.log(rpm?.status === 'ok' ? rpm.value : '—');
break;
}
} finally {
await s.close();
}
};
Node, Flutter desktop and Android use the same connect / identify / live / close calls with a different transport. See Quickstart: JavaScript and Quickstart: Dart.
Platform support
| Platform | How it connects | v0.1 |
|---|---|---|
| Desktop browser (Chrome / Edge) | USB cable, WebSerial (openWebSerial) |
yes |
| Node (Windows / macOS / Linux) | USB cable, serialport (fromSerialPort) |
yes |
| Flutter / Dart desktop | USB cable, smongrot_sdk_libserialport |
yes |
| Android (Flutter) | USB-OTG cable, smongrot_sdk_usb_serial |
yes |
| iOS | no USB-serial access, so no cable | v0.2, SMR board over BLE |
| SMR board (any phone) | Bluetooth LE | v0.2 |
Phone browsers do not have WebSerial. Use the Android or desktop row.
| Feature | Needs |
|---|---|
| ECM-ID, live data, fault codes | the cable only; works offline |
Model name on identify() |
a free API key (Identify and API key) |
| Fault codes | beta: Keihin boxes are decoded; anything unclear is unreadable |
Hardware you need
An FTDI or KKL K-Line cable, and the bike's 12 V with the key ON. The ECU is powered by the bike, not by USB. Serial settings are 10400 8N1. Details, drivers and the Android / iOS limits: Hardware.
What v0.1 does not do
- It does not write, erase or change the ECU.
- It does not read the full ROM.
- It does not clear fault codes (that also resets learned values).
- It does not talk to the immobilizer.
Those stay out of this SDK. Later levels that need the SMR board are not here.
Pages
| Page | |
|---|---|
| Concepts | session, ECM-ID, live fields, makers, timing |
| Hardware | cable, connector, drivers, 10400 8N1, Android, iOS |
| Safety | what v0.1 sends, and what a missing value means |
| Quickstart: JavaScript | browser (WebSerial) and Node |
| Quickstart: Dart | Flutter desktop and Android |
| Examples | CSV logger, gauge, Flutter, DTC, API key |
| API reference | every export, with types and defaults |
| Identify and API key | ECM-ID, model name, the free key |
| Protocol overview | what goes on the wire |
| Troubleshooting | every error code, and the look-alike symptoms |
| FAQ | price, license, privacy, roadmap |
| llms.txt · llms-full.txt | for AI coding tools |
The normative spec is kline, live, dtc and board-ble (board support is v0.2). An implementation is correct only if it passes the published vectors listed in llms.txt.
Next: Concepts