Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4898

General discussion • Re: How to Intercept and Display Signal from HLK-LD2450 Module Directly Connected to Raspberry Pi?

$
0
0
My understanding is the data is a basic serial stream:
The LD2450 module communicates with the outside world through a serial port with a default baud rate of 256000, 1 stop bit, and no parity bits.
A manual detailing the frames is available at https://drive.google.com/drive/folders/ ... 2crR_DO0uh - note though this is reported to by Hi-Link I cannot prove this one way or another so please check downloads carefully before use.

I know the home automation folk tried the early firmware and found it unstable - this was fixed in a later firmware update but I have zero details on the versions so recommend you update to the latest code before use.
now I have this Error
photo_2024-03-25_23-58-07.jpg
and here my code
import serial
import time

# Настройки соединения с модулем
ser = serial.Serial(
port='/dev/ttyAMA0', # Подключение к порту ttyAMA0
baudrate=256000, # Скорость передачи данных
bytesize=serial.EIGHTBITS, # Размер байта
parity=serial.PARITY_NONE, # Без проверки паритета
stopbits=serial.STOPBITS_ONE, # Один стоп-бит
)

# Чтение данных
while True:
if ser.in_waiting:
data = ser.read(ser.in_waiting)
print(data.decode('utf-8')) # Декодирование и печать данных
time.sleep(0.1) # Краткая пауза перед следующим чтением
The error message is telling you you're trying to open a serial port that doesn't exist. Find the actual serial port and change the port parameter in serial.Serial()

Statistics: Posted by ame — Mon Mar 25, 2024 11:53 pm



Viewing all articles
Browse latest Browse all 4898

Trending Articles