Robotics using Lego Mindstorms EV3 (Intermediate) Facebook.com/roboticsgateway @roboticsgateway
Robotics using EV3 Are we ready to go Roboticists? Does each group have at least one laptop? Do you have EV3-G software installed on the laptop? If you have a question at any time please raise your hand and we will help you 2
Robotics using EV3 Sensors Touch Ultrasonic Gyro Color Infrared 3
Robotics using EV3 Putting it all together Take an EV3 Brick Build a chassis with Lego Structural elements, motors and wheels Use EV3 software to program it to perform the desired action and download the program to the brick Select the program and run it! 4
Robotics using EV3 Building the EV3 Castor Bot 5
6
7
8
9
10
11
Adding the Touch Sensor 12
Robotics using EV3 EV3 programming concepts Touch Sensor Loop Control Ultrasonic Sensor Color Sensor/Line Following MyBlocks / Functions 13
Touch Sensor Touch Setting 0 = Released 1 = Pushed 2 = Bumped 14
Wait Until Touch Turn B+C motors ON Wait for touch sensor to be pressed (Touch sensor is on port 2) 15
Loop Control Use a loop to allow repeating a set of instructions based on different criteria listed below Loop Until 16
Touch Sensor Challenge Program the robot to move forward continuously at 40% power. If the touch sensor is pressed the first time, the robot should turn 180 degrees and move in the opposite direction continuously. If the touch sensor is pressed again, the robot should once again turn and move forward continuously. This process of moving then turning should repeat 5 times; after 5 cycles, the robot should stop completely. 17
Ultrasonic Sensor Range in cm Set Comparator Selected for Proximity 18
Don t Touch the Walls! Challenge Program the robot to move forward continuously at 40% power. Every time it hits an obstacle as indicated by an ultrasonic sensor, the robot should move back one rotation, turn at about 120 degrees and continue. Robot should stop after 10 repetitions. 19
Adding the Color Sensor Attach the color sensor accessory and plug it into port 3 20
Line Following Humans want to follow the line in the middle. Let s have the robot do the same thing using the Color Sensor 21
Line Following 1. If we are on black, keep going straight 2. If we are on white, turn left to get back to the line When the robot leaves the left side of the line, the program no longer works! 22
Line Following Why can t the robot follow the line the same way humans do? They can see ahead. They can see the whole line and its surroundings They see both sides and which side they left Can t tell right or left side of the line Instead of the middle, could the robot follow the edge? So now the robot will fall off only the same side. 23
Line Following Left Edge If on black, turn left. If on white turn right. The robot has to choose which way to turn when the color sensor sees a different color. The answer depends on what side of the line you are following! Right Edge If on black, turn right. If on white turn left. 24
Line Following 25
MyBlocks 1. Create a program. It can be any sequence of blocks. 2. Highlight the blocks by holding the SHIFT key and clicking each block. 26
MyBlocks 3. Select the Tools menu, and click on My Block Builder. 27
MyBlocks 4. Name and choose an icon for your block. 28
Create Your Own MyBlock Create a MyBlock for your Line Following program from the last challenge! 29
Open Challenges Use the brick buttons to make a remote control for your robot: the left-arrow turns left, and the right-arrow turns right. The robot moves continuously forward, only pausing to turn when the buttons are pressed. Optional: If the up-arrow is pressed, move forward 3 rotations. If the down-arrow is pressed, move backward 3 rotations. Use the touch sensor to give your robot emotions! If the touch sensor is pressed, have the EV3 brick screen display a Big smile. If the touch sensor is not pressed, have the screen display a Sad face. Optional: Display additional expressions when the brick buttons are pressed. Use The Force to move your robot! If it is closer than 20cm from your hand, move backward, otherwise move forward. 30
Robotics using EV3 Thanks for coming! Visit our website to sign up for more classes this summer! Web resources: Legomindstorms.com EV3lessons.com 31