EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Similar documents
EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Grove - Infrared Receiver

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

ZX Distance and Gesture Sensor Hookup Guide

FABO ACADEMY X ELECTRONIC DESIGN

CPE 100L LOGIC DESIGN I

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Arduino Lesson 1. Blink. Created by Simon Monk

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

Application Note AN 157: Arduino UART Interface to TelAire T6613 CO2 Sensor

TWEAK THE ARDUINO LOGO

ESC 100: Exploring Engineering. Fall Lab 2: Calibrating An Infrared Distance Sensor

Using a Sharp GP2D12 Infrared Ranger with BasicX

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Community College of Allegheny County Unit 7 Page #1. Analog to Digital

ILR #1: Sensors and Motor Control Lab. Zihao (Theo) Zhang- Team A October 14, 2016 Teammates: Amit Agarwal, Harry Golash, Yihao Qian, Menghan Zhang

Module: Arduino as Signal Generator

Coding with Arduino to operate the prosthetic arm

INA169 Breakout Board Hookup Guide

CPSC 226 Lab Four Spring 2018

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Grove - I2C Color Sensor User Manual

EE 221 L CIRCUIT II. by Ming Zhu

EE 221 L CIRCUIT II. Learn to use LTspice to run circuit simulations for voltage, current, etc.

Portland State University MICROCONTROLLERS

Arduino: Sensors for Fun and Non Profit

Lesson 3: Arduino. Goals

Pin Symbol Wire Colour Connect To. 1 Vcc Red + 5 V DC. 2 GND Black Ground. Table 1 - GP2Y0A02YK0F Pinout

APDS-9960 RGB and Gesture Sensor Hookup Guide

Welcome to Arduino Day 2016

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

Light Emitting Diode IV Characterization

User Manual. Grove - IR Distance Interrupter. Release date: 2015/9/22. Version: 1.0

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT

Experiment 4.B. Position Control. ECEN 2270 Electronics Design Laboratory 1

Arduino An Introduction

URM37 V3.2 Ultrasonic Sensor (SKU:SEN0001)

Programming 2 Servos. Learn to connect and write code to control two servos.

Practical Assignment 1: Arduino interface with Simulink

Training Schedule. Robotic System Design using Arduino Platform

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters

A servo is an electric motor that takes in a pulse width modulated signal that controls direction and speed. A servo has three leads:

Magnetic Levitation System

Experiment 5.B. Multifunction Wireless Control. ECEN 2270 Electronics Design Laboratory 1

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

PSoC and Arduino Calculator

Operating Mode: Serial; (PWM) passive control mode; Autonomous Mode; On/OFF Mode

The wiring is relatively simple. You should put the module on one of the compatible Arduinos. The following are compatible:

Community College of Allegheny County Unit 4 Page #1. Timers and PWM Motor Control

1. Controlling the DC Motors

The Robot Builder's Shield for Arduino

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

EE 320 L LABORATORY 9: MOSFET TRANSISTOR CHARACTERIZATIONS. by Ming Zhu UNIVERSITY OF NEVADA, LAS VEGAS 1. OBJECTIVE 2. COMPONENTS & EQUIPMENT

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

EE 221 L CIRCUIT II. by Ming Zhu

Available online Journal of Scientific and Engineering Research, 2018, 5(4): Research Article

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

Figure 1. Digilent DC Motor

Experiment 1: Robot Moves in 3ft squared makes sound and

Adafruit 16-Channel Servo Driver with Arduino

LVTX-10 Series Ultrasonic Sensor Installation and Operation Guide

INTRODUCTION to MICRO-CONTROLLERS

HVW Technologies Analog Infra-Red Ranging System (AIRRS )

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

ASCOM EF Lens Controller

Basic Microprocessor Interfacing Trainer Lab Manual

Pulse Sensor Individual Progress Report

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

HC-SR501 Passive Infrared (PIR) Motion Sensor

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

