Multiple-Sensor_Interface_logo.png

  User Guide - Multiple-Sensor Interface

LICENSE: User-Guide of Multiple Sensor Interface © 2021 by David Nuno G. da Silva S. Quelhas is licensed under CC BY-SA 4.0

CC BY-SA 4.0   -   Creative Commons Attribution-ShareAlike 4.0 International

NOTE: The Software/Firmware and Hardware of the Multiple Sensor Interface have their own licenses (GNU, CERN).

.

Table of Contents

 

The symbol Table of Contents returns the reader to the top of the Table of Contents.

1- Introduction Table of Contents

1.1 - Intro- Multiple-Sensor Interface:1 device , unlimited applications. Table of Contents

Low cost RTU (Remote terminal unit). Interfaces sensors based on the variation of resistance, inductance, capacitance; sensors with a frequency output, analog voltage.

device_multiple_sensor_simplified_drawing_top_view
Device Multiple Sensor Interface Simplified Drawing.

Connectors / jumper list:
1- LCR sensors (resistive, inductive, capacitive, frequency).
2- Analog voltage (ADC).
3- Measurement range for LCR sensors).
4- Digital output / trigger (Ex: alarms).
5- RS485 connector (A, B).
6- USB connector.

1.2- Connecting the sensors: Table of Contents

