[arm-allstar] pcsensor
Dusty Smith
w4msi at outlook.com
Sun Jan 23 23:59:18 EST 2022
Worked like a champ. Thanks again!!!
Dusty Smith
—W4MSI—
-----Original Message-----
From: David McGough <kb4fxc at inttek.net>
Sent: Saturday, January 22, 2022 10:12 PM
To: Dusty Smith <w4msi at outlook.com>
Cc: Dusty Smith via ARM-allstar <arm-allstar at hamvoip.org>
Subject: RE: [arm-allstar] pcsensor
Dusty,
Looking at the messages, the utility "bc" is missing.
I'm guessing the RPi0W is running some Debian derivative OS? If so, try:
apt-get install bc
73, David KB4FXC
On Sun, 23 Jan 2022, Dusty Smith wrote:
> Hi again. I have successfully used your scripts on 2 different RPi3 units. But I was trying tonight to use it on a RPi zero wireless model and am getting errors. Can you offer any help on this.
>
> Here is the modified script I'm using that works flawlessly on rpi3 models.
>
> ---------------
> #!/bin/bash
> #
> # Simple temperature query script for PCSENSOR dual-sensor
> # device, version: Temper2_V3.7. KB4FXC 2021-11-28
> #
> # Available on Amazon: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.amazon.com%2Fdp%2FB073PQJBMQ&data=04%7C01%7C%7Cc20ee816cb6042cfda1708d9de268918%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637785079371198723%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=52aK55R2hYMRROotKKR%2FvP0gMpUdNkJPEUgYfpJ0Vzk%3D&reserved=0
> #
>
> [ ! -d /sys/class/hidraw ] && echo "No HID directory found!" && exit 1
>
> res=0
> for i in $(find /sys/class/hidraw/ -type l | sort -r) ; do
> grep -F -m 1 1A86:E025 <<< $(ls -srlt $i) &>/dev/null
> [ $? -eq 0 ] && res=1 && break
> done
>
> [ $res -eq 0 ] && echo "No HID devices found! Try resetting usb
> device" && exit 1
>
> hiddev="/dev/$(basename $i)"
>
> [ "$hiddev" = "" ] && echo "No HID directory found!" && exit 2 [ ! -c
> "$hiddev" ] && echo "No HID device file found!" && exit 3
>
> DATE=$(date "+%Y-%m-%d-%H:%m:%S")
>
> exec 5<> $hiddev
> [ $? -ne 0 ] && echo "Can not connect to HID device!" && exit 4
>
> # Query the device version
> echo -e '\x00\x01\x86\xff\x01\x00\x00\x00\x00\c' >&5
>
> # get ASCII response
> OUT="$(timeout 5 dd count=2 bs=8 <&5 2>/dev/null | xargs)"
> #echo "version=$OUT"
>
> [ "$OUT" = "" ] && echo "ERROR: Can not read Version, try resetting
> usb device: hiddev=$hiddev" && exit 5
>
> REPLY="$OUT"
>
> # Query the temperature
> echo -e '\x00\x01\x80\x33\x01\x00\x00\x00\x00\c' >&5
>
> # get binary response
> OUT="$(timeout 5 dd count=2 bs=8 <&5 2>/dev/null | xxd -p )"
> #echo "out=$OUT"
>
> [ "$OUT" = "" ] && echo "ERROR: Can not read Temperature, try
> resetting usb device: hiddev=$hiddev" && exit 6
>
> # characters 5-8 is the temp1 in hex x1000 HEX4=${OUT:4:4}
> DVAL=$((16#$HEX4))
> CTEMP=$(bc <<< "scale=2; $DVAL/100")
> FTEMP=$(bc <<< "scale=2; 9 * $DVAL / 500 + 32") #echo
> "Temp1=$CTEMP,$FTEMP"
> REPLY="$REPLY|$CTEMP|$FTEMP"
>
> # Starting at position 16, characters 5-8 is the temp2 in hex x1000
> HEX4=${OUT:20:4}
> DVAL=$((16#$HEX4))
> CTEMP=$(bc <<< "scale=2; $DVAL/100")
> FTEMP2=$(bc <<< "scale=2; 9 * $DVAL / 500 + 32") #echo
> "Temp2=$CTEMP,$FTEMP"
> REPLY="$REPLY|$CTEMP|$FTEMP"
>
>
> date2=$(date +%D---%T)
>
> echo "| ~ DATE ~ |USB F||Probe F|"
> echo "|$date2|$FTEMP-||$FTEMP2 |"
> exit 0
>
> -------------------------
>
>
> The error I get is as follows.
>
> root at raspberrypi:/HouseTemp# checktemp
> /usr/local/sbin/checktemp: line 52: bc: command not found
> /usr/local/sbin/checktemp: line 53: bc: command not found
> /usr/local/sbin/checktemp: line 60: bc: command not found
> /usr/local/sbin/checktemp: line 61: bc: command not found
> | ~ DATE ~ |USB F||Probe F|
> |01/22/22---21:43:12|-|| |
>
>
>
> Dusty Smith
> —W4MSI—
>
> -----Original Message-----
> From: David McGough <kb4fxc at inttek.net>
> Sent: Saturday, November 20, 2021 8:03 PM
> To: Dusty Smith <w4msi at outlook.com>
> Cc: Dusty Smith via ARM-allstar <arm-allstar at hamvoip.org>
> Subject: Re: [arm-allstar] pcsensor
>
>
> Okay, I'll try to obtain one to test.
>
>
>
> On Sun, 21 Nov 2021, Dusty Smith wrote:
>
> > Ok just making sure you did get the reply. I purchased it from Amazon. Here’s a link.
> >
> > PCsensor Double Sensor Computer USB Thermometer Data Logger Free PC
> > Software for Logging Temperature with Email Alarm -40~+120 Celsius
> > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww
> > .a%2F&data=04%7C01%7C%7Cc20ee816cb6042cfda1708d9de268918%7C84df9
> > e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637785079371198723%7CUnknown%7
> > CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
> > XVCI6Mn0%3D%7C3000&sdata=Q1KQ0rEyYfZ8Q5p6hWl48AzoBoRSY%2BbdMSL6m
> > 9jbnw8%3D&reserved=0
> > mazon.com%2Fdp%2FB073PQJBMQ%2Fref%3Dcm_sw_r_cp_api_glt_fabc_PNC0A203
> > 5C
> > R21T1QR8NK%3F_encoding%3DUTF8%26psc%3D1&data=04%7C01%7C%7Cf548aa
> > 3d
> > aa864d94424108d9ac92fbf0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%
> > 7C
> > 637730569565918148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQI
> > jo
> > iV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=W4cyxQUfUZY
> > sJ
> > gxGMDIkplmh4HZHxX%2BWhN6ORyGxPjA%3D&reserved=0
> >
> > Let me know what you find and if there’s any way I can assist or whatever. Appreciate your responses and any help you can offer.
> >
> >
> > Dusty Smith
> > â€â€W4MSIâ€â€
> >
> > (sent from my smartphone)
> >
> > On Nov 20, 2021, at 7:50 PM, David McGough <kb4fxc at inttek.net> wrote:
> >
> > 
> > Hi Dusty,
> >
> > Yes, I got the lsusb output. I'm not familiar with the model temp sensor
> > you've got, listed as:
> >
> > Bus 001 Device 005: ID 1a86:e025 QinHeng Electronics
> >
> >
> > I google'd this device ID and others indicated that a very simple
> > software update (probably just changing the device PID/VID in the
> > program) was all that was needed to get it to work. However, since I don't have one of
> > these sensors, I can't personally test. Where did you get this sensor??
> > If I can get one, I'll try to update the software.
> >
> >
> > 73, David KB4FXC
> >
> >
> >
> >
> > On Sun, 21 Nov 2021, Dusty Smith wrote:
> >
> > Did you get my reply with the lsusb output?
> >
> >
> > Dusty Smith
> > â?"W4MSIâ?"
> >
> > (sent from my smartphone)
> >
> > On Nov 19, 2021, at 7:36 PM, David McGough <kb4fxc at inttek.net> wrote:
> >
> > 
> > Hi Dusty,
> >
> > Please post the output from lsusb. Typically, that family of
> > sensors is very easy to use. I expect a minor software change will
> > get the model you've got to work.
> >
> >
> > 73, David KB4FXC
> >
> >
> > On Sat, 20 Nov 2021, "Dusty Smith via ARM-allstar" wrote:
> >
> > Hello, I'm trying to setup a usb temperature sensor on my pi/hamvoip
> > node/repeater to monitor the temp of the station and such. I just
> > purchased a TEMPer2 usb sensor. Plugged it into the Pi and ran
> > pcsensor and it gives the error of "Couldn't find the USB device,
> > Exiting" tried updating hamvoip and rebooting multiple times to no
> > avail. If I run lsusb I can see the device listed. So the Pi is
> > seeing it. But pcsensor doesn't seem to know it's there. Can you offer any guidance? Thank you!
> >
> > So after doing some more digging it appears that maybe the sensor I
> > purchased just simply isn't compatible (TEMPer2). If that's the
> > case, do you know which sensors are compatible. I'd like to get this
> > working but not sure what needs to be purchased. Here's a site with different models.
> >
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> > pc%2F&data=04%7C01%7C%7Cc20ee816cb6042cfda1708d9de268918%7C84df9
> > e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637785079371198723%7CUnknown%7
> > CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
> > XVCI6Mn0%3D%7C3000&sdata=q6slIs3gMlY90zXAJ%2Bb%2BpV4H%2FLaccjodD
> > uJpF9PQ0gY%3D&reserved=0
> > sensor.com%2Fusb-temperature-humidity.html&data=04%7C01%7C%7Cf54
> > 8a
> > a3daa864d94424108d9ac92fbf0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7
> > C0
> > %7C637730569565918148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLC
> > JQ
> > IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Hi4wvQW9
> > D4
> > 3cAioXH%2Fpqd34idipj5AyVEumrOP210mo%3D&reserved=0
> >
> > Any help would be greatly appreciated. Thanks!
> >
> >
> > Dusty Smith
> > -W4MSI-
> >
> > _______________________________________________
> >
> > ARM-allstar mailing list
> > ARM-allstar at hamvoip.org
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.
> > hamvoip.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Farm-allstar&data=04
> > %7
> > C01%7C%7Cf548aa3daa864d94424108d9ac92fbf0%7C84df9e7fe9f640afb435aaaa
> > aa
> > aaaaaa%7C1%7C0%7C637730569565918148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> > MC
> > 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&
> > sd
> > ata=j3XyL1qranQYCMjn8%2BOOjk7vM%2FpRcmD9JDIQ2ifExO4%3D&reserved=
> > 0
> >
> > Visit the BBB and RPi2/3/4 web page -
> > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhamv
> > oi
> > p.org%2F&data=04%7C01%7C%7Cf548aa3daa864d94424108d9ac92fbf0%7C84
> > df
> > 9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637730569565918148%7CUnknown%
> > 7C
> > TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
> > VC
> > I6Mn0%3D%7C3000&sdata=r5ehJu5SWrED0ME9eYk9jd8LoIPw%2BNr3fHpL%2F6
> > Pu
> > LqQ%3D&reserved=0
> >
> >
> >
> >
> >
>
>
More information about the ARM-allstar
mailing list