|
1 | 1 | # Spatial-Mapping-System |
2 | | -an embedded spatial measurement system using a VL53L1X time-of-flight sensor to acquire information about the area around you |
| 2 | +**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.** |
| 3 | + |
| 4 | +Check out the datasheet for this project: [SMSUTOFv01 Datasheet](SMSUTOFv01-datasheet.pdf) |
| 5 | + |
| 6 | +## Demo |
| 7 | + |
| 8 | +<div style="display:flex; justify-content:center;"> |
| 9 | + <div style="text-align:center;"> |
| 10 | + <div>Area scanned:</div> |
| 11 | + <img src="datasheet-src/images/hallway1.png" width="50%" /> |
| 12 | + </div> |
| 13 | + <div style="text-align:center;"> |
| 14 | + <div>Output plot:</div> |
| 15 | + <img src="datasheet-src/images/scan2.png" width="50%" /> |
| 16 | + </div> |
| 17 | +</div> |
| 18 | + |
| 19 | +## Setting up: |
| 20 | + |
| 21 | +1. Build the circuit based on the following schematic: |
| 22 | +<img src="datasheet-src/images/schematic.png" alt="Circuit schematic" width="500"/> |
| 23 | + |
| 24 | + |
| 25 | +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](main-keil) then translate, build and load the program. |
| 26 | + |
| 27 | +## Software Installation: |
| 28 | + |
| 29 | +1. Download Python 3.9, which can be found at https://www.python.org/downloads/ under specific release downloads. |
| 30 | +2. Install NumPy, open3d, and Pyserial: |
| 31 | + |
| 32 | +`pip install numpy` |
| 33 | + |
| 34 | +`pip install open3d` |
| 35 | + |
| 36 | +`pip install pyserial` |
| 37 | + |
| 38 | +Refer to their documentation for any issues: |
| 39 | +* NumPy documentation: https://numpy.org/doc/1.21/ |
| 40 | +* Open3D documentation: http://www.open3d.org/docs/release/ |
| 41 | +* Pyserial documentation: https://pyserial.readthedocs.io/en/latest/pyserial.html |
| 42 | + |
| 43 | +## How to use the device after setting up: |
| 44 | + |
| 45 | +1. Open `measurement_data.py` and modify the PORT variable to that of your device, found from UART port listed in device manager. |
| 46 | +2. Run `measurement_data.py` by opening terminal, navigating to the directory of the file, and entering `python measurement_data.py` |
| 47 | +3. Enter how many displacement steps the scan will use when prompted by the program. |
| 48 | +4. Press the peripheral push button to enable measurements to set up the ToF. Pressing this again will toggle this back off. |
| 49 | +5. Press the the onboard PJ1 button each time a measurement rotation has to be made. Pressing this again will end the rotation process. |
| 50 | +6. 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) |
| 51 | +7. Press the button again for the next measurement. |
| 52 | +8. 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. |
| 53 | +9. Run the `spatial_visualization.py` file by typing `python spatial_visualization.py` in terminal. |
| 54 | +10. 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. |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +The spatial map should now be visible to you in an interactive GUI window. |
| 59 | + |
| 60 | + |
| 61 | + |
0 commit comments