Presentation is loading. Please wait.

Presentation is loading. Please wait.

The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.

Similar presentations


Presentation on theme: "The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2."— Presentation transcript:

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

2 Agenda Review of Robot Building and Motor Control –Handyboard connections –Attaching a motor and controlling it Brief Review of 2 Analog Light Based Sensors –Light Sensor & IR “Top Hat” Sensor –Review of how to program using sensors Introduction to Project #1 –Description –Obstacle course diagram –Pictures of previous year robot designs –Optional portion of project

3 Review of Robot Building and Motor Control (for students who are new to ECE 001 & ECE 002)

4 Hardware Components HANDY-Board (Interface to motors) Serial Port Interface (Interface between Handyboard & Robot) AC Adapter (Provides power to Serial Port Interface & Handyboard) Serial Port Cable (Connects “Serial Port Interface Board” to back of PC) RJ-11 Cable (Connection btwn Handyboard & Serial Port Interface)

5 HANDY-Board Layout Ports 0,1,2,3 for MOTORs (Connect a wire from Port 0 to your LEFT motor And another wire from Port 2 to your RIGHT motor) LCD Screen (for output from your ROBOT) ON/OFF Button Download Connector (Connect Serial Port Interface Board to Handy-board here) I LOVE ECE001!

6 Building a Robot Chassis Using the Legos provided, construct a small chassis capable of carrying the load of the handy-board. Attach motors to chassis. Attach a gear to the motor, as shown on the following page (figure 1). Put a gear and wheel combination on an axle. Align two gears as shown in figure 2.

7 Figure 1 Attaching Gear/Axle to Chassis

8 Connecting Motor to Gears Figure 2

9 Wire Connections From Motors to Handy-Board Figure 3

10 Procedure to Attach and Test Motors on Robot 1.Attach the two motors to the connector wires. Next, attach the wire plugs to Handyboard ports. 2.Turn the Handyboard on. 3.Open your Interactive C software. Make sure the computer is talking to the controller. 4.In interactive window, type “fd(1);” 5.After making sure motor connected correctly, type “off(1);” 6.Turn on motor 1 using the motor(n,x) command. 7.Make motor 1 alternate between a forward and backward direction. 8.You can change the speed of your motors. For example motor(1,100) means motor 1 is turning at 100 or full speed.

11 Sample Motor program void main() { printf("Press START to test motors\n"); while(!start_button()); // wait for start button press fd(1); // motor in port 1 go forward sleep(2.0); // sleep for 2 seconds bk(1); // motor in port 1 go backward sleep(2.0); off(1); // turn motor in port 1 off fd(3); // motor in port 3 go forward sleep(2.0); bk(3); // motor in port 3 go backward sleep(2.0); off(3); }

12 Analog Sensor Review

13 Analog Sensors Outputs a range of integer values, depending on the input signal that is sensed. 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. In today’s project, only the light sensor will be utilized.

14 Analog Sensor 1: Light Sensor The light sensor included in the kit, can “sense” lightness and darkness. Connect to analog ports 2-6 or 20-23 Access with function analog(port#) Analog values range from 0 - 255. A low value indicates bright light or close proximity to an obstacle A high value indicates dark light or far proximity from an obstacle Enlarged Light Sensor

15 Analog Sensor 2: IR Reflectance Sensor “Top Hat” The IR sensor included in the kit, can also “sense” lightness and darkness like the light sensor Connect to analog ports 2-6 or 20-23 Access with function analog(port#) Low values indicate bright light, light color, or close proximity High values indicate low light, dark color, or distance of several inches Sensor has a reflectance range of about 3 inches Enlarged IR Sensor

16

17 Light Sensor Sample Code /% Program that measures the reads from the light sensor and displays its output values continuously. %/ void main() { int color=0; printf(“\n Light Sensor Sample Program"); while(!start_button()); // Press Start Button while(1) // Continue infinitely { sleep(0.5); color = analog(6); // Read “lower deck” analog port 6 printf(“\n Color is %d”, color); // if near 0 – WHITE // if near 255 - BLACK }

18 Project 1 Overview

19 Project Description The aim of this project is to design a robot that moves along a given path, from the Start point, towards the Finish line. The thick black line acts as the guide for the robot to follow. As an optional element to the project, after reaching the finish line, the robot should turn around, and go back along the path it came to the starting point. Robot will be judged on smoothness of journey, and robot design. It is the student responsibility to make sure that the Handy Board is fully charged Each group will have one chance to demonstrate their project to the judges. Therefore, fully test your project before demonstration.

20 Project #1 - Route 2m Start Finish

21 Diagram of Robot with Light Sensor RO BOT Right LIGHT SensorLeft LIGHT Sensor When RIGHT sensor senses black line turn right (and vice-versa)

22 Some Sample Robots

23 Some Sample Robots (cont)

24

25

26 Optional Portion of Project As an optional objective, we wish to make the robot U-turn, and go back along the path to the starting point. This can be carried out in the following way: –After sensing a black surface on BOTH light sensors, the robot stops, and then starts to rotate in either direction. –The robot rotates until the first sensor senses the black line, it CONTINUES rotating, but stops once the second sensor detects the black line. –Once the rotation has been completed, the robot moves along the line in the same way as in the main part of the project until it reaches the start line.

27 Main Functions of Week 2 –fd (n); Rotate motor ‘n’ forward –bk(n); Rotate motor ‘n’ backwards. –motor(n, s); move motor ‘n’ at speed ‘s’ »‘s’ range: -100 ~ +100 »‘s’>0 forward »‘s’<0 reverse –off(n); turn off motor ‘n’ –ao(); turn off all motors –sleep(x); // Delays execution of next statement for ‘x’ secs. –msleep(x); // Delays execution of next statement for ‘x’ millisecs. –beep(); // Causes the handy-board to Beep. –analog(x) ; // reads input from an analog sensor on port x –Digital(x) ; // reads input from a digital sensor on port x –sonar() ; // read input from the analog sonar sensor


Download ppt "The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2."

Similar presentations


Ads by Google