Support Forums
Log RS232 string - ultrasonic wind sensor

I would like to log the wind data of an ultrasonic wind sensor type Young 81000, using a DT80 series 2 (most recent firmware installed). The wind sensor has been programmed as follows:

  • it waits for the poll string "MA!"
  • it responds with the following string: " 0.52 2.7 -4.4 16.87 0" meaning: windspeed, azimuth, elevation, temperature, error code format: real[m/s], real[deg], real[m], real[degC], integer[-].

The wind sensor is connected to DT80 serial port 2 (9 pins connector on the left of the logger). RS232 connections and port settings seem to be correct: when I program the wind sensor to output continuous results (without polling), and use the DeLogger5 command 'Text' > 'Serial Direct Mode' > '2SERIAL' then I observe a stream of output strings with correct wind speed, azimuth, elevation, temperature and error code zero.

So I conclude that hardware connections and settings are OK. The polling using the poll string 'MA!' does work because I tested it on a pc with a terminal server program. However, I don't manage to log the wind sensor output. FIRST PROGRAM: I try to log into individual variables:

'JOB=JOB1 
'COMPILED=2010/03/13 16:14:26 
'TYPE=dt80 
DT=\d 
BEGIN"JOB1" 
CATTN 
'Spans and polynomial declarations 
'Thermistor declarations 
'Switches declarations 'Parameter declarations
'Global declarations 
RS1S 
'schedule definition 
RA("B:",ALARMS:OV:100KB,DATA:OV:1MB)2S LOGONA GA 
2SERIAL("{MA!}%f[1CV]%f[2CV]%f[3CV]%f[4CV]%d[5CV]\e",=6CV,1.1) 
END 
'end of program file

The programs (I think) polls every 2 seconds with 'MA!' then waits at least 1.1s for sensor output (It takes the sensor 1s to generate data).

The result is a stream of error messages, every 2 seconds:

'Serial sensor scan error at control string position 13'

The variables are not filled nor stored on disk.

SECOND PROGRAM: I try to log into 1 string

'JOB=JOB1 
'COMPILED=2010/03/13 16:14:26 
'TYPE=dt80 
DT=\d BEGIN"JOB1" 
CATTN 
'Spans and polynomial declarations 
'Thermistor declarations 
'Switches declarations 
'Parameter declarations 
'Global declarations 
RS1S 
'schedule definition 
RA("B:",ALARMS:OV:100KB,DATA:OV:1MB)2S LOGONA GA 
2SERIAL("{MA!}%31s[1$]\e",=6CV,1.1) 
END 
'end of program file

This time, no error occurs, but again no wind data are logged nor displayed. I work exclusively with DeLogger, searched the manual and this forum but although I find similar topics, I did not find a solution how to do this exactly.

Many of the DeLogger options are not clear at all to me. Could anyone help how to do this exactly? I suppose that logging a digital sensor using the RS232 port has been successfully done before...

Thanks,
PME

