Project

General

Profile

Analog Input » History » Version 2

Adam Klama, 06/21/2026 02:52 PM

1 1 Adam Klama
# Analog Input
2
3
## Overview
4
An **Analog Input** reads an analog voltage on a hardware pin and converts it into a
5
scaled engineering value. It is the most common input type — used for any
6
voltage-output sensor such as temperature (NTC), pressure, throttle/pedal
7
position, fuel level, and similar.
8
9
The raw measured voltage is mapped to an output value using the input/output
10
two-point scaling below. For a non-linear sensor, feed this input into a
11 2 Adam Klama
[Map Input](Map_Input) for multi-point scaling.
12 1 Adam Klama
13
## Prerequisites & hardware
14
- A sensor whose output is a **voltage** within the selected range.
15
- Wire the sensor signal to the chosen analog pin and its ground to controller ground.
16
- Pick the **range** to match the sensor's full-scale voltage so you use the full
17
  ADC resolution.
18
- **Pull-up:** most analog pins have **no pull-up hardware**, so the option is
19
  unavailable on the majority of inputs. Where a pin does support it, a resistive
20
  sensor (e.g. an NTC thermistor) can use it to form a divider instead of an
21
  external resistor. Otherwise, fit the divider externally.
22
23
## Add it in the app
24
1. Add a new input and choose **Analog Input** as the type.
25
2. Select the **pin** the sensor is wired to.
26
3. Give it a clear **alias** (e.g. `Oil Temp`).
27
4. Set the **range**, scaling and fault thresholds below.
28 2 Adam Klama
5. For a non-linear sensor, scale it with a [Map Input](Map_Input).
29 1 Adam Klama
30
## Settings reference
31
> Schema: `config/AdcConfiguration.proto`.
32
33
| Setting | Meaning | Unit | Range / values | Notes |
34
|---|---|---|---|---|
35
| **Range** | Input voltage range / scaling reference | — | `5 V`, `Internal 5 V`, `12 V`, `Raw` | Choose the smallest range that covers the sensor's full-scale voltage. `Raw` reports unscaled ADC counts. |
36
| **Pull-up** | Enables an internal pull-up on the pin | — | on / off | **Only available on pins with pull-up hardware** — most analog pins do not have it. Where present, lets resistive sensors (e.g. NTC) form a voltage divider. |
37
| **Low-pass filter** | Smooths a noisy signal | — | on / off | Reduces jitter; adds a small amount of lag. |
38
| **Saturation** | Clamps the output to the out min/max range | — | on / off | When on, values are limited to `Out min … Out max` instead of extrapolating. |
39
| **Enable interpolation** | Linearly interpolates between the in/out scaling points | — | on / off | Off = step/clamped mapping. |
40
| **In min / In max** | Raw input range to scale **from** | mV (raw counts if `Raw`) | sint32 | The measured low/high points. |
41
| **Out min / Out max** | Engineering range to scale **to** | input unit | sint32 | The value reported at In min / In max. |
42
| **Fault min / Fault max** | Out-of-range thresholds that flag a fault | mV | sint32 | Readings outside this band indicate an open/short or failed sensor. |
43
44
**Scaling:** the input is mapped from `In min…In max` to `Out min…Out max` using
45 2 Adam Klama
[two-point interpolation](Scaling_and_Maps#two-point-interpolation).
46 1 Adam Klama
For example, a 0.5–4.5 V pressure sensor reading 0–10 bar: set In min/max to the
47
voltages and Out min/max to `0`/`10`. Non-linear sensors should instead pass this
48 2 Adam Klama
input through a [Map Input](Map_Input) for
49
[multi-point scaling](Scaling_and_Maps#multi-point-scaling).
50 1 Adam Klama
51
## Common settings
52
Analog Input also uses the shared settings — alias and pin. See
53 2 Adam Klama
[Common IO Settings](Common_IO_Settings).
54 1 Adam Klama
55
## Example — coolant temperature (NTC)
56
1. Type **Analog Input**, alias `Coolant Temp`, on the sensor's pin.
57
2. Range `5 V`. If the pin has pull-up hardware, **enable Pull-up** to form the
58
   divider with the NTC; otherwise fit the divider resistor externally.
59
3. **Low-pass filter on** (temperature changes slowly; suppress noise).
60 2 Adam Klama
4. Feed this input into a [Map Input](Map_Input) with a voltage → °C curve from
61 1 Adam Klama
   the data sheet (NTCs are strongly non-linear, so a two-point scale is not enough).
62
5. Set **Fault min/max** just inside the supply rails to catch an open or shorted
63
   sensor.
64
65
## Troubleshooting
66
- **Reads full-scale or zero / stuck:** check wiring; the value may be sitting
67
  outside the **Fault min/max** band (open or shorted sensor).
68
- **Value noisy / jumpy:** enable the **Low-pass filter**.
69
- **Reading scales wrong:** verify **In min/max** are in the same units as the
70
  measured signal and that **Range** matches the sensor.
71 2 Adam Klama
- **Non-linear / offset reading:** scale it with a [Map Input](Map_Input) rather
72 1 Adam Klama
  than the straight in/out scale.
73
74
## Related
75 2 Adam Klama
- [Analog Switch Input](Analog_Switch_Input) — multi-position switch on one
76 1 Adam Klama
  analog pin.
77 2 Adam Klama
- [Map Input](Map_Input) — multi-point scaling for non-linear sensors.
78
- [Scaling & Maps](Scaling_and_Maps)