This topic is about reading soil moisture sensor Trime-Pico (type 32 or 64) from IMKO Micromodultechnik using dataTaker:
https://www.imko.de/en/trime-pico-32/
https://www.imko.de/en/trime-pico-64/
There are 5 required components to construct a poll syntax:
- ASCII syntax action write (hexadecimal 15)
- ASCII syntax action read (hexadecimal 14)
- ASCII syntax measurement (hexadecimal 16)
- sensor serial number (i.e.: 41607)
- CRC calculator (i.e.: http://www.datastat.com/sysadminjournal/maximcrc.cgi)
The syntax structure in hexadecimal as follows:
- FD is the first byte which is the poll header
- the second byte is action syntax (you will need to use 15 or 14) in different sequence
- 03 is the third byte which is 3 byte length (possibly related to sensor serial number)
- the fourth to sixth byte are related to an inverse hexadecimal of sensor serial number. In the above case 41607 is A287 hexadecimal, we can write it as 00A287 and the inverse is 87A200
- the seventh byte is CRC check for the first sixth byte (i.e: FD150387A200). You can copy this series of string to CRC calculator to get the number which is B4
- there is a space between seventh and eighth byte
- the eighth byte depend on the usage of second byte: 06 for action write/ read, FF for measurement
- the ninth byte is always 00
- the tenth byte depend on the usage of second byte: 01 for action write, CRC check for action read/ measurement
- the eleventh byte is CRC check for action write
Thus we can find ourselves with 3 different set of syntax:
- Action write: FD150487A200FF 0600018F
- Action read: FD140387A200B4 0600AA
- Measurement: FD160387A20037 FF0081
When triggering a measurement, Trime-Pico follow this sequence:
- send action write syntax
- check the eighth byte of response using action read syntax, if that byte has 01 value the measurement is not ready
- when the eighth byte of action read has 00 value, send measurement syntax.
Action Write
FD150487A200FF 0600018F
00150087A200C9
Action Read
FD140387A200B4 0600AA
00140287A20003015E
Action Read
FD140387A200B4 0600AA
00140287A20003015E
Action Read
FD140387A200B4 0600AA
00140287A200030000
Measurement...
FD160387A20037 FF0081
00164187A200E84F02000039FF134439FF13449056464243A17844C09311C2000000006E8CA1C16E8CA1C100000000CDCCC0420000C4410000C44100000000000000000000000045
And this is the dataTaker program, because the data are floating points but defined in hexadecimal sequence we will need to perform IEEE754 conversion. This also explain how to run a loop in that conversion:
BEGIN"PICO"
97..99CV(W)=0
Y1=3.1601,5.6122E-2,1.6825E-2,-1.1950E-4,2.5088E-7
RA1M
1SERIAL("\e{\253\021\004\135\162\000\255\006\000\001\143}",W)
DO{GB}
RB300T HB
1SERIAL("\e{\253\020\003\135\162\000\180\006\000\170}",W)
1SERIAL("\e%*7b%1b[98CV]",W)
IF(98CV==0){1SERIAL("\e{\253\022\003\135\162\000\055\255\000\129}\w[300]%*7b",W) HB GC}
RC300T HC
99CV(W)=99CV+1
1SERIAL("\w[100]%1b[4CV]%1b[3CV]%1b[2CV]%1b[1CV]",W)
IF(99CV==1){11CV=3CV*256+4CV}
5CV("Sign Bit",W)=(-1*(1CV>127.5))+(1CV<127.5)
IF(1CV>127.5){1CV(W)=1CV-128}
6CV("Exp Low Bit",W)=2CV>127.5
IF(2CV>127.5){2CV(W)=2CV-128}
10CV("Exponent bias",W)=((1CV*2)+6CV)
7CV("Exponent",W)=((1CV*2)+6CV)-127
8CV("Bin Frac",FF7,W)=(2CV/(2^7))+(3CV/(2^15))+(4CV/(2^23))
IF(8CV<1){8CV(W)=8CV+1}
9CV("Number",FF3,W)=5CV*(2^7CV)*8CV
IF(99CV==2){12CV=9CV}
IF(99CV==3){13CV=9CV}
IF(99CV==4){14CV=9CV}
IF(99CV==5){15CV=9CV}
IF(99CV==6){16CV=9CV}
IF(99CV==7){17CV=9CV}
IF(99CV==8){18CV=9CV}
IF(99CV==9){19CV=9CV}
IF(99CV==10){20CV=9CV}
IF(99CV==11){21CV=9CV}
IF(99CV==12){22CV=9CV}
IF(99CV==13){23CV=9CV}
IF(99CV==14){24CV=9CV}
IF(99CV==15){25CV=9CV}
IF(99CV==16){26CV=9CV 99CV=0 HC XD}
RDX LOGOND
11CV("MeasureCount",FF0)
12CV("CalcuCount",FF3)
13CV("ASICCount",FF3)
14CV("ASICTemp",FF3)
15CV("t",FF3)
16CV("tp",FF3)
17CV("StdMoisture",FF3)
18CV("MatMoisture",FF3)
19CV("TempMoisture",FF3)
20CV("Moisture",FF3)
21CV("TDRLevel",FF3)
22CV("MeasureMatTemp",FF3)
23CV("CompMatTemp",FF3)
24CV("DryGravity",FF3)
25CV("WetGravity",FF3)
26CV("RbC",FF3)
27CV("Dielectric Constant",Y1,FF3)=26CV
END
Best regards,
Rudy Gunawan
This topic is about reading soil moisture sensor Trime-Pico (type 32 or 64) from IMKO Micromodultechnik using dataTaker:
https://www.imko.de/en/trime-pico-32/
https://www.imko.de/en/trime-pico-64/
There are 5 required components to construct a poll syntax:
- ASCII syntax action write (hexadecimal 15)
- ASCII syntax action read (hexadecimal 14)
- ASCII syntax measurement (hexadecimal 16)
- sensor serial number (i.e.: 41607)
- CRC calculator (i.e.: http://www.datastat.com/sysadminjournal/maximcrc.cgi)
The syntax structure in hexadecimal as follows:
- FD is the first byte which is the poll header
- the second byte is action syntax (you will need to use 15 or 14) in different sequence
- 03 is the third byte which is 3 byte length (possibly related to sensor serial number)
- the fourth to sixth byte are related to an inverse hexadecimal of sensor serial number. In the above case 41607 is A287 hexadecimal, we can write it as 00A287 and the inverse is 87A200
- the seventh byte is CRC check for the first sixth byte (i.e: FD150387A200). You can copy this series of string to CRC calculator to get the number which is B4
- there is a space between seventh and eighth byte
- the eighth byte depend on the usage of second byte: 06 for action write/ read, FF for measurement
- the ninth byte is always 00
- the tenth byte depend on the usage of second byte: 01 for action write, CRC check for action read/ measurement
- the eleventh byte is CRC check for action write
Thus we can find ourselves with 3 different set of syntax:
- Action write: FD150487A200FF 0600018F
- Action read: FD140387A200B4 0600AA
- Measurement: FD160387A20037 FF0081
When triggering a measurement, Trime-Pico follow this sequence:
- send **action write** syntax
- check the eighth byte of response using **action read** syntax, if that byte has 01 value the measurement is not ready
- when the eighth byte of action read has 00 value, send **measurement** syntax.
Action Write
````
FD150487A200FF 0600018F
00150087A200C9
````
Action Read
````
FD140387A200B4 0600AA
00140287A20003015E
````
Action Read
````
FD140387A200B4 0600AA
00140287A20003015E
````
Action Read
````
FD140387A200B4 0600AA
00140287A200030000
````
Measurement...
````
FD160387A20037 FF0081
00164187A200E84F02000039FF134439FF13449056464243A17844C09311C2000000006E8CA1C16E8CA1C100000000CDCCC0420000C4410000C44100000000000000000000000045
````
And this is the dataTaker program, because the data are floating points but defined in hexadecimal sequence we will need to perform IEEE754 conversion. This also explain how to run a loop in that conversion:
````
BEGIN"PICO"
97..99CV(W)=0
Y1=3.1601,5.6122E-2,1.6825E-2,-1.1950E-4,2.5088E-7
RA1M
1SERIAL("\e{\253\021\004\135\162\000\255\006\000\001\143}",W)
DO{GB}
RB300T HB
1SERIAL("\e{\253\020\003\135\162\000\180\006\000\170}",W)
1SERIAL("\e%*7b%1b[98CV]",W)
IF(98CV==0){1SERIAL("\e{\253\022\003\135\162\000\055\255\000\129}\w[300]%*7b",W) HB GC}
RC300T HC
99CV(W)=99CV+1
1SERIAL("\w[100]%1b[4CV]%1b[3CV]%1b[2CV]%1b[1CV]",W)
IF(99CV==1){11CV=3CV*256+4CV}
5CV("Sign Bit",W)=(-1*(1CV>127.5))+(1CV<127.5)
IF(1CV>127.5){1CV(W)=1CV-128}
6CV("Exp Low Bit",W)=2CV>127.5
IF(2CV>127.5){2CV(W)=2CV-128}
10CV("Exponent bias",W)=((1CV*2)+6CV)
7CV("Exponent",W)=((1CV*2)+6CV)-127
8CV("Bin Frac",FF7,W)=(2CV/(2^7))+(3CV/(2^15))+(4CV/(2^23))
IF(8CV<1){8CV(W)=8CV+1}
9CV("Number",FF3,W)=5CV*(2^7CV)*8CV
IF(99CV==2){12CV=9CV}
IF(99CV==3){13CV=9CV}
IF(99CV==4){14CV=9CV}
IF(99CV==5){15CV=9CV}
IF(99CV==6){16CV=9CV}
IF(99CV==7){17CV=9CV}
IF(99CV==8){18CV=9CV}
IF(99CV==9){19CV=9CV}
IF(99CV==10){20CV=9CV}
IF(99CV==11){21CV=9CV}
IF(99CV==12){22CV=9CV}
IF(99CV==13){23CV=9CV}
IF(99CV==14){24CV=9CV}
IF(99CV==15){25CV=9CV}
IF(99CV==16){26CV=9CV 99CV=0 HC XD}
RDX LOGOND
11CV("MeasureCount",FF0)
12CV("CalcuCount",FF3)
13CV("ASICCount",FF3)
14CV("ASICTemp",FF3)
15CV("t",FF3)
16CV("tp",FF3)
17CV("StdMoisture",FF3)
18CV("MatMoisture",FF3)
19CV("TempMoisture",FF3)
20CV("Moisture",FF3)
21CV("TDRLevel",FF3)
22CV("MeasureMatTemp",FF3)
23CV("CompMatTemp",FF3)
24CV("DryGravity",FF3)
25CV("WetGravity",FF3)
26CV("RbC",FF3)
27CV("Dielectric Constant",Y1,FF3)=26CV
END
````
Best regards,
Rudy Gunawan