Introduction: Let's Cook: 3D Scanner Based on Arduino and Processing

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.

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.

Step 2: Principle of Operation

Picture of Principle of Operation

How does it work?
We have to found Cartesian coordinates (in some space) of points which belongs to scanned object.
Basically, we are looking for distance, between rotation axle and a point marked red by laser ("ro" on the picture). To found this, we have to measure how many pixels are between optical axle of camera and laser-marked point. On picture, this distance is marked as "b". When we get that information, we have to convert it into millimeter (how many pixels are in one millimeter). Angle between laser and camera axle is constant and equals "alpha". Using simple trigonometry, we can calculate "ro":
sinus(alpha) = b / ro, which means that ro = b / sinus(alpha)
This operation repeats every layer, in my case it is 480times. Then rotating platforms move by some angle and whole operation repeats.

Let's move to second picture.
Previous operations gave us coordinates in polar coordinates system. In polar system, every point look something like that:
P = (distance from Z axis, angle between point and X axis, Z) which is P = (ro, fi, z).
Ro is our distance, measured in previous operation. Fi is an angle of rotating platform. It grows an constant amount, every time platform rotate. This constant amount in equal 360 degree / number of operation
I.e. for 120 profiles around object, platform moves about  360deg / 120 = 3 deg. So after first move, fi = 3, after second fi = 6, after third fi = 9 etc.
Z value is the same value as Z in Cartesian system.

Conversion from polar to Cartesian is very simple:
x = ro * cosinus( fi )
y = ro * sinus( fi )
z = z

Step 3: Motor

Picture of Motor

It is 4-connector bipolar stepper motor from an old OKI printer. It has 48 steps per revolution (7,5 deg per step), driven by 3,7V power supply. Integrated gear has 6:1 ratio, which means i had  6*48 steps on the output. It takes 200-250mA when moving.
I soldered 4 wires to connectors of stepper motor. To another ends of wires i have soldered single gold pin. Now it is very easy to connect it with driver.
I attached Lego pulley to the integrated gear. I took it out and drill 6 holes. Holes has same size and arrangement as holes on Lego pulley. Pulley and gear are joined together with „3-long” shafts.

Step 4: Motor Driver and Power Supply

Picture of Motor Driver and Power Supply

Bipolar stepper is driven by h-bridge. Because of low power consumption of stepper, L293D is more than enough. In simplest variant, h-bridge uses 4 digital output pins from Arduino, +5V and GND. For reducing output pins to 2, You can use small, additional board.
More info can be found in Arduino reference and on Tom's Igoe page:
Ready to termotransfer boards and schematics are attached below.
Part     Value          Package   Library             Position (mil)        Orientation

IC1      L293D          DIL16     st-microelectronics (700 750)             R270
JP1                     2X03      pinhead             (700 1350)            R0
JP2                     2X03      pinhead             (700 1875)            R0
OUT1                    AK500/2-H con-ptr500          (300 150)             R0
OUT2                    AK500/2-H con-ptr500          (1100 150)            R0
POWER                   1X02      pinhead             (950 1875)            R90
Q1       BC547          TO92      transistor-npn      (275 2175)            R180
Q2       BC547          TO92      transistor-npn      (1125 2175)           R180
R1       1k             0207/10   rcl                 (425 1700)            R0
R2       1k             0207/10   rcl                 (750 2175)            R180
R3       10k            0207/10   rcl                 (975 1700)            R0
R4       10k            0207/10   rcl                 (800 2050)            R0
SIGNAL                  1X02      pinhead             (450 1875)            R90
X3                      AK500/2-H con-ptr500          (700 150)             R0

Power supply:
Power supply for stepper is super-simple LM317 application. Schematic can be found on datasheet. Using potentiometer, i can set voltage to needed level (3,7V in my case).

Part     Value          Package      Library    Position (mm)         Orientation

