MR60BHA1 - Report, Send and Read in RospberryPI Python


I am trying to read heart beat and breath rate using MR60BHA1 connected to Raspberry Pi. MR60BHA1 is connected to TTL Serial port in Raspberry Pi.

When the application started, it dumps some times random values and some times some meaningful data.

After that, when I write any command, it doesn’t respond.

How to get the required data whenever user clicks on UI?

Which instance of wiki are you currently using.It seems that everything is arduino, but I don’t know much about python, and I don’t know if it is a program problem

I connected MR60BHA1 to Raspberry Pi though TTL serial port. Wrote the code to read from serial port. Initially when I power up it sends (report) data without any command from program. This data and data length are not consistent. Its changed for every power cycle.

After that when I wrote any command, I am not getting any response.

Do you have any sample program for simple read and write in Python on Raspberry Pi.


Below is my code and output.

import os
import serial
from time import sleep
import numpy as np
from datetime import datetime

os.system(‘sudo chmod +777 /dev/ttyS0’)
print("", file=open(‘output.txt’, ‘a’))


def fetch_and_update_radar_data():
ser = serial.Serial ("/dev/ttyS0", 115200)

# read all the data reported at power cycle. 
# no command is required from application program

msgRaw = bytearray(bytes(128))
ndx = 0
while ser.in_waiting:
	readByte =
	number = int.from_bytes(readByte, byteorder='big')
	msgRaw[ndx] = number
	ndx = ndx+1

msgNew = bytearray(bytes(ndx))
for x in range(ndx):
	msgNew[x] = msgRaw[x]
print("Rp",'%Y-%m-%d %H:%M:%S'), msgNew, file=open('output.txt', 'a'))
print("Rp",'%Y-%m-%d %H:%M:%S'), msgNew)

flag = True
while flag == True:

	msgRaw = bytearray(bytes(256))
	msgWrite = [bytes([0x53, 0x59, 0x80, 0x81, 0x00, 0x01, 0x0F, ((0x53 + 0x59 + 0x80 + 0x81 + 0x00 + 0x01 + 0x0f) & 0xFF), 0x54, 0x43]), 
				bytes([0x53, 0x59, 0x07, 0x87, 0x00, 0x01, 0x0F, ((0x53 + 0x59 + 0x07 + 0x87 + 0x00 + 0x01 + 0x0f) & 0xFF), 0x54, 0x43]), # out of bound status
				bytes([0x53, 0x59, 0x01, 0x80, 0x00, 0x01, 0x0F, ((0x53 + 0x59 + 0x01 + 0x80 + 0x00 + 0x01 + 0x0F) & 0xFF), 0x54, 0x43]), # Heartbeat Package Inquiry
				bytes([0x53, 0x59, 0x01, 0x02, 0x00, 0x01, 0x0F, ((0x53 + 0x59 + 0x01 + 0x02 + 0x00 + 0x01 + 0x0F) & 0xFF), 0x54, 0x43]), # Module Reset
				bytes([0x53, 0x59, 0x02, 0xA1, 0x00, 0x01, 0x0F, ((0x53 + 0x59 + 0x02 + 0xA1 + 0x00 + 0x01 + 0x0F) & 0xFF), 0x54, 0x43]), # Product Model
	i = 1 # change i values for selection of command
	print("Sending ", msgWrite[i])
	print("W",'%Y-%m-%d %H:%M:%S') , msgWrite[i], file=open('output.txt', 'a'))
	ndx = 0
	while ser.in_waiting:
		readByte =
		number = int.from_bytes(readByte, byteorder='big')
		msgRaw[ndx] = number
		ndx = ndx+1

	msgNew = bytearray(bytes(ndx))
	for x in range(ndx):
		msgNew[x] = msgRaw[x]
	print("R",'%Y-%m-%d %H:%M:%S'), msgNew, file=open('output.txt', 'a'))
	print("R",'%Y-%m-%d %H:%M:%S'), msgNew)

def main():
#while 1:


Out put file
Rp 2023-08-01 22:31:24 bytearray(b’\x04\xd0\xcc\xc4’)
W 2023-08-01 22:31:34 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:31:34 bytearray(b’’)
W 2023-08-01 22:31:44 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:31:45 bytearray(b’’)
W 2023-08-01 22:31:55 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:31:55 bytearray(b’’)

Rp 2023-08-01 22:32:05 bytearray(b’Y\x80\x03\x00\x01\x044TCSY\x80\x05\x00\x04\x00_\x00Z\xeeTC’)
W 2023-08-01 22:32:15 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:32:15 bytearray(b’’)
W 2023-08-01 22:32:25 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:32:25 bytearray(b’’)
W 2023-08-01 22:32:35 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:32:35 bytearray(b’’)

Rp 2023-08-01 22:37:14 bytearray(b’Y\xf1\x88\xf6’)
W 2023-08-01 22:37:24 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:37:24 bytearray(b’’)
W 2023-08-01 22:37:34 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:37:34 bytearray(b’’)
W 2023-08-01 22:37:44 b’SY\x02\xa1\x00\x01\x0f_TC’
R 2023-08-01 22:37:44 bytearray(b’’)

Rp 2023-08-01 22:38:02 bytearray(b’Y\x80\x02\x00\x01\x021TCSY\x80\x03\x00\x01\x13CTCSY\x80\x04\x00\x02\x00BtTC’)
W 2023-08-01 22:38:12 b’SY\x07\x87\x00\x01\x0fJTC’
R 2023-08-01 22:38:12 bytearray(b’’)
W 2023-08-01 22:38:22 b’SY\x07\x87\x00\x01\x0fJTC’
R 2023-08-01 22:38:22 bytearray(b’’)
W 2023-08-01 22:38:32 b’SY\x07\x87\x00\x01\x0fJTC’
R 2023-08-01 22:38:32 bytearray(b’’)


I am relatively new. I am not sure what version of Wiki. I got MR60BHA1 and straight away connected Paspberry PI TTL port.

Is there any other document for beginners, if I am doing something wrong.

Because I’m not very good at python (except for machine learning), I looked at the code as much as I could and it seemed to work fine importing device number configurations and all sorts of things.
Almost all the usage documentation for MR60BHA1 is done on ArduinoIDE:
60GHz mmWave Static Breathing and Heartbeat | Seeed Studio Wiki