Recently, I build myself a 3D scanner that works sort of ok, but due to its cheap cost, it was very slow and low quality. However, it is a fun project to do though.
Step 1: Pre-Version
This is a pre-version of the 3D Scanner. As you can see, it contain a mount for Ultrasound Sensor, a straw that make the sensor move up and down. I personally not recommend you to use this one because it require a fairly high skills to make those 3D printed parts. That means, if your 3d printer is not accurate enough, I highly recommend you to go with the 2nd version.
3D printed parts are as follow:
Baser : The rotating platform which object is placed on it for scanning (5V stepper required)
Roller ver 2: This can be ignored if your Ultrasound Sensor moving quite smoothly without vibration
Roller: This unit is connected to the 2nd 3D scanner which used to pull up the Ultrasound Sensor
Side Grapper: This also can be ignored if your Ultrasound Sensor moving smoothly without vibration
Slider: This is the back side of the Ultrasound Sensor Holder which is used to attach itself to the straw for up down movement
Top Pully: Place on the top of the structure for smooth movement
Ultrasound Sensor Holder: Holder for the ultrasound Sensor
Up goer: Used to hold the two paper plate on both side, this can be ignored if you use other harder materials.
As my 3D printer has failed to make the Ultrasound Sensor Move smoothly because of my printer's accuracy, I re-design the whole thing again and name it as V2. You can make V1 though if you have enough confident with your 3D printer's accuracy.
- Top Pully.stl
- Ultrasound Sensor Holder.stl
- Up go er.stl
- Roller ver2.stl
- Side Grapper.stl
Step 2: Gathering Material
In the v2, things become much more simple.
Here are the material you need.
- 5V Stepper Motor x2
- Arduino nano x1
- Ultrasound sensor x1
Here are the tool you need
- 3D Printer
- Hot Glue gun
Step 3: Wiring
The wiring is simple.
- Plug the 2 stepper motor into the arduino directly. It is NOT NECESSARY for a UNL2003 board for power supply.
- For the stepper under the rotation platform, plug it into pin D2 to D6, where D2 is vcc
- For the stepper on top of the tower, plug it into pin D8 to D12, where D8 is vcc
- For the Ultra Sound Sensor, plug the vcc to A0, GND to A3, echo to A2 and trig to A1
Step 4: 3D Printed Parts (Main)
3D Printed parts is much more complicated than the one before. Hence, I split it into two parts.
THE PARTS IN THIS STEP ARE NECESSARY. ALL OF THEM HAVE TO BE PRINTED TO MAKE THIS SCANNER WORK.
You need not to use any screws, just hot glue them together.
Step 5: 3D Printed Parts (Optional)
These are OPTIONAL 3D printed parts for reinforcement or making it more stable etc.
I personally like the stepper Wheel 2 instead of the Stepper wheel in the Main Page. There is 2 hole on the stepper wheel 2 for you to tie your string on it. But Stepper Wheel (1) works just fine.
Step 6: Connect the String From the Stepper Wheel to the Ultrasound Sensor Unit
Install all stepper into their suitable place as picture above,
Then, Install the ultrasound sensor and straws to make a rail for its up down movement.
Next, position the center of the Scanning Disk at a distance of 5.5 cm in front of the tip of Ultrasound Sensor.
Step 7: Arduino Code
I assumed that you know how to write program into arduino nano, and here is the code for the scanner to work.
And yes, I modified it from an example, but it works, right?
You might need slightly modify if your setup is different from mine.
P.S Autodesk Inventor generated stl files always got scaling problem. I need to scale it up to 10 times in order for it to work on my computer.
Step 8: Backstage Processing
In here, I use the VB.net to write the backstage processing program.
The scanning data was receive from serial in a format of
(d, r, h) where d is the distance measured, r is the steps that the scanning platform rotated and h is the height of the Ultrasound Sensor moved up in steps
To convert them back into x y z value, we need the following code
Dim data() As String
Dim tempspliter() As String
Dim x As Double
Dim y As Double
Dim z As Double
Dim r As Double 'radius
Dim p As Double 'angle from center
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
On Error Resume Next
data = TextBox1.Text.Split(vbNewLine)
Dim rawdata As String
For Each rawdata In data
tempspliter = rawdata.Split(" ")
'Put the right value into the right place
x = tempspliter(0)
y = tempspliter(1)
z = tempspliter(2)
'Data Analysis and sorting
z = z / 22 'Convert z from steps to cm
r = 65 - x 'Radius from center of rotating platform to object edge
p = y / 2048 * 360 ' Convert angle from step to degree
x = r * Math.Cos(p)
y = r * Math.Sin(p)
TextBox2.AppendText(x & " " & y & " " & z & vbNewLine)
Step 9: Copy and Paste
Copy the converted coordinate from textbox2 to a new file with a file extension as "asc"
This is a point cloud format that allow MESHLAB to read
Lastly, Open the file with MESHLAB and you will see your scanned data presented in a form of 3D coordinates.
Step 10: You Are Now Finished!
Now, start your Serial and connect your arduino to an USB port
Copy all the data returned from serial to VB.net application.
Press convert , copy and paste the converted data to a new asc format file,
then, you have successfully scanned an object!