This system captures accurate 3D scans of indoor environments using a rotating Time-of-Flight sensor controlled by a microcontroller. The project combines embedded systems and Python-based 3D visualization to produce interactive point clouds.
- C (Keil IDE): For microcontroller programming and hardware control.
- Python 3.9: For data processing and visualization.
- Open3D: Renders real-time point cloud scans in 3D.
- PySerial: Enables UART communication between the MCU and PC.
- MSP432E401Y Microcontroller: Controls scanning logic and interfaces with sensors/motors.
- VL53L1X ToF Sensor: Provides distance measurements using infrared light.
- 28BYJ-48 Stepper Motor + ULN2003 Driver: Rotates the sensor to capture a full 360° view.
- Full 3D Scanning:
- Captures spatial data in multiple layers to create a detailed room scan.
- Converts polar measurements into Cartesian coordinates for visualization.
- Live Data Transmission:
- Uses UART to transmit distance data to the PC in real time.
- Interactive 3D Visualization:
- Open3D displays point clouds that users can pan, rotate, and zoom.
- Modular Scan Settings:
- Adjustable resolution (steps per rotation), number of layers, and vertical displacement.
- Visual Feedback:
- Onboard LEDs indicate scan progress, UART activity, and status.
- Assemble the sensor mount with the VL53L1X and stepper motor.
- Connect the components to the MSP432E401Y microcontroller as per the schematic.
- Ensure all components are powered appropriately (3.3V for the sensor, 5V for the stepper).
- Launch Keil µVision and open the project file:
Final_Project.uvprojx - Click
Translateto compile the code. - Click
Buildto generate the hex output. - Click
Downloadto flash the code onto the microcontroller.
- On your PC, open Device Manager and identify the COM port the microcontroller is connected to.
- Open the Python script
3dvisual.pyin your preferred Python IDE. - Modify the configuration variables at the top of the script (commented as
CONFIG):num_slices = 3 num_segments = 32 z_step_height = 100 ser = serial.Serial('COM4', 115200, timeout=5)
- Run the program and wait for the terminal to show
waiting for PJ0 button press. - Press the PJ0 button on the board to begin the scanning sequence.
- After each scan layer, manually move the system along the Z-axis to prepare for the next layer.
- The program will continue scanning until all layers are completed.
- After the last scan, all the 3D points are saved to a file named
3Dvisual.xyz. - This file can be opened using Open3D or other third-party 3D tools for further analysis or export.
- A 3D viewer will launch automatically, displaying the full scan with connected points and layers.
Final_Project.c: Microcontroller code for stepper and sensor control.3dvisual.py: Python script for serial data reading and visualization.3Dvisual.xyz: Output file with all scanned XYZ points.
- Add vertical motor control for automated Z-axis movement.
- Upgrade data transfer to USB-C or wireless for higher throughput.
- Add filtering and mesh generation for cleaner 3D models.
- Export point clouds directly to STL or PLY for CAD applications.
Enjoy scanning your world in 3D! 📡