Professional Documents
Culture Documents
Overview
Challenge Usingoneultrasonicsensor,twotouchsensors,andtheNXTbuttons,buildand programaguitarwithanNXTbrickasitsbaseelement.Usethetouchsensorsto raiseandlowerthesoundoneoctaveeach,usethebuttonsontheNXTto controltheemissionofsounds,andlettheultrasonicsensorcontrolthepitchof thesoundcreated. AgeRange 1518 Topics Buttons TouchSensors UltrasonicSensors Subjects Math&Science Music ProgrammingThemes Logic MathematicalManipulationofData Loops Switches,NestedSwitches RelatedMath&ScienceConcepts Ultrasound SoundWaves
BuildingandProgramming
Materials NXTbrick TouchSensorsx2 UltrasonicSensor NXTUltrasonicTouchGuitar(seeUltrasonic_Touch_Guitar_Instructions.pdf) BuildingInstructions 1. BuildanUltrasonicTouchGuitar (SeeUltrasonic_Touch_Guitar_Instructions.pdf) 2. Connectonetouchsensoreachtoports1and4ofanNXTbrick. 3. Connectoneultrasonicsensortoport2oftheNXTbrick.
ProgrammingInstructions UsingMindstormsNXTG,programtheguitartoplaynoteswhentheNXTbricks buttonsarepressed(left,right,andenter,inanycombination).Thepitchofthenote emittedwillbedeterminedusingthedistancefromtheultrasonicsensortoa movingbarrieronthefretboardoftheguitar.Thispitchcanbeshiftedupanoctave (twicethefrequencyoftheoriginalnote)bypressingonetouchsensor,anddown anoctave(halfthefrequencyoftheoriginalnote)bypressingtheothertouch sensor. 1. Startwithaninfiniteloopwithaswitchinside,settobecontrolledbylogic.Place aSoundblockontheswitchsfalse,orlower,path,settostopallsound.
6. Onthefirstnestedswitchstrue,orupper,path,placeatouchsensorswitch, port1,whenpressed.Thisisthesecondnestedswitch.Onthesecondnested switchsfalsepath,placeanUltrasonicSensorblock,settoport2,distance measuredincentimeters.AddaMathblock,settoMultiplication,valueA= 160.WirethedistanceoutputoftheUltrasonicSensorblocktoinputBofthe Mathblock.AddanotherMathblock,settoMultiplication,valueB=2.Wire intheresultofthefirstMathblocktoinputAofthesecondMathblock.(You couldcombinethemathblockstoonesingleblockwithasetinputof320,but forclarity,theblockswereleftseparate.)AddaSoundblock,settoplayatone for0.5seconds,volume75,withWaitforCompletionunchecked.
Thefinal,overallschematicoftheprogramisgivenbelow,forcoherence:
InAction
SetuptheinstrumentbyholdingtheNXTbrickinyourlefthand(orstrumming guitarhandifyourelefthanded,youmaywishtouseyourrighthandforthispart) andholdingthemovingplatformonthefretboardinyourotherhand.Holdthe movingplatformwithyourfingerscurledoverthetouchsensorsforbettercontrol. Toplaytheinstrument,soundsaretriggeredwhenoneormoreoftheLeft, Right,orEnterbuttonsontheNXTbrickarepressedwiththestrumminghand.Thepitch outputbytheinstrumentcanbecontrolledbyslidingthemovingplatformwiththe frettinghandupanddownthefretboard.Thebuttonsonthemovingplatformcanbe pressedandheld,oneatatime,toincreaseordecreasethepitchbyanoctave(afactor of2),dependingonwhichbuttonispressed.Ifbothbuttonsarepressed,thenetchange inpitchiszero(sinceanynumbernx2/2=n,theoriginalpitchgenerated). Formorevariety,changethevaluesintheMathblocksandchangethe durationofthesoundintheplayingSoundblock.Seeifthesoundcanbecome smootherormoresteppedsounding(i.e.thereisalotofzippernoiseduetothe quantizationofpitchvaluesandthereforethesounddoesnotseemsmoothtotheear). Changetheoctavebuttonstoincreaseordecreaseby2octavesatatime(pitchvaluex 4orpitchvalue/4),orevenallowforincreaseinoctavebybumpingatouchswitch repeatedly(onebumpup=pitchx2,or1octaveup;twobumpsup=pitchx4,or2 octavesup,etc).
Resources/Help
RelatedActivities UltrasonicTheremin MusicBox LEGORCXPiano Building&ProgrammingReferences TheNXT Ultrasonic_Touch_Guitar.rbt KnowledgeBase WhataresomepossibleusesfortheNXTtouchsensor?HowdoIprogramitwith NXTG? WhatistheNXTGswitchblockfor? HowdoIcreatealoopinNXTGsothatIcanrepeatonesequenceofeventsover andover? WhywouldIneedtouselogicinputsandoutputsinNXTG?Whatisanexample ofaprogramthatuseslogicinputsandoutputs?
ClassroomManagement
Procedure 1. Beginthelessonwithadescriptionofhowultrasonicandtouchsensingworks. AnintroductoryapproachmightbetoexplainthattouchsensingwiththeNXT sensorworksbasedonwhetherornotthebuttonispressed,outputtingalogical 0or1dependingonstate(inNXTG,thetruestateisselectedwithradiobuttons ontheTouchSensorblockeitherwhenpressed,released,orbumped). Ultrasonicsensingcanbelikenedtotheecholocatingabilityofbatsand submarines,merelyapropogationofawaveformthatisthenreflectedbackto thesource.Thetimebetweentheemissionofthewaveanditsreturnyieldsthe distance.Moreadvancedclassescanbetaughttheelectronicsofresistorsand thephysicsofultrasoundbasically,thatvelocityofthewaveemittedmultiplied bythetimeittooktoreflect,whendividedinhalf,yieldsthedistancetheobject isfromthesource: [velocity(m/s)timeelapsed(s)]2=distance(m)toreflectivesurface Electronicinstruments,especiallytheelectricguitarandbass,canalsobe includedinthisintroductoryperiod,withthepotentialadditionofhowthe electronicsintheseinstrumentswork.Thisisespeciallyhelpfulforteaching electromagnetictheoryusingvarioustypesofpickupsinaguitarorbassas examples.Perhapsagoodactivitytocompletebeforehand,oratthestartofthis explanation,wouldbetobuildanddescribetheworkingsofenelectromagnet, asthepickupsinanelectricguitarorbassworkessentiallyasreverse electromagnets. 2. EachstudentorgroupofstudentsshouldhaveanNXTbrickwithallparts necessarytocreateanultrasonictouchguitarasdetailedinthiscoursepack,as wellastwotouchsensors,anultrasonicsensor,andthreeconnectingcords. 3. Eachstudentorgroupofstudentsshouldconstructtheultrasonictouchguitar, attachonetouchsensoreachtoports1and4oftheNXTbrick,andattachthe ultrasonicsensortoport2oftheNXTbrick. 4. HaveeachstudentorgroupofstudentsprogramtheirNXTbrickseitherusing theinstructions,orontheirowniftheyarereadyforthechallenge. (Alternatively,theNXTbrickscanbepreloadedwiththeUltrasonicTouchGuitar programtosavetime,ifprogrammingequipmentisnotreadilyavailable,orto accommodateyoungerclasses.) 5. Havestudentsexperimentwiththeinstrument,makingchangestotheprogram astheygoifpossible.
6. Collaborateasaclassandcompilealistofchangesthatmightbehelpfultothe program,changingthequalitiesofthesoundemitted.Forexample,howcanthe instrumentbeprogrammedtoplayonlyinmusicalhalfsteps,wholesteps,or octaves?Howcanthesmoothestsoundgradientbeobtainedwhenmovingthe platformacrossthefretboard?Doeschangingthesurfaceofthemoving platformfacingtheultrasonicsensor,perhapsbyattachingpaper,plastic,wood, ormetal,createmorecontroloverthepitchoftheinstrument?Isiteasiertouse ahandinfrontoftheultrasonicsensorthantousethemovingplatform? 7. Tryoutsomeideasiftheclassismotivatedandableto,orwrapupbytalking abouttheactivityandadditionalusesofultrasonicandtouchsensingsystems. Electronicinstrumentsandtheirdesignandusagecanalsobediscussedand exploredfurther.Additionalmusicalinstrumentbuildingsessionscanbeheldas ameansofprogressivelearning. Worksheets&Handouts 1. UltrasonicTouchGuitarBuildingInstructions [Ultrasonic_Touch_Guitar_Instructions.pdf]