That's a good idea, I might play with doing that.. Or i can look into doing one that ties into some GPIO pins.
Of course, it'd be nice if we could all just use one of the two rs232 interfaces already on the darn device.
receivers are placed on each tank to measure the water level with ultrasonic pulses. The level data is sent back to a little receiver station that has an RS232 port on it. My goal is to take that data and ship it off to something like amazon IOT so I can check the water level from my phone without having to go look at the display on the device.
continuing the saga for the edification of anyone else interested. I tried a USB to serial adaptor with the FTDI FT232RL chipset. It's a sabrent so I guess it's not a counterfeit?
The cable worked fine from my laptop to the device I was querying. Attaching it to my onion showed things working better than the onboard UART, but I still saw corrupted data.
I realized that omega had python2 installed, so I installed python3, and then things worked fine. No idea why, as that doesn't make sense. But whatever, it works so i'll call it good enough.
I'm pretty frustrated that the omega2+ onboard UART doesn't work right, but I don't know how to debug that any further
So i'm not the only one, and i'm not crazy.. that's good at least.
Looking at all the diagnostics you've run I'm guessing the python library must be making some calls that run afoul of the bug in the UART driver. in my case I can use a USB to serial adapter with my device, but broken serial drivers seriously impairs what I had planned to use these for. That's frustrating.
I'm trying to connect my Omega2+ to a wireless water tank measurement system so I can check the tank water levels from my phone without having to go look at display on little receiver. There's a serial port on the receiver with a very simple API. I've written a script to grab the data, however I'm having trouble actually getting the serial connection from the omega to talk to the receiver. I get either nothing, or a bunch of garbage characters coming back.
If I connect my laptop to the receiver with a USB to serial adapter, my script works fine, and I get the data I expect. However it doesn't work on the Omega2+
I'm using python3 and the pyserial library, connecting at 9600 baud. Is there something i'm missing here?
I've tried two different Omega2's, the power dock, and the arduino dock. Same behavior regardless of the combination, so I don't think it's them. The Omega's are from feb 2017, and I just updated their firmware to the latest available.
the code is below, in case it's relevant:
ser = serial.Serial(port='/dev/ttyS1',
stopbits=serial.STOPBITS_ONE) # open serial port
i = 0
#the following request asks the receiver to return the data for the first tank:
send_bytes = serial.to_bytes([0x02,0x01,0x01,0x0D])
print("Sending: ", send_bytes)
readbyte = ser.read(1)
i += 1
#the next two conditionals are to deal with garbage chars
if readbyte == serial.to_bytes([0x00]):
print("I got a zero..")
if readbyte != serial.to_bytes([0x02]):
print("I read this unexpected byte: %d",readbyte)
#looks like we found a message
tankID,sequence,tankLevel,RSSI,temp,battery,Alarm,endbit = ser.read(8)
print("tankID" , tankID)
print("sequence" , sequence)
print("tankLevel" , tankLevel)
print("RSSI" , RSSI)
print("temp" , temp)
print("battery" , battery)
print("Alarm" , Alarm)
print("endbit" , endbit)
ser.close() # close port
Looks like your connection to Community was lost, please wait while we try to reconnect.