Introduction: Autonomous / Voice Controlled - 3D Scanning Rig for 3D Printing

The idea behind the voice controlled / autonomous 3D scanning rig is to allow for a 3D scanning capture to work as smooth as possible with the minimum effort for the person how is scanning as for the person how is being scanned.

The main goals of the project are:

1 - Create a portable/compact 3D scanning turntable (with the necessary size for 1 person to be rotated)

2 - Setup a autonomous system for the scanning process

3 - Setup a voice controlled 3D scanning system

Step 1: The System's Design

The design of the structure is minimalist, composed by a sheet of plywood as a base and big toothed gear, a Lazy Susan Bearing, a Geared DC motor and an Arduino micro-controller.

Feel free to alter the proportions of the design using sketchup or any other 3D CAD Software. All dimensions on the sketchup file are in 1:1 scale.

Step 2: Tools and Materials

In order to build this project, you will need the following list of materials, tools and machines.

Materials:

- 1 sheet of marine grade plywood (120x60x1.2 cm)

- 100ml of Wood glue

- 12" Lazy Susan bearing

- 48 20mm Wood screws

- 12V DC geared motor 15rpm

- 1 H-Bridge DC motor driver

- Arduino Nano

- Blue-tooth module


Tools and machines:

- 3D printer

- CNC machine

- Table saw

- Hand drill

Step 3: Workshop Safety (working With Wood)

The chosen material for the 3D scanning rig was plywood, because of its properties, easy to cut and glue.

Some safety measures before working with wood:

- Protect your eyes using some sort of goggles.

- Protect your respiratory tract from fine wood particles/dust using a face mask that covers your mouth and nose.

- Protect hands by using gloves

Make sure you clean the wood dust after you finish cutting the wood to avoid contaminating your workshop with wood dust.

Step 4: Cutting the Plywood Base

The turntable base is made from marine grade plywood 12mm thick.

Materials needed:

- 500x400x12mm marine grade plywood or similar

Tools needed:

- Table saw

- Hand drill machine

Instructions:

Start by cutting two 500x400x12mm rectangles from the plywood sheet using a table saw.

Step 5: Glueing/Fixating the Plywood Base

Materials needed:

- 100ml Wood Glue

Tools Needed:

- Paint brush

Instructions:

Glue the two pieces of plywood together using wood glue. Make sure to align the 2 pieces together as best as possible after applying the glue. Place a heavy object on top of the 2 pieces of plywood while the glue is drilling. To ensure a strong fixation, drill some wood screws on to the bottom of the Base.

Step 6: Applying Varnish to the Base

Materials needed:

- 100ml Floor Varnish

Tools needed:

- Paint brush

Instructions:
After the two pieces of plywood are properly fixated, apply two or three cotes of wood floor varnish using a paint brush. Allow drying in between coats.

Step 7: Thrust Bearing - Lazy Susan Bearing

Before we attach the bearing to the system please have a read on the following citations, in order to understand the function of the bearing:

"A thrust bearing is a particular type of rotary rolling-element bearing. Like other bearings they permit rotation between parts, but they are designed to support a predominately axial load."

wikipedia: http://en.wikipedia.org/wiki/Thrust_bearing

"A Lazy Susan is a turntable (rotating tray) placed on a table or counter top to aid in moving food. Lazy Susans may be made from a variety of materials but are usually glass, wood, or plastic.
They are usually circular and placed in the center of a circular table to share dishes easily among the diners. Owing to the nature of Chinese cuisine, especially dim sum, they are especially common at formal Chinese restaurants both on the mainland and abroad."

wikipedia:http://en.wikipedia.org/wiki/Lazy_Susan

Step 8: Positioning the 12" Bearing

The Lazy Susan bearing is a perfect for turntables, the 12" one we are going to use has a 120kg limit.

Materials needed:

- 4 wood 20mm wood screws

Tools needed:

- 50 cm ruler

- 1 pencil

- Compass

Instructions:

Before installing the 12" lazy Susan make sure to lubricate the bearings for a smoother ride. Using the ruler and pencil mark the centre point on the plywood base, the next step is to draw two circles using the compass. The first circle represents the inner bearing diameter and the second one the outer bearing diameter.

The next step is to place the bearing on top of the plywood inside the 2 drawn circles, this ensures that it is aligned, and in position for fixation.

