ADC:Измерение сопротивлений - технические детали/en: различия между версиями
(не показана 1 промежуточная версия 1 участника) | |||
Строка 2: | Строка 2: | ||
The LRADC channel of the processor that the Wiren Board uses to operate the ADC has an integrated current source. This allows to measure the resistance of the load connected to the outputs of the ADC, i.e., to read values of resistive sensors. | The LRADC channel of the processor that the Wiren Board uses to operate the ADC has an integrated current source. This allows to measure the resistance of the load connected to the outputs of the ADC, i.e., to read values of resistive sensors. | ||
See also the description in the processor | See also the description in the [[Freescale i.MX233/en|documentation]] on the processor,p. 1334 | ||
Resistance measurement is implemented in the wb-homa-adc driver, see [[ADC/en |ADC]]. | Resistance measurement is implemented in the wb-homa-adc driver, see [[ADC/en |ADC]]. |
Версия 12:35, 24 мая 2019
The LRADC channel of the processor that the Wiren Board uses to operate the ADC has an integrated current source. This allows to measure the resistance of the load connected to the outputs of the ADC, i.e., to read values of resistive sensors.
See also the description in the documentation on the processor,p. 1334
Resistance measurement is implemented in the wb-homa-adc driver, see ADC.
The measuring procedure in the manual mode
Make sure the wb-homa-adc daemon is not running
Disable output
(only for Wiren Board rev. 2.8)
- For terminals 2-7: close the transistor. See List of GPIOs, Low voltage load management.
- For terminal strip 9: set GPIO 2 to input mode (Managing GPIO)
Channel selection
Use wb-adc-set-mux to select a channel(ADC)
Setting output current
Setting the output current is not supported by the driver, so it is implemented using the userspace application with direct memory access.
Command lradc-set-current (https://github.com/contactless/wirenboard/tree/master/utils/adc/resistance).
root@wirenboard:~# lradc-set-current Set output current for LRADC1 channel USAGE: ./lradc_current <uA>|off Available currents: 0uA, 20uA, ..., 280uA, 300uA Use "off" to switch off current source. 0uA setting could result in some current
The maximum current is 300 µa. The current is set in increments of 20 µa.
Setting 100 µa current:
root@wirenboard:~# lradc-set-current 100
Disconnecting the current source:
root@wirenboard:~# lradc-set-current off
It is necessary to set the maximum possible value of the output current at which the voltage on the LRADC does not exceed 1.85 V, i.e. the raw result is not equal to 4095.
In the following example 40 µa is the optimum current:
root@wirenboard:~# lradc-set-current 100 root@wirenboard:~# wb-adc-get-value 4095 root@wirenboard:~# lradc-set-current 20 root@wirenboard:~# wb-adc-get-value 1663 root@wirenboard:~# lradc-set-current 60 root@wirenboard:~# wb-adc-get-value 4095 root@wirenboard:~# lradc-set-current 40 root@wirenboard:~# wb-adc-get-value 3154
Calculating the results
The resistance is calculated by the formula:
r = 1.0/(I/V - 1/R1) - R2
r is the measured resistance, R2 is the series resistance of the channel
R1 is parallel resistance (divider arm/leakage currents).
V is input voltage LRADC measured by the processor:
V = N / 4095 * 1.85V
where N is the raw LRADC readings, I is the output current.
For different versions:
- Wiren Board 5 (terminals R1-R2): R2 = 3150 Ohm, R1 = 1000kOhm.
- Wiren Board 4 (terminals R1-R2): R2 = 3570 Ohm, R1 = 120kOhm.
- Wiren Board Smart Home rev. 3.5 (terminals R1-R4): R2 = 600 Ohm, R1 = 93kOhm.
- Wiren Board rev. 2.8. R2 = 12kOhm, R1 = 33.0 kOhm.