Let's cook: 3D scanner based on Arduino and Processing by cube000
Featured
skaner.png
Ever wonder of copypaste method, usable in real life, not only in virtual reality? Me too. It is  21th century, and those are nearer than most of all can imagine! This is possible thank to 3d scanners and printers. So let's try to scan something!

First of all, sorry for my English skills. It is not my native language, I have learned it at school, but don't have many occasions to use it, except of reading articles in English. But i hope it would be good enough to understand.

 
Remove these adsRemove these ads by Signing Up

Step 1: Ingredients

skaner.png
-one Arduino with Arduino IDE
-one Processing IDE
-a lot of LEGO (best toy ever!)
-one stepper motor
-one Stepper motor driver and power supply
-one linear laser
-one webcam
- one working Meshlab
and Some help :)

First, you need to get all parts and think about overall look and working method.
And it depends the most of type of stepper motor you can get. I got my stepper from old OKI printer, which has attached gear set. It was very useful, because i could attach Lego pulley, without destroying it permanently. In a fact, i hadn't destroyed any Lego blocks during build of rotating platform. I hate destroying things.
Code is primitive, i know it. It has major mistakes, not all needed algorithms are applied. But it generates point clouds, which are very similar to real things and that was goal of this alpha version of scanner.

So let's prepare parts.
amandaghassaei says: Dec 3, 2012. 11:42 AM
have you tried sxporting the stl directly from processing, I just downloaded the modelbuilder library and have had a lot of success with it. cool project!
cube000 (author) says: Dec 4, 2012. 2:09 AM
I have not because I hadn't know about it. It seems to be really promising thing! Thank You very much for this information!
amandaghassaei says: Dec 4, 2012. 3:55 AM
http://workshop.evolutionzone.com/2011/04/06/code-modelbuilder-library-public-release/
it's really easy to use
thelwyn says: Feb 24, 2013. 5:16 PM
I had an Arduino lying on my desk for a while, a friend got into  3D printing, another one was over motivated and we finally bumped into your Instructables. A few hours later, without an installation as stable as yours and a cheap equipment (the good point of living in China at the moment) we already get some decent result (picture attached).

Now the next step is to deal with meshlab, because even with a nice cloud of points it doesn't seem so easy to get a nice STL, I may try the library that Amanda was suggesting actually (crazy Instructables Amada also did by the way!)

And then, plug that in a 3D printer \o/

