Skip to content

Instantly share code, notes, and snippets.

@maxious
Last active June 9, 2024 11:51
Show Gist options
  • Save maxious/cd84b408c8be5426a113f7b5d4cb6197 to your computer and use it in GitHub Desktop.
Save maxious/cd84b408c8be5426a113f7b5d4cb6197 to your computer and use it in GitHub Desktop.
HT625B Wind Meter Anemometer

https://www.habotest.com/sale-13562820-9999-cfm-handheld-digital-anemometer-ht625b-wind-meter-anemometer.html

https://autensdirect.com/2022/03/09/ht625b-anemometer-software-download/

      ========================== Summary =========================
Vendor ID                : 0x1A86 (Nanjing Qinheng Microelectronics Co., Ltd.)
Product ID               : 0x7523
USB Version              : 1.1
Port maximum Speed       : High-Speed
Device maximum Speed     : Full-Speed
Device Connection Speed  : Full-Speed
Self powered             : no
Demanded Current         : 104 mA
Used Endpoints           : 4

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Friendly Name            : USB-SERIAL CH340 (COM15)
Device Description       : USB-SERIAL CH340
Device Path 1            : \\?\USB#VID_1A86&PID_7523#8&da31e2b&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Device Path 2            : \\?\USB#VID_1A86&PID_7523#8&da31e2b&0&4#{86e0d1e0-8089-11d0-9ce4-08003e301f73} (GUID_DEVINTERFACE_COMPORT)
Kernel Name              : \Device\USBPDO-18
Device ID                : USB\VID_1A86&PID_7523\8&DA31E2B&0&4
Hardware IDs             : USB\VID_1A86&PID_7523&REV_8134 USB\VID_1A86&PID_7523
Driver KeyName           : {4d36e978-e325-11ce-bfc1-08002be10318}\0008 (GUID_DEVCLASS_PORTS)
Driver                   : \SystemRoot\System32\Drivers\CH341S64.SYS (Version: 3.50.2014.8  Date: 2019-03-04  Company: www.winchiphead.com)
Driver Inf               : C:\WINDOWS\inf\oem40.inf
Legacy BusType           : PNPBus
Class                    : Ports
Class GUID               : {4d36e978-e325-11ce-bfc1-08002be10318} (GUID_DEVCLASS_PORTS)
Service                  : CH341SER_A64
Enumerator               : USB
import struct
from datetime import datetime
def parse_data(hexByte):
str3 = ""
num1 = hexByte[10] & 0b10000000
func_map = {
0: ("m/s", "VEL"),
1: ("km/h", "VEL"),
2: ("mil/h", "VEL"),
3: ("ft/m", "VEL"),
4: ("ft/s", "VEL"),
5: ("knots", "VEL"),
6: ("CMS", "FLOW"),
7: ("CMM", "FLOW"),
8: ("CFM", "FLOW"),
}
func_code = hexByte[4]
if func_code in func_map:
MainDispUnit, FuncDisp = func_map[func_code]
else:
FuncDisp = ""
num2 = float(int(hexByte[7] * 65536) + int (hexByte[6] * 256) + int(hexByte[5])) / 100.0
if num2 <= 999.9:
if num2 <= 99.99:
MainDisp = f"{num2:05.2f}"
else:
MainDisp = f"{num2:06.1f}"
else:
MainDisp = f"{num2:07.0f}"
ScaleLevelDisp = str(hexByte[8])
rh = float(int(hexByte[10]) * 256 + int(hexByte[9])) / 10.0
RHDisp = f"{rh:4.1f}"
if hexByte[12] == 0:
DPWBDisp = ""
elif hexByte[12] == 1:
DPWBDisp = "DewPoint"
elif hexByte[12] == 2:
DPWBDisp = "WetBulb"
temp = float(int(hexByte[14]) * 256 + int (hexByte[13])) /100.0
TempDisp = f"{temp:4.1f}"
if hexByte[11] & 1:
TempUnit = "°F"
else:
TempUnit = "°C"
if hexByte[15] & 1:
str8 = "HOLD"
else:
str8 = ""
if hexByte[15] & 2:
str9 = "MAX "
labelMaxmin = "REC. MAX"
elif hexByte[15] & 4:
str9 = "MIN "
labelMaxmin = "REC. MIN"
elif hexByte[15] & 8:
str9 = "AVG "
labelMaxmin = "REC. AVG"
else:
str9 = ""
labelMaxmin = ""
recHold = str8 + ("\\" + str9 if str8 and str9 else str9)
# Get the current date and time
now = datetime.now()
# Print the current date
strDate= now.date()
strTime = now.time()
return f"{FuncDisp}\t{MainDisp} {MainDispUnit}\t{DPWBDisp}{TempDisp} {TempUnit}\t{RHDisp}%RH\t{recHold}\t{strDate}\t{strTime}"
import serial # python -m pip install pyserial
ser = serial.Serial('COM15')
try:
while True:
numArray = ser.readline().strip()
#print ("received data:",[hex(c) for c in numArray])
if (numArray[0]== 6 and numArray[1] == 91) and len(numArray) == 16 :
# valid line\
print(parse_data(numArray))
else:
print ("received invalid data:",[hex(c) for c in numArray])
except KeyboardInterrupt:
quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment