Introduction: 3D Scanner: FabScan Pi
There are several way to build an affordable 3D scanner for your home. One way is to make photos (maybe even automatisied) from all sides of an object and let Autodesk 123D Catch do its magic. Another option is to use a depth camera like the Kinect and place your object on a rotating table and get depth images of all sides - great especially for a person scanner.
A cheap option is using a line laser which enlights on line on a object, get a camera image of that line and then rotate the object a bit and repeat - until you get the 3D form out of this slices when you have rotated the obect by 360 degree.
Francis Engelman build such a system as bachelor thesis at the media computing group of the RWTH Aachen - the so-called FabScan. It uses a basic webcam, an arduino for controlling a line laser and a stepper motor for a turntable.
One disadvantage was that it relies on a external computer for processing, which gives a hassle with different operating systems and so on.
Mario Lukas now made a big improvement of it in his thesis: The FabScan Pi uses a raspberry Pi (getting rid of the external computer and controlling the FabScan with a web browser), using the raspberry Pi camera as a better camera system and polishing the installation and usage process.
To build your own fabscan Pi you will need:
- A raspberry Pi 2 and a camera (you could also reuse the webcam of the old FabScan, but the one for the raspberry is better) and a Micro SD card for the Pi
- A line laser
- A stepper motor, motor driver (a stepstick, Polulo A4988 will do, Silent stepstick is better)
- A round plate mounted on the stepper motor, either with a Polulo Univeral Mounting Hub or a 3D printed one, as long as the plate holds stable on the motor axis
- A box, almost anything will do as long its about 33cm*24cm*20cm or bigger. You don't have to use a fancy box, at the end a shoebox can also work (might only a bit unstable).
There are several ways to connect the components:
- Use a standalone arduino, connect everthing with jumper wires and connect Pi and Arduino with a USB cable. Add a 12V power supply for arduino and stepper motor and a 5V supply for the Raspberry Pi
- Use the Fabscan shield, getting rid of the jumper wires
- Use the (upcoming) Fabscan Pi hat for the raspberry which will include an arduino, reducing the necessary power supplys to one 12V supply
In my case i went for the second option, adding two 230V connectors at the bottom of the FabScan Pi housing to hides both power supplys. If you don't have a fabscan shield at hand, you can just have a look at the board layout and make the connection with wires.
Apart from the box you will need some 3mm and 2mm screws, nuts and springs. For my housing i used 5 sheets of 3mm MDF, 30cm*60cm which i lasercutted and then painted black, using clasp and joints of a small box for the door and 2 sheets of golden paper for additional decoration - very importand for functionality :-)
If you want to make color scans, you might also want to add some RGB lights (WS2812b) for enlightment, something i didn't do yet, but basically they are just connected to 5V and ground of the arduino and their data input is attached to pin A1 of the arduino.
Oh, and votes for the contests are highly appreciated :-)
Step 1: First Test Upgrading the Old FabScan
Since we already had a FabScan at the Fablab Aachen (no wonder, since it belongs to the chair where these thesis are done :-) i first upgraded the old one. Just take a SD card and upload the newest image form Fabscan.org on the card, it's the same way as uploading the standard rasbian image on a sd card with the path to the fabscanpi_basic_jessie image instead to the rasbian image. On Raspberry.org are instructions for the different operating systems.
The camera of the raspberry is mounted on a small circle, which is then mounted with longer screws at the housing of the scanner. Springs between the camera plate and the scanner housing allow correcting the orientation of the camera.
The nice thing of the new system is that the raspberry pi uploads the program automatic to the arduino, no need to do something here, just connect the raspberry pi and arduino with an USB cable.
Step 2: Calibration, Usage and Basics
The FabScan Pi is then connected with a ethernet cable with your network. Typing its IP address in the browser allow you to control the FabScan. At the basis window you can browse old scans in the left folder or make a new scan with the button in the middle (on the left is a sharing button for downloading a scan if one is loaded).
The Laserline should go through the middle of the turntable, be as sharp (thin) as possible and should be vertical at the baseplate. While the camera looks vertical on to the backwall in one line with the turntables middle, the laserline should be at circa 57 degree to this camera direction.
Starting a new scan opens a preview window and some slider for control. At the beginning you might want to control the camera position: the slightly green crosshair in the preview window should horizontal at the middle of the turntable and vertical at the upper border of it, at least that worked for me :-)
To change the postion you can use the three spring mounted screws which hold camera plate and housing together.
After this you are ready to scan. The three paramter sheets control first the threshold for detecting the laserline and resolution of the scan, the other two sets are for RGB color leds etc. for a color scan.
Next i designed a new (smaller) housing. Some parameter like the angle between camera view and laser line can be changed in software, but to make things simple i reused the dimensions of the FabScan cube housing. A nice summery of the important dimensions can be found here.
Basically besides the laser line/camera-turntable angle i reused height of camera and laser, the diameter of the turntable (14 cm diameter) and the distance to the backwall of the turntable (a 0.5mm gap). The distance of camera to turntable's middle is in the new housing actually smaller (about 24 cm) than within the cube.
Step 3: Lasercut MDF, Painting Black
The parts in the Scänner.svg are cutted with a laser cutter out of 3mm MDF, but any box in similar dimensions will also do.
They are then painted black - which has the advantage that diffuse light is minimized, but the camera will not recognize the laserline on the back wall - at this position the surface has to be more reflective, i added at here later a stripe of white tape. Additional the bendable parts of the side walls (where the bunch of short parellel lines are) are taped on the inside before painting to make them opaque.
Bending the MDF can be improved (a.k.a. breaking minimized) by moistening the MDF before bending. The additional thickness of the color will also upgrade all connections to press-fit conenction, which only work when force is applied... not the brightest idea of myself. I should have colored it after mounting.
Step 4: Mounting the Turntable and the Laser
The turntable is mounted with polulo mount on the stepper motor, which is mounted before on the base plate. The laser is pressed inside few layers of MDF, which are screwed together. On its bottom magnets are glued with double sides tape and hidden behind black colored tape. A metall plate is then glued on the base plate and also hidden behind tape, which holds the laser magnetic on its place.
Altough this is complete useless for normal scans, it can be funny: By changing the angle between laserline and camera line you will get a distorting mirror effect for the scans.
Step 5: Camera Mount
The same camera mount as used before for the Cube version:
The ring is big enough to add later a small WS2812b neopixel ring. The camera is mounted with 2mm screws on the plate, while 3mm screws with springs are used as connection between mount and housing.
Step 6: Completing the Housing
First both larger sheets for the side walls are glued together (actually i did this before painting, which allows me to fixate this additional with tape inside). Then the border is stuck on the front side (deeper cut-outs on the base plate), and the top side is added. Thereafter, the side walls can be mounted.
The lid itself lays loose on top, while the front opening is assembled with clasp and joints from a box. The screws were to long and had to be shortened.
Step 7: Electronics and Testing
The raspberry and arduino are then screwed on the backside of the bottom plate, both connected with a usb cable, powered by a 12V supply(arduino) and a 5V supply (raspberry). On the arduino is a fabscan shield, which connects arduino, stepstick driver, stepper motor and laser with the arduino. Both powersupplys are plugged into two connected 230V sockets for only one outgoing power line. Apart of the two boards, a bunch of hot glue holds everything on its place.
At this point the FabScan Pi is functional, just a few decorations are missing.
Step 8: Decoration
Since the black box is a bit boring, i added some very useful decorations. Just lasercutted some designs from my favorite fonts (Bodoni, Soft Ornaments Three, Foundry Ornaments demo...) out of golden paper. To prevent them from flying away while cutting i glued them on a sheet of cartoon , with a layer of clear tape between to allow the paper pieces to be removed from this carrier cartoon after cutting. Which luckely worked well.
The cutted out rests of the paper could be also used as position help for glueing the parts at the right positions.
Step 9: Final Testing
Finally: Seems to work :-)
Just need to transform the pointcloud into a STL-file which is at the moment not done automatically by the Pi.
Step 10: From Pointcloud to Stl
For transforming the pointcloud into a printables STL-file i use MeshLab (at least until it is integrated into the FabScan software :-): Just download the .ply file from the Pi to your computer (right button in the FabScan browser window), and import it as a mesh in MeshLab. Then use several steps in the filter menu:
First in "Normals, Curvatures and Orientation" select "Compute normals for point sets". In the appearing window just press "Apply", no need to change some setting.
Then transform it into a surface by using "Surface Recunstruction: Poisson" in the submenu "Point set". Again, i justed applied the upcoming window instead of optimizing the values.
As a last step under "Cleaning and Repairing" you can find the "Merge Close Vertices" tool, where you can change some paramters or just press apply again.
You can now export the mesh as an stl file (again with no special settings apart from the from MeshLab suggested ones), and print the resulting object with your favorite 3D printer.
Step 11: A Simpler Housing - Work in Progress
The housing looks good and works, but of course a simpler version might be better if you just want to build your own scanner. The here included svg file allows to cut the housing out of 5 sheets 25cm*33cm of 3mm MDF, including mountings for the rotating table, the laser could be mounted with or without motor. In both cases no Polulo mounts are necessary anymore.
Only one type of screw is required (including camera and Pi): 16mm long 3mm hex screw. And small pieces of a spring for the camera mount.
But that's just the spoiler, because it's still work in progress. E.g. getting rid of the front door and just open the lid will additionally simplify things.
Second Prize in the
Raspberry Pi Contest 2016
Participated in the
Full Spectrum Laser Contest 2016
Participated in the
Digital Life 101 Challenge