AN ARDUINO CONTROLLED CHAOTIC PENDULUM FOR A REMOTE PHYSICS LABORATORY

1Getting Started SIK BINDER //3

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual

INTRODUCTION to MICRO-CONTROLLERS

Application Note. Communication between arduino and IMU Software capturing the data

Adafruit 16-Channel Servo Driver with Arduino

Security in a Radio Controlled Remote Switch

Lab 13: Microcontrollers II

Walle. Members: Sebastian Hening. Amir Pourshafiee. Behnam Zohoor CMPE 118/L. Introduction to Mechatronics. Professor: Gabriel H.

S AMPLE CHAPTER IN ACTION. Martin Evans Joshua Noble Jordan Hochenbaum MANNING

LAB PROJECT 2. Lab Exercise

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science?

1 Lab + Hwk 4: Introduction to the e-puck Robot

Capacitive Touch with Conductive Fabric & Flora

Distance Measurement of an Object by using Ultrasonic Sensors with Arduino and GSM Module

AS726X NIR/VIS Spectral Sensor Hookup Guide

Arduino Hacking Village THOTCON 0x9

INTRODUCTION to MICRO-CONTROLLERS

EE 221 L CIRCUIT II LABORATORY 4: AC CIRCUITS, CAPACITORS AND INDUCTORS UNIVERSITY OF NEVADA, LAS VEGAS OBJECTIVE COMPONENTS & EQUIPMENT BACKGROUND

PIR Motion Detector Experiment. In today s crime infested society, security systems have become a much more

Electronics Design Laboratory Lecture #10. ECEN 2270 Electronics Design Laboratory

Arduino Control of Tetrix Prizm Robotics. Motors and Servos Introduction to Robotics and Engineering Marist School

Marine Debris Cleaner Phase 1 Navigation

Transcription:

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 7: IR SENSORS AND DISTANCE DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS GOAL: This section will introduce the Sharp IR Distance Sensor and interface it with the Arduino UNO and OBJECTIVES: Learn the basics of Arduino Programming o Commands: setup() loop() Serial Library DistanceGP2Y0A21YK Library Interface with the Sharp Distance Sensor Generate a calculated distance Furthur expand and create an event based on the returned value OVERVIEW AND REQUIREMENTS: Infrared Proximity Sensor - Sharp GP2Y0A21YK 1 Output 2 Ground 3 VCC (5V) Fig. 1. Sensor The Sharp GP2Y0A21YK is an Infrared proximity Sensor. It shines a beam of IR light from an LED, and measures the intensity of light that is bounced pack using a phototransistor. This IR sensor is more economical than sonar rangefinders, yet it provides much better performance than other IR alternatives. Interfacing to most microcontrollers is straightforward: the single analog DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 1

output can be connected to an analog-to-digital converter for taking distance measurements, or the output can be connected to a comparator for threshold detection. The detection range of this version is approximately 10 cm to 80 cm (4" to 32"); a plot of distance versus output voltage is shown below. Fig. 2. Voltage and distance relation As you can see the output from the sensor is not linear. In order to compensate for this we are using a library that contains a Look-up Table (LUT) that has stored distance values relative to the analog output voltage from the IR sensor. How the Sensor Works 1. A pulse of IR light is emitted by the emitter. 2. This light travels out in the field of view and hits an object. 3. The reflected light returns to the detector and creates a triangle between the point of reflection, the emitter, and the detector. 4. The angles in this triangle vary based on the distance to the object. 5. The receiver uses a precision lens to transmit the reflected light onto various portions of the enclosed linear CCD array based on the angle of the triangle described above. 6. The CCD array can then determine what angle the reflected light came back at and therefore, it can calculate the distance to the object. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 2

COMPONENTS: Arduino Uno USB A-B Cable Sharp GP2Y0A21YK IR Proximity Sensor Host PC Installed Arduino Uno drivers and IDE DIAGRAM: DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 3

