limpkin / cdm324_fft

Repository for the CDM324 backpack v2
MIT License
16 stars 6 forks source link

UART and 'k','u' commands & streaming data from CDM 324 #6

Closed Marcus-Peterson closed 6 months ago

Marcus-Peterson commented 7 months ago

Quick question: When I send the 'k' to the doppler radar from let's say an MCU. Does my MCU only have to send it once and the data can be "streamed" or does the MCU need to send the 'k' command to get a new speed reading every time?

limpkin commented 7 months ago

the latter :)

Marcus-Peterson commented 7 months ago

So just to be clear, I'll have to send a new command (the 'k') to the radar everytime I want to get a speed reading?

limpkin commented 7 months ago

that's correct :)

Marcus-Peterson commented 6 months ago

@limpkin I understand that this issue is closed, but I believe it's better to continue the discussion here instead of opening a new issue for the same topic. Apologies if I'm repeating myself, but I want to ensure that I have a clear understanding of the communication process with the CDM 324.

As I understand it, the data from the CDM 324 cannot be continuously streamed to a device, such as a serial monitor. Instead, to obtain new speed-data values, the MCU must send a 'k' command each time it wants to read a new value. Could you confirm whether my understanding is correct?

For example, if I send the 'k' command once from the MCU, can I then set up some programmatic logic in, let's say an MCU and start a continuous streaming of speed-data values to a serial monitor? Or does each new data value require sending the command again, every time I want a new speed-data value? I ask because many applications using UART communication can continuously stream data. I'm a little confused trying to determine if this applies to the CDM 324 or if my current understanding of the way an MCU for example need to do, in order for it to collect a speed-data value (Ergo, it needs to send the 'k' command over and over to obtain new speed-data).

To clarify my question, here's a Python script demonstrating what I mean by data streaming over UART. Although I haven't tested this script, it should illustrate the concept:

import serial

# Set up UART communication parameters
uart = serial.Serial(port='/dev/ttyS1', baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)

# Transmit a data stream (example: sending a string continuously)
data = "Hello, UART streaming!"
uart.write(data.encode())  # Transmit data as bytes

# Receive a data stream (example: reading a buffer of 100 bytes)
received_data = uart.read(100)  # Read 100 bytes from UART

Can you confirm if the CDM 324 behaves like this, where it allows continuous streaming, or if each new data retrieval requires sending a new command? Your guidance would be greatly appreciated.

Marcus-Peterson commented 6 months ago

Also, How do I reopen issue? There is not button

limpkin commented 6 months ago

such as a serial monitor. Instead, to obtain new speed-data values, the MCU must send a 'k' command each time it wants to read a new value. Could you confirm whether my understanding is correct?

that is correct indeed :)

Or does each new data value require sending the command again, every time I want a new speed-data value

that indeed

Can you confirm if the CDM 324 behaves like this, where it allows continuous streaming, or if each new data retrieval requires sending a new command?

the latter

Tell you what, whenever I have time i'll try to code a streaming mode :)

henridbr commented 6 months ago

So I am not alone. This question seems obvious, but it's not.
My first idea was that the sensor is sending a flow of data because the screen is always showing speed, but it's not the case. The sensor answers only when "k" is sent like the cop's handheld radar when he pushes on the trigger. It is possible to add a presence detector (with an acute angle of detection) to do that. Or by software to send "k" continuously in order to receive a flow of values and filter them to get useful data. Many problems I guess to discriminate different objects.

Marcus-Peterson commented 6 months ago

So I am not alone. This question seems obvious, but it's not. My first idea was that the sensor is sending a flow of data because the screen is always showing speed, but it's not the case. The sensor answers only when "k" is sent like the cop's handheld radar when he pushes on the trigger. It is possible to add a presence detector (with an acute angle of detection) to do that. Or by software to send "k" continuously in order to receive a flow of values and filter them to get useful data. Many problems I guess to discriminate different objects.

Yes indeed, the only way I got, what you could consider a "stream" (It's not an actual stream, but it kind of looks like one). Is to just send a command to the radar every 600 milliseconds. But the problem with that is that it can cause problems later down the line once you want to say for example do counting and stuff like that.

But yeah, I am less confused hope you are as well.

Unless someone has any other thoughts or ideas, we can most likely close down this issue, again.

Marcus-Peterson commented 6 months ago

And also @limpkin I want to thank you personally for taking your time and answering all of the community's question. I appreciate this a lot. And I'm very grateful.

I'll make sure to contribute what I can to this FOS project. to make it easier for you.

limpkin commented 6 months ago

sure! let me know if you have any other question :)