This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/BOOSTXL-PGA460: Using PGA-460 to calculate the distance from an object to the sensor

Part Number: PGA460
Other Parts Discussed in Thread: MSP430F5242, ,

Tool/software: Code Composer Studio

Hi,

I need to calculate the distance from an object to an ultrasound sensor. I have a PCB and components to do that but I have doubts about using the right commands. I use USART interface.

I use a MSP430F5242 to communicate with pga 460.

First I tried to do that using the “Transducer echo data dump” command (command 7 in page 38 of pga460q1.pdf). For each measurement I obtained 128 Data Bytes. I think this solution is for data analysis and not for a final measurement system (FMS). To obtain an algorithm to calculate the distance automatically with command 7 we need to do a hard work, specially, to discriminate the “normal zone” and the “blind-zone” (the zone with an object with a distance nearly less than 25 cm from the sensor).

For a FMS, we can use “Ultrasonic measurement result” (command 5 in page 38 of pga460q1.pdf). My doubt is how to use this to detect if an object is in the “blind-zone”. If an object is in the “normal zone”, command 5 can be used correctly for example with a “threshold level” high in the begin, and nearly 56 after the blind-zone. But if the object is at a distance less than 25cm the result obtained with the execution of command 5 is wrong (for example – if distance equal 15 cm the result are 44,3 cm).

To detect the blind-zone I tried to use command 8 – detect the decay time but I have doubts about the answer. For example if I consider SAT_TH = 14 (0xE) and take a measurement with no object nearby, I obtain a value of the decay time in decimal – 79. Converting this in time (in µs) we have 79x16 = 1264 µs. In attachment I send an excel file with a measurement with command 7 of the first 99 values and the distance and time of the data according to the configuration selected.

My doubts are:

  • Is it possible to calculate the distance of an object to the sensor with command 5 and command 8?
  • If yes, how is it possiblePost17-12-2019.xlsx
  • Hi Jose,

    The PGA460 has a built-in time-of-flight calculator, so you do not need to extract the echo data dump for post-processing. When DATADUMP_EN=0, the ultrasonic measurement result (UMR) is updated after every burst/listen cycle. To extract the UMR, use USART command 5. This is the most basic approach of reading time-of-flight data from the PGA460.

    Regarding your doubts:

    To convert the time-of-flight result from command 5 into distance, use this equation: distance (m) = [v_sound * (MSB<<8 + LSB) / 2 * 1us].

    This equation is detailed in footnote-2 of the datasheet's Table 3 "UART Interface Command List". If your object is too close, it is possible to get a false reading at twice the distance due to multiple echo round-trips between the transducer face and targeted object. However, command 8 (system diagnostics) can be used to monitor the near field detection (NFD) or blind-zone time to first check if there is something very close to the transducer. Refer to section 7.3.5 System Diagnostics of the datasheet to see the description on the "Decay-period time capture":

    Decay-period time capture During the decay stage of the record interval a transducer decay time measurement is performed to verify correct operation of the transducer. This diagnostic in combination with the transducer frequency measurement are commonly used in ultrasonic systems to detect external blockage of the ultrasonic transducer. The decay period time is measured at the output of the digital data path. The measurement starts at the same time when the burst stage is completed and the decay period is measured as long as the echo level is higher than a saturation threshold level defined in the EEPROM by the SAT_TH parameter. The provided result can be extracted by using any of the PGA460-Q1 interfaces, while the value is expressed in 16-ìs time increments. If the decay time measured greater than 4 ms, the value extracted will read 0xFF.

    In short, you can set the value of SAT_TH to 0xF to maximize the saturation diagnostic threshold level, send a burst/listen command, then read back the system diagnostic results via command 8.

  • Hello Akeem, 

    I have a question for you, please what the max of ping per second for PGA460.

    Thanks. 

  • Part Number: PGA460

    Tool/software: TI C/C++ Compiler

    Hello,

    How to set maximum burst frequency for a distance between 1m and 1.5m?

    thanks

  • Hi Mustafa,

    The max ping per second rate is dependent on the preset record length time you select on the device. Your options range from 4.096ms to 65.536ms per burst/listen cycle. You would select the record length time based on the maximum range you need to detect, which will be between 70cm to 1100cm respectively through air. You can calculate your required preset record length as:

    RecLen [s] = TimeOfFlight [s] = (MaxDistance [m] * 2) / SpeedOfSound [m/s]

    where

    • MaxDistance in meters is provided by the user
    • SpeedOfSound in meters/second is 343m/s in air at room temperature

    Example: If my maximum range 1.5m, then: RecLen = (1.5m * 2) / 343m/s = 8.746 ms

    In this case, the PGA460's selected preset record length should be rounded up to 12.288ms to enable a maximum detectable range of 2.107m.

    Coming back to your question about ping/second rate, you must then account for the interface you are using the communicate with the PGA460, which is either UART or SPI. UART is much slower at 11.5kBaud max rate, while SPI allows up to 8MHz clock interfacing. Also, what information are you extracting from the device per iteration: ultrasonic measurement results, echo data dump, system diagnostics, temperature, etc.?

    I always recommend giving yourself at least 20ms of margin between each burst/listen iteration (sufficient for nominal communication delays and to avoid ghost echoes), so you can assume your ping interval to be about 35ms for 1.5m object detection, which is about 28 pings per second.