OPERATION: Using the distance sensor 1. Download and extract the DistanceGP2Y0A21YK.zip file included in this lab. https://faculty.unlv.edu/eelabs/soft/distancegp2y0a21yk.zip 2. Copy the extracted DistanceGP2Y0A21YK into the Arduino libraries folder. 3. If you already have the Arduino client running, make sure to restart the client after copying the Distance folder into the libraries folder (i.e. extract the zip into libraries folder). The client will not recognize that the folder is there if you do not. 4. Wire the circuit as shown in the schematic. Your final result should be something similar to the following snapshot. 5. Attach the Arduino UNO to the host PC with the use of the USB cable. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 4

6. Open the Arduino IDE and create a new sketch titled IRSensor. Verify that the correct COM port is in use. 7. Upload the following sketch to your Arduino UNO (Code 1): #include <DistanceGP2Y0A21YK.h> //Load Distance Library DistanceGP2Y0A21YK Dist; int distance; void setup() { Serial.begin(9600); Dist.begin(A0); } //Define the struct //Variable to hold distance //Start Serial //Start Distance Lib void loop() { distance = Dist.getDistanceCentimeter(); //Use LUT to get Distance Serial.print("\nDistance in centimeters: "); //Print Serial.print(distance); delay(100); } 8. Verify your results by running the COM window and testing the IR Sensor. If your sketch is not compiling please add the following line at the top of DistanceGP2Y0A21YK_LUTs.h library file (it can be found in the folder DistanceGP2Y0A21YK): typedef const unsigned char prog_uchar; DEMO AND SCREENSHOTS: DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 5

PRELAB: What does analogread() returns? How to convert this value to a voltage (0 5V)? EXPERIMENTS: Experiment 1 1. Wire the circuit and sensor as mentioned in Operation section 2. Verify the operation of the sensor 3. Demonstrate the results to the TA Experiment 2 1. Extend the circuit: a. Using the breadboard shield, add an LED to your design b. Modify the code so that when the IR Sensor detects a distance less than 10 centimeters the LED turns on. 2. Demonstrate the results to the TA Experiment 3 1. Extend the circuit from Experiment 2: a. Using the breadboard shield, add one more LED, so you have green LED and red LED. b. Keep in mind, that the measurements below 10cm and above 80 cm are erroneous. However for the purpose of this experiment assume 40 cm as the higher bound (i.e. you are assuming that only measurements between 10 cm and 40 cm are correct). Modify the code so green LED is on when measurements are correct, and red LED turns on when measurements are incorrect (outside of assumed range). c. Display the measurements in the serial monitor d. Demonstrate the operation to the TA Experiment 4 1. By plotting the output voltage versus inverse number distance (1/cm), we can get the linear relation such as in Fig. 3. 2. Using the equation y = 20.99x + 0.19, where y is voltage output and x is inverted distance, modify Code 1 to find the distance without the use of the included library. 3. Make 5 measurements for the library and your method (same object distance for the pair of measurements). Place them in the table: No. 1. 2. 3. 4. 5. Library measurement A Your method measurement B A B DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 6

What are your conclusions? Fig. 3. Output characteristics with inverse number of distance POSTLAB REPORT DELIVERIES Include the following elements in your postlab report: 1. Theory of operation a. Describe how the distance sensor works b. List 3 different applications of the distance sensors 2. Results of the experiments For each experiment, include: a. The code that you developed for the experiment. Each line that was added must be highlighted and commented with the explanation of what is its meaning. b. Brief explanation how the goal of the experiment was reached c. Screenshots of the serial monitor with the values, presenting the operation of your code For experiment 4, explain your method. Write your conclusions about the differences between library and your results. 3. Answer the questions: a. Is the output of the IR sensor analog or digital? b. Find out the technical data about the sensor used: i. Detecting distance DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 7

ii. Operating temperature iii. Operating supply voltage 4. Conclusions a. Write down your conclusions, things learned, problems encountered during the lab and how they were solved, etc. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 8