13
Lab 1 P. 1 Engineering H193 - Team Project Spring Quarter Gateway Engineering Education Coalition Introduction to Sensors Lab 1

Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Embed Size (px)

Citation preview

Page 1: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 1

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Introduction to Sensors

Lab 1

Page 2: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 2

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Today’s Laboratory

• Purpose:

• The purpose of this lab is to expose your team to some of the sensors that you might use in your robot design.

– Learn the basic operating principles of micro-switches and photo sensors (CdS cells).

– Write and run a program to control the speed and direction of an erector set motor using a microswitch and a CdS cell.

– Learn how to test the motor ports, analog ports, and digital ports of your handyboard.

Page 3: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 3

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Procedure

• Connect the Handyboard to the computer using the interface board, phone cable, and serial cable provided.

• Run Interactive C on your computer. Follow the instructions to download pcode to your handy board. Select the file Handy_Board_1.2.icd when prompted.

Page 4: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 4

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Procedure

• Determine if your Handyboard is working correctly by loading and running the program "hbtest.c". This program will allow you to check the motor ports, analog ports, digital ports, and the control knob. Run the following subroutines (one at a time) by typing them at the bottom of the Interaction Window.

• testmotors(); • testdigitals(); • testanalogs();

Page 5: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 5

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Gearhead Motor

• Trim a male header strip (use three pins only) and solder it to the wire leads of the gearhead motor (See Section 6 of the Handyboard technical reference.)

• Connect the motor to one of the motor ports.

Page 6: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 6

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Gearhead Motor

• Write a program using the motor(int m, int p) command to turn the motor on and off, and to reverse its direction.

– Do not exceed a power level of 60~65 (instead of 100). This is to avoid burning the motor (which is rated at 6 V).

– Use printf statements to show the status of the motor on the LCD screen.

Page 7: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 7

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Microswitch

• Solder a microswitch to a two-wire ribbon cable.

• Trim a male header strip (use four pins only) and solder it to the other end of the ribbon cable (See figures on section 6 of the handyboard technical reference. )

Page 8: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 8

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Microswitch

• Connect the microswitch to a digital port.

• Write a program that allows the motor to run while the microswitch is "not pressed" (switch open). The motor should stop whenever the microswitch is "pressed" (switch closed). Use printf statements to show the status of both the motor and the microswitch on the LCD screen.

Page 9: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 9

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

CdS (Cadmium Sulfide) Cell

• Plug a CdS cell directly to an analog port of the handyboard.

• Write a command to print the output of the CdS cell on the LCD screen.

Page 10: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 10

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

System to Sense and Control

• Connect the erector set motor, the microswitch, and the CdS cell to the Handyboard

• Write a program that will continuously change the speed and direction of the motor based on the output of the CdS cell.

– Use the start button on the Handyboard to run the motor at a maximum power level of 60~65 in one direction.

– As you cover the CdS cell with your hand, the motor will slow down, stop, reverse its direction of rotation, and run at a power level of 60~65.

– The motor should stop whenever the microswitch is pressed (switch closed) or when the stop button is pressed.

Page 11: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 11

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

System to Sense and Control

• NOTE: Make sure that each team member can operate the Handyboard including setup, initialization, connection of devices, operating the devices in command mode, writing code in IC, and operating the devices under program control.

Page 12: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 12

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Individual lab reports

• Four pages maximum (including cover page, sketches, and attachments).    

• Cover page: title, name, section, team #, date, and professor.

• Description of the lab procedure, problems encountered, and how problems were solved.

• Include a sketch of the controller, motor, microswitch, and CdS cell connected. Use labels to indicate the ports used.

• Include copies of the programs used for parts 5 and 6.

Page 13: Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1

Lab 1 P. 13

Engineering H193 - Team Project

Spring Quarter Gateway Engineering Education Coalition

Questions ?