Project

General

Profile

CAN Bus Input » History » Version 2

Adam Klama, 06/21/2026 03:00 PM

1 1 Adam Klama
# CAN Bus Input
2
3
## Overview
4
A **CAN Bus Input** decodes a single **CANbus signal** directly out of a raw
5
incoming CAN frame, using a byte/bit layout you define by hand. Use it when you
6
know the frame layout (e.g. from a DBC) for an arbitrary or custom device and
7 2 Adam Klama
there is no [CAN Preset](Working_with_the_CAN_Bus#can-presets) for it.
8 1 Adam Klama
9
This is the **raw frame signal** approach: you give the message ID, say how the
10
bits are encoded and where they sit, then scale the raw value to engineering
11
units. To read a named object from a supported device instead, use a
12 2 Adam Klama
[CAN Object Input](CAN_Object_Input).
13 1 Adam Klama
14
## Prerequisites & hardware
15
- A **defined CAN bus** for the channel the frame arrives on — see
16 2 Adam Klama
  [Working with the CAN Bus](Working_with_the_CAN_Bus).
17 1 Adam Klama
- The frame's **message ID** and **bit layout** for the signal you want (length,
18
  offset, signedness, endianness).
19
20
## Add it in the app
21
1. Add a new input and choose **CAN Bus Input** as the type.
22
2. Give it a clear **alias** (e.g. `Engine RPM`).
23
3. Enter the **Message ID** and its **ID type**, then the **decoding type**,
24
   **length** and **offset** that locate the signal in the frame.
25
4. Set the **raw → out** scaling and the **fault** / **timeout** behaviour below.
26
27
## Settings reference
28
> Schema: `config/CanbusInputConfiguration.proto`.
29
30
| Setting | Meaning | Unit | Range / values | Notes |
31
|---|---|---|---|---|
32
| **Message ID** | CAN frame identifier to match | hex | fixed32 | The arbitration ID of the frame carrying the signal. |
33
| **Message ID type** | Identifier width | — | `Extended (29-bit)`, `Standard (11-bit)` | Must match how the sending device addresses the frame. |
34
| **Decoding type** | How the raw bits are interpreted | — | `UnsignedBigEndian`, `UnsignedLittleEndian`, `SignedBigEndian`, `SignedLittleEndian`, `BitField`, `BitFieldBigEndian`, `SignedBitField`, `SignedBitFieldBigEndian`, `FloatLittleEndian`, `FloatBigEndian` | Selects signedness, endianness, bitfield or float decoding. Match the sender's encoding. |
35
| **Length** | Signal length | bytes / bits | uint32 | In **bytes** for the integer/float types; in **bits** for the bitfield types (`BitField`, `BitFieldBigEndian`, `SignedBitField`, `SignedBitFieldBigEndian`). |
36
| **Offset** | Position of the signal in the frame | bytes / bits | uint32 | Same units as Length: **bytes** for integer/float types, **bits** for bitfield types. |
37
| **Enable interpolation** | Linearly interpolates between the raw/out points | — | on / off | Off = step/clamped mapping. |
38
| **Raw min / Raw max** | Raw signal range to scale **from** | — | sint32 | The decoded low/high points. |
39
| **Out min / Out max** | Engineering range to scale **to** | signal unit | sint32 | The value reported at Raw min / Raw max. |
40
| **Fault input** | An input whose state flags this signal as faulted | — | input alias | When that input is in its fault band the signal is treated as faulted. |
41
| **Fault min / Fault max** | Values that indicate a fault | — | sint32 | Decoded values inside this band mark the signal as faulted. |
42
| **Saturate** | Clamps the output to the out range | — | on / off | On = limit to `Out min … Out max` instead of extrapolating. |
43
| **Default value** | Value used before any frame arrives / when default selected | signal unit | sint32 | Reported until the first valid frame. |
44
| **Fault value** | Value reported on fault | signal unit | sint32 | Substituted while the signal is faulted. |
45
| **Timeout** | Maximum time between frames | ms | uint32 | A gap longer than this triggers the timeout behaviour. |
46
| **Timeout mode** | What to report on timeout | — | `UsePrevious`, `UseDefault`, `UseFault` | See the [Timeouts](../Working-with-the-CAN-Bus.md#timeouts-inputs) section. |
47
48
**Scaling:** the decoded value is mapped from `Raw min…Raw max` to
49
`Out min…Out max` using
50 2 Adam Klama
[two-point interpolation](Scaling_and_Maps#two-point-interpolation).
51 1 Adam Klama
52
## Common settings
53
CAN Bus Input also uses the shared setting — alias. See
54 2 Adam Klama
[Common IO Settings](Common_IO_Settings).
55 1 Adam Klama
56
## Example — engine RPM from a 500 kbit/s bus
57
1. Type **CAN Bus Input**, alias `Engine RPM`.
58
2. **Message ID** `0x0CF00400`, **ID type** `Extended (29-bit)`.
59
3. **Decoding type** `UnsignedLittleEndian`, **Length** `2` (bytes), **Offset** `3`
60
   (starts at byte 3) — a 16-bit value. (A bitfield type would use bits here.)
61
4. **Raw min/max** `0`/`65535` → **Out min/max** `0`/`8191` (0.125 rpm/bit gives
62
   the right scale); **Saturate on**.
63
5. **Timeout** `100` ms, **Timeout mode** `UseFault`, **Fault value** `0` so a lost
64
   ECU is detected rather than the last rpm being held.
65
66
## Troubleshooting
67
- **Value is garbage / wildly wrong:** check the **decoding type** (signedness and
68
  endianness) and that **Length** and **Offset** match the frame layout — remember
69
  they are in **bytes** for integer/float types and **bits** for bitfield types.
70
- **Reads zero / never updates:** confirm the **Message ID** and **ID type**, and
71
  that the CAN bus baud rate matches the sender.
72
- **Scaled wrong:** verify **Raw min/max** and **Out min/max**.
73
- **Holds a stale value when the device drops off:** set a **Timeout** and a
74
  **Timeout mode** of `UseDefault` or `UseFault`.
75
76
## Related
77 2 Adam Klama
- [CAN Object Input](CAN_Object_Input) — read a named object from a CAN Preset
78 1 Adam Klama
  instead of decoding bytes by hand.
79 2 Adam Klama
- [CAN Bus Output](CAN_Bus_Output) — pack a signal into an outgoing
80 1 Adam Klama
  frame.
81 2 Adam Klama
- [Working with the CAN Bus](Working_with_the_CAN_Bus)