Hi,
I'm currently trying to get the breath and heart rate outputs via USB without using the vital signs visualiser. I have parsed the configuration code via the command line interface and the EVM is flashed with the pre-built vital-signs detection binary file.
As mentioned in other threads, this is my python code:
import serial
import time
import numpy as np
# Change the configuration file name
configFileName = 'profile_2d_VitalSigns_20fps.cfg'
CLIport = {}
Dataport = {}
byteBuffer = np.zeros(2**15,dtype = 'uint8')
byteBufferLength = 0;
dataBin = [None] * 288
magicWord = [2, 1, 4, 3, 6, 5, 8, 7]
magicWord = [bytes(i) for i in magicWord]
# Byte sizes for different values
magicWord = 8
fftOrPeak = 4
# ------------------------------------------------------------------
# Function to configure the serial ports and send the data from
# the configuration file to the radar
def serialConfig(configFileName):
global CLIport
global Dataport
# Open the serial ports for the configuration and the data ports
# Raspberry pi
#CLIport = serial.Serial('/dev/ttyACM0', 115200)
#Dataport = serial.Serial('/dev/ttyACM1', 921600)
# Windows
CLIport = serial.Serial('COM4', 115200)
Dataport = serial.Serial('COM5', 921600)
# Read the configuration file and send it to the board
config = [line.rstrip('\r\n') for line in open(configFileName)]
for i in config:
CLIport.write((i+'\n').encode())
print(i)
time.sleep(0.01)
return CLIport, Dataport
def processData(dataBin):
# Alter to 4-byte data in array form 1 byte/element
breathFFT = dataBin[52:56]
breathFFT = breathFFT[::-1]
heartFFT = dataBin[56:60]
heartFFT = heartFFT[::-1]
# Remove b value in hex
breathFFT = [s.hex() for s in breathFFT]
heartFFT = [s.hex() for s in heartFFT]
# Join arrays together to form 4 byte value
breathFFT = float.fromhex("".join(breathFFT))
heartFFT = float.fromhex("".join(heartFFT))
return breathFFT, heartFFT
def readAndParseData(dataBin, Dataport):
readBuffer = Dataport.read(Dataport.in_waiting)
dataBin = dataBin[Dataport.in_waiting:]
dataBin.append(readBuffer)
# ------------------------- MAIN -----------------------------------------
# Configurate the serial port
CLIport, Dataport = serialConfig(configFileName)
print(CLIport)
print(Dataport)
print("reading")
while True:
if Dataport.in_waiting > 0:
try:
readAndParseData(dataBin, Dataport)
if dataBin[0:8] == magicWord:
breathFFT, heartFFT = processData(dataBin)
print(breathFFT,heartFFT)
except KeyboardInterrupt:
CLIport.write(('sensorStop\n').encode())
CLIport.close()
Dataport.close()
However, I am not getting any outputs from the evaluation module. When running the vitalSignsDemo_GUI.exe visualiser with the same cfg file, the GPIO_1 LED lights up and the data is transmitted to the visualiser without any problems, using the same COM ports.
The cfg parameters are as follows:
Any assistance is greatly appreciated!