Instructables

Let's cook: 3D scanner based on Arduino and Processing

Featured
Picture of Let's cook: 3D scanner based on Arduino and Processing
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

Picture of Ingredients
-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.
1-40 of 59Next »
clow_reed made it!4 months ago

I'm working on this similar project. I used the basis of the software here to get started!

I've heavily modified the software to fit my purpose. I now have a somewhat chatty serial console that talks from the Arduino to the Processing sketch. I also changed the Processing code to use 2.0 and the new Video code.

I have my current derived work here: https://github.com/jwcrawley

I look at having it no longer derived when I eventually rewrite the code in Java and using PCL and OpenCV libraries. But that's a long time out :) And all shall still be open source!

img_20131103_112512.jpg
cube000 (author)  clow_reed4 months ago

I am very ashamed that I cannot continue my work with scanner. In my country, there is common proverb: "When You want to make God smile, tell him about your plans"... I've got finished rotating platform made from vinyl records player, laser diode driver controlled from ardu, better cam. But I'm not still finished with software. I see, You've implement handshake mechanism (You are calling it ping-pong); i've resigned from in 1'st version, but found it necessary in second. Anyway, GOOD JOB.

clow_reed cube0003 months ago

Sorry I havent had a chance to respond sooner! I've been quite busy with this:

http://hackaday.io/project/2021-3D%28ollar%29-Scan...

And don't be ashamed :) It was your project's start that I embarked on my own. I plan on the license of this software to be an Open Source one, either BSD or GPL (probably GPL3).

I was given an HD webcam by a friend of mine at our local Hackerspace. I've also bought 2 line lasers from China as well! Currently, I need to rebuild my project enclosure and work on the Linux GUI application. I plan on using Qt (for the GUI), OpenCV, and PointCloud Library! And I'm already a good step of the way there.

I hope you're able to use my works once I am done with it! I'm sure glad you started it, for I take the baton and continue :)

Sincerely,

Joshua Crawley

doll compare.png
thelwyn1 year ago
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
Idrispo thelwyn7 months ago

Hi... could make one instructables for us (the noob)... we will appreciate that.

thelwyn Idrispo7 months ago

Hi,

Hum Idrispo I'm confused, here is the page of an instructable about this so what else are you asking for? You mean this instructables is not detailed enough?

cube000 (author)  thelwyn1 year ago
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...
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)  amandaghassaei1 year ago
I have not because I hadn't know about it. It seems to be really promising thing! Thank You very much for this information!
http://workshop.evolutionzone.com/2011/04/06/code-modelbuilder-library-public-release/
it's really easy to use

"hey i tried running the code on processing but i got an error saying ArraryIndexOutofBoundsException: 0 for this line

myPort=new Serial(this, Serial.list()[0], 9600);"

I'm having the same problem. Anybody here konws solve it ? Thanks...

skiong18 months ago

hey i tried running the code on processing but i got an error saying ArraryIndexOutofBoundsException: 0 for this line

myPort=new Serial(this, Serial.list()[0], 9600);

is there any1 that can help me with this problem?

I need help too.... Anybody here knows solve this problem? thanks.

vj017 months ago

hi

it all works fine its just when i run the processing
sketch the window that opens up for the camera view is all white is it
possible i could get some help with this

thank you

mrtraviss8 months ago

Hi there, great project!

How do you time the picture with the stepper motor? Is that controlled by Arduino or is it just a timing thing?

ir_One9 months ago

what software to use capture image.?

cube000 (author)  ir_One9 months ago

Processing with Gsvideo library.

ir_One cube0009 months ago

without software, and where file *.asc directory save.?

sorry my language not good :)

cfishy1 year ago
um. What's a linear laser?
comicguru1 cfishy10 months ago

When a ray of light or laser pointer falls on a glass rod, it diverges and it can be considered that the glass rod acts as a convex lens. After divergence, it gives a line instead of a point when falls on a surface.

comicguru110 months ago

I am very new at this thing so I may sound stupid. The interconnection between the circuit components are a bit unclear to me. will you please tell me at least shortly?
And there is a part about switching on and off of LED in the processing code. But I cant find anything about any LED elsewhere. Maybe it is my fault. Please reply.

Jan_Henrik11 months ago
Arr! Pirates! :D
isahunter11 months ago
hi, genius idea. i tried to eliminate the rotating platform for make a flat 3d but i cant make work, can you please help me?
cube000 (author)  isahunter11 months ago
Selecting between rotating platform and linear scanning will be feature in v2 software, im currently writing. But it can take some time more beacuse of huge amount of other things i had to do. New release could be expected in 2-3 months.
isahunter11 months ago
hi, genius idea, i tried to eliminate the rotating platform for scanning a plane object but i cant make it work :( can you help me a little?

regards :)
12beav1 year ago
Hey I was just wondering what you used for a linear laser? And where I could possibly get one for cheap?..
cube000 (author)  12beav1 year ago
Check worldwide ebay, dx.com or aliexpress. ~3.5$
DoctorWoo1 year ago
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)  DoctorWoo1 year ago
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 ;)
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)  DoctorWoo1 year ago
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.
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.
Yettimania1 year ago
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)  Yettimania1 year ago
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
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.
Yettimania1 year ago
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.
thelwyn1 year ago
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)  thelwyn1 year ago
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 ;)
wavegm1 year ago
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) 1 year ago
I've add one step, please take a look at step 12.
1-40 of 59Next »