跳转至

无线控制温箱

RS485转USB接头

RS485转USB接线示意图

安装转接线驱动

到这里下载驱动

http://www.ftdichip.com/Drivers/D2XX.htm

转接线可以映射为PC的USB口或com口,打开设备管理器安装驱动即可。下图显示COM6为转接器。

温度设置与读取

修改LW9022.py中的COM口设置,然后运行下面code即可读取设置温度。

import LW9022
Dev_9022LC = LW9022.Device()
CV1=Dev_9022LC.GetValue(1)
print(CV1)
SP1=Dev_9022LC.SetSp(1,25)
print(SP1)

树莓派连接温箱

将USB线插到树莓派。

查看USB设备信息

~ # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 011: ID 0403:6001 FTDI FT232 USB-Serial (UART) IC

下一步查看USB设备的端口号

~ # dmesg | grep tty

或者在文件/var/log/messages中可以查看USB的serial number

usb 2-4: Product: FT232R USB UART
usb 2-4: Manufacturer: FTDI
usb 2-4: SerialNumber: A6008isP
  • UART http://www.electronicwings.com/raspberry-pi/raspberry-pi-uart-communication-using-python-and-c
  • USB设备名称修改 http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/