The SMSUTOFv0.1 is an embedded spatial measurement device I've created which uses a VL53L1X time-of-flight sensor to acquire information about the area around you and generates a 3D mapping of a scanned area.
Check out the datasheet for this project: SMSUTOFv01 Datasheet
- Build the circuit based on the following schematic:
Ensure the ToF is mounted to the stepper motor. The Keil project should be flashed on the micro controller by default, so pressing the reset button is sufficient to load the program. If this is not the case: Open the Keil Project src found here then translate, build and load the program.
The embedded C code can be run on Keil uVision and flashed directly onto the microcontroller from the IDE.
It is recommended to use a virtual environment, as this program uses libraries compatible upto Python 3.9. If you choose to do this with conda:
conda create -n <env-name> python=3.9
You can then install the required packages (NumPy, Open3D, and Pyserial):
pip install -r requirements.txt
- Open
measurement_data.py
and modify the PORT variable to that of your device, found from UART port listed in device manager. - Run
measurement_data.py
by opening terminal, navigating to the directory of the file, and enteringpython measurement_data.py
- Enter how many displacement steps the scan will use when prompted by the program.
- Press the peripheral push button to enable measurements to set up the ToF. Pressing this again will toggle this back off.
- Press the the onboard PJ1 button each time a measurement rotation has to be made. Pressing this again will end the rotation process.
- For each number of physical steps taken, wait for the motor to complete one full rotation and return back to the home position. Once this is complete, move forward by the amount of x-displacement increment set (350 mm in the program but modifiable by user in the
STEP_INCREMENT
variable) - Press the button again for the next measurement.
- The program will then print to you the measurements at each point taken as the program runs from the scan and also output this to a file in the same directory called
pointdata.xyz
. D3 LED will flash on the micro controller for verification purposes. - Run the
spatial_visualization.py
file by typingpython spatial_visualization.py
in terminal. - When prompted, enter the number of scans taken. The program will use this and then output the numerical value to the user in the console and output the visualization points on the screen in a GUI. Closing this screen will show a new screen with final spatial map in a GUI.
The scan is of a yz-plane with x being the displacement taken for each scan. y
and z
are seen as the vertical plane that the motor rotates and scans for, and x
is the displacement after physically moving the motor by the step increment defined.
The spatial map should now be visible to you in an interactive GUI window.