ADC:Измерение сопротивлений - технические детали/en: различия между версиями

Материал из Wiren Board
(Новая страница: «Setting the output current is not supported by the driver, so it is implemented using the userspace application with direct memory access.»)
(не показано 20 промежуточных версий 2 участников)
Строка 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 documentation, p. 1334 -[http://www.freescale.com/files/dsp/doc/ref_manual/IMX23RM.pdf Reference Manual]
See also the description in the documentation on the processor, [[Freescale i.MX233|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]].  
Строка 10: Строка 10:
== The measuring procedure in the manual mode ==
== The measuring procedure in the manual mode ==


Make sure the wb-homa-adc daemon is not running
Make sure the wb-homa-adc daemon is unloaded


=== Disable output ===
=== Disable output ===


(only for Wiren Board rev. 2.8)
(only for Wiren Board rev. 2.8)
* For terminals 2-7: close the transistor. See [[Список GPIO/en|List of GPIOs]], [[Управление низковольтной нагрузкой/en|Low voltage load management]].
* For terminals 2-7: close the transistor. See [[Список GPIO/en|Список GPIO]], [[Управление низковольтной нагрузкой/en|Low voltage load management]].
* For terminal strip 9: set GPIO 2 to input mode ([[Работа с GPIO/en|Managing GPIO]])
* For terminal strip 9: set GPIO 2 to input mode ([[Работа с GPIO/en|Managing GPIO]])


Строка 28: Строка 28:
Setting the output current is not supported by the driver, so it is implemented using the userspace application with direct memory access.
Setting the output current is not supported by the driver, so it is implemented using the userspace application with direct memory access.


Command <b>lradc-set-current</b> (https://github.com/contactless/wirenboard/tree/master/utils/adc/resistance).
Команда <b>lradc-set-current</b> (https://github.com/contactless/wirenboard/tree/master/utils/adc/resistance).


<pre>
<pre>
Строка 38: Строка 38:
</pre>
</pre>


The maximum current is 300 µa. The current is set in increments of 20 µa.
Максимальный ток - 300 мкА. Ток устанавливается с шагом в 20 мкА.


Setting 100 µa current:
Установка тока в 100 мкА:


<pre>
<pre>
Строка 46: Строка 46:
</pre>
</pre>


Disconnecting the current source:
Отключение источника тока:
<pre>
<pre>
root@wirenboard:~# lradc-set-current off
root@wirenboard:~# lradc-set-current off
</pre>
</pre>


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.
Необходимо установить такое как можно большее значение выходного тока, при котором напряжение на LRADC не зашкаливает за 1.85V, т.е. сырой результат не равен 4095.


In the following example 40 µa is the optimum current:
В примере 40 мкА - оптимальный ток:


<pre>
<pre>
Строка 71: Строка 71:




=== Calculating the results ===
=== Вычисление результата ===


The resistance is calculated by the formula:
Сопротивление вычисляется по формуле:


<pre>
<pre>
Строка 79: Строка 79:
</pre>
</pre>


<b>r</b> is the measured resistance, <b>R2</b> is the series resistance of the channel
<b>r</b> - измеряемое сопротивление, <b> R2 </b> - последовательное сопротивление канала


<b>R1</b> is parallel resistance (divider arm/leakage currents).
<b>R1</b> - параллельное сопротивление (плечо делителя/токи утечки).


<b> V </b> is input voltage LRADC measured by the processor:
<b> V </b> - напряжение на входе LRADC, измеряемое процессором:


<pre>
<pre>
Строка 89: Строка 89:
</pre>
</pre>


where N is the raw LRADC readings, I is the output current.
где N - сырые показания LRADC, I - выходной ток.


For different versions:
Для разных версий:


* Wiren Board 5 (terminals R1-R2):   <b>R2 = 3150 Ohm, R1 = 1000kOhm</b>.
* Wiren Board 5 (клеммники R1-R2):   <b>R2 = 3150 Ohm, R1 = 1000kOhm</b>.
* Wiren Board 4 (terminals R1-R2):  <b>R2 = 3570 Ohm, R1 = 120kOhm</b>.
* Wiren Board 4 (клеммники R1-R2):  <b>R2 = 3570 Ohm, R1 = 120kOhm</b>.
* Wiren Board Smart Home rev. 3.5 (terminals R1-R4): <b>R2 = 600 Ohm, R1 = 93kOhm</b>.
* Wiren Board Smart Home rev. 3.5 (клеммники R1-R4): <b>R2 = 600 Ohm, R1 = 93kOhm</b>.
* Wiren Board rev. 2.8.  <b>R2 = 12kOhm, R1 = 33.0 kOhm</b>.
* Wiren Board rev. 2.8.  <b>R2 = 12kOhm, R1 = 33.0 kOhm</b>.

Версия 11:15, 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 unloaded

Disable output

(only for Wiren Board rev. 2.8)


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.

Команда 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

Максимальный ток - 300 мкА. Ток устанавливается с шагом в 20 мкА.

Установка тока в 100 мкА:

root@wirenboard:~# lradc-set-current 100

Отключение источника тока:

root@wirenboard:~# lradc-set-current off

Необходимо установить такое как можно большее значение выходного тока, при котором напряжение на LRADC не зашкаливает за 1.85V, т.е. сырой результат не равен 4095.

В примере 40 мкА - оптимальный ток:

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


Вычисление результата

Сопротивление вычисляется по формуле:

r = 1.0/(I/V  - 1/R1) - R2

r - измеряемое сопротивление, R2 - последовательное сопротивление канала

R1 - параллельное сопротивление (плечо делителя/токи утечки).

V - напряжение на входе LRADC, измеряемое процессором:

V =  N / 4095 * 1.85V

где N - сырые показания LRADC, I - выходной ток.

Для разных версий:

  • Wiren Board 5 (клеммники R1-R2): R2 = 3150 Ohm, R1 = 1000kOhm.
  • Wiren Board 4 (клеммники R1-R2): R2 = 3570 Ohm, R1 = 120kOhm.
  • Wiren Board Smart Home rev. 3.5 (клеммники R1-R4): R2 = 600 Ohm, R1 = 93kOhm.
  • Wiren Board rev. 2.8. R2 = 12kOhm, R1 = 33.0 kOhm.