I would like to log the wind data of an ultrasonic wind sensor type Young 81000, using a DT80 series 2 (most recent firmware installed). The wind sensor has been programmed as follows: - it waits for the poll string "MA!" - it responds with the following string: " 0.52 2.7 -4.4 16.87 0" meaning: windspeed, azimuth, elevation, temperature, error code format: real[m/s], real[deg], real[m], real[degC], integer[-]. The wind sensor is connected to DT80 serial port 2 (9 pins connector on the left of the logger). RS232 connections and port settings seem to be correct: when I program the wind sensor to output continuous results (without polling), and use the DeLogger5 command 'Text' > 'Serial Direct Mode' > '2SERIAL' then I observe a stream of output strings with correct wind speed, azimuth, elevation, temperature and error code zero. So I conclude that hardware connections and settings are OK. The polling using the poll string 'MA!' does work because I tested it on a pc with a terminal server program. However, I don't manage to log the wind sensor output. FIRST PROGRAM: I try to log into individual variables: ```` 'JOB=JOB1 'COMPILED=2010/03/13 16:14:26 'TYPE=dt80 DT=\d BEGIN"JOB1" CATTN 'Spans and polynomial declarations 'Thermistor declarations 'Switches declarations 'Parameter declarations 'Global declarations RS1S 'schedule definition RA("B:",ALARMS:OV:100KB,DATA:OV:1MB)2S LOGONA GA 2SERIAL("{MA!}%f[1CV]%f[2CV]%f[3CV]%f[4CV]%d[5CV]\e",=6CV,1.1) END 'end of program file ```` The programs (I think) polls every 2 seconds with 'MA!' then waits at least 1.1s for sensor output (It takes the sensor 1s to generate data). The result is a stream of error messages, every 2 seconds: ```` 'Serial sensor scan error at control string position 13' ```` The variables are not filled nor stored on disk. SECOND PROGRAM: I try to log into 1 string ```` 'JOB=JOB1 'COMPILED=2010/03/13 16:14:26 'TYPE=dt80 DT=\d BEGIN"JOB1" CATTN 'Spans and polynomial declarations 'Thermistor declarations 'Switches declarations 'Parameter declarations 'Global declarations RS1S 'schedule definition RA("B:",ALARMS:OV:100KB,DATA:OV:1MB)2S LOGONA GA 2SERIAL("{MA!}%31s[1$]\e",=6CV,1.1) END 'end of program file ```` This time, no error occurs, but again no wind data are logged nor displayed. I work exclusively with DeLogger, searched the manual and this forum but although I find similar topics, I did not find a solution how to do this exactly. Many of the DeLogger options are not clear at all to me. Could anyone help how to do this exactly? I suppose that logging a digital sensor using the RS232 port has been successfully done before... Thanks, PME

Good morning pme,

You are forgetting to read in the , that separate the data. You will need to use the Text > Skip > Literal string and , as the literal string.

You will probably need to generate

2SERIAL("{MA!}%f[1CV],%f[2CV],%f[3CV],%f[4CV],%d[5CV]\e",=6CV,1.1)

Cheers,
Roger

Good morning pme, You are forgetting to read in the , that separate the data. You will need to use the Text > Skip > Literal string and , as the literal string. You will probably need to generate ```` 2SERIAL("{MA!}%f[1CV],%f[2CV],%f[3CV],%f[4CV],%d[5CV]\e",=6CV,1.1) ```` Cheers, Roger

Roger,

Thank you for your answer. Could you detail when exactly the , is needed?
I notice you place it between the data, but not, for instance between the last %d[5CV] and the \e? The program works, the output contains lines as:

Date,Offset,Schedule,A.ws,A.wd,A.as,A.ggg,A.eror code
2010/03/15 13:44:58;0.309570;A;0,05;43,4;0;17,84;0
2010/03/15 13:44:59;0.097290;A;0,05;43,4;0;17,83;0

Is there a way I could omit the offset from the output?

Thank you very much,
pme

Roger, Thank you for your answer. Could you detail when exactly the , is needed? I notice you place it between the data, but not, for instance between the last %d[5CV] and the \e? The program works, the output contains lines as: ```` Date,Offset,Schedule,A.ws,A.wd,A.as,A.ggg,A.eror code 2010/03/15 13:44:58;0.309570;A;0,05;43,4;0;17,84;0 2010/03/15 13:44:59;0.097290;A;0,05;43,4;0;17,83;0 ```` Is there a way I could omit the offset from the output? Thank you very much, pme

Good morning pme,

The , is the data separator. The , is often chosen because it is a commonly used in programs like Microsoft Excel, data bases etc.

You have to tell the DT80 what to read in and what to skip over. Looking at your sample data the sequence is number, number, number etc.
The %f reads a floating point number then skip the , then read the next number etc. When you reached the end of the line the \e will simply delete the rest of the input buffer.

I would prefer you had the \e before sending the poll command as this will make sure there are no stray characters in the input buffer before we start parsing. With the way your code is if a stray char is in the input buffer when you send the poll command the parsing will fail.

Cheers,
Roger

Good morning pme, The , is the data separator. The , is often chosen because it is a commonly used in programs like Microsoft Excel, data bases etc. You have to tell the DT80 what to read in and what to skip over. Looking at your sample data the sequence is number, number, number etc. The %f reads a floating point number then skip the , then read the next number etc. When you reached the end of the line the \e will simply delete the rest of the input buffer. I would prefer you had the \e before sending the poll command as this will make sure there are no stray characters in the input buffer before we start parsing. With the way your code is if a stray char is in the input buffer when you send the poll command the parsing will fail. Cheers, Roger
26
3
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft