Chacha
Chacha

Reputation: 21

receiving empty data while reading serial communication on usb port- Raspberry Pi 3 model B+

I have a smart camera sending telemetry data every one minute through wMbus (wireless Meter-Bus) and I have a usb stick (wMbus receiver) plugged in a raspberry pi 3 Model B+. I am trying to read the data sent by the camera. I used this:

import serial

ser = serial.Serial(port='/dev/ttyUSB0', baudrate=2400, parity=serial.PARITY_EVEN, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=10)

while True:
    data = ser.readline()
    print(data)

the result is as follows:

b''
b''
b''
b''
b''

Do you know what is the problem and how I can fix it to be able to read the telemetry data sent by the camera?

Upvotes: 2

Views: 813

Answers (2)

Ruotong Jia
Ruotong Jia

Reputation: 41

Most likely it's because there is no data being received over the serial port, and the timeout (which is 10 seconds) has been hit. You can validate this with no device attached at all and see if you get the same behavior.

Upvotes: 0

xhenrique
xhenrique

Reputation: 153

This can be so many different things, almost every device has his own characteristics when it comes to serial communication, i recommend you to look for some library that's designed directly for your device, or maybe look the device documentation directly.

My opnion is based on my experience with IoT proofs of concept, i had to work with different modules and devices togheter with RPI and Arduino, and every single one of them had some peculiarity when it comes to serial pairing and data exchange.

Looking into google for "wMbus python3 lib" returned a few libraries on github that you may try out and check if it fits your needs.

Upvotes: 1

Related Questions