React Protocol Decoder

A logic analyser earns its price the moment it shows you the edges and what they mean on one time axis. Decoded fields sit above the raw SCL/SDA traces, aligned to the exact samples they came from — hover a field and its boundaries drop through the waveform.

I²C bus — temperature sensor

I²C @ 100 kHz · 1600 kSa/s · 496 samples

startaddressdataacknack
S0x48 WA0x2FA0x91NPSCLSDA0.0 77.3 154.7 232.0 309.4 µs
Hover a decoded field for detail.

Installation

npx shadcn@latest add "https://kelvinui.com/registry/protocol-decoder.json"

Props

PropTypeDescription
channelsDigitalChannel[]{ name, samples } — one 0/1 per sample
fieldsDecodedField[]{ start, end, label, kind, detail? } in sample indices
sampleRatenumberSamples per second, drives the time axis
protocolstringShown in the header, e.g. "I²C @ 100 kHz"
timeUnit timeScalestring / numberAxis units (µs → 1e6)

kind is start, address, data, ack, nack, stop, or error — enough vocabulary for I²C, SPI, UART, and CAN alike. The component renders whatever you decode; it is a display, not a decoder engine, so the protocol logic stays where it belongs (your capture pipeline or a worker).

Alignment is the whole product

An annotation that is a few samples off the bits it describes is worse than no annotation — it will send someone hunting a bug that isn't there. So the demo synthesises the waveform and the field boundaries in the same pass, bit by bit: a genuine I²C transaction with START, address 0x48 + W, ACK, two data bytes, a NACK on the last, then STOP.

That construction is verifiable, and worth verifying. Reading the address byte back out of the generated waveform — sampling SDA in the middle of each SCL-high window across the address field's own boundaries — returns 0x90, i.e. 0x48 shifted left with the write bit. The waveform also contains exactly one valid START (SDA falling while SCL is high) and one valid STOP (SDA rising while SCL is high). The picture is electrically correct, not just plausible-looking.

Digital traces render as proper step paths — hold the level, jump vertically on change — rather than interpolated lines, because a sloped edge on a logic trace is a lie about what the signal did.

New components every week

Get the week's new Kelvin UI components and templates in one short email. No spam, unsubscribe anytime.