SP32 Analog Input – Why It Needs Care #
The ESP32 is the go-to microcontroller for industrial IoT: cheap, Wi-Fi/Bluetooth connected, and powerful enough for real control logic. But its analog input pins accept a maximum of 3.3V — while the industrial-standard sensor signal, 0–10V, is more than three times that. Reading 0–10V sensors with an ESP32 always means adding signal conditioning between the sensor and the pin, and getting accurate, stable readings out of it takes a few deliberate choices.
This guide is a refreshed reference for ESP32 0–10V analog input: what the signal is and where it’s used, how the native ADC behaves and where its accuracy limits are, the signal-conditioning practices that matter once wiring leaves the bench, and a complete walkthrough of wiring and reading 0–10V sensors on the NORVI IIOT-AE04-V — an ESP32 controller with six protected 0–10V inputs built in.
In this guide
0-10V signal fundamentals → ESP32 ADC basics → wiring the AE04-V’s inputs → reading and converting the signal in code → ADC accuracy tips → industrial signal conditioning → testing & troubleshooting.
Understanding the 0–10V Signal #
0–10V is one of the two dominant analog standards on the factory floor (the other being 4–20mA current loop). A transmitter maps its measured range linearly onto 0–10V — 0V is the bottom of scale, 10V is the top, and every value in between scales proportionally. It’s popular because it’s simple to wire, needs no loop-current math, and is easy to verify with an ordinary multimeter.
| Typical 0–10V sensor / signal | What it represents |
|---|---|
| Pressure or level transmitter | 0–10V mapped to a pressure or tank-level range |
| VFD speed reference | 0–10V sets motor speed as a percentage of full scale |
| HVAC damper / actuator position | 0–10V drives or reports damper open percentage |
| Light-level (lux) sensor | 0–10V mapped to a measured illuminance range |
| Humidity transmitter | 0–10V mapped to 0–100% relative humidity |
The catch for any ESP32-based design is voltage, not the concept: every one of these signals can swing up to 10V, and an unprotected ESP32 pin only survives up to 3.3V. That gap has to be closed by hardware — either a resistor divider built by hand, or a protected, pre-conditioned input like the ones on the AE04-V.
ESP32 ADC Basics #
- Max safe input: 3.3V. Anything above that on a bare ADC pin risks permanent damage — a 0–10V signal must always be scaled down or conditioned first.
- Resolution: 12-bit (0–4095) by default on the internal ADC; more bits doesn’t automatically mean more accuracy (Section 6).
- ADC1 vs ADC2: ADC2 shares hardware with the Wi-Fi radio and can misbehave while a Wi-Fi connection is active — keep sensors on ADC1 pins (GPIO32–39 on the classic ESP32) for any networked build.
- Attenuation: 11 dB/12 dB attenuation extends the ADC’s usable range to roughly 0–3.3V, the setting needed to read a signal that’s already been scaled down.
- These limits are exactly why NORVI’s own 0–10V controllers, including the AE04-V, don’t rely on the ESP32’s internal ADC at all for the sensor inputs — they route each channel through a dedicated 16-bit external ADC instead, covered next.
NORVI IIOT-AE04-V: 0–10V Inputs, Built In #
The NORVI IIOT-AE04-V is an ESP32-WROOM32 DIN-rail controller with six 0–10V analog inputs already protected and conditioned on the board — no resistor dividers or clamping diodes to design yourself. Each channel runs through a 16-bit ADS1115 ADC (not the ESP32’s internal one), which is what gives it the accuracy the internal ADC alone can’t reach.
| Spec | NORVI IIOT-AE04-V |
|---|---|
| MCU | ESP32-WROOM32 (Wi-Fi 2.4GHz / Bluetooth, RS-485) |
| Analog inputs | 6 x 0–10V, protected up to 38V DC |
| ADC | ADS1115, 16-bit, I2C (0x48 / 0x49) |
| Other I/O | 6 digital inputs, 2 transistor outputs |
| Onboard extras | 0.96″ OLED, microSD, DS3231 RTC w/ battery backup |
| Supply | 24V DC, ~400 mA |
| Mounting / rating | DIN rail, IP20, -10…+85°C |
| Certifications | EN 61131-2, EN 61010-1, EMC 2014/30/EU |
Wiring the AE04-V’s 0–10V Inputs
Each of the six inputs maps to a single-ended channel on one of two onboard ADS1115 chips. Getting a sensor connected correctly is a short checklist:
| Terminal | Maps to | Notes |
|---|---|---|
| A0 – Analog Input 0 | ADS1115 #1 (0x48), AIN0 | First 4 channels share ADC #1 |
| A1 – Analog Input 1 | ADS1115 #1 (0x48), AIN1 | |
| A2 – Analog Input 2 | ADS1115 #1 (0x48), AIN2 | |
| A3 – Analog Input 3 | ADS1115 #1 (0x48), AIN3 | |
| A4 – Analog Input 4 | ADS1115 #2 (0x49), AIN0 | Last 2 channels on ADC #2 |
| A5 – Analog Input 5 | ADS1115 #2 (0x49), AIN1 |
- Power down the sensor and the AE04-V before making any connections.
- Connect the sensor’s 0–10V output to the target analog input terminal (A0–A5).
- Connect the sensor’s ground/common to the AE04-V’s GND terminal — a shared ground reference is required, not optional.
- Power the sensor from its rated supply (commonly 12–24V DC); the AE04-V’s analog inputs themselves don’t source sensor power, so check your transmitter’s wiring diagram for loop- or externally-powered configuration.
- Power up the AE04-V from a 24V DC supply and confirm the OLED display shows input activity before connecting to firmware.
Because every input is rated up to 38V DC, small wiring mistakes or transient spikes on the line don’t take out the board the way they would with a bare ESP32 pin — one of the practical advantages of using a purpose-built analog input over a DIY divider.
Reading and Converting the Signal #
The AE04-V’s analog inputs are read over I2C through the two ADS1115 chips. This example builds on NORVI’s own AE04-V test firmware and adds voltage conversion, so the output is volts rather than raw ADC counts:
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads1; // I2C 0x48 -> AIN0-3
Adafruit_ADS1115 ads2; // I2C 0x49 -> AIN0-1
// LSB size at GAIN_ONE, and the board's fixed 0-10V input-divider ratio
#define LSB_MV 0.125
#define DIVIDER_RATIO 0.2065
float toVolts(int16_t raw) {
return (raw * LSB_MV / 1000.0) / DIVIDER_RATIO;
}
void setup() {
Serial.begin(115200);
Wire.begin(16, 17); // SDA=16, SCL=17 on the AE04-V
ads1.begin(0x48);
ads2.begin(0x49);
ads1.setGain(GAIN_ONE);
ads2.setGain(GAIN_ONE);
}
void loop() {
for (uint8_t ch = 0; ch < 4; ch++)
Serial.printf("AI%d: %.2f V\n", ch, toVolts(ads1.readADC_SingleEnded(ch)));
for (uint8_t ch = 0; ch < 2; ch++)
Serial.printf("AI%d: %.2f V\n", ch + 4, toVolts(ads2.readADC_SingleEnded(ch)));
delay(500);
}
To turn a voltage into an engineering value — temperature, pressure, level — map it linearly against the sensor’s rated range, the same way the sensor itself maps its measurement onto 0–10V:
// Example: a 0-10V pressure transmitter rated 0-100 PSI
float voltsToPSI(float volts) {
return (volts / 10.0) * 100.0;
}
ADC Accuracy Tips #
Whether reading through the ESP32’s internal ADC or an external one like the ADS1115, these practices close the gap between an ADC reading and a multimeter reading:
- Use calibrated reads on the internal ADC. analogReadMilliVolts() applies Espressif’s factory calibration automatically — a one-line improvement over raw analogRead() for any project not using an external ADC.
- Avoid the internal ADC’s non-linear tail. It gets noticeably less linear above ~2.6–2.9V at 11/12 dB attenuation. If building your own divider, target a max scaled voltage around 2.5V, not 3.2V.
- Average multiple samples. 16–32 samples averaged removes most of the ADC’s inherent jitter with negligible added latency for slow-changing sensor signals.
- Keep sensors on ADC1 pins. ADC2 shares hardware with Wi-Fi and can return errors while a Wi-Fi connection is active.
- Filter at the pin. A 100 nF ceramic capacitor from signal to ground suppresses high-frequency noise before it ever reaches a sample.
- Go external for multi-channel precision. A 16-bit ADC like the ADS1115 removes most internal-ADC error sources outright — the reason the AE04-V uses one for every analog channel rather than the ESP32’s built-in ADC.
Why the AE04-V sidesteps most of this
Because every analog input runs through a 16-bit ADS1115 instead of the ESP32’s 12-bit internal ADC, the AE04-V avoids the internal ADC’s non-linearity and reference-voltage drift by design — most of the tips above are for anyone still reading 0-10V through bare ESP32 pins.
Industrial Signal Conditioning #
Beyond the ADC itself, the wiring and installation practices below are what separate a reading that holds up in a live panel from one that only worked on the bench.
| Practice | Why it matters | On the AE04-V |
|---|---|---|
| Overvoltage protection | A wiring mistake or transient can exceed the signal range | Inputs rated to 38V DC — built in |
| Common grounding | Multiple ground paths cause noisy, drifting readings | Tie sensor GND to the AE04-V GND at one point |
| Shielded, twisted-pair cabling | Rejects noise from VFDs, contactors, and long runs | Recommended for any run beyond a few metres |
| Isolation | Removes ground-loop risk between separate power systems | Add an isolated front end if sensor and controller share no common supply |
| EMC/Certification | Proves protection holds up in a real plant, not just on paper | Built to EN 61131-2, EN 61010-1, EMC 2014/30/EU |
Testing and Troubleshooting #
- Power up the AE04-V and confirm the OLED shows all six analog inputs at 0 with nothing connected.
- Connect a known voltage source (or the sensor itself) to one input and confirm the displayed/serial reading tracks within a few percent.
- Sweep from 0V to 10V and confirm the reading moves smoothly with no jumps, dead zones, or reversed polarity.
- If a channel reads 0 or stays pinned at max, recheck the terminal, the shared ground connection, and that the sensor is actually powered.
| Symptom | Likely cause | Fix |
|---|---|---|
| Reading jumps around | Noise on a long unshielded cable | Use shielded twisted pair; average more samples |
| Reading stuck at 0 or max | No shared ground, or sensor unpowered | Confirm GND tie and sensor supply |
| ADS1115 channel not responding | Wrong I2C address, SDA/SCL swapped | Confirm 0x48/0x49 and SDA=16 / SCL=17 |
| Values off vs. a multimeter | Divider ratio in code doesn’t match the board | Re-check DIVIDER_RATIO / gain against the datasheet |
10. Get the Hardware #
Explore the NORVI IIOT-AE04-V hardware, documentation, example code, and engineering support.