C1       100uF          E5-8,5       rcl        (24.13 5.08)          R270
C2       100nF          C050-030X075 rcl        (10.16 13.335)        R270
IC1                     317TS        v-reg      (20.32 16.51)         R0
R1       240R           0207/10      rcl        (17.78 10.16)         R0
R2       5k             CA6V         pot        (13.97 4.445)         R180
X1                      AK500/2      con-ptr500 (3.81 13.335)         R270
X2                      AK500/2      con-ptr500 (33.02 13.335)        R90

Step 5: Rotating Platform

Picture of Rotating Platform

Lego part! My stepper was cased by Lego, so it has no chance to move. I didn't need to use screws, glue, etc. Momentum is transferred to platform by rubber band and pulley same size as the one on motor (ratio 1:1). Then it is connected with another axle by 20:12 gear set. All of this causes overall ratio 10:1, which means i need exact 10 full revs. of steeper for one revolution of platform. Platform was made of CD glued to broken Lego wheel (it was very poor series of Lego elements, thin plastic causes A LOTS OF brokes during normal play...). CD is covered by green paper, glued by 2-side sticky tape.
Pic is worth more than thousand words?

Step 6: Webcam

Picture of Webcam

I used very primitive Creative Webcam Vista. It's rather old, it has poor sensor (640x480), it has poor optics (plastic lenses). But it has one advantage. I have already had it. It is also attached to rotating platform (little to low, need to change that soon).

Step 7: Linear Laser

Picture of Linear Laser

Poor quality (~1$) laser pointer is attached to cylindrical lens made from glass rod. This kind of glass rods are used in chemistry labs. Laser and lens is cased in Lego case (cased in case; thank you Captain Obvious...). Laser is turned on by rotating it a little bit, button is pushed by Lego. Also attached to platform. Angle between optical axle of camera and laser are around 30degree.

Step 8: Arduino + IDE

Picture of Arduino + IDE

I owe Arduino Leonardo only, so it was only choice i've got.
It has simple code, which causes rotate stepper when got command from Procesing. Commands are sent by Serial.
I chose 4 steps per phase, which means i got 120 photos and 120 profiles around object, every 12 degree. Less steps causes mistakes because of elasticity of rubber band.
It is using arduino's standard stepper library.


