Whenever you need to talk with a ModBus device, take look at ModPoll. ModPoll runs on virtually any Platform and is able to talk over RS232, RS485 and TCP. The only drawback is that it can only read data (but not write).
The Advantech Adam 6015 has 7 input channels for use with Pt100 and others. You can configure the module using a proprietary Windows Software where you can set the type of thermocouple as well as the module’s IP address. Once the module is available on your network you can create a small bash script to retrieve the values.
Take care when assembling the sensors. The Adam6015 has 7 input channels but only 6 COM clips. You have to use the COM clip #6 for #7 too. And this is not noted in the manual.
The script below now connects to the device using modpoll from the link above, extracts the 7 data channels including a 8th average channel and writes them to stdout.
Although the manual states that the values are available starting on address 40000 you have to start at address 1.
The values you receive are 16bit Integers. When your sensor now has a range of -50°C to 150°C you have to calculate them by
TempRange/2¹â¶*Value-50
Ok, I know that the bash script below is NOT state of the art, but it works
#!/bin/bash
rm /tmp/ad6015
rm /tmp/ad6015err
modpoll -mtcp -r1 -c9 -1 192.168.6.220 2> /tmp/ad6015err > /tmp/ad6015
errsize=`stat -c %s /tmp/ad6015err`
if [ "$errsize" = "0" ]; then
out=`cat /tmp/ad6015|grep "\[1\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f1=${out:0:6}
out=`cat /tmp/ad6015|grep "\[2\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f2=${out:0:6}
out=`cat /tmp/ad6015|grep "\[3\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f3=${out:0:6}
out=`cat /tmp/ad6015|grep "\[4\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f4=${out:0:6}
out=`cat /tmp/ad6015|grep "\[5\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f5=${out:0:6}
out=`cat /tmp/ad6015|grep "\[6\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f6=${out:0:6}
out=`cat /tmp/ad6015|grep "\[7\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
f7=${out:0:6}
out=`cat /tmp/ad6015|grep "\[9\]:"`
out=${out#*:}
out=$(echo "200/65536*$out-50"|bc -l)
fa=${out:0:6}
echo "F1|"$f1
echo "F2|"$f2
echo "F3|"$f3
echo "F4|"$f4
echo "F5|"$f5
echo "F6|"$f6
echo "F7|"$f7
echo "AVG|"$fa
fi
