Week 3: Circuit and PCB Design, Software Development and Distance Measurement Testing
Smart Obstacle Avoidance Helmet Development Log - Week 3: Circuit and PCB Design, Software Development and Distance Measurement Testing
Finalized Circuit and PCB Design
We designed the final circuit diagram, integrating all components efficiently.
Final Circuit Diagram
[Circuit Diagram]
Final PCB Design
Software Development Process
This week, we focused on software development and testing for the STM32 + ToF400C distance measurement system, aiming to implement parallel operation for three ToF sensors to ensure synchronized and stable measurements. The development process is outlined below:
1. Single ToF Sensor Testing (Baseline Development)
Before implementing a multi-sensor setup, we first tested a single ToF400C sensor using STM32 and Keil uVision:
Clock Synchronization: Configured STM32's clock and pins to ensure correct ToF sensor initialization.
Basic Measurement Code: Developed the
main()
function to read sensor data.Initial Test Failure: The test failed due to
define
statement conflicts with the STM32 runtime library (particularly Chinese-English character encoding issues).
2. Improved Single ToF Sensor Design
After troubleshooting the initial issues, we made the following optimizations:
Redesigned the
main()
function to properly initialize the sensor and configure the measurement process.Added a 500ms delay to ensure stable data acquisition.
Successful Testing: After fixing the code, the ToF sensor was able to provide stable distance measurements.
3. Implementing Parallel Operation for Three ToF Sensors
Once a single ToF sensor was operational, we proceeded to implement parallel operation for three ToF sensors, encountering the following challenges:
Challenge 1: Measurement Synchronization
Each sensor needed to complete measurements within the same cycle.
Adjusted the measurement delay to 1000ms to ensure synchronized operation.
Challenge 2: STM32 Pin Configuration Conflicts
When multiple I2C sensors are connected, SDA/SCL pin allocation must be carefully managed to prevent conflicts.
Assigned separate I2C pins for each ToF sensor to ensure proper communication.
Distance Measurement Testing and Results
After successfully implementing parallel ToF sensor operation, we conducted real-world distance measurement tests to evaluate accuracy and reliability:
Test Setup:
Three sensors were installed at different angles on the helmet to measure obstacles in the front, left, and right directions.
Data was collected in both indoor and outdoor environments to analyze performance under different conditions.
Results and Observations:
Overall measurement accuracy was high, but occasional fluctuations were observed in highly reflective environments.
The synchronization method was effective, ensuring all sensors completed data acquisition at the same time.
Conclusion
This week's progress marks a significant milestone for the project:
Successfully implemented parallel operation of ToF sensors.
Ensured synchronized measurement data across all sensors, optimizing delay handling.
Completed real-world testing, verifying the reliability of the distance measurement system.
Next, we will focus on the 4th ToF, integrating the voice module and final assembly, bringing us closer to a fully functional smart obstacle-avoidance helmet prototype!
评论
发表评论