1 / 20

The George Washington University Electrical & Computer Engineering Department ECE 002

The George Washington University Electrical & Computer Engineering Department ECE 002. Dr. S. Ahmadi Lab 1. Class Agenda. Digital Sensors Analog Sensors Light Sensors. Optical Rangefinder Sensors. Ultrasonic Sensors (Sonar). Analog Sensor Characterization.

zenda
Download Presentation

The George Washington University Electrical & Computer Engineering Department ECE 002

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Lab 1

  2. Class Agenda • Digital Sensors • Analog Sensors • Light Sensors. • Optical Rangefinder Sensors. • Ultrasonic Sensors (Sonar). • Analog Sensor Characterization

  3. Two Distinct Categories of Sensors • Digital and Analog • Digital sensors have two states: 0 or 1 • Analog sensors have a range of states depending on their input • Example: • A door can be open or closed • What type of representation of the condition of the door is this? • How far the door is open (0 to 180 degrees!) • What type of representation of the condition of the door is this?

  4. Hooking up Sensors to the Handyboard Hook up additional Analog sensors To these ports (20-23) Hook up DIGITAL Sensors To these ports: 7-15 Hook up ANALOG sensors To these ports: (2-6)

  5. Digital Sensor: The Bumper Sensor • Digital sensor: • Returns either a 0 or 1. • Connect to DIGITAL ports 7-15 • Access with function digital(port#); • ‘0’ indicates switch is open (nothing has happened). Normally, switch will be ‘0’. • ‘1’ indicates switch is closed (Switch has been hit).

  6. For more information on different digital sensors available to you, refer to the Botball Kit Documentation, slides 42, 43, 51.

  7. Bumper Sensor Procedure and Test Code /* Program to beep if a bumper on port 13 has been hit. */ void main() { while(start_button()==0){ } // Waits for user to press start button. while(stop_button()==0) // Keep program running until press stop button { printf(“Switch on port 13 is open!\n”); // Bumper connected to port // 13. If it is hit, sends if (digital(13)= =1) // 1 to handyboard. { printf(“Switch on port 13 has been closed!\n”); beep(); } } }

  8. Analog Sensors • Output a range of values, depending on the input read. • The main analog ports are ports 2 – 6, and ports 20 – 23. • Actual ports that should be used will depend on the sensor being used. • The three main analog sensors that we will be using are the Light Sensor, the Optical Rangefinder Sensor and the Ultrasonic Sensor, also known as the Sonar.

  9. Light Sensors • Access with function analog(port#) • Connected to ports 2-6 or 20-23 • Analog values range from 0 - 255. • A low value indicates bright light, and vice versa.

  10. Optical Rangefinder Sensors • Access with function analog(port#) • Connected to ports 16-19 • Analog values range from 0 - 255. • Low values indicate far distance from an obstacle • High values indicate close proximity to an obstacle ~4 inches

  11. Ultrasonic Sensors (Sonar) • Connectredto upper deck board - port #0 • Connectgrayto Digital #7 • Access with function sonar() • Returned value is distance in mm to closest object in field of view • Range is approximately 30-2000 mm • When objects are too close or too far, gives value of 32767

  12. Sonar Sample Code /% Program that measures the sonar reading at different input values. %/ void main() { int range=0; printf(“\n Sensor Sample Program"); while(!start_button()); // Press Start Button while(1) // Continue infinitely { sleep(0.5); range = sonar(); printf(“\nOutput is %d”, range); } }

  13. Analog Sensor Characterization • The purpose of this exercise is to tabulate the readings from the three different analog sensors mentioned, when different inputs are sensed: • Light Sensor: Using the attached color scale, move the light sensor along the sheet, and record the values read at different intervals. • Optical Rangefinder: Using the provided boards, at different distances record the outputs read from the sensor. • Ultrasonic Sensor: Similar to the Optical Rangefinder, record the output from the sensor at different input distances.

  14. Light Sensor Color Scale ½” 100% 0% 50%

  15. ½” ½” ½” ½”

  16. Lab Requirements • Collect Data for at least one sensor. (Data to be handed in at end of lab, and you’ll need it for your HW.) • FOR LIGHT SENSOR: Take 10 equally spaced readings. • FOR SONAR SENSOR: Take enough readings to characterize sensor (more when measurements are non-linear, less when data is predictable) • Insert the data into an Excel spreadsheet • Plot the data (X-axis for distance, Y-axis for sensor readings). • Email the spreadsheet to all group members to complete HW

  17. Sensor Range • Sensors have an established operating range. Determine what this is for your sensor. • Choose your ten points so that they span the complete operating range of the sensor.

  18. Example Plot of Sensor Characterization – RANGE FINDER SENSOR

  19. Due in Lab Today • After tabulating the results, plot the graph for each sensor type, to see if the relationship turns out linear or not. Draw the curve to fit the graph. • Note: To simplify your work, write a short program that can continually print out the reading of the sensor on the Handyboards display. • Take a look at HW#1(Comprehensive Report on the Characterization of Robot’s Sensors), save your data/graphs for HW#1.

More Related