Automated 3D Scanner

7,937

118

13

Introduction: Automated 3D Scanner

About: Hello, my name is George, I enjoy many hobbies like my garden and house, building models, electronics, developing applications, I also like to combine possibilities as I did in de first project I posted.

First of all I want to thank daveyclk (https://www.thingiverse.com/thing:1762299) and Primer (https://www.thingiverse.com/thing:2237740/remixes) for there basic ideas. I found it on Thingiverse and decided to make an automated version of the 3d scanner.

The scanner makes (by default) 2 rounds of 30 pictures per round (+10% extra to get around the starting point). In between the rounds it stops to make camera adjustment to get another viewpoint.

Number of rounds and pictures are adjustable at start. The camera is triggered through the volume button of a tweaked earphone cable.

After taking the pictures I managed to work with them perfectly through the proces of creating a 3d design with VisualSFM, Meshlab and Blender (thnx to 4A44 for the instructions: https://www.instructables.com/id/Make-a-3D-model-from-pictures/)

Supplies

Objects used:

  • 14 Printed parts of the scanner (700 gr / 230 m PLA)
  • 1 Mobile phone
  • 1 Earphone with volume control
  • 1 Carphone holder with flex arm
  • 2 Ball bearings
  • Screws and stuf

Electronics used:

  • 1 Arduino Nano R3
  • 1 Blue Liquid Crystal Display (LCD1602 I2C PCF8574)
  • 1 Gear Stepper Motor DC 12V 4Fase (28BYJ-48)
  • 1 Driver Board (ULN2003)
  • 1 Relay Module 1-Channel
  • 6 Push buttons on a strip
  • 2 LED's
  • 2 Resistors 220Ohm
  • 1 Small breadboard
  • 1 Power supply 12V 1A
  • 1 Power connector
  • 1 Mini breadboard
  • Wires

Step 1: Print 3D Objects and Construct the House

Here is the link to the 3D printed parts that I used.

https://www.thingiverse.com/thing:4200428

I removed all the inside to make room for the electronics and added a center axle for the ball bearings.

As for the ball bearings: I used 2 types (one from a spinner is placed at the bottom of the axle and the other is 2 plates with a balls ring in between on top to bear the table).
It could be done without like in the original. With help of Tinkercat it can be adjusted to your own possibility.

I choosed to make the mounts for electronics as separate parts and screw them to the base, but it is also possible to combine them with the base parts in Tinkercad and print it connected. I made a special connection strip for the cables but this is easier done with a mini breadboard.

The Arduino Nano is a solder version but on Thingiverse are also mounts for a pinned Nano available.

As a phone mount I used a car phone mount to which I added a flex tube from an old lamp, for this I had to print two specially designed parts. This works great because I can turn and bend the mount into any position and distance needed to make right pictures.

Step 2: Build Electronics

The Arduino Nano is a version with soldered cables. The scanner table consists of a display with buttons to take in commands and show the process.

The display and button strip are screwed in the panel. The other mounts are screwed on the bottom of the base.

On the side I glued a power connector in a hole.

I opened the volume button on the earphone and soldered a cable to the wtich connections, so the whole earphone is completely inside, but in fact it could becut off, just as long as the right wires are connected to therelay out NO (normally open).

Connect everything according to the fritzing scheme.

Step 3: Write the Arduino Program

Download the Arduino IDE (https://www.arduino.cc/en/main/software)

Download libraries:

  • LiquidCrystal_I2C (https://www.arduinolibraries.info/libraries/liquid...
  • CheapStepper (https://www.arduinolibraries.info/libraries/cheap-...

Download the program, adjust it if needed, or write your own.

Load it to the Arduino Nano.

Step 4: Run the Scanner and Take Pictures

After completing the scanner connect a mobile phone with opened camera and start it up. An intro screen will show shortly and it wil ask the amount of rounds and pictures. Pressing the start button the process will start taking the amount of pictures. Per round it will stop to set the camera to a viewpoint.

Buttons from left to right:

  1. Reset button
  2. Minus button for number of photos
  3. Plus button for number of photos
  4. Minus button for number of rounds
  5. Plus button for number of rounds
  6. Start button

Bring the photos from your mobile to a PC and create a 3d design with VisualSFM, Meshlab and Blender (see the instructions: https://www.instructables.com/id/Make-a-3D-model-from-pictures/).

Be the First to Share

    Recommendations

    • Soup & Stew Speed Challenge

      Soup & Stew Speed Challenge
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Space Contest

      Space Contest

    13 Comments

    0
    kjell_nilsson
    kjell_nilsson

    Question 1 year ago on Introduction

    Do you have a specification and brand for the upper ball bearing?

    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    I'm sorry but I can't provide you with that information. I used an upper ball bearing I had available. It probably came from a Kärcher high pressure sprayer I took apart and designed the table around it. It consists of 2 rings with a ball bearing in between. The ball bearing at the bottom is a standard one 8x22x7mm. I could provide Tinkercad link to adjust to your own needs.

    0
    kjell_nilsson
    kjell_nilsson

    Reply 1 year ago

    Thanks for the answer. I have more questions for you. As en electronic engineer I like to have a real electronic diagram, do you have that?
    I downloaded your code and it will not compile error free. It's problem with the
    // LCD
    display code


    #include
    <LiquidCrystal_I2C.h>


    LiquidCrystal_I2C
    lcd(0x27, 2, 1, 0, 4, 5, 6, 7); // Set the LCD I2C address
    Error message: exit status 1
    no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int)'
    I have tried different versions of LiquidCrystal. All give compiling error.
    I run Aurdino 1.8.10 and have several versions of LiquidCrystal in the library i have tried.
    Do you have any clue?. I'm stuck there.

    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    Hi Kjell,

    Sorry, bit late reaction on your question.
    I am not sure but shouldn't this be one line:

    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7); // Set the LCD I2C address

    If that is not the case then post the code so I can check out.

    Good luck.

    0
    kjell_nilsson
    kjell_nilsson

    Reply 1 year ago

    Thank you for your answer,
    The code is actually on one line, I just copied ther compile error message.
    I had one more questions in my last answer. Do you have real engineering electronic schematic of the project?
    I have all oteher parts reay to go.

    Here I will paste the Arduino code I downloaded from your project. Hope it will fit. If you see any error, please let me know. Thank you again, Kjell

    /** 3D
    Scanner Camera Turntable - v1


    George Lukkezen





    Controlling a turntable to 3D scan objects.


    Components:


    a. turntable with steppermotor


    b. camera of mobile phonewith earplug cable
    tweaked on volume button


    c. Arduino Nano


    d. LCD-screen I2C


    e. steppermotor


    f. relais to control camera


    g. 2 LED's


    h. 6 pushbuttons





    Process:


    1. Take a series of photo's


    2. Buid 3D model on PC with software


    3. Save as .STL to make 3D prints


    */





    /** Use
    Arduino:


    Pin VIN
    - 12V+


    Pin GND - 12V-


    Pin Reset - Button 1 - Reset programma


    Pin 2 - Button 2 - Photo -


    Pin 6
    - Button 3 - Photo +


    Pin 3
    - Button 4 - Turns -


    Pin 5
    - Button 5 - Turns +


    Pin 4
    - Button 6 - Start scanning


    Pin 7
    - LED 2 - Motor status


    Pin 8 t/m 11 - Stepper motor


    Pin 12
    - Digital pin to trigger camera through relay on mobile phone VOL+


    - LED 1 - Camera status


    Pin A4
    - SDA I2C LCD-screen


    Pin A5
    - SCL I2C LCD-screen


    */


    // LCD
    display


    #include
    <LiquidCrystal_I2C.h>


    LiquidCrystal_I2C
    lcd(0x27, 2, 1, 0, 4, 5, 6, 7); // Set the LCD I2C address





    //
    Stepper motor


    #include
    <CheapStepper.h>


    // here
    we declare our stepper using default pins on ULN2003 board:


    // 8 <--> IN1


    // 9 <--> IN2


    // 10
    <--> IN3


    // 11
    <--> IN4


    CheapStepper
    stepper;


    //
    CheapStepper library defaults to 4096


    // Ratio
    for gear of disk is 7.8552246:1


    const
    int stepsFullRotation = 32175; //
    Change this to fit the number of steps per rotation


    boolean
    moveClockwise = true; //
    Direction of stepper





    const
    int BT_photo_min = 2; // pin button Nr of photos value
    down


    const
    int BT_photo_plus = 6; //
    pin button Nr of photos value up


    const
    int BT_turns_min = 3; // pin button Nr of turns value
    down


    const
    int BT_turns_plus = 5; //
    pin button Nr of turns value up


    const
    int BT_start = 4; // pin button Start scanning


    const
    int LED_motor = 7; // pin Motor running


    const
    int SW_camera = 12; // pin Trigger for camera on
    mobile phone





    int
    BT_photo_min_state; //
    State of photos min button


    int
    BT_photo_plus_state; // State of photos plus button


    int
    BT_turns_min_state; //
    State of turns min button


    int
    BT_turns_plus_state; //
    State of turns plus button


    int
    BT_start_state; //
    State of scanning button





    int
    nrPhotos = 30; //
    The amount of photos that have to be taken


    int
    PhotoTime = 600; //
    Time needed for camera to act on taking picture


    int
    nrTurns = 2; //
    The amount of turns to make around the object


    double
    TurnOverlap = 1.1; // %
    Overlap in round from start: extra photo(s) will be made


    int
    stepsPerPhoto; //
    Amount of steps per photo (calculated -> see MenuNr 0/SwMenu 2)


    int
    pushTime = 250; // Time to wait for pushed
    button





    void
    setup() {


    lcd.begin(16, 2); // Lcd setup for 16 x 2
    LCD module


    lcd.setBacklightPin(3, POSITIVE);


    lcd.setBacklight(HIGH);





    pinMode(BT_photo_min, INPUT_PULLUP); // Set photos min button as input


    digitalWrite(BT_photo_min, HIGH); // Set photos min button off


    pinMode(BT_photo_plus, INPUT_PULLUP); // Set photos plus button as input


    digitalWrite(BT_photo_plus, HIGH); // Set photos plus button off


    pinMode(BT_turns_min, INPUT_PULLUP); // Set turns min button as input


    digitalWrite(BT_turns_min, HIGH); // Set turns min button off


    pinMode(BT_turns_plus, INPUT_PULLUP); // Set turns plus button as input


    digitalWrite(BT_turns_plus, HIGH); // Set turns plus button off


    pinMode(BT_start, INPUT_PULLUP); // Set start button as input


    digitalWrite(BT_start, HIGH); // Set start button off





    pinMode(LED_motor, OUTPUT); // Set phone trigger as output


    digitalWrite(LED_motor, LOW);


    pinMode(SW_camera, OUTPUT); // Set phone trigger as output


    digitalWrite(SW_camera, LOW);





    lcd.setCursor(1, 0); // Startup screen start


    lcd.print("3D Scanner V1");


    lcd.setCursor(0, 1);


    lcd.print("George Lukkezen");


    delay(1000);


    menuSettings(); // Show main menu


    }


    void
    loop() {


    // Read all buttons


    delay(pushTime);


    BT_photo_min_state =
    digitalRead(BT_photo_min);


    BT_photo_plus_state =
    digitalRead(BT_photo_plus);


    BT_turns_min_state =
    digitalRead(BT_turns_min);


    BT_turns_plus_state =
    digitalRead(BT_turns_plus);


    BT_start_state = digitalRead(BT_start);





    if (BT_start_state == HIGH) { // Settings mode


    if (BT_photo_min_state == LOW) { // Photos down


    nrPhotos--;


    if (nrPhotos < 1) nrPhotos = 1;


    showNumber(0, nrPhotos);


    }


    if (BT_photo_plus_state == LOW) { // Photos up


    nrPhotos++;


    if (nrPhotos > 99) nrPhotos = 99;


    showNumber(0, nrPhotos);


    }


    if (BT_turns_min_state == LOW) { // Turns down


    nrTurns--;


    if (nrTurns < 1) nrTurns = 1;


    showNumber(1, nrTurns);


    }


    if (BT_turns_plus_state == LOW) { // Turns up


    nrTurns++;


    if (nrTurns > 99) nrTurns = 99;


    showNumber(1, nrTurns);


    }


    } else { // Running mode


    stepsPerPhoto = stepsFullRotation /
    nrPhotos; // Calculate nr of steps
    per photo


    int nrActPhotos = TurnOverlap * nrPhotos;


    int nr = 0;


    for (int Turn = 1; Turn <= nrTurns;
    Turn++) { // Take photos per turn


    menuExecTurn();


    menuExecPhotos();


    showNumber(0, Turn);


    for (int Photo = 1; Photo <=
    nrActPhotos; Photo++) {


    digitalWrite(LED_motor, HIGH); // Turn table


    stepper.move(moveClockwise,
    stepsPerPhoto);


    digitalWrite(LED_motor, LOW);


    digitalWrite(SW_camera, HIGH);


    delay(PhotoTime); // Make photo


    showNumber(1, Photo);


    digitalWrite(SW_camera, LOW);


    delay(PhotoTime);


    nr++;


    }


    }


    menuFinished(nr);


    menuSettings(); // Show main menu


    }


    }





    void
    menuSettings() {


    lcd.clear();


    lcd.setCursor(0, 0);


    lcd.print("Pictures?");


    showNumber(0, nrPhotos);


    lcd.setCursor(0, 1);


    lcd.print("Turns?");


    showNumber(1, nrTurns);


    }





    void
    menuExecTurn() {


    lcd.clear();


    lcd.setCursor(0, 0);


    lcd.print("Set up camera.");


    showStart();


    }





    void
    menuExecPhotos() {


    lcd.clear();


    lcd.setCursor(0, 0);


    lcd.print("Scan round 0");


    lcd.setCursor(0, 1);


    lcd.print(" photo
    0");


    }





    void
    menuFinished(int nr) {


    lcd.clear();


    lcd.setCursor(0, 0);


    lcd.print(nr);


    lcd.setCursor(0, 3);


    lcd.print("photos ready.");


    showStart();


    }





    void
    showStart() {


    lcd.setCursor(0, 1);


    lcd.print("Push to start...");


    delay(pushTime);


    while (digitalRead(BT_start) == HIGH) {} //
    Wait for push


    }





    void
    showNumber(int line, int number) {


    int cursor = 13;


    if (number < 100) cursor = 14;


    if (number < 10) {


    lcd.setCursor(cursor, line);


    lcd.print(" ");


    cursor = 15;


    }


    lcd.setCursor(cursor, line);


    lcd.print(number);


    }

    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    Hello,

    the code is OK.
    I see on Github a mess of libraries, many different versions.
    I used NewLiquidCrystal library: https://github.com/fmalpartida/New-LiquidCrystal
    This one compiles right.

    As for the electronics I only have the Fritzing scheme that was posted on this publication. Do you have any problem with that drawing?

    Greetings, George

    0
    kjell_nilsson
    kjell_nilsson

    Reply 1 year ago

    Hi George,
    It's like magic, I got it to work error free and download it to my two Arduino Nano.
    Unfortunately that's on my stationary computer, I need it work on my laptops so I can bring it with me.
    I don't no what the problem is. It look like it's a problem with the libraries, hard to delete old libraries.
    Regarding the drawing, the picture is a little bit fuzzy, hard to see the connections on the breadboard and I can't find any breadboard with 21 rows. I attach a picture of an example of what kind of drawing I'm used to work with and than find out how I will connect the wiring.
    Thank's again,
    Kjell

    12 Schematic.jpg
    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    Hi Kjell,
    wow, I am not that much of a technician, so probably will need a month to study that picture LOL. I will look into that further.

    As for the location of libraries there can be several, on my computer/laptop it are these:
    1. Installation of Arduino IDE: Program Files (x86)\Arduino\libraries
    2. In your user documents: Documents\Arduino\libraries
    3. In de directory of the Arduino program itself, so the location of the INO file, but there you need the files not in subdirectories (I do seldom prefer this way).

    I am not sure in what order it will look, check Arduino site for that, maybe there is an answer to that.

    George

    0
    kjell_nilsson
    kjell_nilsson

    Reply 1 year ago

    Hallo again George,
    I finally manage to get it to work on two of my laptops by laborating with the libraries, deleting, moving. I'm not sure what made it to work. It's a mess with these libraries. It's almost impossible to delete them within Arduino IDE. You get a lot of messages saying there are duplicate libreries. But for now, I have the program working so now I can proceed with the project. Whats left is to get that special upper ball bearing and the small breadboard for 20 rows.
    The electronic drawing was just an example of what I like to have. It was from a previous project I made, a small digital oscilloscope, very handy. By the way, I attach a picture of the oscilloscope, it's very small.
    I will probably come back to you when the hardware and wiring is done. I haven't look in it too much how to get a .stl file to print the scanned object. Look very complicated with these Mesh, Blender and VisualSFM programs, but one step at the time.
    Thanks from Stockholm, Sweden
    Kjell

    07 Done and working.jpg
    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    Since this scheme is with standard modules I don't know why you make the detailed scheme, but it is impressive :-).
    Easiest way to delete modules from libraries is just delete files.
    As to the upper ball bearing you could redesign it with any other way, there are examples in Thingiverse.
    Here is a nice video explaining 3D photography: https://www.youtube.com/watch?v=V4iBb_j6k_g&has_verified=1

    Good luck from Netherlands.
    George

    0
    kjell_nilsson
    kjell_nilsson

    Reply 1 year ago

    Thanks again for your prompt answer. The video helps a lot.
    Hope I don't bother you too much. I was starting to wire the project when I noticed that there were some missing wires and miss-wiring on the "fritzing" drawing. Wires to the Nano from push-buttons were missing and a ground wire from the Nano was wired to the LED 2 Motor status. I hope I'm correct, otherwise I don't want to proceed with project. Your built 3D-scanner, did it work as advertised. Have you heard any feedback from others? I attach a revised drawing how I think it should be wired. Have a look and let me know if you agree to the modified "fritzing" drawing. I added some description of the components used on the drawing.
    Looking forward to your reply,
    Kjell

    3D-Hardware layout Ver 2.jpg3D_Scanner_Phone_Arduino.png
    0
    LuckyLuke55
    LuckyLuke55

    Reply 1 year ago

    Hi Kjell, no problem.
    You are absolutely right. I had some mistakes in my drawing. The buttons should be connected right through to the nano as well as the led2 , the gnd was meant one higher. I am sorry to cause you some troble there.

    The scanner works fine here but when building I probably just made it right and had drawing in head instead of on paper :-)
    I didnt have any comment before. I hope to find time to correct this on the publication. So thanks for the check.

    Good luck with yours. By the way I saw a really good alternative doing the same but with different looks and working.
    Check it out: https://www.thingiverse.com/thing:3958326

    Greetings from The Netherlands again
    George