🛠 Lire un capteur analogique 0–10 V sur les entrées Opta
Objectives
Configure the multifunction inputs I1..I8 in analog mode to read 0–10 VDC transmitters. The Opta offers a user-configurable resolution from 12 to 16 bits (LSB 166 µV, accuracy ±5 %, repeatability ±2 %, acquisition cycle 10 µs). You will learn how to convert the raw reading into actual voltage using the onboard voltage divider (factor 0.3034).
Hardware
- Arduino Opta powered by 24 VDC
- One 0–10 V transmitter (pressure, temperature, powered potentiometer)
- Connections to I1, I2, I3 (pins A0, A1, A2) and common 0 V
- Arduino IDE, Opta core
Complete code
// opta_analogique_0_10v.ino — surveillance de 3 transmetteurs 0..10 V
const float VOLTAGE_MAX = 3.3; // pleine echelle ADC
const float RESOLUTION = 4095.0; // 12 bits
const float DIVIDER = 0.3034; // diviseur embarque 10 V -> ~3,3 V
const int TERMINAUX[] = {A0, A1, A2}; // borne I1, I2, I3
void setup {
Serial.begin(9600);
analogReadResolution(12); // 12..16 bits configurables sur Opta
}
void loop {
for (int i = 0; i < 3; i++) {
int brut = analogRead(TERMINAUX[i]);
float volts = brut * (VOLTAGE_MAX / RESOLUTION) / DIVIDER; // 0..10 V
Serial.printf("I%d : %d -> %.3f VDC\n", i + 1, brut, volts);
}
delay(1000);
}
Expected verification
With a transmitter outputting 5 V, the corresponding line displays approximately 5.000 VDC. By switching to analogReadResolution(16), decimal stability improves (oversampling). The measurable range is 0–10 VDC only in analog mode — not 24 V.
Common errors
- Sending more than 10 V to an input in analog mode: the range is 0–10 VDC; a 0–20 mA or 0–10 V signal must be respected, and a shunt resistor is required for current loops.
- Incorrect conversion factor: forgetting to divide by 0.3034 results in voltages that are off by a factor of 3; refer to the official sketch in the user manual.
- Misunderstood resolution: 16 bits in user configuration does not mean 16 bits of accuracy — accuracy remains ±5 %.
- Missing common ground: without a common 0 V between the sensor and the Opta, the reading drifts or oscillates.
Other tutorials for this board
- Premier sketch : faire clignoter une LED sur Arduino Opta
- Lire une entrée numérique 24 V (capteur de proximité)
- Commander une charge 230 V avec un relais de sortie
- Server Modbus TCP : exposer les relais sur Ethernet
- Remonter des données machine en MQTT via Ethernet
- Exploiter le double cœur : M7 pour le PLC, M4 en coprocesseur
Code examples for this board
relais_securise.inoArduinoentrees_numeriques.inoArduinoanalogique_0_10v.inoArduinomodbus_tcp_esclave.inoArduinomodbus_rtu_maitre.inoArduinomqtt_telemetrie.inoArduino