Getting Started With the Radar Sensor

From BoSL Wiki
Jump to navigation Jump to search

This page will tell you how to get started with the radar sensor. For information about the development of the sensor please see Radar Velocity.

This guide is for use with the BoSL Board rev 0.4.x, and Radar velocity sensor 0.1.x.

Connecting to BoSL board

To connect the radar sensor to the BoSL board with the supplied logging code please see the table below:

Radar Sensor Cable BoSL Board
WKE Half Orange -
TX Brown D3
RX Blue D2
3V3 Green 3V3
RST Orange D6
GND Half Green GND

BoSL logging firmware

Here is supplied firmware for a BoSL board to connect to a radar sensor and log the data to the web: File:BoSL logger rev1.7.1.zip

To upload to the BoSL board please find the instructions below:

  1. Connect the BoSL board to your computer using the USB port, plug in a battery to the BoSL board
  2. Download the Arduino IDE (https://www.arduino.cc/en/software/OldSoftwareReleases)
  3. Add the BoSL board package by following the instructions at https://monash-bosl.github.io/BoSL-IDE-Core/
  4. Click Tools > Board: > Board Manager
  5. Install the "BoSL Boards" package
  6. Click Tools > Board: > BoSL Board to select the correct board for uploading
  7. Unzip and open the firmware file in the IDE
  8. Select the correct port under Tools > Port:. This should be the one which appears only when the bosl board is plugged in.
  9. Click the upload button at the top left side of the IDE window.
  10. Wait until you receive the 'Uploading Done.' message.

BoSL logging firmware adjustables

  • line 23: SITEID. Set this to a site ID you would like the upload to be identified with. Aim to keep this below 12 characters.
  • line 24: LOGMODE. This controls the data recorded and uploaded. Please set to 5 for default behaviour associated with this guide.
  • line 161: Sleepy(x). x (in seconds) sets how long the logger should wait before proceeding onto he next measurement. Expect a +- 10% error in the time value.

Installing the sensor

The sensor should be tested with the data logger to check that upload occurs before installation. Make sure a valid SIM card is inserted into the datalogger. The sensor should be installed above the water channel facing either upstream or downstream. The sensor should be angled at between 65 - 75 degrees as measured by the sensor's output from the logger. The installation height should be such that the sensor is not submerged under typical flow. The sensor is waterproofed so it will continue to function if it becomes underwater but it not give accurate readings while submerged. By default the sensor's measurement range is from 240 - 2240 mm line of sight from the back of the sensor body. Aim such that the water flow will always be in this range. If a different range is required please see the advanced section on how this can be changed. The sensor should now continue to log the flow bi-minutely uploading to the web database.

Accessing and interpreting the data

To access the data please download the csv file with the SITE ID name from http://www.bosl.com.au/IoT/testing/databases/

The data and the column values are explained in this excel file File:Fine depth decode.xlsx. As per the excel file the velocity needs to be corrected as per the formula v -> v/cos θ, where θ is the uploaded installation angle. The excel file also decodes the fine depth into distances (line of sight) and amplitudes. One of the 4 measurements will typically be the water surface. We return the 4 strongest measurements for the depth as if there is a strong static reflection in the scene which is not the water surface (typically a metallic object) this will not mask the measurement of the water surface. A course depth measurement (line of sight) which is the byproduct of the velocity determination is also provided. The course depth measurement is only sensitive to dynamic reflections. The only dynamic reflection in the scene will almost always be the water surface. Hence the course measurement should be more robust against interference and can be used to cross check the fine depth measurement. The course depth measurement has a measurement resolution of 60 mm while the fine depth 2 mm. To go from line of sight distance to water depth. The installation height H needs to be known, for a line of sight distance l the depth is d = H - l/sin θ where θ is the uploaded installation angle.

Advanced

Uploading to the Radar Sensor

The ATmega328PB is the MCU which is used to interface with the sensor. Firmware can be uploaded to this MCU using the Arduino IDE. 0. Download the firmware File:Radar-velocity firmware rev1.7.1.zip. This firmware also provides testing files which can be used to interface the sensor with a computer and directly capture the sensor output rather than relying on a datalogger.

1. Connect the TTL pin block on the radar sensor to a USB- TTL converter. For specific wiring please refer to the table

Radar Sensor Cable USB-TTL converter
WKE Half Orange -
TX Brown TX
RX Blue RX
3V3 Green 3V3
RST Orange RST
GND Half Green GND

2. Open the firmware up in the Arduino editor and select the correct port number.

3. Make sure that the BoSL AVR boards have been added to the editor if not please see https://support.arduino.cc/hc/en-us/articles/360016119519-How-to-add-boards-in-the-board-manager and follow the steps with the board manager URL https://monash-bosl.github.io/BoSL-IDE-Core/package_bosl.com.au_index.json.

4. Select the BoSL Boards -> ATmega328PB (3.3V, 8MHz)

5. Click upload

6. The firmware should now upload to the radar velocity sensor

ATmega328PB firmware adjustables

  • line 11: SWEEP_LENGTH. Set this value (in mm) to change the length of the scan interval. This measured along the line of sight of the sensor. Range 0 to 3800
  • line 12: SWEEP_START. Set this value (in mm) to change the start distance of the scan interval. This is measured along the line of sight of the sensor. Range 240 to 1500 (recommended), 3000 (experimental)

Flashing the STM32G071CB

The STM32G071CB on the XM132 is responsible for controlling the A111 radar sensor and performing digital signal processing. This should already come pre-flashed with firmware. Instructions on how to do this are coming soon... If you have access to a UART port on the STM32 and can connect this to a computer then simply using:

  py.exe -m stm32loader -p<comport> -b921600 -e -w -v <path to binary>

will flash the STM32