Using a pencil mark the 4 fixation points and the 2 big holes.

Using a hand drill, drill out the big hole on the plywood base. This holes will be used later to secure the geared wood plate on top of the bearing.

After drilling the hole, screw the bearing in place, using wood screws.

Step 9: Toothed Gear Design Software

The 3D scanning turntable has a motorized geared transmission system, so in order to build the gears we need to design the them first, for this the gear template generator software.

The Big gear has 60 teeth. The smaller gear has 10 teeth.

The attached drawings are in DFX format.

Step 10: CNC Milled Plywood - Big Gear

In order to cut out the big gear, we are going to using a CNC machine.

Instructions:

- Place a 400x400x12mm plywood sheet on the working area of the CNC

- Start the machine and collect the dust if possible using a vacuum cleaner

If you are using 20mm plywood, just one piece will work, if you are using 12mm plywood use two sheets one on top of each other to ensure strength.

Step 11: Glueing/Fixating the Big Gear

Materials needed:

- Wood glue

Tools needed:

- Paint brush

Instructions:

Make sure to align the 2 pieces together as best as possible after applying the glue. Place a heavy object on top of the 2 pieces of plywood while the glue is drilling.To ensure a strong fixation, drill some wood screws on to the bottom of the big gear.

Step 12: Applying Varnish to the Big Gear

Materials:
- 100ml Floor Varnish

Tools Needed:

- Paint brush

Instructions:

After the two pieces of plywood are properly fixated, apply two or three cotes of wood floor varnish using a paint brush. Allow drying in between coats.

Step 13: Big Gear Markings - Lazy Susan

Tools needed:

- Pencil

- Ruler

- Compass

Instructions:

First locate the centre of the big gear using a compass. Than using the compass draw two circles on the pllywood, one with the same diameter of the inner circle of the bearing and one with the outer diameter. After placing the bearing inside the circles, mark the 4 holes for the screw.

Step 14: Base Markings - Lazy Susan

Tools needed:
- Pencil

- Ruler

- Compass

Instructions:

Using the ruler mark a centre point on the base located at 20cm from the borders of the plywood. Than using the compass draw two circles on the plywood, one with the same diameter of the inner circle of the bearing and one with the outer diameter. After placing the bearing inside the circles, mark the 4 holes for the screw. Also mark the place of the two big holes on the bearing.

Step 15: Drilling 2 Holes on to the Base - Lazy Susan

Tools needed:

- Hand drill

Instructions:

In order to attach the big gear to the bearing, we need to drill 2 holes no to the bottom Base. These holes will be used to access the bearing from beneath the base in order to screw the big gear to the lazy Susan.

Step 16: Attaching the Lazy Susan Bearing to the Plywood Base

Materials needed:

- 4 Screws

Tools needed:

- Screw driver

Instructions:

To attach the Lazy Susan bearing on to the base, turn the base on to its bottom side and place the use the 2 holes to locate the screw positions.

Step 17: Testing and Aligning the Base and the Big Gear

Now that you have fixated the bearing to the bottom and top plywood structures it is time to test if it is properly aligned. Spin the big gear and try to see if it spins perfectly in relation to its centre, if it wobbles instead of spinning perfectly, you need to unscrew the 4 screws that attach the big gear to the bearing. Double check your markings and re-screw the big gear to the bearing.

If all goes well, you should get a nice centred smooth spin. I noticed that the bottom hole can be used to lubricate the bearing, one in a while for maintenance.

Step 18: The Smaller 3D Printed Gear

Tools needed:

- 3D Printer

Instructions:

Now the the turntable if aligned and spinning correctly, time to move on to the smaller gear. The smaller gear will be attached to a motor shaft.

NOTE: 10 teeth work fine, but i found that 7 teeth work best, the distance from the motor shafts is shorter so the torque is higher with 7 teeth.

Step 19: Motor/Small Gear - Coupling

Materials needed:

- 4 M3 screws

Tools needed:

- screwdriver

Instructions:

The coupling of the motor and the small gear is made by inserting the small gear onto the shaft and hammering it down gently onto the shaft.

Step 20: The Motor Support

Tools needed:

- 3D printer

Instructions:

The motor support has 4 holes on the base to allow it to attach to the plywood base using wood screws. Then it has on the top a center hole and 6 small holes to attach the motor. It was 3D printed.

Step 21: Choosing a Geared Motor

