loading

Introduction

This instructable will guide you to build a 3D scanner for less than $30, or even $12 if you already have a USB webcam.

Seeing the price tag and limitations of commercial scanners I decided to challenge myself to build my own. It had to be cheaper and easy for anybody to build one using a 3D printer.

Result

The "Sardauscan" is a laser scanner, comparable to other professional laser scanners but for less than 20-30 times the price, and it has twice the number of lasers.

My design principles were:

· Keep it simple

· Keep it low cost

· Make it evolutive

· Provide a complete solution

The scanner is completely open source and open hardware:

· The "Sardauscan" software is written in C# - the full source code is available.

· You can write plugins for your own hardware or for your tasks.

The software allows you to scan, smooth, build meshes and export to various formats.

How does it work?

The principle of a 3D laser scanner is simple.

· A picture of the object is taken without any lasers firing

· One laser is switched on and another picture is taken

· Computing the difference between the two images, a laser trace (profile of the object) is obtained

· By knowing the positions of the camera and laser you can derive the 3D coordinates of all the points on the profile

· You do the same for all the lasers, turn the table and repeat the process until the table has made a full revolution

And there you go, you have a complete point cloud representing your object.

Step 1: What do you need ?

Here is the list of all the parts you need to build the scanner:

· A bunch of M3 (16 and 20 mm)

· A bunch of M4 (12 and 20 mm)

· 1x Arduino nano (Chinese copy, $4) http://www.befr.ebay.be/itm/NEW-Nano-V3-0-ATmega32...

· 1x Chinese Stepper Motor (28BYJ-48) and controller (ULN2003) (5$) http://www.befr.ebay.be/itm/Uln2003-Stepper-Motor...

· 1-4x Line laser 5v ($2.5$ piece) http://www.befr.ebay.be/itm/251688838898?ssPageNa...

· 1x Hercule HD Twist ($15) http://www.befr.ebay.be/itm/Hercules-HD-Twist-5-0...

· 20x20 profile (can be printed : there are plenty of STLs on the net)

