F900/UAS Interface Manual

F900/UAS Serial Data Input/Output User Spec
F900/UAS Interface Manual
Degree Controls Inc.
18 Meadowbrook Drive
Milford, NH 03055
USA
Tel: (603) 672-8900
Fax: (603) 672-9565
www.degreec.com
Document Revision History:
Date
Version
Change
January 2005
1.0
Original
March 2005
1.1
Added address mode in section 4
August 2006
1.2
Added switch mode in section 6
November 10, 2006
1.3
Corrected color on RX/TX data lines Section 1.1
July 26, 2007
1.4
Add humidity and pressure compensation information
07/27/07
Page 1/20
F900/UAS Serial Data Input/Output User Spec
Table of Contents
1.0 Electrical Interface Protocol of F900:....................................................................4
1.1 Connector on F900 series sensor.......................................................................4
1.2 UAS Interface.....................................................................................................4
2.0 Connection Via Serial Terminal:............................................................................5
3.0 Valid Serial Commands:.........................................................................................6
3.1 *E Command ....................................................................................................6
3.2 *V Command......................................................................................................7
3.2.1 XML output..................................................................................................7
3.3 *X Command ....................................................................................................7
3.4 *0 Command .....................................................................................................8
3.5 CRC 16 Value.....................................................................................................8
3.5.1 CRC 16 Example code.................................................................................8
4.0 Multiple sensors on a serial bus (Address Mode F900 Only)................................10
4.1 Assigning address to sensors...........................................................................11
4.2 Addressing Sensors and Getting Data..............................................................11
4.3 HELP Lost sensor address...............................................................................12
4.4 Turning Off Address Mode...............................................................................12
5.0 F900/UAS Sensor Sample Rate Configuration.....................................................13
5.1 Averaging Internal Operation:......................................................................13
5.2 Why do you want averaging?........................................................................13
5.3 When to select shorter averaging periods....................................................13
5.4 How to configure the number of samples to take and averaging period.......13
5.5 Example Setting The Number of samples to 512 (0.853s)............................14
6.0 Airflow switch mode (F900 Only).........................................................................16
6.1 Airflow switch mode internal algorithm. ......................................................16
6.2 Switch example 1: Set switch point to 1m/s in normal mode.......................16
6.3 Switch example 2: Set low switch point to 1m/s and high switch point to 3
m/s in normal mode. 1m/s hysteresis................................................................18
6.4 Switch Example 3: Set low switch point to 3m/s and high switch point to 1
m/s in inverted mode 1m/s hysteresis................................................................19
6.5 Disable airflow switch mode, and use to linear output...............................20
7.0 Pressure and Humidity Compensation (F900 and UAS)......................................21
Note:
In this document type in Italics is data sent to the sensor via the serial connection.
<CR> is carriage return.
07/27/07
Page 2/20
F900/UAS Serial Data Input/Output User Spec
1.0 Electrical Interface Protocol of F900:
The Digital Input/Output is RS232 without the level shift. With 5 Volt logic.
Placing a external RS-232 or RS-422 level shift makes the device fully RS-232 or RS485 compliant.
Without the level shift, the customer may hook the digital Input/Output pins directly
to their UART (universal asynchronous receiver-transmitter), or microprocessor.
The UART can handle input of 0-3.3V or 0 – 5 Volts. The UART output is in the 05V range. The output is normally high through internal pull up resistors and pulled
low when active.
We offer a optional RS-232 Level shifter on a demonstration board.
1.1 Connector on F900 series sensor
Pin
Color
Connection
1 Black
Ground. Power Supply and Output Return
2 Red
Power Supply 7-13 Volts DC
3 White
Linear Velocity Output Signal 4V Full scale. 5V MAX
4 Orange
RX. Digital Input. RS-232 Protocol without level shift. TTL 0-5V
5 Yellow
TX. Digital Output. RS-232 Protocol without level shift. TTL 0-5V
1.2 UAS Interface
The UAS interface is USB 2.0 full speed compliant.
07/27/07
Page 3/20
F900/UAS Serial Data Input/Output User Spec
2.0 Connection Via Serial Terminal:
When the UAS series sensor is connected to a USB port, or the F900 is properly level
shifted to RS-232, RS-422, RS-485, etc. The sensor may be connected via a serial
terminal program such as Hyper Terminal, minicom, or Procomm. Serial port
settings are 19200 BPS 8N1.
Settings:
19200 Bits Per Second.
Eight data bits.
No parity
1 stop bit.
No Flow Control
Illustration 1: Hyper Terminal Parameters
07/27/07
Page 4/20
F900/UAS Serial Data Input/Output User Spec
3.0 Valid Serial Commands:
The F900 series works in polled mode as a slave. It will only respond to requests for
information.
Commonly used commands overview:
Command
Description
*E
Get Time, Airflow, Temperature and CRC16
*V
Get Airflow and Temperature in XML format.
*0
Reset Command
@Address
Address a specific sensor in address mode (only use this
on F900, do not use for UAS)
3.1 *E Command
The *E command will provide the time, velocity and temperature
Example:
*E
0:01:31.62 0.344 19.44!CRC=0xC8EF
The output format is:
HH:MM:SEC (velocity in m/s) (Temp in degrees C ) ! (CRC16 value)
Data
Explanation
HH
Hours since sensor power on
MM
Minutes
SEC
Seconds !NOTE! The part after the decimal point is 64ths of a
second, not 100ths
Temp
Temperature in Degrees C
Velocity
Air Velocity in meters per second.
!
Terminates the data
07/27/07
Page 5/20
F900/UAS Serial Data Input/Output User Spec
Data
CRC=XXXX
Explanation
CRC16 of the Data Starting from the first hour char up and
including the !
The CRC16 value provides the CRC value of the data up to and including the "!". It
does not include the *E that would be echoed back to you if the echo is on. the echo
would come back, before the data.
3.2 *V Command
The *V command will output velocity and temperature data, in XML format.
Example:
<SD>
<VEL Units=”m/s”>1.234</VEL>
<TEMP Units=”C”>21.5</TEMP>
</SD>CRC=0x1234
The *V command provides the CRC 16 Value of the all data of the <SD> through
</SD>
3.2.1 XML output
The sensor output will be in XML format as specified by ISO 8879
http://www.w3.org/XML/
3.3 *X Command
This command only provided backwards compatibility to Accutrac version 4.0 and
higher, and in general should not be used.
Format is:
Hour Minute Seconds.Fraction_64 Flow_FPM Temp_Deg_C
Example:
07/27/07
Page 6/20
F900/UAS Serial Data Input/Output User Spec
*X
0 1 31.12 520 15.00
The part after the decimal point of the seconds is in 1/64 of a second.
3.4 *0 Command
This command can be used to reset the sensor. Can be used for commands that only
take effect after the sensor has been reset, instead of cycling the power.
Example:
*0
Sensor Startup V 1.3.0
www.degreec.com
3.5 CRC 16 Value
With the *V command, the CRC is a CRC 16 that includes all the data including the
<SD> and the </SD>. This will include carriage returns(CR) and new
lines(linefeed/LF). Since the CRC16 includes carriage returns and newlines, if using
a PC, you must take care to set you set the serial port in RAW mode. No CR-->LF
or LF-->CR translation .
3.5.1 CRC 16 Example code
// with this example function you pass in the data
// return is the CRC16
unsigned short int SensorClass::CalcCRC16(string CRCData)
{
unsigned short crc = 0xFFFF; unsigned short temp;
unsigned short quick;
unsigned char byte;
for(unsigned int i=0; i < CRCData.size(); i++)
{
byte=CRCData[i];
temp = (crc >> 8) ^ byte;
crc <<= 8;
quick = temp ^ (temp >> 4);
crc ^= quick;
07/27/07
Page 7/20
F900/UAS Serial Data Input/Output User Spec
quick <<= 5;
crc ^= quick;
quick <<= 7;
crc ^= quick;
} return crc;
}
07/27/07
Page 8/20
F900/UAS Serial Data Input/Output User Spec
4.0 Multiple sensors on a serial bus (Address Mode F900
Only)
It is possible to have multiple sensors on a serial bus. This is possible becase the
UART output is normally pulled high via internal pull up resistors. The active
transmitting sensor then pulls the line low. In this mode, the echo of characters
Steps to enable this mode are:
1. Program Address with single sensor connected
2. Reset Sensor (Cycle power or send *0)
3. Put sensor on serial bus with multiple sensors.
4. Address sensor with @Address
5. Send command to get velocity *E
Block Diagram of multiple sensors:
Notes:
1. When in address mode, the sensor will never echo input
2. To set address use Command: *W43<CR>[Address]<CR>
3. To address sensor @[Address]
4. All sensors will respond to address 12345 (Command: “@12345”)
5. Addresses Between 1 and 10000 are valid.
6. Every sensor on the same serial lines must have a unique address.
07/27/07
Page 9/20
F900/UAS Serial Data Input/Output User Spec
4.1 Assigning address to sensors
(Note <CR> in this document is the Carriage return on the keyboard)
The format to set the address is *W43<CR>[Address]<CR>
To assign an address of 1 you need to send *W43<CR>1<CR>
For this to take effect the sensor will have to be reset, by either cycling the power or
sending *0
After reset the sensor will only respond after addressed with @[Address]
Example setting the address to 2
Computer Sends Command:
Sensor Responds:
Computer Sends Address:
Sensor Responds:
Computer Sends Reset Command:
*W43<CR>
P#=43
Val-->
2<CR>
P#43=2
*0
4.2 Addressing Sensors and Getting Data
To address the sensor send the Command @[Address]
For example to address sensor with the address of 1 and 2 and to get the data from
each.
Controller Sends:
Sensor 1 Responds:
Controller Sends:
Sensor 1 Responds:
Controller Sends:
Sensor 2 Responds:
Controller Sends:
Sensor 2 Responds:
07/27/07
@1<CR>
Addr=1<CR>
*E
0:01:31.62 0.344 19.44!CRC=0xC8EF<CR>
@2<CR>
Addr=2<CR>
*E
0:02:14.35 0.349 18.37!CRC=0x5CAD<CR>
Page 10/20
F900/UAS Serial Data Input/Output User Spec
4.3 HELP Lost sensor address
In case you forget what address you assigned to a sensor, you can address sensor
12345 to which any sensor will respond. Take care not to use this when multiple
sensors are connected.
Below is an example to reset a sensor with unknown address to 3.
Controller Sends:
Sensor Responds:
Computer Sends Command:
Sensor Responds:
Computer Sends Address:
Sensor Responds:
Computer Sends Reset Command:
@12345<CR>
Addr=12345<CR>
*W43<CR>
P#=43
Val-->
3<CR>
P#43=3
*0
4.4 Turning Off Address Mode
If you enabled address mode and wish to disable it. You may hook up a single sensor
and set the address to 4294967295
Controller Sends:
Sensor Responds:
Computer Sends Command:
Sensor Responds:
Computer Sends Address:
Sensor Responds:
Computer Sends Reset Command:
Sensor Responds:
07/27/07
@12345<CR>
Addr=12345<CR>
*W43<CR>
P#=43
Val-->
4294967295<CR>
P#43=4294967295
*0
Sensor Startup V 1.1.0
www.degreec.com
Page 11/20
F900/UAS Serial Data Input/Output User Spec
5.0 F900/UAS Sensor Sample Rate Configuration
Note:
In this document type in Italics is data sent to the sensor.
<CR> is carriage return.
5.1 Averaging Internal Operation:
Internally the sensor samples at 300 Hz. This can not be changed. What can be
changed is the number of samples to average over. It is configurable from 8 samples
to 512 Samples. This effectively has the sensor averaging readings between a
configurable 0.0104 and 1.7067 Seconds.
5.2 Why do you want averaging?
Averaging can smooth out turbulence in the air flow readings. Having this done
internally closest to the signal source will have the greatest benefits. Averaging will
also have the effect of removing signal noise. If your application does not need a
very fast response rate, it is recommended to keep the default 1.7 Seconds averaging
on. Turbulent flow can produce large variations in measurement, averaging this
turbulence out will provide a more stable reading.
Note: Fans can produce very turbulent flow.
5.3 When to select shorter averaging periods
When you need data quickly and may be trying to measure turbulence.
5.4 How to configure the number of samples to take and
averaging period
1. Write using the “*W145” command to page 145 of the sensor internal flash
memory.
2. Write the correct value to the memory listed in the Table below
07/27/07
Page 12/20
F900/UAS Serial Data Input/Output User Spec
Value to write with *W145
#of Samples at 300Hz
Time Period
4294967295
512 (Default)
1.71 Seconds
393728
512
1.71 Sec
327936
256
0.853 Sec
262272
128
0.467 Sec
196672
64
0.213 Sec
131104
32
0.107 Sec
65552
16
0.0533 Sec
8
8
0.0267 Sec
3. Use the *R145 Command to verify the contents of the memory.
4. Use the *0 Command to reset the senor and the changes will take effect.
5.5 Example Setting The Number of samples to 512 (0.853s)
1. Computer Sends: *W145<CR>
2. Sensor Responds:
*Wpage->:145
P#=145
Val-->
3. Computer Sends: 393728<CR>
4. Sensor Responds:
P#145=393728
5. Computer Sends: *R145<CR>
6. Sensor Responds:
P#145=393728<CR>
7. Computer Sends: *0
8. After 2 Second Reset Computer Responds:
Sensor Startup V 1.0.2
www.degreec.com
!!!SPEED NOTE For commands longer than 7 characters !!!
The internal sensor microprocessor is not fast enough and does not have enough
input buffer space to handle all the date sent continuously. It is advised to delay
0.03 seconds between every character sent, if this is done by another processor.
07/27/07
Page 13/20
F900/UAS Serial Data Input/Output User Spec
The configuration should be read back to confirm the correct setting by sending the
read command “*R145”
Example C++ code of wring the command strings slowly:
bool SerialClass::WriteStrSlow(string Data)
{
char Buffer[2];
int Ret_Code;
Buffer[0]=0; // char
Buffer[1]=0; // null terminate
if(Debug)
cout << "sending Data-->" << Data << "<--" << endl;
for (unsigned int i=0; i < Data.size(); i++)
{ // send one char at a time
Buffer[0]=Data[i];
Ret_Code=write(fd,Buffer,1);
if (Ret_Code < 1 )
return false; // error writing. errno set
usleep(30000); // delay between char
}
}
return true;
07/27/07
Page 14/20
F900/UAS Serial Data Input/Output User Spec
6.0 Airflow switch mode (F900 Only)
In this mode, the airflow sensor linear analog output is disabled, and the sensor
analog output is either high(5V) or low (0V) depending on if you are either above
or below a the set points. Hysteresis can be programmed.
Airflow switch overview:
●
●
●
●
●
●
●
To configure this option you must manually write to Memory Page 54 (*W54
Command)
Memory Page 54 is a 32 bit memory page.
High 16 bits, is high flow switch point. (Nomenclature here as Page 54.1)
Low 16 bits is low flow switch point (Nomenclature here as Page 54.0)
Normal Mode:
● Output High (4.6 Volts - 5 Volts) when above high set point.
● Output Low (0 Volts - 0.1 Volts) when below low set point.
Inverted Mode (When low set point is higher then high set point):
● Output High (4.6 Volts - 5 Volts) when below high set point.
● Output Low (0 Volts - 0.1 Volts) when above low set point.
Switch point settings must be set in mm/s (millimeters per second)
● To convert: (Value in feet/minute) / 0.19685 = (Value in mm/s)
6.1 Airflow switch mode internal algorithm.
if (page 54 == 0xFFFFFFFF) we are in normal linear flow mode,else in switch mode
In switch mode:
If (page 54.0 < page 54.1) { // normal mode
Set Output 0V when airflow < page 54.0
Set Output 5V when airflow > page 54.1
} else { // 54.0 >= 54.1 // inverted mode
Set Output 5V when airflow < page 54.1
Set Output 0V when airflow > page 54.0
}
6.2 Switch example 1: Set switch point to 1m/s in normal mode
1m/s = 1000 mm/s = 0x03e8 (Value of high 16 bits)
07/27/07
Page 15/20
F900/UAS Serial Data Input/Output User Spec
0.999m/s = 999 mm/s = 0x03e7 (Value of low 16 bits)
Page #54 value to write = 0x03e803e7 = 65536999.
The decimal value 65536999 must be written to page 54.
Sent to sensor
Received from sensor
*W<CR>
Description
Send command to write page
*WPage->:
54<CR>
Sensor responds with prompt
Page 54
P#=54
Sensor Response
Val-->
65536999<CR>
65536999
Input value, sensor echoes
P#54=65536999
Sensor displays value
*R54<CR>
Send command to read page and
verify read value
P#54=65536999
07/27/07
Sensor response
Page 16/20
F900/UAS Serial Data Input/Output User Spec
6.3 Switch example 2: Set low switch point to 1m/s and high
switch point to 3 m/s in normal mode. 1m/s hysteresis
3m/s = 3000 mm/s = 0x0BB8
1m/s = 1000 mm/s = 0x03e8
Page #54 value to write = 0x0BB803e8 = 196609000
Sent to sensor
Received from sensor
*W<CR>
Description
Send command to write page
*WPage->:
54<CR>
Sensor responds with prompt
Page 54
P#=54
Sensor Response
Val-->
196609000<CR>
196609000
Input value, sensor echoes
P#54=196609000
Sensor displays value
*R54<CR>
Send command to read page and
verify read value
P#54=196609000
07/27/07
Sensor response
Page 17/20
F900/UAS Serial Data Input/Output User Spec
6.4 Switch Example 3: Set low switch point to 3m/s and high
switch point to 1 m/s in inverted mode 1m/s hysteresis
In this switch mode, the sensor output will go to 0 Volts if air flow is above 3 m/s. If
air flow is below 1m/s the output will be at 5 volts.
1m/s = 1000 mm/s = 0x03e8 (high page)
3m/s = 3000 mm/s = 0x0BB8 (low page)
Page #54 value to write = 0x03e80BB8 = 65539000
Sent to sensor
Received from sensor
*W<CR>
Description
Send command to write page
*WPage->:
54<CR>
Sensor responds with prompt
Page 54
P#=54
Sensor Response
Val-->
65539000<CR>
65539000
Input value, sensor echoes
P#54=65539000
Sensor displays value
*R54<CR>
Send command to read page and
verify read value
P#54=65539000
07/27/07
Sensor response
Page 18/20
F900/UAS Serial Data Input/Output User Spec
6.5 Disable airflow switch mode, and use to linear output
When all 32 bits of Page 54 are 1's the switch mode is disabled. So we need to send
hex value 0xFFFFFFFF which is 4294967295 in decimal.
To disable airflow switch mode, and go back to linear output send:
Sent to sensor
Received from sensor
*W<CR>
Description
Send command to write page
*WPage->:
54<CR>
Sensor responds with prompt
Page 54
P#=54
Sensor response
Val-->
4294967295<CR>
4294967295
Input value, sensor echoes
P#54=4294967295
Sensor displays value
*R54<CR>
Send command to read page and
verify read value
P#54=4294967295
07/27/07
Sensor response
Page 19/20
F900/UAS Serial Data Input/Output User Spec
7.0 Pressure and Humidity Compensation (F900 and
UAS)
The F900 and UAS1000 series sensors are compensated in calibration for correct
velocity flow reading at 1 atmosphere of pressure (1013.25 hecto Pascals) , 0
Degrees Celsius, and 0 % RH. This conforms to ISO 10780, the IUPAC standard
prior to 1982, and "NIST Standard Reference Data Base 7 Users Guide", December
1969, NIST, Gaithersburg, MD, USA.
Reference:
http://en.wikipedia.org/wiki/Standard_temperature_and_pressure
To calculate the pressure and humidity compensated reading, use the following
equation:
Note that the F900 and UAS are hot wire type, mass flow sensors. In some
applications, what the user really wants to know, is mass flow referenced to standard
pressure. One example is in some cooling applications, you may not want to
compensate, so you know the air flow rate as if it were standard pressure air.
07/27/07
Page 20/20