For transmission, we are going to use an electrical motor. I first tried with a NEMA 17 Motor unsuccessfully. It does not have enough torque to make the turntable spin with some one on top.

The chosen motor is a 12V DC motor with 15RMP and 250N/cm torque. This motor is powerful enough to spin the turntable.

Motor specifications:

- Torque: 250 N*cm12V DC;

- 15RPMShaft length: 21mm

- Total length: 73mm;

- Shaft diameter: 6mm

- Diameter: 37mm;

- Length (excluding shaft): 52mm

Step 22: Ataching the Motor Support Onto the Base

Materials needed:

- 4 small wood screws

Tools Needed:

- Hand drill or screwdriver

Instructions:

Before attaching the motor mount to the base, make sure you position it in the right place, not too close to the big gear and not too far from it either. You can tun the motor and adjust the distance in real time when the motor is turning, than stop the motor and attach the motor support to the plywood base, just screw in 4 screws using a hand drill or a screw driver.

Step 23: Wiring the Electronics

Tools needed:

- Soldering iron

- Solder wire

- Multimeter

Material needed:

- Arduino Nano

- Ultrasonic range finder

- 12V power supply

- Bluetooth module

- Dual H-bridge DC motor driver

- DC geared motor 12V 15RPM

Instructions:

Follow the schematic for wiring the electronics. First of, wire the ultrasonic range finder, and test it. Than attach the DC motor driver and motor, and the power supply. Lastly connect the Bluetooth module.

Step 24: Costume - DC Motor Driver Circuit Board

NOTE: You can buy any Dual H-bridge DC motor driver for this step, i asked a friend of mine to make this costume PCB board.

Tools needed:

- Laser printer

- Hand drill

Materials needed:

- PCB board 8x6 cm

- Hydrochloric acid

- 8 Diodes

- 4 LED's

- 4 resistors

- Male pins

Instructions:

First off you need draw the circuit on your computer, then print the circuit using your laser printer and photo paper, remember it is double sided PCB board. Than you need to do the toner transfer method, using a iron press the print onto the PCB. Transfer the paint to the top side of the PCB than on the bottom side, be careful to align the circuits.

Now that the paint is transfered, put the PCB in cold water to remove the pieces of paper that are attached to the PCB.

The next step, is mix 2/3 of peroxide and 1/3 of hydrochloric acid and dip the pcb inside. keep the fluid in motion to corrode the copper. After 2 minutes remove the PCB form the solution. Clean the PCB using water to remove the acid.

Clean the PCB using acetone using a soft brush, to remove unwanted toner.

Drill the holes using a drill, and solder the components in place.

For protection after soldering everything use a coat of varnish to protect and isolate

Step 25: Commercially Available DC Motor Driver

Instead of the costume board you can purchase any HBridge DC motor driver. Keep in mind that the motor runs at 12V.

Have a look at this guide:

https://learn.sparkfun.com/tutorials/ardumoto-shield-hookup-guide

Step 26: Arduino Nano - Bluetooth Module

The Arduino Nano is small an compact, so is the Bluetooth module, so in this setup i glued them together back to back using double sided tape.

Step 27: Autonomous 3D Scanning - Ultrasonic Range Finder

Because the 3d scanner is autonomous we need a sensor on the rig. A ultrasonic range finder is perfect for detecting presence of object on the big gear.

The idea is to start the motor if an object is present for 3 seconds on the turntable. The position of the ultrasonic range finder is such, that it aims for the persons legs/feet.

In the Arduino code, the motor will turn as soon as a object is detected in front of the sensor inside a 1-35cm distance.

Step 28: The Arduino Source Code

#include 

const byte PWMA = 9;  // PWM control (speed) for motor A
const byte DIRA = 8;  // Direction control for motor A

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

float nextspeed=0;
int data=0;
int msg_lenght=0;

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
 
char  userInput[4] = {'s','0','0','\r'};

void setup() { 
  Serial.begin(9600);
  pinMode(PWMA, OUTPUT); 
  pinMode(DIRA, OUTPUT); 
} 

