EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL Sensors

EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL Sensors MR. SHEA

What is a Flowchart? Flow charts are diagrams that show a particular process from beginning to end. They are used by programmers to help build logical paths for robots/computers to follow, and also by businesses to help solve problems and improve efficiency. Flow charts can be used to provide a visual aid when describing any type of process.

Problem Solving Flowchart You fool! You poor fool!

Imagine flowcharting your day… According to studies, the average human makes about 612 decisions a day. This equals to 4, 900 decisions in a week and 254, 800 in a year.

Rounded Box This is used to represent an event which occurs automatically. Such an event will trigger a subsequent action, for example `receive telephone call’, or describe a new state of affairs. • There must be a START and an END box. All flow paths should be between these. • Start has 1 output and no inputs. • End box has no outputs and 1 input. START Alarm goes off END

Diamond Used to represent a decision point in the process. Typically, the statement in the symbol will require a `yes’ or `no’ response and branch to different parts of the flowchart accordingly. Yes START Alarm goes off Hit the Snooze button? No END

Rectangle This is used to represent an event which is controlled within the process. Typically this will be a step or action which is taken. Go back to sleep START Alarm goes off Yes Hit the Snooze button? No Get out of bed END

Linear Flowchart START Get a Pot When boiling, add pasta Cook for 11 minutes, stirring occasionally Get a Strainer Fill it most of the way with water Wait for the water to boil Strain pasta from water. Put it on the stove Turn on the burner Put pasta on a plate. ENJOY YOUR PASTA. END

Non-Linear Flowchart START YES Add pasta Cook for 11 minutes, stirring occasionally Get a Pot Is the water boiling? Put it on the stove Fill it most of the way with water Wait for the water to boil Turn on the burner NO Get a Strainer THROW OUT THE PASTA AND ORDER A PIZZA Strain pasta from water. ENJOY YOUR PASTA Why did you make pasta then? Put pasta on a plate. YES Do you like pasta? NO

Flowchart Basics START INPUT SEQUENTIAL DECISION NO YES OUTPUT END


Brick Parts -Sides Computer Connection OUTPUT PORTS (Motors) INPUT PORTS (Sensors) B & C - Large Motors D - Small Motor 1 SPEAKER 2 3 4 PC USB PORT D C B A SD CARD SLOT • The best use of sensors is with the Switch Flow Control block

SWITCH • Switches are used, primarily with sensors, to help a robot interact with its environment and make decisions. • When the appropriate conditions are met, the robot will run the program in the CHECK box. If the appropriate conditions are not met, the robot will run the program in the X box. • If, then statements… If the color sensor reads a blue color, then it will say “Blue”. If the color sensor does not read a blue color, then it will say “LEGO”.

LOOP • Loops are used to repeat certain commands a definite or infinite amount of time depending on the setting. • This can help save time and space in the program. In the program below, the robot will drive forward for 3 seconds at 50% power, then turn right at 30% power for 1 rotation. This will repeat for 4 times.

Sensors • Sensors are used by robots to interact with its environment • The best use of sensors is with the Switch Flow Control block Color / Light Sensor Gyroscopic Sensor Touch Sensor Ultrasonic Sensor

Sensors Color / Light Sensor Gyroscopic Sensor Touch Sensor Ultrasonic Sensor

Touch Sensor When the Touch Sensor is activated, it closes an electrical circuit which allows current to flow. If the sensor is released the circuit is broken and no current flows. The flow or lack of current is detected by the brick allowing it to know whether the sensor is pressed or not. The sensor has three modes: • pressed and held • pressed and released • released

ULTRASONIC SENSOR PORT VIEW • Sends an ultrasonic (rapid sound) signal out and receives back their echoes to help the robot determine the distance of objects. • Can measure distance in centimeters or inches. • Features • Distances measured up to 250 cm (~100 -inch) • Accuracy of +/- 1 cm (+/- 0. 4 -inch) • Has the ability to recognize other ultrasonic sound (other robots)

ULTRASONIC SENSOR OBJECT EV 3

ULTRASONIC SENSOR PORT VIEW • The Ultrasonic Sensor uses the speed that sound waves travel (341 m/s) to measure distance to an object. • The sensor has two openings; • one opening emits ultrasonic waves, • the other opening receives them. • The sensor measures the distance by timing how long it takes for an ultrasonic wave sent out by the emitter to bounce off an object and come back to the receiver. (Time Wave is Emitted) x (Speed of Sound) Distance to Object = 2* *Wave has to travel to object and back.

Gyro Sensor • Used as assistance in stability of a robot. The mechanical system can determine the rotation and robot orientation on several axes giving the possibility for users to measure the angles and design robots with proper navigation systems. • Students can use this sensor in building balancing robots with high accuracy in movements. • Similar to the technology that keeps the image on smartphones orientated in the correct direction.

Color Sensor • Used for object detection, follow a line, sorting objects, or detection of a normal or reflected light. • The digital EV 3 Color Sensor could be used for applications to detect • • the absence of color, the difference between colors, up to seven different colors, the light intensity. • Features • • • detection for up to seven colors; detect the absence of color; it works in ambient light; sample rate of 1 k. Hz; Auto-ID is built into the EV 3 Software;

How do our eyes see color? GREEN!

LIGHT REFLECTION SENSOR • Measures the percentage of light reflected off of a surface. • Brighter surface colors (white, yellow) reflect a larger percentage of light back to the sensor. (80 90%) • Darker surface colors (black, blue) reflect a lower percentage of light back to the sensor (10 - 20%)

Analyzing a Sensor program

PORT VIEW • Allows you to instantaneously see the status or reading of the motors and sensors plugged into the brick. Port View Motor Control IR Control Brick Program Brick Dialog

PORT VIEW • Allows you to instantaneously see the status or reading of the motors and sensors plugged into the brick. Port View Motor Control IR Control Brick Program Brick Dialog

PORT VIEW Motors • Allows you to instantaneously see the status or reading of the motors and sensors plugged into the brick. Sensors --- 6 --- -15 24 --- 79

ULTRASONIC SENSOR PORT VIEW OBJECT EV 3 - - - --- ---

ULTRASONIC SENSOR PORT VIEW OBJECT EV 3 - - - --- ---

GYROSCOPIC SENSOR • The digital EV 3 Gyro Sensor measures the robot’s rotational motion and changes in its orientation. • Used to create precise turns measure angles, create balancing robots. • Angle mode measures angles with an accuracy of +/- 3 degrees • Gyro mode has a maximum output of 440 degrees/second --- ---

LIGHT REFLECTION SENSOR --- ---
- Slides: 32