Thank you so much for the inspiration!!
photo(1).JPG
cube000 (author) says: Feb 24, 2013. 11:45 PM
Good to see that my instructable was used by someone!
Currently I have unplanned stop at the scanner. Parts for this project (laser) and for another one, ordered in China, have huge delay... My hands shaking, wants to do sthg...
DoctorWoo says: Mar 12, 2013. 2:07 AM
I'm trying to make my own 3D scanner loosely based off of yours (more modular to allow for larger scans) and was curious to how well GSVideo can make point clouds. I was curious if you are aware of a way to set up GSVideo to import a video of a laser scan to create a point cloud. Thanks!
cube000 (author) says: Mar 12, 2013. 7:45 AM
GSvideo is only used to grab pictures (frames) from webcam. Rest of work is done in pure processing. Of course, it can be done by continuus recording and then using frames from video, but webcam reduce their resolution in video mode to 320x240. And this can be enough, only, to scan a brick ;)
DoctorWoo says: Mar 13, 2013. 7:21 PM
Ah, ok. That makes sense. I may take a stab at just taking a recording and going from that every ten or so frames. Thanks!
cube000 (author) says: Mar 14, 2013. 1:00 AM
Choosing method of grabbing images should depend of hardware you got. I think, in my case, photos method is more accurate. There are really low friction, no bearings, and elastic band as transmission belt; this causes oscillation of platform (not same angle after frame). After every step camera waits till oscillation fizzle out. In continuus method (grabbing video) you should think about acceleration at start of rotation and deacceleration at the end to prevent angle miss when rotation speed is not yet constant.
DoctorWoo says: Mar 15, 2013. 12:19 AM
Failed to think about the grabbig process...have to take a look at that.
However, the rest I have thought about. And as I was looking about (shortly after my last comment) I fond a program called david scan that will make a point cloud and model, and is free. I might try and implement some of the automation you have here, but all in all, I may jump ship to David.
Yettimania says: Mar 13, 2013. 2:30 PM
Really Enjoy this. Could you explain how you got to this equation, im confused by the +1 and the row*skan... b=((maxBrightPos+1-row*skan.width)-skan.width/2)/pxmmpoz; and how do you determine you have 5 pix in 1 mm.
cube000 (author) says: Mar 13, 2013. 3:37 PM
This equation, which You are asking for, is an direct effect of method, how Processing stores pixels in memory. 2-dimensional matrix of pixels (x,y), that we are see is stored in single row table variable, which length is equal x*y (i.eg. 8*8px frame is stored in variable frame[0, 1, 2, .... , 62, 63] ).
To determine pix/mm rate, i've used printed pattern made in some cad. I folded it 90deg along bottom horizontal line and i have put it on the platform. Center of cross is placed in cameras optical axis. So, using the horizontal (half-circle) piece, i can measure angle between laser and camera and on vertical piece i can measure pix/mm ratio.
Clipboard03.jpg
Yettimania says: Mar 14, 2013. 2:11 PM
Thanks for the quick response and explaining how the pixels are stored. I have a comment/thought on your pixels per inch. Correct me if I am misunderstanding. You are doing this measurement from a fixed point/plane and a camera that shoots a fixed frame. An object that is 2 inches away from the camera will have many pixels per inch as it takes up the majority of the frame. The same size object could be 5 ft from the camera and if you go with 5 pixels per mm,consuming 1/10 of the pixels in the frame, your object is now considered "smaller" because for example you would have 10 pixels x 5 mm at 50 mm. Versus if it is 2 in away you would have 100 pixels at 5 mm so it would be 500 mm. I just bring this up because the owls are textured and have a decent amount of depth to them so this may be introducing error in the mesh because the pixels are so small the error may be magnified by only a 1/4" of depth change on the object. This happens because you are assuming 5 pixels / mm at the rotational axis. Have you gotten better scans since first making this instructable? I'm just thinking of improvements that could be made if I build one and removing error.
Yettimania says: Mar 14, 2013. 2:10 PM
Thanks for the quick response and explaining how the pixels are stored. I have a comment/thought on your pixels per inch. Correct me if I am misunderstanding. You are doing this measurement from a fixed point/plane and a camera that shoots a fixed frame. An object that is 2 inches away from the camera will have many pixels per inch as it takes up the majority of the frame. The same size object could be 5 ft from the camera and if you go with 5 pixels per mm,consuming 1/10 of the pixels in the frame, your object is now considered "smaller" because for example you would have 10 pixels x 5 mm at 50 mm. Versus if it is 2 in away you would have 100 pixels at 5 mm so it would be 500 mm. I just bring this up because the owls are textured and have a decent amount of depth to them so this may be introducing error in the mesh because the pixels are so small the error may be magnified by only a 1/4" of depth change on the object. This happens because you are assuming 5 pixels / mm at the rotational axis. Have you gotten better scans since first making this instructable? I'm just thinking of improvements that could be made if I build one and removing error.
thelwyn says: Mar 13, 2013. 9:08 PM
MakerBot announced the release of a 3D scanner for coming autumn. Considering what you already did, I'm not very impressed by the data acquisition they will make (the first picture they gave of the platform seems actually close to your system). Now, what I am VERY curious about is how they will manage to translate it in a usable 3D file for 3D printing. Seems to me that this is where the bottleneck is?
cube000 (author) says: Mar 14, 2013. 1:10 AM
I think yes. There are some algorithms which can convert point cloud into triangle grid. This can be made manually, in meshlab, or by adding algorithms code in scanning program. I'm not programmer, programming is not so easy to me so i'm currently collecting knowledge and I will try add stl out in scanner before makerbot do this ;)
cfishy says: Jan 30, 2013. 2:41 AM
um. What's a linear laser?
wavegm says: Dec 6, 2012. 12:52 PM
Great Project ! Great instructable too !
Do you know David laser scanner ?(http://www.david-laserscanner.com/)
They might have some tips in their manuals for improving your scan
There are few guys that also scan with smartphones:
http://www.trimensional.com/
cube000 (author) says: Dec 4, 2012. 2:48 PM
I've add one step, please take a look at step 12.
doxsys says: Dec 4, 2012. 7:40 AM
This is freakin' brilliant! Great work -- Can't wait to try it.
noahspurrier says: Dec 3, 2012. 5:20 PM
Could you provide a download for the ASC of your Owl scan data? I'd like to get a better feel for the data that comes out of your scanner.

I've worked with MeshLab v1.3.0 on Linux. It seems pretty stable.
cube000 (author) says: Dec 4, 2012. 2:03 AM
I was pretty sure I had attached scan file, but now I realised that it didn't showed in. I had modified step 11, please take a look and read, now You can download owl.
Jamby says: Dec 4, 2012. 1:01 AM
Really really a fantastic project!
I've never thought it could be so easy to build a 3d computer model, I'll probably build something similar.
I've got just a question (maybe I've lost some point in the tutorial). How can you draw such "line" of laser on the object? If I just point the laser to the object, I would see just a point on it (like museum guides use laser pointers), don't I?
cube000 (author) says: Dec 4, 2012. 1:37 AM
Let's back to step 7. Maybe it is not clearly written, glass rod is attached in front of laser pointer. It makes something like cylindrical lens. When laser beam goes thru it, changes its characteristic from point (small width and small height - point) to linear (same width and much bigger height - vertical line). Much more details can be found in internet. You can search for physics optic theory for convex lenses.
If you have laser pointer, You can check using straight stem of wineglass.
captain Jack says: Dec 3, 2012. 4:00 PM
pan pisze code po Polsku, I lubi Lego! Coś takiego! Wspaniały Instructable!
judofish says: Dec 3, 2012. 1:11 AM
Great Project ! well done. Would love to see a higher res camera result.
llluis says: Dec 2, 2012. 8:32 PM
GREAT instructable!
I was looking for this for a while (I even got the line laser) but didn't have the theory nor the code to start from. You've provided both, thank you! Using a good cam and batch processing would give awesome results.
DIY-Guy says: Dec 2, 2012. 6:13 PM
Nice! I wondered what other methods could use a projected laser line.
This works sort of like the DAVID 3D scanner which started out fully free and open source.
The software still seems to be available for free- http://www.david-laserscanner.com/

