Your RevPi MIO has eight analog inputs, with which you can measure voltage from 0 to 10 V in millivolts. The inputs have an overhead with a buffer of 0.76 V. Measurements above 10.76 V are blocked.
Analog Inputs as Digital Inputs
Variable switching thresholds enable analog inputs to behave as digital inputs. You can define the switching thresholds for each channel. The result, i.e. whether the switching threshold at a channel has been exceeded, is shown in the process image in the fields AnalogInputLogicLevel_1-8.
Signals
To increase the accuracy of the AD converter, the signal is “oversampled”. The analog inputs are sampled with 15-bit resolution and are available in the process image as a millivolt value (0 to 10000).
If your signal is too severely affected by noise, you can set a moving average filter for the analog inputs. This filter ensures that any disturbance values such as measurement noise are filtered out of your sensor’s signal.
Note: If you use the moving average filter, the maximum frequency that can be detected is reduced. The signal’s bandwidth is reduced as a result.
Ground
A system ground (GND) is available for the analog inputs. This ensures that all connections have the same reference level for the measurements. Connect the system ground with low impedance.
If you do not connect the system ground, your output values may be distorted.
Description |
Number Left |
Number Right |
Description |
---|---|---|---|
Analog input 8 |
14 |
13 |
Analog input 7 |
System GND |
12 |
11 |
System GND |
Analog input 6 |
10 |
9 |
Analog input 5 |
System GND |
8 |
7 |
System GND |
Analog input 4 |
6 |
5 |
Analog input 3 |
System GND |
4 |
3 |
System GND |
Analog input 2 |
2 |
1 |
Analog input 1 |
Resistance and Current Measurement
Resistance and current measurements are not yet implemented in the software. Currently, you need to derive these from a voltage measurement in the RevPi Connect. Here we explain how to do this.
Resistance Measurement
For resistance measurement you can use a voltage divider.
The voltage divider consists of the resistor RT to be measured and a reference resistor R1.
The resistance RT can be calculated from the voltage VT, which is tapped between the resistors with the analog input.
VT = (Vref*R1)/(R1+RT) à RT = R1*((VREF/VT)-1)
Example:
We assume the following values in this example: VT = 8000 mV; R1=1000 Ohm, VREF = 10000 mV
The reference voltage is to be generated with analog output 1 and the voltage VT is measured at analog input 1.
- Set the reference voltage at analog output 1 to 10000 mV:
piTest -w AnalogOutput_1,10000 - Measure the voltage at analog input 1 (in this example 8000mV):
piTest -r AnalogInput_1
You can now calculate the resistance RT with the function described above.
RT = 1000 Ohm * (10000 mV/8000 mV – 1) = 250 Ohm
Current Measurement
You can measure small currents via a shunt resistor.
For measuring current between 0 mA and 20 mA a shunt resistor of 430 Ohm is suitable.
If you measure the voltage at the analog input and divide it by the resistor value, you get the measured current.
I = U_in/R_shunt