A cost-effective and efficient embedded spatial mapping system using a VL53L1X Time-of-Flight (ToF) sensor, stepper motor, and microcontroller to generate 3D visualizations of indoor environments.
For a comprehensive explanation of the design, implementation, testing, and results, https://github.com/GitMustafaCode/Spatial-Mapping-System/blob/main/2DX3_Project_Report.pdf.
Setup
3D visualisation of hallway scan
- Texas Instruments MSP432E401Y Microcontroller
- VL53L1X Time-of-Flight Sensor
- 28BYJ-48 Stepper Motor with ULN2003 Driver Board
- A Windows/Linux system with Python 3.8+
- Required libraries:
pyserial
,open3d
,numpy
- Connect the VL53L1X ToF sensor to the microcontroller via I2C (SCL to PB2, SDA to PB3).
- Connect the Stepper motor to the microcontroller through the ULN2003 driver board.
- Configure the onboard push button (PJ1) for initiating scans.
- Verify LED status indicators (PN0, PN1) are correctly wired.
- Clone this repository:
git clone https://github.com/YourUsername/SpatialMapping.git cd SpatialMapping
- Open Keil uVision and load the provided project files.
- Compile and upload the firmware to the MSP432E401Y microcontroller.
- Install required Python libraries:
pip install pyserial open3d numpy
- Modify the Python script (
2DX_pythonCode_shahim45.py
) to match your system's UART port. - Run the Python script to start capturing spatial data:
python 2DX_pythonCode_shahim45.py
This project creates a 3D spatial map by rotating a ToF sensor mounted on a stepper motor. The system collects distance data at every 11.25° step and transmits it to a computer for visualization.
- Press PJ1 to start scanning.
- The stepper motor rotates 360°, taking measurements every 11.25°.
- Data is sent to the MSP432E401Y via I2C.
- The microcontroller transmits the data to the PC via UART.
- The Python script processes data into 3D models using Open3D.
- Interfaces with the ToF sensor using I2C.
- Retrieves distance measurements in millimeters.
- Sends data to the microcontroller memory.
- Manages UART communication between microcontroller and PC.
- Sends measured distances to the Python script.
- Configures timing delays for sensor sampling and stepper motor control.
- Configures the system clock speed based on student parameters.
- Controls status LEDs for data collection feedback.
- Reads data from the MSP432E401Y via UART.
- Converts raw distance readings into (x, y, z) coordinates.
- Generates a 3D point cloud using Open3D.
✔️ Time-of-Flight Sensor for precise distance measurement
✔️ Stepper Motor Integration for automated scanning
✔️ Real-time 3D Visualization using Open3D
✔️ UART Communication between microcontroller and PC
✔️ Modular Code Design for easy expansion