#include <Stepper.h>
Stepper oki(48,8,9); //see stepper tutorial in for info about that
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte =;
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'S') {
      digitalWrite(ledPin, HIGH);
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'K') {
      digitalWrite(ledPin, LOW);

Step 9: Processing

Picture of Processing

Why Processing? Because it is easy to use, with big reference and tutorial base. Also it is very similar to arduino. That means the probability of mistake during code writing decrease. Libraries are well documented also.

First thing to do in processing is installation of GSVideo library. Download and installation instructions are there:
So basically program sequence looks something like that, but it is divided into 2 loops (make photos and the rest):
make photo => find brightest pixel in every row => save picture of representation brightest pixels => find distance between middle of picture and brightest pixel in every row => convert gathered polar coordinates to kartesian XYZ  => save ASC file with point cloud.
Explanation can be found in comments in code.
First thing must be done preety soon is setting where Z-value is equal 0. Now Z=0 is set not on the center of platform, but on the first row of photo. This causes that output point cloud is upside-down.

import codeanticode.gsvideo.*;
import processing.serial.*;

PFont f;
GSCapture cam;
Serial myPort;
PrintWriter output;

color black=color(0);
color white=color(255);

int itr; //iteration
float pixBright;
float maxBright=0;
int maxBrightPos=0;
int prevMaxBrightPos;
int cntr=1;
int row;
int col;

//scanner parameters
float odl = 210;  //distance between webcam and turning axle, [milimeter], not used yet
float etap = 120;  //number of phases profiling per revolution
float katLaser = 25*PI/180;  //angle between laser and camera [radian]
float katOperacji=2*PI/etap;  //angle between 2 profiles [radian]

float x, y, z;  //cartesian cords., [milimeter]
float ro;  //first of polar coordinate, [milimeter]
float fi; //second of polar coordinate, [radian]
float b; //distance between brightest pixel and middle of photo [pixel]
float pxmmpoz = 5; //pixels per milimeter horizontally 1px=0.2mm
float pxmmpion = 5; //pixels per milimeter vertically 1px=0.2mm

//================= CONFIG ===================

void setup() {
  size(800, 600);
  //camera conf.
  String[] avcams=GSCapture.list();
  if (avcams.length==0){
    println("There are no cameras available for capture.");
    text("Camera not ready",680,32);
    println("Available cameras:");
    for (int i = 0; i < avcams.length; i++) {
    text("Camera ready",680,32);
    cam=new GSCapture(this, 640, 480,avcams[0]);
  //Serial (COM) conf.
  myPort=new Serial(this, Serial.list()[0], 9600);
  //output file
  output=createWriter("skan.asc");  //plik wynikowy *.asc


//============== MAIN PROGRAM =================

void draw() {
  PImage zdjecie=createImage(cam.width,cam.height,RGB);;
  for (itr=0;itr<etap;itr++) {;
    for (int n=0;n<zdjecie.width*zdjecie.height;n++){
    String nazwaPliku="zdjecie-"+nf(itr+1, 3)+".png";;

void licz(){
  for (itr=0; itr<etap; itr++){
    String nazwaPliku="zdjecie-"+nf(itr+1, 3)+".png";
    PImage skan=loadImage(nazwaPliku);
    String nazwaPliku2="odzw-"+nf(itr+1, 3)+".png";
    PImage odwz=createImage(skan.width, skan.height, RGB);
    int currentPos;

    for(row=0; row<skan.height; row++){  //starting row analysis
      for(col=0; col<skan.width; col++){
        currentPos = row * skan.width + col;
        odwz.pixels[currentPos]=black; //setting all pixels black
      odwz.pixels[maxBrightPos]=white; //setting brightest pixel white
      //output.println(b + ", " + prevMaxBrightPos + ", " + maxBrightPos); //I used this for debugging
      x=ro * cos(fi);  //changing polar coords to kartesian
      y=ro * sin(fi);
      if( (ro>=-30) && (ro<=60) ){ //printing coordinates
        output.println(x + "," + y + "," + z);
    }//end of row analysis

void obroc() {  //sending command to turn

Step 10: Scanning

Picture of Scanning
When all steps above are done, we can start scanning. Currently, processing code is bugged, so there is not live view. To set webcam correctly, I'm using GettingStartedWithCaptureWin code form GSVideo library examples. Best scans are made when there is no lightning, so closing scanner in some enclosure will be good idea. If you don't have any, wait till evening, like I.
Turn on the power supply, turn on the laser, hit Run in Processing IDE. Wait till scanning is ready. You will get *.asc file, which contains Cartesian coordinates of every point.

Sorry for low quality video! Ain't got any better recording camera!

Step 11: Point Cloud

Picture of Point Cloud

Download Meshlab ( or use some other software to manage 3D point clouds. Import your *.asc file, simple by drag and drop method. Uncheck triangulation and hit OK. You will get see cloud points of scanned object! Success!
I cannot do almost anything more in Meshlab, because it is crashing a lot. Don't know why, I'll be fighting with this. But if you get stable version (is there any?) you can turn cloud into solid and exporting it as stereolitography *.stl file. And this can be printed on any 3D printer!

Isn't it lovely?

Edit: 4. december 2012:
I was pretty sure i've attached output file to this step.
It seems I cannot add asc or 7z file to the instructable...
If you want to take a look at asc output file, please download pdf attached to this step and delete ".pdf" file extension from the name of file. You should to remain "owl.asc" only.
This scan is not the same scan showed in instructable! It was taken yesterday during day, so it is little distorted! It was control scan made after minor modification of camera mount.

Step 12: Fighting With Meshlab

Picture of Fighting With Meshlab
Added 4th december 2012.
As I said earlier, i've go a lot of meshlab crashes. But I tried to fought with them, and I got partially success. I've made another scan, and did some mid-quality solid of it! I don't think i can get more accuracy using my webcam.
But hey! It looks like an OWL!

I've made something like that:
  1. Filters => Remeshing... => Surface reconstruction: Poisson; attributes 10, 8, 1, 1 (it is quite possible you will have to experiment with another values)
  2. Filters => Normals... => Invert face orientation
  3. Filters => Smoothing... => Taubin Smooth
  4. Filters => Vertex attribute transfer; mark "transfer geometry", "transfer normals"; source "another owl - good quality.asc"; target "poisson mesh"
As in previous step, there are attached 2 files with double extension. Delete last one(pdf), and you wil get *.asc file, directly from scanner and *.ply: solid made in meshlab (before another crash ofc).

Step 13: To-do and Ideas

setting Z=0 position.
Rebuild interface (actually: build... ;) )
Buy real linear laser module, without „ghost light” effect
add calibration to main program
add an algorithms that makes scan more accurate
and a lot, lot of other things...

better webcam, fullHD maybe?
Maybe DSLR instead of webcam?
Turning webcam 90degree will increase vertical resolution from 480 to 640 layers
Linux compatibile (currently I got errors installing gsvideo on my mint13)

Far, far away idea:
Mobile phone scanner. Almost every mid- and premium-class smartphone has very good quality camera. Android software shouldn't be so hard to write. Arduino Mega ADK can be directly operated by android phone... Unfortunately I don't have smartphone neither Mega ADK. When I'll get that, I will try.

I hope You will like my instructable. Scan things and have fun with that!


clow_reed made it! (author)2014-07-15

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:

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!

cube000 (author)clow_reed2014-07-18

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 (author)cube0002014-07-30

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

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 :)


Joshua Crawley

thelwyn (author)2013-02-24

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!!

Idrispo (author)thelwyn2014-04-02

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

thelwyn (author)Idrispo2014-04-02


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)thelwyn2013-02-24

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...

amandaghassaei (author)2012-12-03

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)amandaghassaei2012-12-04

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 (author)cube0002012-12-04
it's really easy to use

KarrarL made it! (author)2017-12-19

Hello I need help. That's my problem with the program

FG10 made it! (author)2017-05-20

I COME UP some problem. But I cannot see my object when ı open ".txt" file which include cordinates for points in Meshlab. Sometime I only see verticles:1 in the meshlab. What can ı do? ı another problem is when ı open in your processing code I get a this problem: "..BoundsError..." such as latest pic.

IL-2 made it! (author)2017-04-20

Made it with arduino motorshield (4/2 (4 simple motors or 2 step motors) channel at L293d's) and Logitech C270 cam (GSVideo don't works properly with my chineese actioncam and notebook camera). Looks nice but have not enough accuracy. Objects with glossy surface have problems with scanning because of light glares, so I've mastered a black box for scanner from cardboard and black mat paper with opaque cap (to show process!). Thank you!

ZardashtA (author)2016-07-07

hello dear than you for your project really its amazing project,

Dear i use the following code for stepper motor i dont know its the same or not becaue your arduino code dont work in my IDE please i need your help :

#include <Stepper.h>

/*-----( Declare Constants, Pin Numbers )-----*/

//---( Number of steps per revolution of INTERNAL motor in 4-step mode )---


//---( Steps per OUTPUT SHAFT of gear reduction )---

#define STEPS_PER_OUTPUT_REVOLUTION 48 * 6 //288

const int ledPin = 12;

int incomingByte; // a variable to read incoming serial data into

Stepper small_stepper(STEPS_PER_MOTOR_REVOLUTION, 8, 10, 9, 11);

/*-----( Declare Variables )-----*/

int Steps2Take;

void setup() /*----( SETUP: RUNS ONCE )----*/


// initialize serial communication:


// initialize the LED pin as an output:

pinMode(ledPin, OUTPUT);

// Nothing (Stepper Library sets pins as outputs)

}/*--(end setup )---*/

void loop() /*----( LOOP: RUNS CONSTANTLY )----*/


incomingByte =;

// if it’s a capital H (ASCII 72), turn on the LED:

Steps2Take = - STEPS_PER_OUTPUT_REVOLUTION; // Rotate CCW 1 turn

small_stepper.setSpeed(60); // 700 a good max speed??


if (incomingByte == 'S')


digitalWrite(ledPin, HIGH);

// delay(2000);


else if (incomingByte == 'E')


//return ;

digitalWrite(ledPin, LOW);


/* --(end main loop )-- */


/* ( THE END ) */

hafzalhamza (author)2015-02-24

Hi, i made the connections as per your instruction but when i plug it on my motor keep buzzing(shaft not rotating) please help me as soon as possible.

ALKATRAZ (author)2015-01-26

Great project. I am new to Processing, can you please help me in understanding the code, the "configuration part" specially. Please I am stuck at this part and I couldn't figure it out myself.

ALKATRAZ (author)2015-01-24

Your project is really very Interesting. Can You Please explain me the "configuration section" and "main section" of your code. I am trying to make this project at home but since I am new to processing I want your help.

flogen (author)2014-12-17

Hi. Built my 3d scanner based from your build. But I created my own communication protocol with my teensy. Letting the teensy turn on/off laser, stepper driver, set microstepping and of course stepping the motor.

The first problem i ran into with your processing code was to use GSvideo. Seems like I cant install the library. Processing wont detect it. So I went with the default*.

With* "cam = new Capture(this, 1024, 768, avcams[0]) wont compile.

With "cam = new Caputer(this, 1024, 768); the built in camera is selected and not my usb one.

With "cam = new Capture(this, avcams[0]); Correct camera is selected but I "get: java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0" which refers to cam.height and cam.width. So no images are captured.

Turned out to be a long trouble shooting post. Really looking forward to getting the scanner to work. Hope you can help me.

Great project, thumbs up!!

hans.muller.503 (author)2014-08-14

"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...

skiong1 (author)2014-03-06

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?

hans.muller.503 (author)skiong12014-08-14

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

vj01 (author)2014-04-15


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

mrtraviss (author)2014-03-10

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_One (author)2014-02-26

what software to use capture image.?

cube000 (author)ir_One2014-02-27

Processing with Gsvideo library.

ir_One (author)cube0002014-02-27

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

sorry my language not good :)

cfishy (author)2013-01-30

um. What's a linear laser?

comicguru1 (author)cfishy2014-01-16

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.

comicguru1 (author)2014-01-16

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_Henrik (author)2013-12-18

Arr! Pirates! :D

isahunter (author)2013-12-02

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)isahunter2013-12-02

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.

isahunter (author)2013-12-01

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 :)

12beav (author)2013-07-06

Hey I was just wondering what you used for a linear laser? And where I could possibly get one for cheap?..

cube000 (author)12beav2013-07-07

Check worldwide ebay, or aliexpress. ~3.5$

DoctorWoo (author)2013-03-12

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)DoctorWoo2013-03-12

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 (author)cube0002013-03-13

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)DoctorWoo2013-03-14

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 (author)cube0002013-03-15

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 (author)2013-03-13

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)Yettimania2013-03-13

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 ( 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.

Yettimania (author)cube0002013-03-14

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 (author)2013-03-14

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 (author)2013-03-13

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)thelwyn2013-03-14

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 ;)

wavegm (author)2012-12-06

Great Project ! Great instructable too !
Do you know David laser scanner ?(
They might have some tips in their manuals for improving your scan
There are few guys that also scan with smartphones:

cube000 (author)2012-12-04

I've add one step, please take a look at step 12.

billhorvath (author)2012-12-04

This is freakin' brilliant! Great work -- Can't wait to try it.

noahspurrier (author)2012-12-03

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.

About This Instructable




Bio: Cyclist, hand made knives enthusiast and cnc fan!
More by cube000:Yet another simple nightvisionRepairing LCD monitor: how NOT to become planned obsolescence victimBecome Rocket Engineer!
Add instructable to: