You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Projects/FMCWRadar.md
+32-36Lines changed: 32 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,23 +141,20 @@ For ultrasonic FMCW radars, the max range bottleneck is $$T_c$$. For regular FMC
141
141
## Radar Design
142
142
{: .text-yellow-300}
143
143
144
-
{: .WARNING}
145
-
Due to mechanical coupling issues on the current SensEdu Shield, this radar implementation will not be able to perform distance measurements with a single SensEdu Shield. The implementation requires two Arduino boards with SensEdu Shields and the radar measures the distance between the two boards.
146
-
147
144
The following block diagram illustrates the architecture of the FMCW radar :
The chirp signal Tx is generated in the transmitter shield and converted to an analog signal with the DAC. Tx is then doubled and follows 2 paths :
152
+
The chirp signal Tx is generated and converted to an analog signal with the DAC. Tx is then doubled and follows 2 paths :
156
153
157
154
- Tx is amplified and sent to the ultrasonic transducer
158
-
- Tx is sent to the receiving shield by using a jump wire between the transmitter DAC pin and the receiver ADC1 pin.
155
+
- Tx is sent to ADC3 by using a jump wire between the DAC pin and the receiver ADC3 pin (A8).
159
156
160
-
On the receiver shield, Tx goes through ADC1. The MEMS microphone receives a signal Rx which is amplified with a low noise amplifier (LNA) and goes through ADC2. This method is by no means optimal but it enables to send Tx and Rx signals to MATLAB from the same shield. The Tx and Rx signals are sent from the receiver shield to MATLAB.
157
+
The MEMS microphone receives a signal Rx which is amplified with a low noise amplifier (LNA) and goes through ADC1. The digital Tx and Rx signals are both sent to MATLAB.
161
158
162
159
The following signal processing is performed in MATLAB to measure the distance between the two shields :
163
160
@@ -169,74 +166,65 @@ The following signal processing is performed in MATLAB to measure the distance b
169
166
## Code Implementation
170
167
{: .text-yellow-300}
171
168
172
-
For this implementation, 2 Arduino with SendEdu boards are required. Follow these steps to get setup :
173
-
- Upload the `Chirp_SawtoothMod.ino` sketch from the [Chirp Project]({% link Projects/Chirp.md %}) to the transmitting board
174
-
- Upload the `FMCW_Distance_Measurement.ino` sketch to the receiving board
175
-
- Wire the DAC output `DAC0` from the transmitting board to the ADC1 of the receiving board. The default script uses analog pin `A7` to connect to ADC1. Check out the [ADC]({% link Library/ADC.md %}) section of the documentation for more details on the available ADCs for each analog pin.
176
-
177
169
{: .IMPORTANT}
178
-
Make sure to wire the DAC output of the transmitting board to the ADC1 of the receiving board !
170
+
Make sure to wire the DAC output to ADC3 (analog pin `A8`).
179
171
180
172
181
173
### Sending the ADC data and receiving in MATLAB
182
174
{: .text-yellow-100}
183
175
184
-
On the receiving board :
185
-
- ADC1 receives the DAC data
186
-
- ADC2 receives microphone #2 data
176
+
- ADC3 receives the DAC data
177
+
- ADC1 receives the microphone #3 data
187
178
188
179
A size header `adc_byte_length` is sent to MATLAB to indicate the size of each ADC frame in bytes. Since ADCs are 16-bit, each data is coded with 2 bytes. The data from both ADCs is sent to MATLAB using the `serial_send_array` function.
189
180
190
181
```c
191
182
// Send ADC data (16-bit values, continuously)
192
183
uint32_t adc_byte_length = mic_data_size * 2; // ADC data size in bytes
serial_send_array((const uint8_t*)adc_dac_data, adc_byte_length); // Transmit ADC1 data
195
-
serial_send_array((const uint8_t*)adc_mic_data, adc_byte_length); // Transmit ADC2 data (Mic2 data)
185
+
serial_send_array((const uint8_t*)adc_dac_data, adc_byte_length); // Transmit ADC3 data
186
+
serial_send_array((const uint8_t*)adc_mic_data, adc_byte_length); // Transmit ADC1 data (Mic3 data)
196
187
```
197
188
198
189
An important variable is `mic_data_size` which must be a multiple of 32 because `serial_send_array` sends data by chunks of 32-bytes. `mic_data_size` will also define the amount of samples used for the plots in MATLAB.
199
190
200
191
The bigger the value of `mic_data_size`, the more latency when you run the MATLAB distance measurement script but the more signal will be displayed on the plots.
201
192
202
-
{: .NOTE}
203
-
Increasing `mic_data_size` won't affect distance resolution since the latter only depends on the chirp bandwidth.
204
-
205
-
In MATLAB, the `read_data` function is used to retrieve the data from both ADCs.
206
-
207
193
```c
208
194
// Retrieve size header for ADC data
209
195
adc_byte_length = read_total_length(arduino); // Total length of ADC data in bytes
210
196
ADC_DATA_LENGTH = adc_byte_length / 2; // Total number of ADC samples
211
197
212
198
// Retrieve DAC to ADC data
213
-
adc1_data = read_data(arduino, ADC_DATA_LENGTH);
199
+
adc3_data = read_data(arduino, ADC_DATA_LENGTH);
214
200
215
201
// Retrieve Mic ADC data
216
-
adc2_data = read_data(arduino, ADC_DATA_LENGTH);
202
+
adc1_data = read_data(arduino, ADC_DATA_LENGTH);
217
203
```
218
204
219
205
220
206
### Data processing in MATLAB & Distance computation
221
207
{: .text-yellow-100}
222
208
223
209
224
-
After sending the data to MATLAB, the data can be processed and the distance is eventually computed. Here are the different steps in order to compute the distance in MATLAB.
210
+
After sending the data to MATLAB, the data can be processed and the distance is eventually computed. It is worth noting that a high-pass FIR filter has also been applied to the mixed signal in MATLAB. This is to attenuate low frequencies (15 Hz to 46 Hz) in the spectrum coming from the transducer's signal directly received by the microphone. These frequencies don't correspond to an object's reflection and thus need to be mitigated. This is important to mitigate the right amount of reflections
211
+
212
+
Here are the different steps in order to compute the distance in MATLAB.
225
213
226
-
**Step 1**{: .text-blue-000} : High pass filter Tx (`adc1_data`) and Rx (`adc2_data`) to clean up the signals
214
+
**Step 1**{: .text-blue-000} : High pass filter Tx (`adc3_data`) and Rx (`adc1_data`) to clean up the signals
@@ -257,11 +245,19 @@ After sending the data to MATLAB, the data can be processed and the distance is
257
245
**Step 6**{: .text-blue-000} : Compute the distance
258
246
259
247
```c
260
-
d = (fbeat * Tc * c) / (f_end - f_start);
248
+
d = (fbeat * Tc * c) / (2*(f_end - f_start));
261
249
```
262
250
263
-
{: .NOTE}
264
-
The distance formula used in this configuration is for a one-way and not roundtrip because the signal travels between the two board. The usual formula differs by a factor of 2.
265
-
266
251
{: .IMPORTANT}
267
-
Make sure the parameters in MATLAB match the parameters of the chirp you are sending (f_start, f_end, Tc, etc...).
252
+
Make sure the parameters in MATLAB match the parameters of the chirp you are sending (f_start, f_end, Tc, etc...).
253
+
254
+
After running the MATLAB code, you should see the following display. This example is with an object placed at 50 cm from the board and using the following radar parameters :
Arduino library of Infineon's [**XENSIV™ Digital Pressure Sensors (DPS3xx)**](https://www.infineon.com/cms/en/product/sensor/pressure-sensors/pressure-sensors-for-iot/).
0 commit comments