void loop(){ 
  
  /*
  delay(100);
  int distcm=sonar.ping_cm();
  Serial.print("Ping: ");
  Serial.print(distcm);
  Serial.println("cm");
  
  
  if( (distcm <= 35) && (distcm) >= 1){
     delay(1000);
     digitalWrite(DIRA,  0);
     analogWrite(PWMA, 200);
     delay(100);  // Motor A will keep trucking for 1 second 
  }
  else{
     digitalWrite(DIRA,  0);
     analogWrite(PWMA, 0);
     delay(100);  // Motor A will keep trucking for 1 second 
  }
  */
  
   if ( data == 0 ) {
      readuserdata();
   }
   if ( data == 1 ){
      nextspeed = (char(userInput[1] - 48)*10 + char(userInput[2] - 48));
      nextspeed = nextspeed*25;
         
      setspeed(nextspeed);
      
      Serial.print(nextspeed); 
      Serial.print(" "); 
      
      data=0;   
      for (int i=0 ; i<=6 ; i++)     
          userInput[i]=0;
      }
}

void setspeed(int nextspeedx){
    analogWrite(PWMA, nextspeedx); 
}

void readuserdata(){
  char tmp;
     if(Serial.available()){ 
        msg_lenght = Serial.available();    
        if( msg_lenght == 3  ){
           Serial.print("Message lenght=");
           Serial.print(msg_lenght);
           tmp = Serial.read();
           if( tmp == 's' ){
              userInput[0] = tmp;
              for (int i=1;i<=msg_lenght;i++){
                tmp=Serial.read();
                userInput[i] = char(tmp);                 
              }
              data=1;
              }
        }
     }
}



Step 29: Speech Recognition - Software (for Windows)

The idea is to program your computer to recognize some keywords that will activate the scanning process automatically, this is done by controlling your mouse automatically, like a mouse bot.

Windows speech recognition SDK allows for speech recognition applications to be developed.

Instructions:

- Install skanect

- Install Microsoft speech tool-kit

- Install visual studio

- Open the voicerecognition project (attachment)

The code recognizes the keywords and sends commands to the COM port connected to the Arduino via Bluetooth.

Change the COM port to match the Bluetooth port, change the path to the skanect software, and finally run the program.

Now you just need to position your self on to the rig and say "start skanect" for the scan to begin. The mouse will move by it self, make necessary adjustments to the coordinates of the mouse if necessary. The scan takes 60 seconds, make necessary adjustments if necessary.

You can also change the speed of the turntable by using the following voice commands:

- spin motor faster

- spin motor slower

For safety you can also turn the motor off and on by using the following keywords:

- turn motor off

You also have the option to change spin direction using the following keywords:

- turn motor right

- turn motor right

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.Runtime.InteropServices;

using System.IO.Ports;
using System.Threading;

namespace VoiceRecognitionGame
{
    public partial class MainWindow : Window
    {
        private SpeechSynthesizer _synthesizer = new SpeechSynthesizer();

