Hey guys.
I'm trying get measurements from a WXT520 in NMEA format using a CR800 but I've never done it before. The WXT communications settings is described as follows:
Setting Fields
a = Device address
XU = Device settings command in ASCII and NMEA 0183
XXU = Device settings command in SDI-12
[A] = Address: 0 (default) ... 9, A ... Z, a ... z
[M] = Communication protocol:
A = ASCII, automatic
a = ASCII, automatic with CRC
P = ASCII, polled
p = ASCII, polled, with CRC
N = NMEA 0183 v3.0, automatic
Q = NMEA 0183 v3.0, query (= polled)
S = SDI-12 v1.3
R = SDI-12 v1.3 continuous measurement
[T] = Test parameter (for testing use only)
[C] = Serial interface: 1 = SDI-12, 2 = RS-232, 3= RS-485,
4 = RS-422
[I] = Automatic repeat interval for Composite data
message:1 ... 3600 s, 0 = no automatic repeat
[B] = Baud rate: 1200, 2400, 4800, 9600, 19200, 38400,
57600, 115200
[D] = Data bits: 7/8
[P] = Parity: O = Odd, E = Even, N = None
[S] = Stop bits: 1/2
[L] = RS-485 line delay: 0 ... 10000 ms
Defines the delay between the last character of the
query and the first character of the response message
from WXT520. During the delay, the WXT520's
transmitter is disabled. Effective in ASCII, polled
and NMEA 0183 query protocols. Effective when
RS-485 is selected (C = 3).
[N] = Name of the device: WXT520 (read only)
[V] = Software version: for example, 1.00 (read only)
<cr><lf> = Response terminator
Can anyone show me the right parameters that I have to set into the WXT and a CRBasic program routine that will get the string sent?
Reading in NMEA strings on a CR800 is fairly easy.
Here is a piece of code for reading in a GPCTD NMEA 0183 string:
'VVV#######GPCTD#########VVV
'Get the latest GPCTD output message
SerialInRecord (Com1,gpctd_string_in,0,26,&H0D0A,bytes_ret_GPCTD,01) '26 bytes long before <CR><LF>: pp.ppppp,ttt.tttt,cc.ccccc
'Parse the incoming PortB serial strings
SplitStr (gpctd_out(1),gpctd_string_in,",",3,5)
'^^^#######GPCTD#########^^^
The important piece not shown is that you need to also use SerialOpen to open Com1 at the same baud rate as the WXT520.
Regarding how to configure the WXT520 to output NMEA data, it would be best to contact Vaisala customer support.
Thanks for the reply. But I still have some questions unanswered.
Q1: in your instruction, which type do you have declared the variable: gpctd_string_in and the variable :bytes_ret_GPCTD,01 ?
Q2: Here are the strings that the station is sending to me :
0R2,Ta=26.5C,Tp=26.7C,Ua=37.1P,Pa=1.0190B
0R1,Dn=093D,Dm=208D,Dx=267D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R1,Dn=093D,Dm=205D,Dx=267D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R3,Rc=0.00M,Rd=0s,Ri=0.0M,Hc=0.0M,Hd=0s,Hi=0.0M,Rp=0.8M,Hp=0.0M
0R5,Th=26.7C,Vh=12.1N,Vs=14.3V,Vr=3.480V
0R1,Dn=093D,Dm=209D,Dx=267D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R2,Ta=26.6C,Tp=26.7C,Ua=37.1P,Pa=1.0189B
0R1,Dn=092D,Dm=202D,Dx=267D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R1,Dn=092D,Dm=203D,Dx=021D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R3,Rc=0.00M,Rd=0s,Ri=0.0M,Hc=0.0M,Hd=0s,Hi=0.0M,Rp=0.8M,Hp=0.0M
0R5,Th=26.5C,Vh=12.1N,Vs=14.3V,Vr=3.479V
0R1,Dn=092D,Dm=206D,Dx=021D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R2,Ta=26.6C,Tp=26.7C,Ua=37.0P,Pa=1.0189B
0R1,Dn=092D,Dm=199D,Dx=021D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R1,Dn=021D,Dm=198D,Dx=267D,Sn=0.0M,Sm=0.1M,Sx=0.2M
0R3,Rc=0.00M,Rd=0s,Ri=0.0M,Hc=0.0M,Hd=0s,Hi=0.0M,Rp=0.8M,Hp=0.0M
How do I get these strings ? please help me . This is very important
Best regards.
It would be simplest to configure the sensor for SDI-12 mode and follow the typical instructions for reading in the data.
It would indeed. But I have already tryed to do that and doesn't work too. That's the why I'm trying to use the NMEA and ASCII formats now. I've made contact with Vaisala's support but without success. They don't know why the WXT is not answering in SDI12.
To get the WXT520 to work in SDI12 mode, there are several settings which need to be set.
SDI-12 must be 7 data bits, even parity, 1 stop bit, 1200 baud.
The WXT520 does not automatically set those parameters when you switch it to SDI-12 mode. You must set all of those parameters, and enable SDI-12 mode on the WXT520.
With SDI-12 on the WXT520, both the Tx and Rx wires need to be connected to the SDI-12 terminal.
I know everything that you just said . And again it doesn't work . earlier I read a post from a guy which happened the same thing . I'm done with SDI12 tries. I wanna try the NMEA and ASCII formats .
please help me .
which values do I have to put in the beginword and endword at the serialinrecord instruction to make my CR800 read a string like that:
0R3,Rc=0.00M,Rd=0s,Ri=0.0M,Hc=0.0M,Hd=0s,Hi=0.0M,Rp=0.8M,Hp=0.0M
The output the sensor is currently outputting is not a NMEA format.
If you do want to use an ASCII output, I suggest changing the sensor to output the NMEA format. With the current output from the sensor, your program would be a lot more complicated.
Ok. I've changed the format to NMEA.
The Strings sent by WXT are listed below:
$WIMWV,174,R,0.8,M,A*34
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIMWV,174,R,0.8,M,A*34
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIXDR,V,0.00,M,0,Z,0,s,0,R,0.0,M,0,V,0.0,M,1,Z,0,s,1,R,0.0,M,1,R,1.9,M,2,R,0.08
$WIMWV,174,R,0.7,M,A*3B
$WIXDR,C,26.3,C,2,U,0.0,N,0,U,14.2,V,1,U,3.480,V,2*45
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIXDR,C,26.8,C,0,C,26.6,C,1,H,36.4,P,0,P,1.0168,B,0*5A
$WIMWV,177,R,0.7,M,A*38
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIMWV,176,R,0.7,M,A*39
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIXDR,V,0.00,M,0,Z,0,s,0,R,0.0,M,0,V,0.0,M,1,Z,0,s,1,R,0.0,M,1,R,1.9,M,2,R,0.08
$WIMWV,180,R,0.8,M,A*3F
$WIXDR,C,26.3,C,2,U,0.0,N,0,U,14.2,V,1,U,3.480,V,2*45
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
$WIXDR,C,26.8,C,0,C,26.6,C,1,H,36.5,P,0,P,1.0168,B,0*5B
$WIMWV,182,R,0.9,M,A*3C
$WIXDR,C,26.3,C,2,U,0.0,N,0*7E
here is the WXT network settings:
0XXU!0XXU,A=0,M=N,T=0,C=2,I=5,B=19200,D=8,P=O,S=1,L=25,N=WXT520,V=2.21
and here are the meaning of each field name
XXU = Device settings command in SDI-12
[A] = Address: 0 (default) ... 9, A ... Z, a ... z
[M] = Communication protocol:
A = ASCII, automatic
a = ASCII, automatic with CRC
P = ASCII, polled
p = ASCII, polled, with CRC
N = NMEA 0183 v3.0, automatic
Q = NMEA 0183 v3.0, query (= polled)
S = SDI-12 v1.3
R = SDI-12 v1.3 continuous measurement
[T] = Test parameter (for testing use only)
[C] = Serial interface: 1 = SDI-12, 2 = RS-232, 3= RS-485,4 = RS-422
[I] = Automatic repeat interval for Composite data
message:1 ... 3600 s, 0 = no automatic repeat
[B] = Baud rate: 1200, 2400, 4800, 9600, 19200, 38400,
57600, 115200
[D] = Data bits: 7/8
[P] = Parity: O = Odd, E = Even, N = None
[S] = Stop bits: 1/2
[L] = RS-485 line delay: 0 ... 10000 ms
Defines the delay between the last character of the
query and the first character of the response message
from WXT520. During the delay, the WXT520's
transmitter is disabled. Effective in ASCII, polled
and NMEA 0183 query protocols. Effective when
RS-485 is selected (C = 3).
[N] = Name of the device: WXT520 (read only) [V] = Software version: for example, 1.00 (read only)
<cr><lf> = Response terminator
And here is a program that I've just made which simulates a serial sensor. Its work well
Public PTemp, batt_volt
Public RawString As String * 30,
Public SplitStrings(3) As String * 16, FloatValue, IntegerValue As Long
Public NBytesReturned
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable
BeginProg
SerialOpen (Com1,4800,18,0,50)
SerialOpen (Com2,4800,18,0,50)
Scan (5,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
SerialInRecord (Com1,RawString,&h02,0,&h0D03,NBytesReturned,01)
SplitStr (SplitStrings(),RawString,",",3,5)
FloatValue=SplitStrings(1)
IntegerValue=SplitStrings(2)
CallTable Test
NextScan
SlowSequence
Scan (1,Sec,3,0)
SerialOut(Com2,CHR(2)&"1234E+04,1234,abcd"&CHR(13)&CHR(3),"",0,100)
NextScan
EndProg
I think that if I do some changes( baud rate , parity, stopbits, rawstring, Nbytes etc.) on this program, I will be able to read the data from WXT.
It is odd that the number of parameters of the WIXDR message is changing.
Here is a program to read in the wind data from the WIMWV message. It should give you an idea on what needs to be done with the other parameters.
Public WindSpeed, WindDirection
Dim rawString As String * 100
Public PTemp, batt_volt
Dim tempStrings(25) As String
Dim bytesReadIn As Long
'Define Data Tables.
DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate.
DataInterval (0,15,Min,10)
WindVector (1,WindSpeed,WindDirection,IEEE4,False,0,0,1)
Minimum (1,batt_volt,FP2,False,False)
Sample (1,PTemp,FP2)
EndTable
'Main Program
BeginProg
'8 data bits, odd parity
SerialOpen (Com1,19200,1,0,500)
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
Do While SerialInChk(com1)
SerialInRecord (Com1,rawString,36,0,13,bytesReadIn,11) 'Read in a line between $ and carriage return
If bytesReadIn = 0 Then ExitDo
SplitStr(tempStrings(),rawString,",",25,5) 'Break into small strings off of commas
If InStr (1,tempStrings(1),"WIMWV",2) Then
'array holds the broken up WIMWV message $WIMWV,180,R,0.8,M,A*3F
WindDirection = tempStrings(2)
WindSpeed = tempStrings(4)
EndIf
'Add similar block to break up other message types.
Loop
'Enter other measurement instructions
'Call Output Tables
CallTable Test
NextScan
EndProg
Thanks for your help. I'll try and come back with a report soon.
regards,
Hi again.
Thank you for your help. The program works. I'm very happy rs. The work time is ending today.
After tomorrow I'll give you more details.
Hi again.
Thank you for your help. The program works. I'm very happy rs. The work time is ending today.
After tomorrow I'll give you more details.
Best regards!
Hi JDavis.
As I just said previously, I'm getting the strings from WXT weather station now. And again, thanks for helping me.
I've made some alterations and it was like you've said.
About the WIXDR changes is because one sends the temperature,pressure and relative humidity measurements and the other sends the precitpitation measurements.
I'll bring you some questions soon. I promise
Best regards.
Hi. I am having the same issue where the data logger is not reading the WXT520. I have done some of the steps mentioned in this forum (using SDIrecorder command etc..), how do I know if the sensor is set to SDI-12 mode? how do I set it at all?
When connected to the data logger (CR850) through Dev. Config. Utility, I try to communicate to the sensor through the terminal tab. I type in a command (such as ?! or M!) and nothing happens.
I would like to use the sensor as an SDI-12 but how do I check to see if it is set and if not, how do I set it? I can send a sample of my program if needed.
Thanks!
To query the settings of the WXT in SDI12, if in fact you have it connected correctly, use the terminal emulator in DevCfg and enter the following command (assuming the device address is 0). To check the address, ?! should give you the answer.
0XXU! (0XU CR/LF) if in RS232 mode
Response should be something like this:
0XXU,A=0,M=P,T=0,C=2,I=0,B=19200,D=8,P=N,S=1,L=25,N=WXT510,V=1.00
M = S for SDI-12 or P = ASCII, polled
C = 1 for SDI-12 or 2 = RS-232
B= Baud Rate
D= Data bits
P= Parity
S=Stop Bits
The BLU and WHT wires of the standard Vaisala cable need to be in C1, C2, C3 or C4, whichever port you are issuing the SDI command on.
Thank you for your reply. I have done all this.
I also have sent it commands to query the data messages such as wind, temp, precip, and composite messages and the sensor just returns a 5 digit number. the number is slightly different for each command however it IS ONLY five digits (i.e. 00063, 00006) NOT a long string of alphanumeric values.
The address and setting configuration string come up (like shown above) but NOT the data messages. When I try to retrieve data messages, it does not give me a string of alphanumeric values but only a 5 digit numeric value.
When I check the public values, it gives some insanely small number (....e^-44) however it does not write all these values to the table although the sampling rates and archival rates coincide.
Just to reiterate: The wiring is correct, the program is correct (given what I have seen here and what campbell has instructed) everything is connected properly, the sensor is set to SDI 12. I'm not sure what else I am missing.
Have you attempted to connect to the sensor with the programming cable and Vaisala software to confirm it can communnicate at all?