· optional 3x 4mm roller ($0.3 piece) (624 bearings

Total: from $26.5 (1 laser) to $35 (4 lasers)

About the 2020 lengths: this is not really important. The only constraint is to have the camera seeing the whole table.

For example, here are the lengths I used for my build:

· 2 x 140mm

· 1 x 120mm

· 1 x 250mm

What to print

All the STL files can be found on Thingiverse:

http://www.thingiverse.com/thing:702470

· 1 x arm_left.stl

· 1x box.stl

· 1x box_door.stl

· 1x box_arduino_clamp.stl

· 1x arm_right.stl

· 1x CORNER.stl

· 1x MOTOR_MOUNT.stl

· 1 to 4 x laser_holder.stl

· 1X Camera_HOLDER_LOWER_PART.stl

· 1x Camera_HOLDER_UPPER_PART.stl

· 1x center_axe_MINIMAL.stl OR 1x table_AXLE.stl (OPTIONAL)

· 3x roller_baseV2.stl

· you can print 12x M4_tslot_nut.stl if you use a 20x20 profile and you don't have any

Remarks:

· The 2020 profiles are just here for ease of use. You can use whatever you have: wood, metal, …

· If you want to use another camera, you will need to adapt “Camera_HOLDER_UPPER_PART” to match it

· The bearing are optional. They are only necessary if you want to scan heavy objects or don't have a perfectly flat table

· The build is simple, just look at the pictures. You can't do it wrong

· Put the motor at the center, place the 3 profiles around and screw them. Place the corner, screw, put the arms, screw, …

· There is a hole for each screw, you can’t get it wrong.

· For the wiring, please refer to the diagram.

<p>Hope it will helps : A French student named Hugo Benoit-Jannin have made a calibration tutorial, i hope it will help.</p><p><a href="https://github.com/Sardau/Sardauscan/blob/master/Tutoriel.Sardauscan3d.pdf" rel="nofollow">https://github.com/Sardau/Sardauscan/blob/master/T...</a></p>
<p>Hello,</p><p>I can't find any hercules hd twist in Romania.</p><p>Can I use Canyon CNR-WCAM43G camera or MS Lifecam VX-2000? If not, can you suggest me a good one?</p><p>Thanks</p>
<p>as said before :</p><p>&quot;if you redo a upper holder, you can use whathever webcam you want except wide angle one. just be sure that your camera is vertical, no tilt, pan or yaw.&quot;</p>
<p>how did you find the co-ordinates (x,y,z) of the laser line?can you please attach the code you have used to find the co-ordinates.</p>
hello, <br>by trianglulation.<br><br>all the code is in the gitup link.given in the instructable: see the task &quot;scan&quot; in source.
<p>actually i didnt understand the highlighted part in the code.</p><p>how did you convert the pixel distance into real world values?</p><p>thnx :)</p>
<p>this code is to rotate the 3d points : when the table have turn, your object is rotated, your coordinate have change. so you must do the inverse rotation of the points to get the all in the same coordinate...</p>
<p>i think it is this code you must understand to convert 2d laser line to 3d world</p><p>it is the triangulation part.</p><p><a href="https://github.com/Sardau/Sardauscan/tree/f7856a15cb1bb3d16da0ea5c7cc6ef8d926d5e59" rel="nofollow">Sardauscan</a>/<a href="https://github.com/Sardau/Sardauscan/tree/f7856a15cb1bb3d16da0ea5c7cc6ef8d926d5e59/Sardauscan" rel="nofollow">Sardauscan</a>/<a href="https://github.com/Sardau/Sardauscan/tree/f7856a15cb1bb3d16da0ea5c7cc6ef8d926d5e59/Sardauscan/Core" rel="nofollow">Core</a>/LocationMapper.cs</p><p>public Point3DList MapPoints(List&lt;PointF&gt; laserLocations, Bitmap image, Color defColor)</p>
<p>actually i didnt understand the highlighted part in the code.</p><p>how did you convert the pixel distance into real world values?</p><p>thnx :)</p>
<p>Hello Sardau,</p><p>I build the Scanner and I can use the Serial Monitor to turn the Laser's on and off, I also can turn the table. </p><p>Now my Problem is, that the Programm &quot;Sardauscan&quot; isn't able to use my Arduino Uno. The Camera works but I can't add the Laser's and the Table.. Everytime I choose my Arduino Uno on COM 3 the &quot;ok&quot;-Button stay's gray. (as you can see in the screenshot). Clicking on the little blue Plug on the right side didn't change anything (I've been clicking that thing for hours..) </p><p>btw: the tutorial from Hugo Benoit haven't help.. </p><p>Hope you can help.. It is very important :S</p><p>Sorry if you don't get whats my problem is (probably caused of bad english ^^)</p><p>Greetings from Germany! :)</p>
<p>(the procedure at this moment is realy simple : i create a standart .net SerialPort, send &quot;Sardauscan?&quot; and wait for a &quot;yes&quot;. if i don't get it, the ok button stay grey)</p><p>the Sardauscan software doesn't allow to change the baudrate for now. have tou cange the baudrate in the firmware ?</p><p>ps: i got some problem with chineese nano clone, i must click severa time to actualy connect (maybee a com link initialisation problem, i dunno)</p>
<p>The funny part is, when i tiped &quot;sardauscan&quot; in th serial monitor it returned &quot;yes&quot;.</p><p>Now after trying some stuff (changing the baudrate, changing the COM-Port, etc.), it suddenly worked. I think the problem was, i had the serial monitor running, while i was trying to connect sardauscan with the Arduino. Maybe the Arduino was just overfloatet with tasks and informations. So I closed the serial monitor and it just worked.</p><p>Maybe some people had the same issue and now they can fix it ^^.</p><p>But thank you for the answer.</p><p>Btw. awesome project!</p>
<p>I have the same problem with table and laser, what should I do, please???</p>
<p>you can have only one connection to a serial port. (one application at a time)</p>
<p>yeah I already knew that, but I haven't thought that it is a different serial port ^^</p><p>Thanks for the help! :)</p>
<p>Hello, I finished building this a few weeks ago, loaded the firmware and my table motor wasn't working. I tried changing the half-step and revolution-step values and it still wasn't working. The stepper motor controller board didn't seem to be powering, I fried the Arduino board as well messing with it. I have a new Arduino and stepper controller but when I tried to compile in the Arduino program I get the error &quot;C:\Users\Mike\Documents\Arduino\Scanner\FirmWare.ino:1:27: fatal error: SerialCommand.h: No such file or directory&quot;</p><p>Anyone know why I'm getting this error now? I tried downloading the sardauscan software again and starting fresh and still get this error.</p><p>-Mike</p>
<p>I am not able to get scans. How can i get the laser line to be just the height of the object? What is Threshold ? What is minimum and maximum width? Can you please help me out.</p><p>Thank you.</p>
Hello Dear Sardau, what is the effect of using more than one laser beam on 3d scanner's speed like your 3d scanner???
here is a part of a earlyer question about the fact of using 4 lasers:<br> <br> <em>Scan time increase, difficulty of calibration increase ( a lot !!!) , but there are many advantages.<br> <br> 1 You get the profile of the object from differents perspectives ( one part hidden for a laser, can be seen from another).<br> <br> 2 You also have more points in your point cloud, so better resolution.<br> <br> the biggest advantage in my opinion : Associated with the &quot;angle&quot; and &quot;laser&quot; task, you can use the different laser scan as samples over the same position.<br> the task &quot;laser&quot; take all the profile (scan line) from each laser at same posion and make a average =&gt; reduction of noise, increase of accuracy (and smoothness)<br> the &quot;angle&quot; task do the same but instead of taking one scan line from each laser, it take all the scanlines whitin a given angle</em>.
<p>Hello Sardau,</p><p>.. Must say a great project. I made the entire project but I have a question. What does this line mean? :Type in &quot;Sarduscan&quot; and Arduino will say &quot;yes&quot;.</p><p>I tried to do it with Serial Monitor of Arduino but nothing happens.</p><p>Also, I cannot understand y are we connecting laser 4 with digital pin 13?</p><p>Is there any error in the above code? If yes please post the updated link.</p><p>Thank you for presenting us with a cheap and effective 3D scanner</p>
<p>hello,</p><p>it is a little trick to identify com ports :</p><p>the command &quot;sardauscan&quot; is my way of identify a com port as a scanner : the software ask &quot;sardauscan&quot; and if it get &quot;yes&quot; he know that these com is a sardauscan scanner ;)</p><p>so to test if the firmware is correct, you can type &quot;sardauscan&quot; in the arduino ide to see if it respond correctly.</p><p>if nothing append if you type &quot;sardauscan&quot; ( and click send off course). this mean the firmware is not installed on the board. </p><p>ps: if you get something unreadable, it is the baudrate in the serial monitor that is not set correctly to 115200.</p><p>for the laser on pin 13, i use this pin mainly for debug purpose : the laser blink when the scanner is plugged or when the arduino reset. it is not realy important, you can choose whatever pin you want if you set it accordingly in the configuration.h.</p>
<p>can someone help me? my project went great but i wonder if anyone has a configuration.h made up to just turn on laser 0.</p>
just replace<br>#define LASER_COUNT 4<br>by<br>#define LASER_COUNT 1<br><br>but you can also select the lasers on the Scan task &quot;litlle gear&quot;.
<p>sorry also stupid question time. lol</p><p>is laser 0 to laser 3 supposed to start from right to left if standing behind the camera?</p>
you choose. <br><br>the only thing important is to have each laser position correct in the Sardauscan software.
<p>I have found all of the components on aliexpress.com for 11.95 grand total if anyone was looking for an even lower price. Just purchased my parts now:<br></p><p><a href="http://www.aliexpress.com/item/1PCS-Nano-3-0-controller-compatible-with-nano-CH340-USB-driver-NO-CABLE-for-Arduino-NANO/32473529871.html" rel="nofollow">1 x 1PCS Nano 3.0 controller compatible with nano CH340 USB driver NO CABLE for Arduino NANO V3.0</a></p><p><a href="http://www.aliexpress.com/item/5V-Stepper-Motor-with-ULN2003-Drive-Test-Module-Board/2055113391.html" rel="nofollow">1 x 5V Stepper Motor with ULN2003 Drive Test Module Board</a></p><p><a href="http://www.aliexpress.com/item/Free-Shipping-Focus-Adjustable-Laser-Head-5V-Laser-Line-Red-Dot-650nm-5mW-Module-New-Hot/32571450258.html" rel="nofollow">4 x Free Shipping Focus Adjustable Laser Head 5V Laser Line Red Dot 650nm 5mW Module New Hot</a></p><ul><li>Subtotal(3 Items):US $11.95<li>Shipping Cost to United States:US $0.00<li>All Total:<br> <strong>US $11.95</strong><br> </ul>
<p>I've been struggling for a long time now, but I'm getting really weird results. It seems like it's scanning two items, there are two &quot;rings&quot; of point clouds, one too big and one too small. The real object is just a tube. I'm using a Trust Webcam Pro because the cam you mentioned wasn't available anymore. Is there something not right in my settings? Could you guide me on this?</p>
that mean your laser aren't well aligned, or you build dimention or laser position/angle are incorect. (or lasers didn't cross at the exact axle of rotation of the table).<br><br>you must be very very very precise.<br><br>when it is as correct as you can physicaly archieve. you can do the correction matrix.<br><br>try with only one laser at first, doing calibration with 4 lasers when you aren't fluent with the calibration is a nightmare and can be very frustrating.
<p>Made it using arduino uno (have included connections), the only thing I printed was the table quide mounts the rest I used marine ply and box tube. I used a Lifecam HD3000 because I found it difficult to get the original here in Australia, but I don't know if I need to alter anything in the software. Everything works great but I can't seem to get a proper scan, I could not get the stepper motor to turn at first so I had to use the alternate settings recommended in config.h. As you can see I am trying to to scan a simple jar but getting a wierd picture, I wish I could read more on 3D scanning and or Sardauscan to leard more about the settings. I have tried numerous setting have failed to improve the scan, I'm degining to think I am doing something basically wrong if any one can help I would appreciate it. Anyway thanks very much for your great design I hope you don't mind me tweaking it a little.</p>
<p>did you ever got it working with the UNO and Lifecam HD3000?</p>
<p>These type of scan is due to the fact that each laser give a different result.</p><p>you can go to the correction page : launch a quick scan.</p><p>there you can see a superposition of each laser scan (view from the top, one color for each laser).</p><p>if the scan does not superpose correctly (and by the look of the result it is the case).</p><p>that mean that the computation of this laser is not correct. </p><p>the cause can be </p><p>- wrong XYZ laser position in the Dimention page.</p><p>- Wrong laser aligment (not crossing exactly at the center of rotation, litle bit tilted, etc) =&gt; physical page</p><p>- camera tilted, rotated, pan, of wrong XYZ position, vertical center not crossing the center of rotation of the table, etc</p><p>I also realise that configuration/calibration with 4 laser is way way to complicated to archieve and very few can archieve a good calibration. </p><p>as soon as i have time, il will work on a semi or full automatic calibration. But it is not a easy task, especialy without any comunity help.</p><p>in the mean time,</p><p>you can try to use only one laser (by changing the configuration.h in the firmware). it is much easier to calibrate and understand what append. </p><p>When you become fluent with the change and calibration, you can add other laser, but be aware that the calibration difficulties are exponential with number of lasers.</p><p>ps: you can see here in the comments many usefull informations to help your calibration.</p>
<p>Nice work! I used an arduino uno instead of a nano with only one (red) laser. I am also using a different (cheaper) camera, which is found by Sardauscan004. But I am using the samen stepper motor as you are. When I load the code to the arduino and start sardauscan004 the lasers work fine when I connect to the arduino. The table, however won't turn, even though I'm sure I connected it right (pin 2, 3, 4, 5). When I load up my own code, the stepper does turn.</p><p>Could it be the arduino still? I'm not sure how to proceed. Could you advise?</p>
<p>What's the camera model you used? in US the hercules HD twist is super expensive.</p>
<p>hello, if your own code work, check the difference. especialy check the declatation of the stepper. there must be some difference.</p>
<p>I tried the trick you described in the readme:</p><p>#define HALFSTEP 4<br>#define REVOLUTION_STEP 2048</p><p>And I downloaded the accelstepper through the link you provided. So if I'm correct I'm running version 1.3. Any tips?</p>
<p>Disregard. I opened configuration.h in notepad++ and edited it while at the same time having configuration.h opened in the arduino IDE. So the arduino IDE took the unedited version which was still in its memory I guess.</p>
<br><p>Hello.<br><br> I bought following stepper motor:</p><p><a href="http://www.ebay.de/itm/271566159276?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">http://www.ebay.de/itm/271566159276?_trksid=p20603...</a></p><p>everything is connected correctly. But the Motor will not turn. it shines no LED on the driver. How to check the driver to function?<br><br> the stroke of the line laser is only 1CM long. how can you extend the line?</p><p>rotating the focus makes the line just out of focus.</p><p><a href="http://www.ebay.de/itm/401017199949?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT" rel="nofollow">http://www.ebay.de/itm/401017199949?_trksid=p20603...</a></p><br>
​for the motor, try the &quot;tips&quot; in the frirmware (see configuration.h and of Readme file). if it don't work, verify that the jumper on the driver is on 5v. try with external power. Or maybee a defect motor/driver, of a 12v motor. try with external power.<br>for your laser it is very strange... maybee it is a different laser, or the lens in the cap is misplaced.
<p>Thanks for your answer. Should the LEDs on the stepper driver light up even without the Motor?<br>This is important for the diagnosis</p><p>where should the lens to<br>sit?<br><br>Before or after the spring?<br><br>rotate the lens I've already tried, but now everything is just out of focus.</p>
<p>the lens is on the outside</p>
<p>I think the laser modules are worthless.</p><div>China scrap :(<br></div>
<p>Great project! Easy to build and nice results after fine calibration. Thank you!</p>
<p>Thx, It is appreciated to see poeple enjoying it. </p><p>Generally poeple only share they problems or reproach ;)</p>
<p>looks great, bit is it possible to use a different webcam ? that hercules webcam is a bit expensive (30-45 euro) i downloaded you software and i can select a different cam, but wil i work ?</p>
if you redo a upper holder, you can use whathever webcam you want except wide angle one. just be sure that your camera is vertical, no tilt, pan or yaw.<br>
<p>Great ! :) does it have to be in line with the lasers (at the same height ?) </p>
<p>no, but it is best to try to keep it at the same height as possible.</p>
<p>Hey man, </p><p>I built everything but I used an uno instead of a nano. I got a bunch of errors in regard to the AccelStepper. I am not sure what to do, its saying there is an issue with a bunch of variables. Here is just a snippet of code below, if I copied the whole error it would be pages long. </p><p>C:\Program Files (x86)\Arduino\libraries\AccelStepper/AccelStepper.cpp:84: multiple definition of `AccelStepper::runSpeedToPosition()'<br><br>sketch\AccelStepper\AccelStepper.cpp.o:sketch\AccelStepper/AccelStepper.cpp:84: first defined here<br><br>libraries\AccelStepper\AccelStepper.cpp.o: In function `AccelStepper::desiredSpeed()':</p><p>Thanks i relaly appreciate the help.</p>
<p>the message said multiple declaration: like if you have included 2 times the library (or 2 different with same names).</p><p>check if you don't have 2 version of the accellstepper library installed.</p>

About This Instructable

166,455views

1,532favorites

License:

More by Sardau:Build a 30$ laser ScannerSardauscan sub-30$ Opensource 3d laser scanner
Add instructable to: