ENGR 2210 - Principles of Engineering

Profs. Hoover, Faas, Minch, & Reifel

Fall 2017

Lab 2 - Due before class Tues., 9/26

Lab 2 - DIY 3D Scanner

Objectives

1) Build and program a rudimentary 3D scanner using a pan/tilt mechanism

2) Scan an object of known, well-defined geometry

3) Visualize the output from your scanner

Introduction

The first lab should have gotten you comfortable with (or at least aware of) how to read and write digital signals, how to read and convert analog signals, and how to use an analog input to change the digital behavior of your circuit.

The purpose of this lab is to introduce sensors and actuators. Sensors are devices that transduce a physical quantity in the world (distance, force, pressure, chemical concentrations, etc.) into a different, often more easily measurable, physical quantity like voltage. Actuators are duals to sensors in that they transform one form of energy (hydraulic pressure, chemical energy in gasoline, electrical potential, etc.) into mechanical work.

This lab will make use of an infrared distance sensor and two hobby servo motors. An infrared distance sensor is an infrared emitter (LED) paired with an infrared detector (photodiode). The detector measures the intensity of the IR light reflected off of an object in its field of view. The output of the sensor is an analog voltage. A hobby servo motor is more than just a motor; it’s a DC motor connected to a potentiometer (to measure the shaft angle), hardware proportional-integral-derivative (PID) controller (to perform position control), and a gear train (to increase torque and decrease speed). A hobby servo is controlled using a square wave form that is pulsed at a fixed frequency. The time that the waveform signal is set to “on” determines what the position of the shaft should be. This scheme is called “pulse width modulation” (PWM) and the percentage of “on” time during the period is called the “duty cycle”. Most hobby servos use a pulse width of between 1ms and 2ms (sometimes the range can be as wide as 0.8ms to 2.2ms).

Requirements

Create a pan/tilt mechanism using the servos and sensor provided for you that is controlled by an Arduino. Transmit servo angle and distance information from your sensor to your laptop for storage and, ultimately, visualization. Using a software package of your choice (MATLAB, Python, JavaScript, etc.) create a 3D visual representation of an object of known, well-defined geometry.

Suggested Steps

  1. Connect your sensor to the appropriate pins on the arduino and verify that it works using the “AnalogInput” example from the Arduino development environment.
  2. Test that serial connection between your laptop and the Arduino can relay sensor data using the “AnalogInOutSerial” example in the Arduino IDE. We have also created a sample sketch that sends data back to the laptop after receiving commands from a  sample Python script.
  3. Test the functionality of your servos using the  “Sweep” example in the Arduino IDE (under “Servo”).
  4. Calibrate your distance sensor. Calibration is the process of getting a set of readings for known distances and determining the mathematical relationship between physical distance and the sensor voltage reading.
  5. Test your calibration with distances that were not used as part of the calibration procedure.
  6. Pick a letter that represents an initial of one of your team members, and cut that letter out of a large sheet of cardboard, foamcore, or pink foam. Create a stand or a base plate for the letter that enables it to stand freely without you having to hold it.
  7. Mechanically mount your sensor to a single servo.
  8. Create a program that sweeps the sensor across the letter and reports distances and the servo angle using serial output from the Arduino.
  9. Create a graph of the 2D, top-down representation of the letter along that line.
  10. Create the pan/tilt mechanism and program it to sweep the entire face of your letter and return distance measurements and both servo angles.

Bill of Materials (BOM):

Lab Report

Your lab report should include the following elements:

  1. A description of the process you used to test your sensor
  2. A calibration plot depicting analog voltage reading vs. actual distance
  3. An error plot showing predicted distance and actual distance for distances not included in your calibration routine
  4. An explanation of your calibration function
  5. An image of your setup for the 1 servo scan of your letter and the data depicting the top view
  6. A photo of your setup for the 2 servo apparatus and some visualization of the 3D data resulting from your scan (a plot, an image, a video, etc)
  7. All source code

Please submit your report as a pdf attachment named lab2_<partner1_last_name>_<partner2_last_name>.pdf  to poe.submit@gmail.com and read the Lab Report Style Guide carefully before writing your lab report.