Fix the base station board and move the tag board. Measure the actual distance with a tape measure, record the UWB readings, and input the data into an Excel calibration sheet.
Use linear regression to obtain calibration parameters. Modify and save the parameters using AT commands to improve ranging accuracy.
Calibration Data CollectionFix the base station device and move the tag device.
First, place the tag board at an actual distance of 10 cm and record the UWB reading.
Move the tag board back to 20 cm and record the UWB reading.
...
Repeat the steps to collect multiple sets of data, fill in the Excel calibration sheet, and obtain the linear regression function automatically.
Obtain the slope and intercept of the fitted linear equation:
y = 0.6386x - 65.06
Right-click on the fitting curve and select Format Trendline Options to view detailed settings.
Based on the slope and intercept obtained, you can use the AT command to replace parameters for calibration:
AT+SETDEV=X1, X2, X3, X4, X5, X6, X7, X8, X9
Parameter meanings:
- X1: Tag capacity (refresh rate)
- X2: Antenna delay
- X3: Kalman filter enable (1: enable, 0: disable)
- X4: Kalman filter parameter Q
- X5: Kalman filter parameter R
- X6: Calibration parameter a (slope)
- X7: Calibration parameter b (intercept)
- X8: Positioning enable (1: enable, 0: disable)
- X9: Positioning dimension setting
Use Ai-Thinker’s serial port debugging tool to obtain the original parameters for both base station and tag boards:
Base station parameters:
- Filter enabled: 1
- Kalman Q: 0.018
- Kalman R: 0.642
- Calibration a: 1.0000
- Calibration b: 0.00
- Antenna delay: 16336
- Rate: 6.8M
Tag parameters:
- Filter enabled: 1
- Kalman Q: 0.018
- Kalman R: 0.642
- Calibration a: 1.0000
- Calibration b: 0.00
- Antenna delay: 16336
- Rate: 6.8M
Open the serial port of the base station and send the following setting command:
AT+SETDEV=5, 16336, 1, 0.018, 0.642, 0.6386, -65.06, 0, 0
After sending, the system will return a confirmation message indicating success.
Then send:
AT+SAVE
This saves the settings and restarts the device, initializing with the new parameters.
You will see that the updated calibration coefficients have been applied.
Use the same process to update the tag board’s calibration parameters.
Re-testing the DistancePerform UWB distance measurement again to verify the effect of calibration.
- 1st Measurement
Result:
Actual distance 20 cm, UWB measured 10 cm → Error: 50%
- 2nd Measurement
Result:
Actual distance 17 cm, UWB measured 22 cm → Error: 30%
- 3rd Measurement
Result:
Actual distance 15 cm, UWB measured 15 cm → Error: 0%
Error AnalysisFrom the above three tests, the average error was 26.67%, significantly reduced from the original 50%.
In practical testing, the error is small and nearly matches the actual distance.The shown variation in the images is likely due to instantaneous measurement fluctuation during photo-taking, potentially affected by angle or surface alignment.
Improvement Plan- Increase the number of calibration data points to obtain a more accurate fitting function and calibration parameters.
- Improve the calibration fixture to ensure optimal signal transmission between the base station and the tag.
- Mount both devices on a sliding rail to enhance movement precision and distance accuracy during calibration.
This document introduces the distance measurement calibration process for the Ai-Thinker BU03-Kit module.
By collecting multiple measurement data points, performing linear fitting, modifying parameters via AT commands, and re-testing, the accuracy of distance measurement is significantly improved.
Error analysis and suggestions for further improvement are provided, offering a valuable reference for applications requiring high-precision UWB ranging.
Comments