Project · Jan 2025 – Apr 2025 · Python · C++ · Hardware

3D Spatial Mapping System

A low-cost LiDAR alternative using a Time-of-Flight sensor and stepper motor to build 3D models of indoor spaces.

The Overview

This project presents a low-cost 3D spatial mapping system that reconstructs indoor environments using a Time-of-Flight (ToF) sensor mounted on a stepper motor. The system is designed to replicate basic LiDAR-like functionality by combining angular motion with precise distance measurements. At the core of the system is the VL53L1X ToF sensor, which measures distance by emitting infrared light pulses and calculating the return time after reflection. These measurements are synchronized with a 28BYJ stepper motor that rotates the sensor through a full 360° scan, enabling spatial sampling across the surrounding environment.

A TI MSP432E401Y microcontroller manages all system operations, including sensor initialization, motor control, and real-time data acquisition. The system communicates with the sensor via I2C and streams processed data to a PC using UART at 115200 bps. The main objective of the project is to convert raw distance readings into structured spatial data that can be used for 3D reconstruction. This allows the system to generate approximate indoor maps using only low-cost embedded hardware.

Spatial Mapper

Hardware setup — ToF sensor mounted on stepper motor for 360° room scanning.

Hardware Integration

The hardware design integrates sensing, actuation, and communication into a single embedded platform. The VL53L1X ToF sensor is connected to the MSP432E401Y microcontroller using the I2C protocol, operating at 100 kbit/s. This allows reliable real-time distance acquisition with minimal latency. The microcontroller acts as the central control unit, running at a 60 MHz clock speed and coordinating all system components. It handles sensor initialization, ranging control, and data processing before transmitting results to a PC through UART at 115200 baud.

A 28BYJ stepper motor with a driver board is used to rotate the sensor in precise angular increments. Each step corresponds to approximately 0.72°, enabling controlled 360° scans. Motor control is managed through GPIO signals (PH0–PH3), while push buttons allow user-triggered scanning and reset control. Status LEDs provide visual feedback during measurement, transmission, and system activity. The system operates within a 3.3V–4V range and is built on a breadboard prototype with a 3D-printed mounting structure to ensure stable alignment between the sensor and motor. Overall, the hardware setup is designed to maintain synchronization between motion and sensing, ensuring accurate spatial data collection.

Hardware

UART and I2C communication links between sensor, microcontroller, and computer.

3D Visualization

he visualization pipeline processes raw sensor data received over UART and converts it into a structured 3D representation of the scanned environment. MATLAB is used as the primary processing environment for this stage. Incoming serial data consists of distance measurements captured at known angular positions during each motor rotation. These values are parsed and interpreted as polar coordinates, where each measurement corresponds to a radius at a specific angle. The system then converts this polar data into Cartesian coordinates using trigonometric transformations. Each full scan produces a circular layer of points. Multiple layers are stacked vertically with fixed spacing, forming a volumetric dataset that represents the scanned environment in three dimensions. This enables reconstruction of both horizontal structure and vertical depth variation.

After conversion, MATLAB generates a 3D point cloud using scatter-based visualization. Additional line connections are added between consecutive points and between layers to improve structural clarity and highlight spatial boundaries. The final output is a layered 3D model that approximates the geometry of indoor spaces such as hallways or rooms. This approach demonstrates how low-cost embedded systems can be combined with simple signal processing to achieve functional spatial mapping without dedicated LiDAR hardware.

3D Output
S