Skip to main content

Library for fmcw radar

Project description

FMCW

Based on initial & ongoing work by Henrik Forstén/@Ttl.

Documentation: Read The Docs

  1. Generalities
  2. Description of the flow
  3. Technical considerations

Generalities

Version convention

Releases have a version number in the following format: X.YYY.ZZZ

  • X is the hardware version.
  • YYY is the release version
  • ZZZ is the minor update version

History

The FMCW package is a library designed to interact at a high level with the fmcw radar from Henrik Forstén/@Ttl. If you are not familiar with it, start with taking a look at Henrik's blog post on the third version of the radar: FMCW 3

For additional information on this type of radar, you can also take a look at the previous blog posts written by Henrik. These older radars are not be compatible with this library but can help shine some light on radar theory and the history of the project:

Additionnaly, Henrik's fmcw project was covered in a few articles. For instance:

Where to get an fmcw3?

Short answer: you have to make it yourself.

Longer answer: only a few boards seem to have been made so far, all based on the files that Henrik uploaded on his GitHub repository. If you plan on building one, make sure you have:

  1. proper hardware to place the components & reflow them
  2. 200+ hours ahead of you (VERY dependant on your existing knowledge)
  3. ~$500

Of course, these are rules of thumbs and should not be taken at face value.

FMCW3

I have an fmcw3, what should I do next?

Congratulations! There are two main options:

  1. You write your own script based on the library. This is expected to be hard as the documentation is lagging behind the code I write.
  2. You reuse the latest release I have for the main script. This is the recommended option.

In what follows, I will describe how I use the library with 190830_rt_fmcw3.py, uploaded with release 3.1.ZZZ.

Description of the flow

Four main tasks are being executed by the script:

  1. Read the data from the FPGA
  2. Process the data
  3. Save the data to file
  4. Display the data in real time

Architecture

A picture is better than a thousand words so here is a schematic: Architecture

Read the data from the FPGA

This step is less easy than it sounds for a simple the reason: the FPGA is a real time chip while everything else (the usb port, the OS on my laptop, python...) is not. As a result, the FPGA outputs data are fixed intervals and if anything down the chain is not ready to receive it, the 4 kb buffers on the FTDI chip will quickly overflow and be overwritten. I have not found a silver bullet for that problem so far and only managed to mitigate it.

See here for more information: Stack Overflow

Process the data

The data coming from the FPGA is parsed to separate it in sweeps. Valid sweeps are then processed in order to display 3 types charts in real time. Invalid sweeps (most of the time incomplete sweeps due to dropped bytes on the USB bus) are zeroed and displayed as such.

Save the data to file

Threads are used to write the data to file. A total of three threads are spawned from the main process:

  1. One for writing the settings to file. Note that it is immediately closed after writing to file.
  2. One to write the raw, byte data to a text file.
  3. One to write the processed data to a csv file.

Display the data in real time

The main script offers the option to display data in real time. But there is no such thing as perfect real time: there is always a lag. Depending on how many sweeps you read at once from the USB port before processing, and how long these sweeps are, the lag can be increased or reduced. With the default settings, the lag is a few hundred ms.

The refresh rate is also severly limited on most laptop given the amount of work needed to refresh a plot that can have tens of thousands of pixels on it. Despite minimizing the amount of elements to refresh when updating a plot and keeping each plot in a separate subprocess, 10 Hz appears to be the maximum refresh rate on my CPU (i7-8565U).

Below, a few examples of the displayed plots: IF signal Angle plot Range time plot

Technical considerations

Batch processing

Here is quick description of how a batch of data is processed. Batch processing Feel like this is cryptic? It is. In a nutshell, the point is to mitigate the non-real time nature of the script as much as possible. It is not perfect and some data will be lost, but these days less than 5% is lost. If you ever want to learn more just reach out to me.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fmcw-3.2.5.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

fmcw-3.2.5-py3-none-any.whl (47.8 kB view details)

Uploaded Python 3

File details

Details for the file fmcw-3.2.5.tar.gz.

File metadata

  • Download URL: fmcw-3.2.5.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15+

File hashes

Hashes for fmcw-3.2.5.tar.gz
Algorithm Hash digest
SHA256 d3340eefc5062211b7879488a53426b3f020317515729ce9e61de462dcd86230
MD5 6865f2607718628255ae26884d4e6f3f
BLAKE2b-256 c9812945cd909e7d35267c251017c27238c81dc12deda81a0422b114585c2d83

See more details on using hashes here.

File details

Details for the file fmcw-3.2.5-py3-none-any.whl.

File metadata

  • Download URL: fmcw-3.2.5-py3-none-any.whl
  • Upload date:
  • Size: 47.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15+

File hashes

Hashes for fmcw-3.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5f2be91671765c88948eb49850162507d3cd3d5f2f133f76884b437f626083
MD5 0768e0ae6463cc8efb7613f449bf16c4
BLAKE2b-256 1e5a5c74e6b0da2cf9d1d1ec421bb92031e2c0360c546acc1355a1695e036cc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page