        [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void mouse_event(uint dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
 

        const int MOUSEEVENTF_MOVE = 0x0001; //moving the mouse
        const int MOUSEEVENTF_LEFTDOWN = 0x0002; //the analog left mouse button is pressed
        const int MOUSEEVENTF_LEFTUP = 0x0004; //the analog left mouse button lift
        const int MOUSEEVENTF_RIGHTDOWN = 0x0008; //simulate a right mouse press
        const int MOUSEEVENTF_RIGHTUP = 0x0010; //simulate a right mouse lift
        const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; //simulate a middle mouse button is pressed
        const int MOUSEEVENTF_MIDDLEUP = 0x0040; //simulate a middle mouse button lift
        const int MOUSEEVENTF_ABSOLUTE = 0x8000; //marked the absolute coordinate
     


        public SerialPort serialPort = new SerialPort();
        public float speed = 0;
        public float direction = 1;
        private SpeechRecognitionEngine _recognizer;

        public MainWindow(){
            InitializeComponent();

            _recognizer = new SpeechRecognitionEngine();
            _recognizer.SetInputToDefaultAudioDevice();

            Choices choices = new Choices("spin motor slower", "turn motor off", "spin motor faster", "turn motor right","turn motor left", "start skanect");

            GrammarBuilder grBuilder = new GrammarBuilder(choices);
            Grammar grammar = new Grammar(grBuilder);
            _recognizer.LoadGrammar(grammar);
            _recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
            _recognizer.RecognizeAsync(RecognizeMode.Multiple);


           
            serialPort.BaudRate = 9600;
            serialPort.PortName = "COM12"; // Set in Windows
            serialPort.Open();
           

                // WRITE THE INCOMING BUFFER TO CONSOLE
                //while (serialPort.BytesToRead > 0)
               // {
                //    Console.Write(Convert.ToChar(serialPort.ReadChar()));
               // }
                // SEND
            
            
                //Thread.Sleep(500);
        }

        void arduino_write(float spd) {
            if (spd == 0)
                serialPort.Write("s00");
            if (spd == 1)
                serialPort.Write("s01");
            if (spd == 2)
                serialPort.Write("s02");
            if (spd == 3)
                serialPort.Write("s03");
            if (spd == 4)
                serialPort.Write("s04");
            if (spd == 5)
                serialPort.Write("s05");
            if (spd == 6)
                serialPort.Write("s06");
            if (spd == 7)
                serialPort.Write("s07");
            if (spd == 8)
                serialPort.Write("s08");
            if (spd == 9)
                serialPort.Write("s09");
            if (spd == 10)
                serialPort.Write("s10");

            if (spd == 0 )
                serialPort.Write("s00");
            if (spd == 1 )
                serialPort.Write("s01");
            if (spd == 2 )
                serialPort.Write("s02");
            if (spd == 3 )
                serialPort.Write("s03");
            if (spd == 4 )
                serialPort.Write("s04");
            if (spd == 5 )
                serialPort.Write("s05");
            if (spd == 6 )
                serialPort.Write("s06");
            if (spd == 7 )
                serialPort.Write("s07");
            if (spd == 8 )
                serialPort.Write("s08");
            if (spd == 9 )
                serialPort.Write("s09");
            if (spd == 10 )
                serialPort.Write("s10");
                       
        }

        void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e){

               output1.Clear();
               output1.AppendText(e.Result.Text);
               
               output2.Clear();
               output2.AppendText(e.Result.Confidence.ToString());

               if (e.Result.Confidence < 0.40)
                   return;

               SpeechSynthesizer s = new SpeechSynthesizer();
               switch (e.Result.Text)
               {          
                   case "start skanect":

                        s.Speak("Yes Master, the application will start in a few seconds");
                       // System.Diagnostics.Process.Start("C:\\Program Files\\Skanect 1.5\\bin\\skanect");

                        //Thread.Sleep(10000);

                        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
                        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                       
                        Thread.Sleep(5000);
 
                        
                        speed = 10;
                        arduino_write(speed);

                        Thread.Sleep(25000);


                        speed = 0;
                        arduino_write(speed);

                       mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
                        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

                        Thread.Sleep(1000);

                        



                        
                        speed = 0;
                        arduino_write(speed);

                       break;

                    case "spin motor slower":
                       
                        if (speed > 1)
                        {
                            speed--;
                            speed--;
                        }

                       arduino_write(speed);

                        break;
                    case "turn motor off":
                        
                        serialPort.Write("s00");
                       // s.Speak("motor off");
                        speed = 0;
                        arduino_write(speed);

                        break;
                    case "spin motor faster":
                        if (speed < 9)
                        {
                            speed++;
                            speed++;
                        }
                       
                        break;
                    case "turn motor left":
                        //    s.Speak("Have a nice day sir");

                        arduino_write(speed);
                        direction = 0;
                       
                        break;
                    
                   case "turn right":
                        //    s.Speak("Have a nice day sir");

                        arduino_write(speed);
                        direction = 1;

                        break;

                    default:
                        break;
                }
        }


    }

   
}

Step 30: 3D Scanning Software and 3D Scanning Sensors

SKANECT Scanning software:

"With Skanect, capturing a full color 3D model of an object, a person or a room has never been so easy and affordable. Skanect transforms your Microsoft Kinect or Asus Xtion camera into an ultra-low cost 3D scanner able to create 3D meshes out of real scenes in a few minutes. Enter the world of 3D scanning now!"

source: "http://skanect.occipital.com"

Scanning sensors:

Skanect supports several sensors such as, Asus Xtion & PrimeSense Carmine and Microsoft Kinect (Windows & Xbox).

Step 31: Some 3D Scanning Results and 3d Prints

The scanning rig comes in handy when you need to scan people constantly. The scanning rig has 2 modes of functioning, autonomous and voice control.

CNC Challenge

Participated in the
CNC Challenge

Automation Contest

Participated in the
Automation Contest

Tools Contest

Participated in the
Tools Contest