Hello and welcome to my first instructable! I made a 3D scanner from scratch.
Simple to use
This is a standalone 3D scanner. Just push a button and wait a minute. You do not need to use special software like MeshLab, Adobe and so on.
Easy to make
3D scanners generally use sensors such as laser. However, in this work, we use camera images and computer vision algorithms.
3D printer friendly
The output is a STL file, so you can use it directly for 3D printing.
Step 1: Key Components
Step 2: Basic Concept
We use the “Shape from Silhouettes” algorithm to get the 3D shape. This algorithm uses multiple silhouettes of the object. Result is not very accurate but it is robust against noise.
In order to get silhouettes from camera images, we have to do background subtraction. In this project, we consider blue area as the background area.
When the 3D scanning is completed, We get "Point Cloud Data" which is an aggregate of dots representing the 3D shape. To convert this to standard 3D data, we need to create polygon mesh. We use the “Marching Cubes” algorithm to generate the polygon mesh.
All processes are done on the board and the result is stored in the storage.
Step 3: Tools and Materials
- Plastic cutter
- Drill and drill bits
- Soldering iron
- Steel ruler
- FFC - 24pin - 0.5mm pitch, 120mm
- Stepper motor - NEMA-17 size - 200 steps/rev, 12V
- A4988 Stepper Motor Driver
- Tact switch (SW1), Resister 100Ω (R1), Ceramic capacitor 0.1μF (C1)
- “Processing” LED (LED1), LED resister 220Ω (R2)
- Electrolytic capacitor 100μF (C2)
- Prototype PCB for Arduino
- 2.54mm single row pin header and pin socket
- DC jack
- 12V AC adapter
- Blue heavyweight paper or blue felt fabric
- 1mm thick plastic sheets
- 5mm L-shaped plastic beams
- M3 screws, nuts and spacers
- M5 flange nut
- Plastic adhesive
- Double-sided tape
Step 4: Wiring on Board
Solder pin socket to GR-LYCHEE. Do not solder USB type-A connector.
Solder other components to the PCB according to the circuit diagram.
Step 5: Designing the Housing
The geometry is very important to the results. When you change the dimension, you need to change the parameters of the program.
Step 6: Building the Lower Frame
Accurate measurement, cutting and bonding are important. The location and size of the mounting screw holes depends on your motor.
Step 7: Building the Upper Frame
The location and size of the holes depends on your board.
Step 8: Making Turntable
The turntable does not have to be a circle. But it must be blue. So I put a blue felt fabric on the plastic plate.
Attach the M5 flange nut to the shaft with hot glue.
Attach the turntable to the stepper motor with hot glue or double-sided tape.
Step 9: Assembly
Connect the upper frame and the lower frame with plastic adhesive.
Attach the board to the upper frame with M3 screws, spacers and nuts.
Attach the stepper motor to the lower frame with M3 screws.
Attach the camera on the upper frame with double-sided tape.
Step 10: Writing Software
I prepared a compiled program for you. Please download the following program. Then connect GR-LYCHEE to your PC, and write the downloaded program to the mounted Mbed drive.
If you want to compile it yourself, please "mbed import" from my GitHub repository.
Step 11: Try It!
(1) Plug the AC adapter.
Make sure the onboard green LED is turned on and the “Processing” LED is off. If something is wrong, unplug the AC adapter and check the wiring.
(2) Put a blue paper in place.
You will be able to check the captured camera image using DisplayApp (PC application provided by RENESAS). Make sure the camera is properly focused.
(3) Insert a SD card to GR-LYCHEE.
The result are written on the SD card. The output is a STL file.
(4) Place the object on the turntable.
The maximum size of the object to be scanned is about 10cm x 10cm x 10cm. If necessary, use double-sided tape to attach it.
(5) Push a button and wait a minute.
The turntable starts to rotate and the “Processing” LED is on. Wait until the LED is turned off. Confirm that the turntable is rotating to the left (counterclockwise). If not, change the wiring of the stepper motor or change the program.
If it does not work, please check again the wiring, the stepper motor driver, AC adaper and SD card. Compatibility issues can also cause problems. If the LED does not turn off, please try another SD card.
Step 12: Tips
Scanning a 3D object requires camera parameters. This converts between the camera's units (pixels) and the real world units (millimeters).
Default parameters in this program are set for the camera bundled with my GR-LYCHEE. To improve the quality of results, I recommend calibrating with your camera. Technically speaking, you need to read a camera calibration article in OpenCV to get parameters, but you can also take a trial-and-error approach. Please change the defined parameters in the program (main.cpp) and recompile it.
To acquire more details
If you adjust the PCD_SIZE and PCD_SCALE in tinypcl.hpp, you can acquire more details. PCD_SIZE x PCD_SCALE determines the 3D acquisition size (in mm). Due to the memory limitation of GR-LYCHEE, the maximum PCD_SIZE is 200. If you want to scan objects in finer detail, set the PCD_SIZE to 200 and the PCD_SCALE to 0.5. The data will be acquired in 0.5mm grids.
Step 13: 3D Scanning Examples
I scanned the object with 0.5 mm grid and printed the result on my 3D printer.