Introduction
Microwave radar sensor can detect distance by transmitting and receiving radio wave. Compared with range&distance sensor of other kinds, the radar sensor can provide much smaller size, lighter weight and wider detection range. Besides, the sensor can keep a steady performance even operated in harsh environments and be able to penetrate most non-metallic materials, dust, smoke and fog etc.. What’s more, it can be used to detect distance of multiple targets.
The principle of radar distance sensor is quite easy to understand: transmit and receive microwaves to measure the distance to the surface of an object. The sensor supports FMCW modulation. All the signal processing units of the radar sensor are integrated inside the product, therefore, users can directly get the distance through Asynchronous Serial Interface.
The microwave radar sensor adopts ASI communication, with 57600bit/s band rate and 3.3V TTL logic level, which can directly communicate with upper computer or other MCU, greatly shortening the developing cycle.
Use it with controllers like Arduino to realize more practical and powerful functions such as, car reverse backup radar system, automatic door opener, UAV, passenger flow detection, collision-preventing device.
Features
- Non-contact detection
- Impervious to temperature, humidity, noise, airflow, dust, light and so on, suitable for harsh environment
- Strong anti-interference ability
- Low power output, saft and environmentally friendly
- Long detecting distance, high accuracy
- Large sensing angle, wide detecting range
- Support distance detection of multiple targets
- High directivity,travle at the speed of light
Specification
- Input Voltage: 4-8V(DC)
- Input Current: >100mA
- Dimension: 34mm×44mm×5mm/1.34×1.73×0.20”
- Weight: 8g
- Storage Temperature: -40℃~80℃
- Operating Temperature: 0℃~70℃
- Transmit:
- Detection Distance:0.5~20m
- Frequency: 24GHz
- Power: 6dBM(Max 10dBM)
- Modulation: FMCW
- Receive:
- Data Update Speed: 10Hz
- H-Plane Half Power Beamwidth: 78(-3db)
- V-Plane Half Power beamwidth: 23(-3db)
Pinout
Num | Description |
---|---|
1 | Power input(4V~8V DC, Current>100mA) |
2 | GND |
3 | Auxiliary power supply output(3.3V). Maximum driving current 100mA |
4 | UART output(TX). Output distance information or related spectral information. Band rate: 57600bit/s |
5 | UART input(RX). The functionality of this interface is reserved |
6 | Choose operation mode.When the interface is left floating, the output is distance data; when it is connected to GND, the output is distance + spectral data. |
Sensor Module Description
Sensor Structure
Signal Processing Diagram
The operating principle of the sensor module is shown as below. First, amplify the tiny signal received by the sensor, then convert it into squarewave signal through comparision circuit and output digital signal 0,1 so that the singlechip could easily process the signal.
There are two protocols for data output, if the port 6 is grounded, the output is distance + spectral data, and it includes: data header, distance data, spectral data, and data tail. The format is as below:
0xff, 0xff, 0xff, 0x, 0x, 0x##...0x##, 0x00, 0x00, 0x00
The first three Oxff are data headers, then next 0x** is the upper eight bits in the 16 bits distance information, and the second 0x** is the lower eight bits. The 16 bits binary data represents the distance to the target. (unit: cm)
The first 0x## is amplitude of the first spectral line of the distance spectral lines, the next one is that of the second spectral line, and so on. There are 126 spectral lines in total. The amplitude ranges from 1 to 44. After post-processing, users can use these spectral lines to realize mutilple targets detection. The last three 0x00 are data tails, marking the ending of this group of data.
If the port is left floating, the output is the distance information. The format is as below:
0xff, 0xff, 0xff, 0x, 0x, 0x00, 0x00, 0x00
The first three 0xff are data headers. The next 0x** is the upper eight bits in the 16 bits distance information, and the second 0x** is the lower eight bits. The 16 bits binary data represents the distance to the target(unit: cm). The last three 0x00 are data tails, marking the ending of this group of data.
The format of the UART communication: 1 start bit, 8 data bits, 1 stop bit, no parity check.
Algorithm of Multiple Targets
The port 6 is grounded, the output is distance + spectral data, and it includes: data header, distance data, spectral data, and data tail. The format is as below:
0xff, 0xff, 0xff, 0x, 0x, 0x##...0x##, 0x00, 0x00, 0x00
The first three Oxff are data headers, then next 0x** is the upper eight bits in the 16 bits distance information, and the second 0x** is the lower eight bits. The 16 bits binary data represents the distance to the target. (unit: cm)
The first 0x## is amplitude of the first spectral line of the distance spectral lines, the next one is that of the second spectral line, and so on. There are 126 spectral lines in total. The amplitude ranges from 1 to 44. After post-processing, users can use these spectral lines to realize mutilple targets detection. The last three 0x00 are data tails, marking the ending of this group of data.
For example: if the amplitude reaches the maximum peak, caculate the central point of the maximum peak. The central point will be the n-th data, then multiply by 0.126.
eg. If the spectral line amplitude forms peaks between 14th to 25th: The distance of the point should be: (14+(25-14)/2)*0.126=2.457 (Unit:m)
Tutorial
Requirements
Hardware
- DFRduino UNO R3 (or similar) x 1
- 24GHz Microwave Radar Sensor x1
- Connectors
Software
Connection Diagram
Single Target Detection
Connection Description:
As the diagram shows, the pin 1 to 6 are placed from top to bottom. Pin 1 to UNO 5V, P2 to GND, pin 4 and 5 to UNO digital pin 4 and 5. Pin 6 is unconnected.
Multiple Targets Detection
Connection Description:
As the diagram shows, the pin 1 to 6 are placed from top to bottom. Pin 1 to UNO 5V, P2 to GND, pin 4 and 5 to UNO digital pin 4 and 5, Pin 6 to UNO GND.
Sample Code
Single Target Detection
* ****************************************************
* @brief 24GHz Microwave Radar Sensor
* @copyright [DFRobot](https://www.dfrobot.com), 2016
* @copyright GNU Lesser General Public License
* @author [Xiaoyu](Xiaoyu.zhang@dfrobot.com)
* @version V1.0
* @date 2019-03-11
* GNU Lesser General Public License.
* All above must be included in any redistribution
* ****************************************************/
#include <SoftwareSerial.h>
char col;// For storing the data read from serial port
unsigned char buffer_RTT[8] = {};
int YCTa = 0, YCTb = 0,YCT1 = 0;
SoftwareSerial mySerial(4, 5);
void setup() {
mySerial.begin(57600);
Serial.begin(115200);
}
void loop() {
// Send data only when received data
if (mySerial.read() == 0xff) {
// Read the incoming byte.
for (int j = 0; j < 8; j++){
col = mySerial.read();
buffer_RTT[j] = (char)col;
delay(2);
}
mySerial.flush();
if(buffer_RTT[1]==0xff){
if(buffer_RTT[2]==0xff){
YCTa = buffer_RTT[3];
YCTb = buffer_RTT[4];
YCT1 = (YCTa << 8) + YCTb;
}
}//Read the obstacle distance of maximum reflection intensity
Serial.print("D: ");
Serial.println(YCT1);//Output the obstacle distance of maximum reflection intensity
}
}
Output result: the obstacle distance of maximum reflection intensity.
Multiple Targets Detection
* ****************************************************
* @brief 24GHz Microwave Radar Sensor
* @copyright [DFRobot](https://www.dfrobot.com), 2016
* @copyright GNU Lesser General Public License
* @author [Xiaoyu](Xiaoyu.zhang@dfrobot.com)
* @version V1.0
* @date 2019-03-11
* GNU Lesser General Public License.
* All above must be included in any redistribution
* ****************************************************/
#include <SoftwareSerial.h>
char col;// For storing data read from serial port
unsigned char buffer_RTT[134] = {};
int YCTa = 0, YCTb = 0,YCT1 = 0,checka,checkb,Tarnum=1,TargetY1 = 0;
double Tar1a,Tar1b,Distance,Distance1,Distance2,Distance3;
SoftwareSerial mySerial(4,5);
void setup() {
mySerial.begin(57600);
Serial.begin(115200);
}
void loop() {
// Send data only when received data
if (mySerial.read() == 0xff)
{
// Read the incoming byte
for (int j = 0; j < 134; j++)
{
col = mySerial.read();
buffer_RTT[j] = (char)col;
delay(2);
}
mySerial.flush();
if(buffer_RTT[1]==0xff){
if(buffer_RTT[2]==0xff){
YCTa = buffer_RTT[3];
YCTb = buffer_RTT[4];
YCT1 = (YCTa << 8) + YCTb;
}
}//Read obstacle distance of the maximum reflection intensity.
for(int i=6;i<134;i++){
if(buffer_RTT[i]==buffer_RTT[i-1]){
if(buffer_RTT[i-1]>buffer_RTT[i-2]){
Tar1a = i-6;
checka= buffer_RTT[i-1];
} //Check the increase of the peak
}
if(buffer_RTT[i]<buffer_RTT[i-1])
{
if(buffer_RTT[i-1]==buffer_RTT[i-2])
{
checkb= buffer_RTT[i-1];//Check the decrease of the peak
if(checka==checkb&&checkb>=10)
{
Tar1b = i-6;
Tar1b=Tar1b-Tar1a;
Tar1b=Tar1b/2;
Tar1a=Tar1a+Tar1b;
Distance=Tar1a*0.126;
Distance=Distance*100;//Calculate distance
Serial.print("Distance");
Serial.print(Tarnum);
Serial.print(":");
Serial.println(Distance);//Output the distance of other obstacles, can read other 3 obstacles at most.
Serial.print("D: ");
Serial.println(YCT1);//Output the obstacle distance of the maximum reflection intensity.
if(Tarnum==1){
Distance1=Distance;
}
if(Tarnum==2){
Distance2=Distance;
}
if(Tarnum==3){
Distance3=Distance;
}
Tarnum++;
}
}
}
}
Tarnum=1;
}
}
Output Result: output about 5 distance values at most.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum