ArduinoGeneral

Help with URM06-RS485

userHead Account cancelled 2016-01-09 04:47:12 1422 Views0 Replies
Hello,

I want to connect an Ultrasonic RS485 sensor URM06 to a Linux system to test it.
    I am using an USB adapter to 485.
    The sensor is connected to an external power supply 12V - 1A.
    The program was coded in Python and it is quite simple.
The problem is that I cannot get response from the sensor and I am sure that it is correctly connected.

How can i check that the sensor is working ?

I will thank any suggestion.

Regards,

Carlos.

this is the python code:

Code: Select all
#!/usr/bin/python
import serial
import time

ser = serial.Serial(port='/dev/ttyUSB0', baudrate=19200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1)

print("connected to: " + ser.portstr)

req = "\x55\xaa\x11\x00\x02\x12"
while True:
print "sending request to sensor"
bytes_written = ser.write(req)
valueFromSensor = ser.read(8)
print [ord[x] for x in valueFromSensor]
time.sleep(5)

ser.close()