This project is about making a 3d scanner at home. Which can scan any object & provide its X, Y & Z coordinates. These coordinates can then be imported for 3D printing. To replicate any old/broken object.
Why did you decide to make it?I made this to ease my work. I had an object that I wanted to replicate by 3D printing. I want it to be a little bigger. That object was very complex to take its dimensions physically. This scanner helped me in scanning that complex object.
How does it work?This scanner is powered by an Atmega328p microcontroller onboard Arduino Uno. There is an ultrasonic sensor that provides the distance between itself & the object in front of it. This sensor is attached to a servo motor in such a way that the sensor is rotated from 45° to 135°. This gives us a 1 line scan of the object. Then the object is rotated 18° anticlockwise with the help of a dc motor connected. This motor rotates 20 times. Thus providing a full 360° scan of the object.
Physical Design of the 3d ScannerThe Ultrasonic sensor (HC-SR04) is attached to the horn of a servo motor (SG-90). The sensor takes the distance reading whereas the motor rotates the sensor simultaneously.
The object to be rotated is placed on the gear. This gear is driven by a worm attached to a DC motor. This arrangement reduces the speed & increases the torque. One more advantage is that the object to be rotated stays in position even if there is a loss of power.
After each top to bottom scan of the object, this motor rotates the object 18° anticlockwise.
The above image shows the whole setup of the 3D Scanner.
Plotting the scanned coordinates with Python MatplotlibThe Arduino code provides the X, Y& Z coordinates. These coordinates are then plotted with the help of the matplotlib library in the python programming language.
The following libraries need to be imported.
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import Axes3D
Below code 3D plots the coordinates
fig = plt.figure()
ax = plt.axes(projection ='3d')
ax.scatter(x, y, z, c=z, cmap='viridis', linewidth=0.5)
ax.set_title('3D Plot Of The Scan')
plt.show()
X, Y & Z are the lists containing respective coordinates.
Input object for 3D ScannerThe above object needs to be scanned by the 3D Scanner.
The output of the 3D ScannerThe above images show the plot of the scanned object.
Issue and Improper ResultThe scan is not perfect due to inaccurate & cheap components. The worm gear arrangement had some engagement issues. But, this is just a technology demonstration. It will require many modifications to be accurate.
That's how we made a 3d scanner at home with off-the-shelf components & plotted/visualized it with the help of matplotlib (python).
Robotics EveryDay!!!
Comments