Sensor Type Connector Measurement Range Applications / Comments
Resistive (Ex: LDR(Light dependent resistor), RTD(resistive temperature detector), FSR(force sensing resistor), LCR sensors: CH0, CH1 Jumpers: JP0.A, JP0.B JP1.A, JP1.B Touch sensors, temperature sensor, luminosity sensors,
Inductance (Ex: thin open door/window sensor) LCR sensors: CH0, CH1 Jumpers: JP0.A, JP0.B JP1.A, JP1.B Alarm systems (Open door/window sensor)
Capacitance (Ex: liquid level sensor LCR sensors: CH0, CH1 Jumpers: JP0.A, JP0.B JP1.A, JP1.B measurement of liquid level in a tall container
Frequency (Ex: Flow meter, wind speed) LCR sensors: CH0, CH1, CH2, CH3, CH4, CH5   flowmeter and anemometer, with square wave or pulse output,
Analogue voltage (electric current clamp)

ADC sensors:

ADC0, ADC1, ADC2, ADC3

0V - 3.7V,

2 - differential,

2 - common reference

Measurement of electric consumption. current clamp sensor

The sensors may be connected through a cable (2 wires) (or depending on its size directly) to the screw terminals on the board edge, alternatively they can also be connected to pin-headers close to the board edge using a connector simulator to connectors used on flat-cables(IDC), although flat-cables is not the recommended type because it has no shielding between the wires of distinct sensor channels and/or external interference sources.

To connect inductive, capacitive or resistive sensors to the device, if the cable connecting to sensor is more than 15cm long or if it has close proximity to other cable with a signal that may cause interference (for example the cable of the other sensor channel), then to ensure reliability/precision always use cables with shielded twisted pair, for example: SSTP cable ( Screened Shielded Twisted Pair, a cable typically used for data transmission on ethernet networks).

The shielded pair assures that the cable won't capture any interference from nearby sensors (the interference could be from the cables of the other channels, the cables from the various channels may usually be placed nearby so is important the shielding). The shielded pair also assures there isn't any interference between different channels of the device due to parasitic mutual inductance, or parasitic capacitive coupling.
diagram connect sensors to MultipleSensor device SSTP cable
Diagram connecting sensors using SSTP cable to Multiple-Sensor device.

Check the raw_value of the input channel were the sensor was connect, at the Multiple-Sensor application.Test to stimulate / activate the sensor and view if the correspondent raw_value has changed significantly. Remember to change the position of correspondent measurement range jumper (connector S6), and take note which position (A or B) causes the largest variations on the raw_value (for the same test stimulus).


1.3- Calibrating the sensors: Table of Contents

Calibration_configuration_on_Multiple_Sensor_Interface
Calibration configuration on Multiple Sensor Interface.

1- Place the sensor and a reference meter under the same stimulus / location. Arrange a calibration setup were you can control the stimulus / parameter to be measured, or in case you can't control select a moment were is expected to occur the normal variation of the stimulus / parameter to be measured.
2- Try to obtain a steady-state value of the stimulus / parameter, then register the value of the reference meter. Build a table with the measured values (RAW values of multiple-sensor) and the measurements of the reference meter. Try to obtain more data-sets of the moments were the variation of the measurements happens faster.
3- Place the calibration table on the multiple sensor software and check if the measured values of the multiple sensor are matching the measurements of the reference meter.

NOTE: For the sensor types where the mathematical relation (function) between the RAW values and the measurements (with units) is known is possible just to collect a small experimental data-set (for example 5 points or more) and then using a data fitting method to calculate the constants of the mathematical relation (function). After obtaining the calibration function is possible to generate a long dataset (many data points) that can simply be imported (or copied) to the calibration table of the software of the multiple sensor interface.

1.4-Viewing the measurements using the calibration on the software. Table of Contents

1- Select tab 2 "Measurements_2" and check the box: "Enable measurements using virtual calibration".
2- "Continuous Read" for update in real time, click "Update Sensor Now" for sample and hold.
3- Select "Single CH" for good accuracy and fast response. Select "Multiple CH" for interfacing up to 2 LCR sensors (resistive, inductive, capacitive, frequency meter) and 4 frequency sensors (frequency meter).

GUI_1_sensor1_light
Multiple Sensor Interface, single channel mode, 1 sensor connected.
GUI_4_sensors_temp_light_RH_force
Multiple Sensor Interface, multi channel mode, 4 sensors connected.

2- Connection for data exchange: Table of Contents

2.1- USB Table of Contents

The multiple-sensor has a USB connector (type mini-USB), that allows communication with most computers. The device software has the USB driver incorporated. Also is possible to develop custom applications that communicate with the device by linking with the Multiple-Sensor USB driver.

2.2- Modbus/RS485 Table of Contents

The multiple-sensor has a RS485 connector (type screw header)  that allows communication with most computers. The device software has the USB driver incorporated. Also is possible to develop custom applications that communicate with the device by linking with the Multiple-Sensor Modbus driver. Also is possible to communicate with the Multiple-Sensor device using a software or systems that is compatible with the Modbus protocol.

2.3- Serial Port (USART, compatible with RS232) Table of Contents

The multiple-sensor has a serial port connection, that allows communication with most embedded systems (and computer using the appropriate cable / adapter). Also is possible to develop custom applications that communicate with the device by linking with the Multiple-Sensor Modbus driver.


3- Transfer of Device Calibration Tables : Table of Contents

3.1 - Upload / Download of device calibration tables. Table of Contents

menu_File_app_multiple_sensor_with_dialog_top
File menu and dialog on software(GUI) to interact with Multiple Sensor.
download_start_multiple_sensor_box
Download calibration Multiple Sensor View 1.
download_progress_USB_multiple_sensor_box
Download calibration Multiple Sensor View 2.
finished_download_by_USB_calib_tables_box
Download calibration Multiple Sensor View 3.
 
 

3.2 - Import / Export of device calibration tables. Table of Contents

The application allows the user to Import and Export calibration tables with calibration data for the device and the with virtual calibration data. The Import/Export is very simple just select the file name to Read/Save.

Example of a calibration data file for the device:

DEVICE_CALIB_CHANNEL_N.0: UNITS:C; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE:+ ; N_VALID_LINES:12; IS_ACTIVE:1;
TABLE:-1000000000,3.12645e+06;425597,120;431366,100;437134,80;440980,60;446108,40;447069,36;449633,30;449953,21;457000,4;462452,-11;1000000000,-2.75002e+06;
COUNTER_CALIB_CHANNEL_N.0: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.1: UNITS:LUX; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE:+; N_VALID_LINES:12; IS_ACTIVE:1;
TABLE:-1e+09,0;229,0;1000,1;3000,3;8500,10;22200,48;40000,100;130000,1072;194000,3950;244000,11000;300800,39800;1e+09,5.0693e+08;
COUNTER_CALIB_CHANNEL_N.1: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.2: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:2; IS_ACTIVE:0;
TABLE:0,0;1,10;
COUNTER_CALIB_CHANNEL_N.2: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.3: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:0; IS_ACTIVE:0;
TABLE:0,0;
COUNTER_CALIB_CHANNEL_N.3: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.4: UNITS:N(newton); CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE:+ ; N_VALID_LINES:10; IS_ACTIVE:0;
TABLE:-1000000000,-137953;961,0;72000,9.8;226000,19.6;364000,29.4;445000,39.2;575000,58.8;585000,68.6;
COUNTER_CALIB_CHANNEL_N.4: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.5: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:1; IS_ACTIVE:0;
TABLE:0,0;
COUNTER_CALIB_CHANNEL_N.5: UNITS:; C3:0; C2:0; C1:0; C0:0;
DEVICE_CALIB_CHANNEL_N.6: UNITS:W(watt); CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:4; IS_ACTIVE:0;
TABLE:-1,0;0,0;1,2340.1;5,11700.5;
COUNTER_CALIB_CHANNEL_N.6: UNITS:------; C3:------; C2:------;C1:------; C0:------;
DEVICE_CALIB_CHANNEL_N.7: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:0; IS_ACTIVE:0;
TABLE:0,0;
COUNTER_CALIB_CHANNEL_N.7: UNITS:------; C3:------; C2:------;C1:------; C0:------;
DEVICE_CALIB_CHANNEL_N.8: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:79; IS_ACTIVE:0;
TABLE:0,0;
COUNTER_CALIB_CHANNEL_N.8: UNITS:------; C3:------; C2:------;C1:------; C0:------;
DEVICE_CALIB_CHANNEL_N.9: UNITS:; CH_MODE:0;
JUMPER_SELECT_OSC_TUNING_RANGE: ; N_VALID_LINES:0; IS_ACTIVE:0;
TABLE:0,0;
COUNTER_CALIB_CHANNEL_N.9: UNITS:------; C3:------; C2:------;C1:------; C0:------;

4- Application examples: Table of Contents

4.1 - Home automation, management of lighting and home appliances. Table of Contents

Diagram of connecting a LDR light sensor to the Multiple Sensor,the MultipleSensor is connected to a computer(Ex: RaspberryPI) running the MisterHouse domotics server that is programmed to read the LDR sensor periodically and control the ON/OOF the light by a relay, by the GPIO pins of the computer.

diagram_light_control_MisterHouse
Diagram light control using MisterHouse and Multiple Sensor Interface.

4.2- Consumption (electricity, water): Table of Contents

- Interface split core electric current sensors.

- Interface flow meter sensors (with square wave digital output).

Consumption/metering application example.

4.3 - Building Automation and security, Inductive open door / window sensor. Table of Contents

Thin flexible sensors, for detection of open door / window, based on inductance (L) variation.

Open door/window thin sensor.
Building automation application example.
 
 

4.4 - Force sensors (FSR) Table of Contents

FSR - Force Sensing Resistor (left); force sensor hand-made using conductive foam (ESD foam) plus aluminum tape (right).
Robotic_Grip_Sensors_Demo_Multiple_Sensor
Robotic Grip Sensors Demo Multiple Sensor.
 
 

4.5 - Sensors built by you Table of Contents

You can design and build a sensors that you desire based on the variation of resistance, capacitance, inductance, frequency or DC-voltage (0V to 4V) then experimentally extract a calibration table and configure Multiple-Sensor interface to work with it.

 
 

4.6 - Irrigation controller Table of Contents


greenhouse_demo_multiple_sensor_app
An example/idea of using Multiple Sensor Interface on automating a greenhouse.

4.7 - Weather station Table of Contents


weather_station_demo_multiple_sensor_app
An example/idea of using Multiple Sensor Interface as a weather station.
 



5 - Interface sensors to other devices and applications Table of Contents

5.1- Adaptability of the device and drivers for the supported standards (RS485, UART, USB) Table of Contents

- The device is able to operate by a USB interface with a computer running Windows OS (XP or latter), through the Multiple-Sensor application (written in C++), also the user can incorporate the USB driver of Multiple-Sensor on its own applications (Dynamic Link Library (DLL) file for C/C++) and so operating Multiple-Sensor through other applications.

- The device is able to operate by RS485 interface and UART interface using the modbus protocol, with any wide variety of devices / OS. The Multiple-Sensor application (written in C++) allows the operation with the device by RS485/UART by modbus,  also the user can incorporate the modbus driver of Multiple-Sensor on its own applications (Dynamic Link Library (DLL) file for C/C++).

- Also there is available the modbus driver written in Perl language to the "MisterHouse" domotics server. MisterHouse allows the user to interface MultipleSensor on a wide variety of devices / OS (Windows, Linux, MAC, Android, etc...), since the interface of this domotics server are HTML page by HTTP. Also the user can write its own interface and rules with Perl scripts in the MisterHouse sever, adapting the device usage to its own needs and objectives.

- The most economic and piratical usage of the Multiple-Sensor Interface through the MisterHouse domotics server is by connecting the device to a RaspberryPI(running MisterHouse,connect with a USB to RS485 adapter), and then the user can interact with Multiple-Sensor by any device that is able to open HTML pages by HTTP, on a LAN or the Internet.

5.2 - Example of interfacing by RS485 to a custom HTML interface (build on MisterHouse domotics software) Table of Contents

For demonstration proposes of the Multiple-Sensor working with MisterHouse, it was developed an HTML interface of an automation on/off to the lights of a room, on the html interface the user can select various configurations of the Multiple-Sensor and also can configure simple rules of the domotics server to control the switch on/off the room lights accordingly with the measurements of an LDR luminosity sensor.

 
config_multiple_sensor_for_light_control
An example of using Multiple Sensor Interface with an html interface (MisterHouse) for light control.
outputs_html_multiple_sensor
Multiple Sensor Interface outputs viewed on html interface (MisterHouse).
 
 

This html interface consists of the following scripts: 

1. "light_control_demo_multiple_sensor.htm" - html page that implements the user interface for the room lights control demonstration with MisterHouse.
2. "configs_multiple-sensor.sxml" - script were are saved the configurations selected by the user for the Multiple-Sensor device and the MisterHouse server .
3. "outputs_multiple_sensor.xml" - script were are saved the read measurements from the Multiple-Sensor Interface .
4. "perl_redirect_light_control_demo_cgi.cgi" - CGI perl script that reads the fields of the html interface  "light_control_demo_multiple_sensor.htm" and saves the user input to the xml file "configs_multiple-sensor.sxml", also redirects the user from the html interface to the javascript page "outputs_multiple_sensor_viwer.shtml".
5.  A perl script that periodically (1s) reads the Multiple-Sensor measurements by modbus and saves them to a XML file "outputs_multiple_sensor.xml", also this script when detects changes on the xml file  "configs_multiple-sensor.sxml" sends the configurations to the Multiple-Sensor device by modbus protocol .
6. "outputs_multiple_sensor_viwer.shtml" - A javascript were are displayed the outputs of the Multiple-Sensor Interface, the outputs are read obtained from the XML file "outputs_multiple_sensor.xml".


6- Sample Calibration Files Table of Contents

Following are extracts of the calibration files that can be imported to the Multiple-Sensor applicationn, this calibration data allows the device to operate and display the sensor measurements with the correspondent units in accordance with the calibration data. The calibration data has the following format: ( raw_value ( [Hz] or [V]measurement (Ex: lux, N, ºC, %, mL, ... ) .

6.1 - RTD - Temperature sensor WZP-Pt100 (adapted at the start and end) Table of Contents

:
VIRTUAL_CALIB_CHANNEL_N.0: UNITS:C; TABLE:-1000000000,3.12645e+06;425597,120;
425917,119;426238,118;426558,117;426879,116;427199,114;427520,113;427840,112;428161,111;
428481,110;428802,109;429763,106;430084,105;430404,104;430725,102;431366,100;431686,98;
432007,97;432327,96;432648,95;432968,94;433288,92;433609,91;433929,90;434250,89;
434570,88;434891,87;435211,86;435532,84;436493,82;437134,80;437455,70;438416,69;
438737,68;439057,67;439378,66;439698,65;440019,64;440339,62;440660,61;440980,60;
441300,58;441621,57;442262,56;442903,54;443223,52;443544,50;443864,49;444185,48;
444505,47;444826,45;445146,44;445467,43;445787,42;446108,40;446428,38;446749,37;
447069,36;447710,35;448031,33;449633,30;449953,21;457000,4;462452,-11;1000000000,-2.75002e+06;
COUNTER_CALIB_CHANNEL_N.0: UNITS:; A:0; B:0;
WZP-Pt100_circle_cable
RTD - Temperature sensor WZP-Pt100.
 

6.2 - LDR - Light Sensor (adapted at the start and end) : Table of Contents


Virtual Calibration Table for LDR sensor (LUX):
VIRTUAL_CALIB_CHANNEL_N.1: UNITS:LUX; CH_MODE:1; JUMPER_SELECT_OSC_TUNING_RANGE:+;
TABLE:-1e+09,0;0,0;229,0;1000,1;3000,3;8500,10;10500,15;13500,25;14000,30;22200,48;
32000,77;40000,100;45000,122;50500,145;56500,173;62500,205;69900,251;76500,300;87500,398;92500,450;
98000,512;104000,590;108000,650;112000,715;118000,820;123500,925;130000,1072;135200,1200;141000,1365;145000,1485;
150000,1660;156000,1880;158700,1985;162500,2162;170000,2400;179000,2930;194000,3950;205500,5000;214500,6000;221500,6950;
229000,8100;237500,9650;244000,11000;248000,12050;253000,13350;260000,15500;264000,17250;270500,19600;274200,20600;284000,25600;
288500,28600;290500,30300;293500,33400;297500,37000;300800,39800;308000,48100;1e+09,1.15247e+09;
COUNTER_CALIB_CHANNEL_N.1: UNITS:; C3:0; C2:0; C1:0; C0:0;

Device Calibration Table for LDR sensor (LUX) for single channel mode:
DEVICE_CALIB_CHANNEL_N.1: UNITS:LUX; CH_MODE:1; JUMPER_SELECT_OSC_TUNING_RANGE:+; N_VALID_LINES:32; IS_ACTIVE:1;
TABLE:-1e+09,0;0,0;229,0;1000,1;3000,3;8500,10;13500,25;22200,48;32000,77;40000,100;
50500,145;62500,205;76500,300;92500,450;104000,590;112000,715;123500,925;135200,1200;150000,1660;158700,1985;
170000,2400;194000,3950;214500,6000;229000,8100;237500,9650;248000,12050;260000,15500;274200,20600;288500,28600;297500,37000;
308000,48100;1e+09,1.05687e+09;
COUNTER_CALIB_CHANNEL_N.1: UNITS:; C3:0; C2:0; C1:0; C0:0;

Device Calibration Table for LDR sensor (LUX) for multiple channel mode:
DEVICE_CALIB_CHANNEL_N.1: UNITS:LUX; CH_MODE:0; JUMPER_SELECT_OSC_TUNING_RANGE:+; N_VALID_LINES:12; IS_ACTIVE:1;
TABLE:-1e+09,0;229,0;1000,1;3000,3;8500,10;22200,48;40000,100;130000,1072;194000,3950;244000,11000;300800,39800;1e+09,5.0693e+08;
COUNTER_CALIB_CHANNEL_N.1: UNITS:; C3:0; C2:0; C1:0; C0:0;

LDR_sensor_3mm
LDR - Light Dependent Resistor, for measuring luminosity [LUX].

 

6.3 - FSR - Force sensitive resistor : Table of Contents


VIRTUAL_CALIB_CHANNEL_N.0: UNITS:N (newton); TABLE:-1000000000,-137953;961,0;72000,9.8;
226000,19.6;364000,29.4;445000,39.2;575000,58.8;585000,68.6;605000,78.4;1000000000,489782;
 
FSR_circle_20mm_sensor
FSR - Force-Sensing Resistor, for measuring force[N].
 

6.4 - Electric current split-core clamp sensor Table of Contents


This sensors has a voltage output (0V - 5V), connect to ADC channels
VIRTUAL_CALIB_CHANNEL_N.9: UNITS:W (watt); TABLE:-1,0;0,0;1,2340.1;5,11700.5;  
Split-Core-Current-Sensor_2
Split-Core AC Current Sensor(current transformer).
 

6.5- Water level capacitive sensor: Table of Contents


- This sensor measures the height (and so also the volume in a container with a constant area of the cross-section) of the water inside a container:
- Important: A 20kohm resistor (or other resistor value the user choose for his own calibration) should be connected in parallel with the sensor to help stabilize the oscillator frequency and set it independent from noise and parasitic components (L, C or R) of nearby objects or from the device power supply. Important: Install the sensor more than 2cm away from container walls to avoid to avoid external interference (the sensor plates more than 2cm away from container walls).  
water_level_cap_sensor
water level/height capacitive sensor (handmade).
 

Frequency [Hz] Height [mm] C [nF] Measurement [mL]
33973 0 0.025 0
35255 1.15 0.038 100
38460 2.3 0.102 200
43908 3.45 0.166 300
48395 4.6 0.218 400
52562 5.75 0.268 500
60254 6.9 0.330 600
67305 8.05 0.378 700
74676 9.2 0.428 800
84612 10.35 0.490 900
94868 11.5 0.540 1000
108329 12.65 0.598 1100
118585 13.8 0.657 1200
131084 14.95 0.717 1300
142302 16.1 0.780 1400
154160 17.25 0.845 1500

- Calibration table obtained with the sensor (capacitive) inserted in a cylindrical container with a circular base with 105mm of diameter ( this is an area of 0.00865 m2 ) and a 20kohm resistor connected in parallel with the sensor to stabilize the oscillator frequency and set it independent from noise and parasitic components (L, C or R) of nearby objects or from the device power supply.
Important: Install the sensor more than 2cm away from container walls to avoid to avoid external interference (the sensor plates more than 2cm away from container walls).
DEVICE_CALIB_CHANNEL_N.0: UNITS:mL; CH_MODE:1; N_VALID_LINES:17; IS_ACTIVE:1; TABLE:0,0;34293,0.0001;34614,100;37498,200;41344,300;45190,400;49677,500;55446,600;61536,700;68587,800;77240,900;86214,1000;
97111,1100;109290,1200;121149,1300;134289,1400;146468,1500;
COUNTER_CALIB_CHANNEL_N.0: UNITS:; C3:0; C2:0; C1:0; C0:0;  
NOTE: was used a 20kohm resistor connected in parallel with the sensor.
water_level_sensor_diagram.png
Capacitive water level sensor technical drawing.
 

6.6 - Soil moisture sensor (resistive sensor): Table of Contents


soil moisture sensor
soil moisture sensor
.
soil moisture sensor technical drawing
soil moisture sensor technical drawing

   This sensor gives an estimation of the amount of water present in the soil, than can be useful for example to automate soil irrigation. However is not possible to obtain a calibrated measurement of the amount of water, nor the humidity of the soil. This is so because the sensor works with the electrical resistivity of the soil that can vary widely due to various factors, for example the composition of the soil and the composition of the water (Ex: salinity).
.


- Calibration table obtained with the sensor grounded in the soil (the soil used was soil for gardening that includes various organic residues).

Frequency [Hz] R [ohm] Moisture [9 levels]
20000 120000 DRY- (1)
56000 70000 DRY (2)
96150 43000 DRY+ (3)
141661 23300 MOIST- (4)
178839 14000 MOIST (5)
220824 9000 MOIST+ (6)
252554 5700 WET- (7)
265053 4700 WET (8)
271502 4000 WET+ (9)

6.7 - Flowmeter: Table of Contents


The Multiple Sensor Interface allows the measurement of the frequency of external digital signals [0V; 5V], for example this allows to read flowmeter sensors.
The flowmeter sensors here presented are "Sae YF-S401" and , they allow for an estimation of the amount of fluid that passed, however they aren't accurate because the sensor calibration constant is slightly dependent on the speed of the water for the same amount of fluid flow.
NOTE: The jumpers of the sensor channel must be removed when interfacing a flowmeter sensor, because this is an active sensor with its own signal, and so by removing the jumper will allow output signal from the sensor to pass unaltered to the digital counter of the Multiple-Sensor device.

Events counted [1] Fluid volume [L]
13000  (for a medium water speed) 1L

The function used for calibration on Multiple-Sensor Interface device:
water_volume = C3*(counter3) + C2*(counter2) + C1*counter + C0   ,     In case the units for 'water_volume' measurement are millilitre[mL] and the counter value (number of cycles) has no units [1] (in accordance with SI International System of Units) , then C1 = 0.0769 mL and C3 = C2 = C0 = 0 .

For measuring a flowmeter sensor (this is a sensor with a square wave voltage as output, where is measured the signal frequency) connect the VDD and GND wires of the sensor to the appropriate pins on Multiple Sensor Interface, then the signal wire (where is generated a square wave voltage as output) should be connected to channels CH2 to CH5 that are dedicated for measuring frequency. In case you want to use an LCR channel (CH0 or CH1) for measuring this sensor it is possible, for that you have to remove jumpers JPx.A and JPx.B so lowering the capacitance of the sensor channel and connect the sensor signal wire to the 1st pin of that sensor channel (that is pin 1of the screw-connector for CH0 and pin 3 of the screw-connector for CH1).


device multiple sensor connect flowmeter diagram
Diagram of connecting a flowmeter sensor to multiple sensor device.


7 - Modbus protocol on Multiple-Sensor Interface Table of Contents

7.1- Command List Table of Contents

The modbus commands used to interact with Multiple-Sensor use the function codes (FCode): 03 (Read Holding Registers), 04 (Read Input Registers), 06 (Write Single Register), 16 (Write Multiple Registers).

 
modbus_read_input_reg_diagram
Modbus read input register protocol diagram.
 
 

QUERY_FREQUENCY_MEASUREMENTS:
    Request: DeviceID (1 byte) | 0x04 |  0x0010 | 0x000C | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x04 | 0x18 | CH.0 (4 bytes)  | CH.1 (4 bytes)  | CH.2 (4 bytes)  | CH.3 (4 bytes)  | CH.4 (4 bytes)  | CH.5 (4 bytes)  | CRC (2 bytes)

QUERY_CONFIGURATIONS_SENSOR_CH:
    Request: DeviceID (1 byte) | 0x03 |  0x0020 - 0x002A ( 0x0020 + <CH_N.> )  | 0x0008 | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 | 0x10 |  N/A (0x0000) (2 bytes) | compare_is_greater_than (0x000X) (2 bytes) | <obsolete register, N/A> (0x0004) (2 bytes) | N/A (0x000000000000) (6 bytes) | trigger_value_data (float value) ( 4 bytes) | CRC (2 bytes)
    Parameters legend:
                    compare_is_greater_than: 0 - Sensor channel is active when its value is greater[>] than trigger,
                                                           1 -  Sensor channel is active when its value is smaller[<] than trigger.
                    trigger_value_data: data bytes of a floating variable that is used as the trigger value to obtain the active status
                                                 status of the sensor channel depending on its current value.
                                                  (Ex: value 4356,87 has the 4 bytes: 0x26 0xF6 0x45 0x88 ).

GET_BOARD_ID_CODE:
    Request: DeviceID (1 byte) | 0x04 (1 byte) |  0x0098 (2 bytes) | 0x0001 (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x04 | 0x02 | 0x00 | DeviceID (1 byte) | CRC (2 bytes)

QUERY_ADC_MEASUREMENTS:
    Request: DeviceID (1 byte) | 0x04 (1 byte) |  0x0016 (2 bytes) | 0x0008 (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x04 | 0x10 | ADC.0 (CH.6) (float value) (4 bytes)  | ADC.1 (CH.7) (float value) (4 bytes)  | ADC.2 (CH.8) (float value) (4 bytes)  | ADC.3 (CH.9) (float value) (4 bytes) | CRC (2 bytes)

QUERY_MULTIPLE_SENSOR_COUNTER_VALUES:
    Request: DeviceID (1 byte) | 0x04 (1 byte) |  0x0050 (2 bytes) | 0x000C (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x04 | 0x18 | counter_CH.0 (4 bytes)  | counter_CH.1 (4 bytes)  | counter_CH.2 (4 bytes)  | counter_CH.3 (4 bytes)  | counter_CH.4 (4 bytes)  | counter_CH.5 (4 bytes)  | CRC (2 bytes)

QUERY_MEASUREMENTS_CH:
    Request: DeviceID (1 byte) | 0x04 (1 byte) |  0x0087 (2 bytes) | 0x0014 (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x04 | 0x28 | CH.0 (4 bytes)  | CH.1 (4 bytes)  | CH.2 (4 bytes)  | CH.3 (4 bytes)  | CH.4 (4 bytes)  | CH.5 (4 bytes) | CH.6 (ADC.0) (4 bytes) | CH.7 (ADC.1) (4 bytes) | CH.8 (ADC.2) (4 bytes) | CH.9 (ADC.3) (4 bytes)  | CRC (2 bytes)

QUERY_MULTIPLE_SENSOR_MODE_MULTI_OR_SINGLE_CODE:
    Request: DeviceID (1 byte) | 0x03 (1 byte) |  0x0040 | 0x0002 | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 (1 byte) | 0x02 (1 byte) | mode_is_single_channel_bool (1 byte) | selected_channel_number (1 byte) | CRC (2 bytes)
    Parameters legend:  mode_is_single_channel_bool: 0 - multiple_channel_mode ; 1 - single_channel_mode
                                      selected_channel_number: 0-5 ( 0 - CH.0 , 1 - CH.1, ... , CH.5 )

QUERY_OUTPUTS_CURRENT_VALUE:
    Request: DeviceID (1 byte) | 0x03 (1 byte) |  0x0093 (2 bytes) | 0x0003 (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 (1 byte) | 0x06 (1 byte) | OUT_0 (0x000X) (2 byte) | OUT_1 (0x000X) (2 byte)
                 | OUT_2 (0x000X) (2 byte) | CRC (2 bytes)

QUERY_LINE_CALIB_TABLE_CH:

    Request: DeviceID (1 byte) | 0x03 |  0x0030 - 0x003A ( 0x0030 + <CH_N.> )  | 0x0000 - 0x00FF ( line number) (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 | 0x08 |  RAW_value (2 bytes) | measurement (2 bytes) |  CRC (2 bytes)
    Parameters legend:
                    RAW_value :  the value [Hz or V] saved on the calibration table of the selected sensor channel and line number
                    measurement: the measurement for the selected sensor channel and line number, this is the measurement that will be calculated by the device when a sensor channel has the correspondent RAW_value.

QUERY_HEADER_CALIB_TABLE_CH:
    Request: DeviceID (1 byte) | 0x03 |  0x0040 - 0x004A ( 0x0040 + <CH_N.> )  | 0x000D (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 | 0x1A | calib_table_is_active_bool (0x00XX) (2 byte) | number_table_lines (2 bytes) | calibration_mode_multi_or_single_ch (0x00XX) (2 bytes) |  units_string ( 20 bytes )  |  CRC (2 bytes)
    Parameters legend:
                    calib_table_is_active_bool:  boolean (0 or 1) indicates if the calibration table is active and so being used by the microprocessor to calculate the measurement values for the sensor channel
                    number_table_lines: integer between 0 and 90, the number of valid lines indicates how many of the first lines are being processed by the microprocessor to calculate measurements.
                    calibration_mode_multi_or_single_ch: boolean (0 or 1) indicates if the calibration table was obtained under multiple channel mode (max. lines processed is 15) or single channel mode (max. lines processed is 90)
                    units_string: character string codded in ASCII with the units of the measurements used on the calibration table.

QUERY_OUTPUT_CONFIG:

    Request: DeviceID (1 byte) | 0x03 (1 byte) |  0x0091 - 0x0093 ( 0x0091 + <OUT_N.> ) (2 bytes) | 0x001B (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x03 (1 byte) | 0x36 (1 byte) |  ( char string boolean function of selected output )              (54 byte) | CRC (2 bytes)


modbus_write_single_reg_diagram
Modbus write single register protocol diagram.
 

SET_BOARD_ID:

    Request: DeviceID (1 byte) | 0x06 |  0x0098 | New_DeviceID (0x00XX) (2 bytes)  | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x06 |  0x0098 | New_DeviceID (0x00XX) (2 bytes)  | CRC (2 bytes)

RESET_MULTIPLE_SENSOR_COUNTER_VALUES:
    Request: DeviceID (1 byte) | 0x06 (1 byte) |  0x0058 (2 bytes) | 0x0001 (2 bytes)  | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x06 (1 byte) | 0x0058 (2 bytes) | 0x0001 (2 bytes)  | CRC (2 bytes)

SAVE_MULTIPLE_SENSOR_MODE_MULTI_OR_SINGLE_CODE:
    Request: DeviceID (1 byte) | 0x06 (1 byte) |  0x0040 (2 bytes) | 0xXX (mode_is_single_channel_bool, 1st byte) , 0xXX (selected_channel_number, 2nd byte) (2 bytes) | CRC (2 bytes) .
    Reply: DeviceID (1 byte) | 0x06 (1 byte) |  0x0040 (2 bytes) | 0xXX (mode_is_single_channel_bool, 1st byte) , 0xXX (selected_channel_number, 2nd byte) (2 bytes) | CRC (2 bytes) .
    Parameters legend: mode_is_single_channel_bool: 0 - multiple_channel_mode ; 1 - single_channel_mode
                                      selected_channel_number: 0-5 ( 0 - CH.0 , 1 - CH.1, ... , CH.5 )
 
modbus_write_multiple_reg_diagram
Modbus write multiple register protocol diagram.
 
 
SAVE_CONFIGURATIONS_SENSOR_CH_CODE:
    Request: DeviceID (1 byte) | 0x10 (1 byte) |  0x0020 (2 bytes) | 0x0007 (2 bytes) | 0x0E (1 byte) | N/A (0x0000) (2 bytes) | compare_is_greater_than (0x000X) (2 bytes) | N/A (0x000000000000) (6 bytes) | trigger_value_data (float value) ( 4 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x10 (1 byte) | 0x0020 (2 bytes) | 0x0007 (2 bytes) | CRC (2 bytes)
    Parameters legend:
        compare_is_greater_than: 0 - Sensor channel is active when its value is greater[>] than trigger,
                                                1 -  Sensor channel is active when its value is smaller[<] than trigger.
        trigger_value_data: data bytes of a floating variable that is used as the trigger value to obtain the active status
                                      of the sensor channel depending on its current value.
                                      (Ex: value 4356,87 has the 4 bytes: 0x26 0xF6 0x45 0x88 ).

SAVE_LINE_CALIB_TABLE_CH:
    Request: DeviceID (1 byte) | 0x10 |  0x0030 - 0x003A ( 0x0030 + <CH_N.> ) (2 bytes) | 0x0005 (2 bytes) | 0x0A (1 byte)  | 0x0000 - 0x00FF ( line number) (2 bytes) | RAW_value (2 bytes) | measurement (2 bytes) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x10 | 0x0030 - 0x003A ( 0x0030 + <CH_N.> ) (2 bytes) | 0x0005 (2 bytes)  |  CRC (2 bytes)
    Parameters legend:
                    RAW_value :  the value [Hz or V] saved on the calibration table of the selected sensor channel and line number
                    measurement: the measurement for the selected sensor channel and line number, this is the measurement that will be calculated by the device when a sensor channel has the correspondent RAW_value.
SAVE_HEADER_CALIB_TABLE_CH:
    Request: DeviceID (1 byte) | 0x10 |  0x0040 - 0x004A ( 0x0040 + <CH_N.> )  | 0x000D (2 bytes) | 0x1A (1 byte) | calib_table_is_active_bool (0x00XX) (2 byte) | number_table_lines (2 bytes) | calibration_mode_multi_or_single_ch (0x00XX) (2 bytes) |  units_string ( 20 bytes ) | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x10 | 0x0040 - 0x004A ( 0x0040 + <CH_N.> ) | 0x000D (2 bytes) |  CRC (2 bytes)
    Parameters legend:
                    calib_table_is_active_bool:  boolean (0 or 1) indicates if the calibration table is active and so being used by the microprocessor to calculate the measurement values for the sensor channel
                    number_table_lines: integer between 0 and 90, the number of valid lines indicates how many of the first lines are being processed by the microprocessor to calculate measurements.
                    calibration_mode_multi_or_single_ch: boolean (0 or 1) indicates if the calibration table was obtained under multiple channel mode (max. lines processed is 15) or single channel mode (max. lines processed is 90)
                    units_string: character string codded in ASCII with the units of the measurements used on the calibration table.

SAVE_OUTPUT_CONFIG:
    Request: DeviceID (1 byte) | 0x10 (1 byte) | 0x0091 - 0x0093 ( 0x0091 + <OUT_N.> ) (2 bytes) | 0x001B (2 bytes) | 0x36 (1 byte) |  ( char string boolean function of selected output ) (54 bytes)  | CRC (2 bytes)
    Reply: DeviceID (1 byte) | 0x10 (1 byte) | 0x0091 - 0x0093 ( 0x0091 + <OUT_N.> ) (2 bytes) | 0x001B (2 bytes) | CRC (2 bytes)

 

8- How to connect Multiple Sensor Interface to a PC by Serial Port (RS232/UART): Table of Contents

sch connect multiple sensor to RS232 PC
Diagram connect multiple sensor by RS232 to PC

To connect to a PC with the standard D-Sub9 port by RS232, you will need a Serial Port logic-level adapter (5V to 12V), because the the microprocessor of multiple sensor Interface works with TTL logic level (5V) and the PC serial port might work at higher voltages (Ex: 12V). Also the sensor board serial port connector are 2 pins (Rx, Tx), while the serial port of the PC is a D-Sub9 male connect (or also very common an USB-to-Serial adapter).

RS232 to TTL level converter/adapter
RS232 to TTL level converter/adapter

Steps for connecting PC RS232 to Multiple Sensor Board:

1- Connect the RX and TX of the voltage_adaptor(RS232_to_serial_TTL) to the Multiple Sensor.

2- The voltage_adaptor(RS232_to_serial_TTL) needs to be connected to power voltage of +5V, use for example the voltage from a USB port of the computer, this is connect +5V of a USB port to VCC of voltage_adaptor and GND of USB port to GND of voltage_adaptor.

NOTE IMPORTANT: Don't use the +5V and GND pins of the Multiple-Sensor board to supply the voltage to the voltage_adaptor(RS232_to_serial_TTL) because this could damage the Firmware(program) of the microprocessor and so cause some problems latter.

3- Connect the voltage_adaptor(RS232_to_serial_TTL) to the PC RS232 port (or the USB-to-Serial adapter).



9- How to connect Multiple Sensor Interface by RS485: Table of Contents

The Multiple Sensor Interface can be connected by RS485 since it includes 2 pins named 'A' and 'B' on connector J7 intended to connect a twisted pair cable used for RS485.

The Multiple Sensor Interface includes a MAX485E IC interfacing between the 'A','B' pins and the microprocessor UART. The Multiple Sensor Interface has on its firmware a Modbus compliant protocol adequate for typical applications with RS485.


..


Popular posts from this blog

Multiple-Sensor_Interface_logo.png

   Multiple-Sensor Interface (personal 'hobby' project)