Your rotating stage is nice for this.
cube000 (author) says: Dec 2, 2012. 11:39 AM
Thanks for comments :)
@jrd210: I saw 123D software making career on Instructables, but haven't tried that yet. When I'll have some free time - sure I will. PC version, because I don't have any iOS stuff.
@Edgar: I do not understand anything of your native language, but thanks for sharing my step-by-step. I gleanced on your blog, and i saved link to that processing library You described. Nice stuff.
@Surrey-Yeti: definitely some with blue shirt! And a sabre! (I forgot about sabre :( )
jrd210 says: Dec 2, 2012. 9:33 AM
123D catch on the iPhone/Ipod 4 or 5 does a pretty good job of getting the basis for a 3D *stl file. Or I use a better camera on tripod and an old turntable marked and divided to take my 80 or 100 photos of an object and feed them into a desktop version to produce *stl or *obj files -- nice creative instructable to add to the 3D creation list.
Surrey-Yeti says: Dec 2, 2012. 8:50 AM
nice!
What pirate do you recommend:-)
Edgar says: Dec 2, 2012. 8:46 AM
Gone to my Blog:
http://faz-voce-mesmo.blogspot.pt/2012/12/codeable-objects-scanner-3d-com-arduino.html
kondzio29 says: Dec 2, 2012. 3:28 AM
Niezłe, właśnie zastanawiam się nad kupnem arduino, warto?
masz 5 gwiazdek
cube000 (author) says: Dec 2, 2012. 7:10 AM
Zdecydowanie warto. Fajne narzędzie i łatwiejsze na początek od czystego C dla AVR.
cube000 (author) says: Nov 30, 2012. 4:45 AM
Thanks for Your comments.
@MissouriVillian, thanks for that link, hope it will help me, as soon as made my Meshlab stable enough to work with. There are some differences between my scanner and those in that instructable. I got only vertexes, better scanners gives faces also. As far as i went with meshlab, was converting points into sort of blob, which, with a pint of salt, can be called "owl" ;) Ain't got screenshot, meshlab crashed... I've checked some tutorials all over the net, and I'm preety sure I'm getting closer to get nice figure of owl, but without many details, feathers (poor webcam and poor laser).
@ipod135: I'm not from Denmark :)
ipod135 says: Nov 29, 2012. 6:37 PM
great instructable are you by any chance from denmark. by the way your english is very good
MissouriVillian says: Nov 28, 2012. 7:28 PM
Your english is as good as many native speakers one finds online. So no worries there. Thought you might find interest in this 'ible, it runs hand in hand with yours. http://www.instructables.com/id/Using-Meshlab-to-Clean-and-Assemble-Laser-Scan-Dat/#step1 Good 'ible.
sleeping says: Nov 28, 2012. 8:28 AM
Thanks for the great instruct-able.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!