Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将RS485输出连接到Raspberry Pi[Android Things]_Android_Raspberry Pi3_Gpio_Android Things_Rs485 - Fatal编程技术网

将RS485输出连接到Raspberry Pi[Android Things]

将RS485输出连接到Raspberry Pi[Android Things],android,raspberry-pi3,gpio,android-things,rs485,Android,Raspberry Pi3,Gpio,Android Things,Rs485,刚开始用安卓系统开发Raspberry Pi,有一个通过RS485电缆输出的传感器,我想把输出输入Raspberry Pi,但没有找到合适的解决方案,如果有人做过这种事情,你可以指导我使用转换器或MAX 485连接 从RS485到RPi的最佳输出方式是什么?如何实现这一目标?提前感谢我不熟悉安卓系统,但希望这能为您指明正确的方向。。。我已经在树莓圆周率上成功地使用了a和。下面是我过去使用过的一些示例代码。这是相当基本的,但应该让你开始 import minimalmodbus import se

刚开始用安卓系统开发Raspberry Pi,有一个通过RS485电缆输出的传感器,我想把输出输入Raspberry Pi,但没有找到合适的解决方案,如果有人做过这种事情,你可以指导我使用转换器或MAX 485连接


从RS485到RPi的最佳输出方式是什么?如何实现这一目标?提前感谢

我不熟悉安卓系统,但希望这能为您指明正确的方向。。。我已经在树莓圆周率上成功地使用了a和。下面是我过去使用过的一些示例代码。这是相当基本的,但应该让你开始

import minimalmodbus
import serial

usbDevice = '/dev/ttyUSB0'

modbusSlaveID = 1

# can be 'ascii' or 'rtu'
modbusFormat = 'rtu'

registerToRead = 64

# 3 is for Holding Registers, 4 is for Input Registers
functionCode = 3

# initialize the device
device = minimalmodbus.Instrument(usbDevice, modbusSlaveID, modbusFormat)

# set the various options, which will depend on the device you are communicating with
device.debug = True
device.serial.baudrate = 9600
device.serial.bytesize = 8
device.serial.parity = serial.PARITY_NONE
device.serial.stopbits = 1
device.serial.timeout = 2   # seconds

print device.read_register(registerToRead, functioncode=functionCode)
p、 这是我的第一个答案,希望我做对了…

大多数硬件上的接口都与这些类型的传感器兼容。默认情况下,电路板/模块上的UART引脚在以下位置工作。电气标准,如RS-232RS-485使用相同的基本协议,但修改了信号线的输出电压和配置

因此,在您的情况下,您只需要在TTL和RS-485之间找到一个转换器,就像您提到的MAX485一样。将其连接到主板上的任何可用UART,并使用该UART从Android Things与之通信