Data Logging (Part 2)

advertisement
ADVANCEDEV3
PROGRAMMINGLESSON
DataLogging(Part2)
BySanjayandArvind Seshan
LessonObjectives
ì Learnwhatdataloggingis
ì LearnthedifferentwaysofdoingdataloggingontheEV3
ì LearnhowtousetheDataLoggingBlock
ì Prerequisites:MustownEduversionofEV3Software
©2016EV3Lessons.com,Lastedit7/19/2016
2
WhatisDataLogging?
ì TheEV3softwareprovidesasimplewaytocontinuouslyrecord
sensorreadingstoafileandtoplotthevalueslater.Thisis
calledDataLogging.
ì WhyuseDataLogging:
ì Greatforscienceexperiments.InPart1,wewillshowhowyou
canrecordvaluesliketemperatureforascienceproject.
ì Greatforunderstandingrobotprogrammingblocks.InPart2,we
willshowhowtousedataloggingtomeasurethedifference
betweenturns.
ì Greatforunderstandingsensorbehavior.InPart3,wewillshow
howtousedataloggingtounderstandthedetailsofsensorssuch
asthegyrosensor.
©2016EV3Lessons.com,Lastedit7/19/2016
3
HowdoyouDataLogonanEV3?
Thereare4waystodatalog usingtheEV3MINDSTORMS:
LiveDataLogging:Realtimedatacollecteddirectly
intheEV3software
2. RemoteDataLogging:Usethethebricktocollect
data,andtransferthedatatothecomputerfor
analysis
3. BrickDataLogging:Runtheexperimentdirectly
fromthebrick
1.
Lesson1:
Temperature
Sensor
Experiment
Lesson2:
Differences
BetweenTurns
4.
Autonomous.CollectdatawiththeDataLogging
block.Thedataisstoredonthebrick.
©2016EV3Lessons.com,Lastedit7/19/2016
4
AutonomousDataLogging
Filename
Autonomous Data
Logging requiresthe
DataLogging Block
Port
Add moresensors
Pickthesensorand
whatyouwantto
measure
DataLoggingblockis
inthebluetab
©2016EV3Lessons.com,Lastedit7/19/2016
5
HowdoyouusetheDataLoggingBlock?
ì Tousethisblock,simplydragaDataLoggingBlockinfrontofthecode
youwanttologandturnit“on”.Tostoplogging,addanotherData
LoggingBlocksetto“off”.
ì Pickalltheotherparameters– theports,thesensorsyouwanttolog,
whatyouwanttorecord(rotations/degrees,etc.)
ì Downloadandrunprogram
On
©2016EV3Lessons.com,Lastedit7/19/2016
Off
6
HowtoViewyourData
Ifyouwanttogetthefile 1
fromyourbricktothe
computer:
1) ClickontheBrick
InformationIcon
2) PresstheOpenBrowser
MemoryIcon.
3) Findthecorrect.rdf
file.
3
2
Ifyouwanttoviewthe
datafilefrom eitherthe
brickorthecomputer:
Toolsà Datalog File
Managerà SelectBRICK
orCOMPUTERandpick
thecorrectfile
©2016EV3Lessons.com,Lastedit7/19/2016
7
Challenge1:ComparingTurns
ì Makefourdifferentprogramsthatdoapivotturnandcompare
thedatafromtherotationsensor
©2016EV3Lessons.com,Lastedit7/19/2016
8
StepstoRemember
STEP1:IntheDataLoggingMyBlock,
selectthesensoryouarereading,the
portstheyarein.
STEP2:Selectthedurationandrate
STEP3:Remembertostopdatalogging
attheendofyourcode
STEP4:Remembertochangethename
ofthefileeachtimeotherwisetheywill
allbecalledMyData.
STEP5:Importyourdatafileand
comparethegraphs.Whichtypeof
pivotturnisthemostreliable?
©2016EV3Lessons.com,Lastedit7/19/2016
9
Challenge1Solution
Below,weranall4together, butyouwillfinditeasiertorun eachmethod separately
(becauseyoucanavoidadding motor resets)
InMethod 4,Motor
Cisdragged along.
Motor Bline
Method 4
Method 3
Motor Cline
©2016EV3Lessons.com,Lastedit7/19/2016
Method 1
Method 2
Methods 1and2are
verysimilar.
Method 3appearsto
bethemostreliable.
Youmaynot notice
muchdifferencein
reallife,butthedata
logshowsusthe
truereading.
10
Credits
ì ThistutorialwaswrittenbySanjaySeshan andArvindSeshan
ì Morelessonsatwww.ev3lessons.com
This work is licensed under a Creative Commons AttributionNonCommercial-ShareAlike 4.0 International License.
©2016EV3Lessons.com,Lastedit7/19/2016
11
Download