![Page 1: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/1.jpg)
EV3 WorkshopOct 3, 2015
Instructor: Chris CartwrightAssistants: Chris Parker and Matthew Ryan
Lawrence Technological University
![Page 2: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/2.jpg)
Lego EV3 robot used - SP
Color Sensor
EV3 Computer
Left Motor: B
Right Motor: C
2
Touch Sensor
Sonar Sensor
![Page 3: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/3.jpg)
• Left Motor connects to B• Right Motor connects to C
• Center Color sensor connects to port no. 1• Left Color sensor connects to port no. X• Sonar sensor connects to port no. 3• Touch sensor connects to port no. 4• Sound sensor connects to port no. X
X: not used in this workshop
Remember the connections!
3
![Page 4: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/4.jpg)
• Examples are using EV3 software Version 1.1.0• EV3 brick Firmware version: 1.60 (V1.06E.bin)• All example programs in
paradeWorkshop2014.ev3 (project)
• Free (Home Edition) version – Google search “EV3 software download”http://www.lego.com/en-us/mindstorms/downloads/software/ddsoftwaredownload/download-software/
Also need to download Ultrasonic.ev3b and select Tools> Block Import
EV3 Versions Used
4
![Page 5: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/5.jpg)
Mission 0:Go straight for 2 seconds using
different power levels
5
LAUNCH
LEGO MINDSTORMSEducation EV3
paradeWorkshop2014.ev3
OR
![Page 6: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/6.jpg)
Go forward for 2 seconds with power level 40 %
6
EV3 offers two move blocks
Move Steering Block: Controls and regulates two motors with a steering input and single power level. (+) steering = right; (-) steering = left
Move Tank Block: Controls two motors with a power level to each motor
In this course we will use the Move Steering Block.
Green!
![Page 7: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/7.jpg)
• Connect the EV3 to the laptop (if this is the first time, then a “Found New Hardware” message will appear)
• Click on the ‘Download’ button• It’s recommended to always unplug the
cable from the bot before running the program
• Navigate through the EV3’s menu:– Turn On > My Files > Software Files– Then select your program and run it!
Let’s test it
7
![Page 8: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/8.jpg)
• How many centimeters when 40% power used?
• How the robot is traveling when 80% power used?
How to find out the current battery voltage level?
Distance traveled
8
![Page 9: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/9.jpg)
EV3 large servo motors: geared motor with built-in rotation sensor
Rotation sensor gives “degrees” turned. (It can also give “rotations”)For example, if the value is 360, the motor turned one rotation.
![Page 10: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/10.jpg)
Display the “rotations” when the bot goes forward for 2
seconds
Mission 1:
10
![Page 11: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/11.jpg)
Display the “rotations” turned from going forward for 2 seconds
11
Program: DispRotations.ev3p
Tip: After in “T” text mode, click here and select wire
![Page 12: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/12.jpg)
• Number of rotations = degrees / 360• Circumference (C) = diameter (D) * 3.14 • Travel distance = number of rotations (N) *
circumference of the wheel (C)• Speed = distance / time
Math Review
12
D
C = D * 3.14
![Page 13: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/13.jpg)
1) We can get number of rotations for 2 seconds by choosing “Measure – Rotations”
2) If the circumference of the wheel is 17.6cm (5.6 x 3.14), what is the travel distance for 2 sec?
3) Then what is the averaged speed of the robot for the 2 seconds?
Note: RoboParade has min and max speed limits. 9 – 18 cm/sec
How to calculate the average speed of robot for that 2 seconds ?
13
![Page 14: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/14.jpg)
• If at 1pm your mom’s car is at mile marker 5,000 and at 3pm your mom’s car is at mile marker at 5,120, what is the average speed of your mom’s car?
How to calculate average SPEED?
14
distance
Time 2Time 1
![Page 15: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/15.jpg)
Example: If the number of rotations = 2.8
15
![Page 16: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/16.jpg)
Display the “speed” when the bot goes forward for 2 seconds
Mission 2:
16
![Page 17: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/17.jpg)
Display Speed for 2 Second Drive
17
Check the port
Program: DispSpeed.ev3p
![Page 18: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/18.jpg)
18
Ultrasonic Sensor• Uses the same scientific principle as bats• Can measure in centimeters or inches• Large objects with hard surfaces return the
best readings
Data from www.ev-3.net/en/archives/844
(a) About 20 degrees(b) About 60 cm(c) About 22 cm
![Page 19: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/19.jpg)
19
• When the robot is connected (USB or Bluetooth) to your computer:
• On the robot: Third tab –> Port View
Test your Sonar Sensor and read data NOW!
How to get (read) sensor data
Tip: reconnect the cable, if it does not work
![Page 20: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/20.jpg)
• Wait: time, touch sensor, …• Loop: endless, count, …• Loop interrupt• Decision making using switch
EV3 Flow Control (Orange)
20
![Page 21: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/21.jpg)
What does this program do?
21
Program: SonarTest.ev3p
![Page 22: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/22.jpg)
22
EV3 Color Sensor• Percent Mode:
– 5% = lowest dark– 100% = very bright
• Reflected Light Mode: shines a red light; we are using this mode.
• The light can be turned off – detecting ambient light (surrounding light) – not used today
• The sensor may need to be Calibrated (see Bonus material)
![Page 23: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/23.jpg)
23
Display EV3 Color Sensor value
Program: DispLight.ev3p
![Page 24: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/24.jpg)
24
• On the parade track record color sensor values– On Black line: ____________– One the beige table: ___________– On the beige color masking tape: ___________
Test & Read Your Color Sensor Data
![Page 25: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/25.jpg)
Zigzag Line following IdeaLeft side following Right side following
![Page 26: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/26.jpg)
Line following using a Color Sensor
Mission 3:
26
![Page 27: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/27.jpg)
Simple Line Following Algorithm
27Q: Right side or Left side following?
Program: LineFlwZZ.ev3p
![Page 28: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/28.jpg)
How and Where to start the robot?
B C On the line: OK
![Page 29: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/29.jpg)
How and Where to start the robot?
B C
Right side of the line: OK
![Page 30: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/30.jpg)
How and Where to start the robot?
B C
Lost… Left side of the line: NO!
![Page 31: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/31.jpg)
Follow the Parade Route and stop when an object is sensed
Mission 4:
31
![Page 32: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/32.jpg)
Repeat the following forever:If sonar sensor detects an object
Stop!!!!!
OtherwiseFollow the black line
Line Following with STOP
![Page 33: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/33.jpg)
Line Following with STOP
33
Program: paradeZZ.ev3p
![Page 34: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/34.jpg)
Multiple parallel programs – RoboParade with Speed Display
(every second)
Mission 5:
34
![Page 35: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/35.jpg)
RoboParade with Speed Display
Program: paradeZZspd.ev3p
![Page 36: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/36.jpg)
Concurrently Run 3 Parallel Programs1) Repeat the following forever:
If sonar sensor detects an objectStop!!!!!
OtherwiseFollow the black line
2) Display the average speed3) Float operations with other motor(s)
Parade Program Concept
![Page 37: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/37.jpg)
RoboParade with all functions
Mission 6:
37
![Page 38: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/38.jpg)
RoboParade with all functions Line Following With Stop
Motor on Float
Display Robot Speed
Program: paradZZall.ev3p
![Page 39: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/39.jpg)
Calibration of the Color Sensor
Bonus Material 1:
39
![Page 40: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/40.jpg)
40
EV3 Color Sensor Calibration
Program: Calibrate.ev3p
![Page 41: EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright Assistants: Chris Parker and Matthew Ryan Lawrence Technological University](https://reader030.vdocuments.mx/reader030/viewer/2022012910/56649ee05503460f94bf00e1/html5/thumbnails/41.jpg)
41
• On the parade track record color sensor values– On Black line: ____________– One the beige table: ___________– On the beige color masking tape: ___________
• Run the calibration program on the parade track and repeat measurements– On Black line: ____________– One the beige color table: ______________– On the beige color masking tape: ___________
Test & Read Your Color Sensor Data