Page1of16
LunchBoxProjectInstructorGuide
Page2of16
TimeLine
Day1 IntroductiontotheLunchBoxProject
Day2 ProjectDay–StartingtoSewtheLunchBoxCircuit
Day3 HowtocodeyourLunchBox
Day4 ProjectDay–SewingtheLunchBoxCircuitandprogrammingtheLunchBox
Day5 ProjectDay–SewingtheLunchBoxCircuitandprogrammingtheLunchBox
Icons
Objectives
BellRingerQuestions
Troubleshooting
Preparation
Content
Practice
Supplies
Standards
Homework
Time
Page3of16
Days1&2–TemperatureSensingLunchboxDescription:Thistemperaturesensinglunchboxprojectwill
introduceyoutocomplexcircuits,sensors,beginningprogramming,andneedlework.Youwillbeabletouseyourexistingknowledgeofcircuits,conductivity,andcraftingtocreatethisuniqueproject.Whencompleted,yourlunchboxwilluseLEDlightstotellyouwhenthetemperatureinsidehasdropped.Thestepslistedaretoactasaguide;timingmayvaryforyourstudents.
Objectives
Studentswill:
• Learnhowtouseanelectronicsensor• Learnhowtouseamicro-processor• Learnbeginningprogramming• Learnhowtosewcircuitswithconductivethread
Preparation SuppliesforStudentGroups
• Assemblematerialsintokitsforeachpairofstudents,sotheycanbeeasilypassedoutwhenreadytodotheactivity.
• SetupCodebenderonclasscomputers.• Ifneededreservecomputerlab.
• ArduinoLilyPad• TemperatureSensor• ThreeLEDlights(Red,Yellow,
Green)• MiniUSB• Battery• Conductivethread• AcomputerwithaUSB
connectionandArduinoprogrammingsoftware(Codebender)installed.
BellRingerQuestions
5Minutes• Whatcanhappeniffoodgetswarm?Foodslikesushi?ormacaronisalad?
Todaywewillstartbuildingalunchboxwithabuiltintemperaturesensor.
NOTES:
_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page4of16
Step1:LabelandColorCodeWorksheet
10MinutesThefirststepofthisprojectistolabelandcolorcodeallpartsoftheschematicworksheetintheprojectdesign.Normallyifyouweredesigningyourownproject,thefirststepwouldbetodrawoutyourprojectonpaper.Itallowsyoutovisualizeyourprojectandbegintoplanhowyouwouldgoaboutpositioningthecomponentsandsewingthemtogetherinawaythatcreatesafunctionalcircuit.However,becauseclasstimeandsuppliesarebothfinite,wehavedesignedaworkingschematicforyou.Itiscriticalthatyoudrawoutallcomponents(thiscanbetrickyasthisisathreedimensionalproject)andproperlylabelpositive,negative,andotherconnectionstoensurethatyourcircuitandprogrammedcomponentswillallworkonceyouhavecompletedsewingthemtogether.
Directions:Labelallpartsoftheworksheet.Makethepositiveandnegativewiresdifferentcolors.Pleasenote:Thetemperaturesensorgoesontheinside,soitappearsupsidedowninthisdiagram.
Step2:DrawYourSchematiconYourLunchBox
10MinutesAfteryouhavelabeledeverythingonyourworksheet,itistimetodrawyourdesignschematicontoyourlunchbox.Thiswillhelpyouplanwhereeachcomponentwillgoandhelpyouavoidcrossingwires.Becausethetemperaturesensorgoesinsidethelunchbox,youwillneed
NOTES:
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Sensor
Button
OnSwitch
Lights
Page5of16
tofigureouthowtoplacethingsontwosidesofyourlunchbox.Ithelpstofirstdraweverythingontheoutsideofthelunchbox.Itdoesnotneedtobeaperfectpicture,butitdoesneedtoclearlytellyouwheretosewthepieces.
Directions:Drawyourschematicontheoutsideofyourlunchboxandhaveyourteacherapproveyourschematic.
Pleasenote:Designsmaychangethroughouttheproject.
Studentsshouldpeerchecktheirdrawingstoensuretheyarecorrect.
ok.
Step3:SewingontheComponents
40-60MinutesAfteryouapprovetheirdrawingsonthelunchbox,itistimetostartsewingthelunchboxcomponentsinplace.ThefirstpiecewesewintoplaceistheMicroprocessor.Wewillsewthenegativeleadintoplacefirst.Sewthroughthenegativeleadthreetimes,makingsureyourstitchesaretight.
NOTES:
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page6of16
Step4:SewintheButton
Wearegoingtoconnectallthenegativelines.Thenegativeleadfromeverysinglecomponentconnectsononelinesowewillsewthemintoplacenow.SewfromthenegativeleadofyourMicroprocessortothenegativeleadofyourButton.Sewthroughthreetimes.Tieoffstringandcut.Noticethattheschematicdrawingandmysewingdonotlineupperfectly.Thatisok.Youmayalsonoticeanerrorinyourdrawing(likewhereyoudrewaleadconnectingisnotwhereitwillconnectnowthatyouplacedthemicroprocessor).Thatisok.Youcanadjustyourdrawingatanypoint.
Step5:SewintheLights
Rethreadtheneedle,tieaknotattheend,andsewfromthenegativeleadoftheButtontothenegativeleadofeachofthelightsinorderfromgreen(atthebottom)thentoyellow(inthemiddle)andfinallyred(atthetop).
NOTES:
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page7of16
Step6:SewintheSensor
Nextwesewintoplacethetemperaturesensor.Thetemperaturesensorissewnontotheinsideofthelunchbox.Thismakessensebecauseitneedstoreadthetemperatureinsidethelunchbox,notoutside.Tosewonthetemperaturesensor,youwillfirstsewfromthenegativeleadoftheredlightbulbtothenegativeleadofthetemperaturesensor.Foreverythingyousewyoushouldstitchthroughitthreetimes.Thiswillensurethatyouhaveagoodconnection.Onceyouhavesewnthenegativeleadofthetemperaturesensordown,youshouldtieaknotandcutyourthread.
NOTES:
______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page8of16
Step7:ConnecttheSensortotheMicroprocessor
Nowwesewintherestofthetemperaturesensor.YouwillsewfromthepositivepinofthesensortopinnumberA4ontheLilypad.Sewandtieoffwithaknot.ThensewfromtheSpinonthetemperaturesensortopinnumberA5ontheLilypad.Tieaknotandcut.
Step8:SewinthePositiveLeads
Atthispointwewillbefollowingthesamestepstosewdownallthepositivelinesofallourcomponents.Eachcomponentneedstobesewnthroughthreetimesandtiedoffwithaknotbeforecuttingtheline.Belowisthelistofpinsthatshouldbesewntofromeachcomponent.
• ButtonStoLilypad2• Greenlightbulb(bottombulb)toLilypad9• Yellowlightbulb(middlebulb)toLilypad10• Redlightbulb(topbulb)toLilypad11
Whenallofthosearesewndown,yourlunchboxshouldlooklikethis:
NOTES:
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page9of16
Day3–HowtoCodeYourLunchBox
Content–CodebenderVideo 10Minutes
ShowthefollowingvideotointroduceCodebender
https://www.youtube.com/watch?v=wsXDtCsIXro
CodebenderisanIDE–anIntegratedDevelopmentEnvironment.Itiswhereyouwillwriteyourprograms(calledSketchesinArduino)andwhereyouwillloadthemontotheArduinoboard.
Becausethecodebendersoftwarerunsformabrowser,yourcodewillbeavailabletoyouwhereveryouare.Wesaythecodeisin“thecloud”.Thisisconvenientforthoseofyouwhoworkvariousplaces.Plusthecodeiseasytosharewithothers.
Page10of16
Activity–GettingtoKnowCodebender
30Minutes
Preparation
• WatchLogInVideoandmakesureallcomputersaresetuptouseCodebender
• WatchCodebenderNavigationvideoandmakesureyouknowhowtousethetool
• WatchSettingUptheLilyPadvideoandmakesureyouknowhowtodothis
Highlightedportionsarenotesforvideo.
NOTES:
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page11of16
Content–CodingtheLunchBox:TheCode/*TemperatureSensingLunchBox*byBenLeduc-Mills*LilyPadSimple,hookedtoatempsensor,soundPin,button,and3*LED's-green,yellow,andred.Pressbuttontosetinitial'good'*temp(green),temp+5=yellow,temp+25=red*ModifedbyVIckiAllan6/29/16*///LEDASSIGNNMENTSintredLED=11;//pinnumberforredledintyellowLED=10;//pinnumberforyellowledintgreenLED=9;//pinnumberforgreenledintmyLED=13;inttempPin=A5;//pinfortempsensorintsoundPin=3;//pinnumberforbuzzerintbuttonPin=2;//pinnumberforbuttonintpowerPin=A4;//hardcodedasHIGHintinitTemp=0;//variabletoholdinitialtemp//NOTESThesedefinitionsareincludedinthepitches.hfile//sinceweonlyneedfourvalues,itiseasierjusttotypethemintNOTE_C4=262;intNOTE_G3=196;intNOTE_A3=220;intNOTE_B3=247;intREST=0;//medoyandnoteDurationsareusedtogether.intmelody[]={NOTE_C4,NOTE_G3,NOTE_G3,NOTE_A3,NOTE_G3,REST,NOTE_B3,NOTE_C4};//notedurations:4=quarternote,8=eighthnote,etc.:intnoteDurations[]={4,8,8,4,4,4,4,4};inttuneLength=8;floatgiveMeFarhenheit(intvalue){ //Fromdatacollectedin6/30/16 floattemperaturef=.7724*value-109.459; returntemperaturef;}
Page12of16
voidsetup(){ Serial.begin(9600);//beginSerialcommunitcation pinMode(redLED,OUTPUT);//setLED'stooutput pinMode(greenLED,OUTPUT); pinMode(yellowLED,OUTPUT); pinMode(buttonPin,INPUT_PULLUP);//buttonsareinputs pinMode(tempPin,INPUT_PULLUP); pinMode(soundPin,OUTPUT); pinMode(powerPin,OUTPUT);//supplypowerfortempsensor digitalWrite(powerPin,HIGH);}voidloop(){ intbuttonState=digitalRead(buttonPin);//testforbuttonpush if(buttonState==HIGH) { digitalWrite(myLED,LOW); } else { //ifbuttonispressed,setinitialreadingasbasetemp digitalWrite(myLED,HIGH); initTemp=analogRead(tempPin); Serial.print("MyInitTemp:"); Serial.println(initTemp); } //keeptestingcurrenttemperature delay(2000); inttemp=analogRead(tempPin); Serial.print("CurrentTemp:"); Serial.println(temp); //floatfTemp=(giveMeFarhenheit(temp)); //Serial.println(fTemp); //greeneverythingok if(temp<=initTemp+5) {
Page13of16
digitalWrite(redLED,LOW); digitalWrite(yellowLED,LOW); digitalWrite(greenLED,HIGH); } elseif(temp<=initTemp+25) { digitalWrite(redLED,LOW); digitalWrite(yellowLED,HIGH); digitalWrite(greenLED,LOW); } else { digitalWrite(redLED,HIGH); digitalWrite(yellowLED,LOW); digitalWrite(greenLED,LOW); playAlert(); }}//playasoundifyourlunchhaswarmeduptoomuchvoidplayAlert(){ for(intthisNote=0;thisNote<tuneLength;thisNote++) { //tocalculatethenoteduration,takeonesecond //dividedbythenotetype. //e.g.quarternote=1000/4,eighthnote=1000/8,etc. intnoteDuration=1000/noteDurations[thisNote]; tone(soundPin,melody[thisNote],noteDuration); //todistinguishthenotes,setaminimumtimebetweenthem. //thenote'sduration+30%seemstoworkwell: intpauseBetweenNotes=noteDuration*1.30; delay(pauseBetweenNotes); //stopthetoneplaying: noTone(soundPin); } delay(5000);//waitfivesecondsbeforeplayingthetuneagain.
}Day4to5–ProjectWorkDays
Activity–LunchBoxProject
Page14of16
90MinutesThelasttwoclasssessionsshouldbeusedforstudentstofinishtheirsewing,coding,andanytroubleshootingtomakeafunctioningtemperaturesensinglunchbox.
NOTES:
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Page15of16
DraftReferenceWorksheetforCodeBenderListoftermsandwhattheymean
Listoferrormessagesandwhattheymean
GeneralNavigation
Searchfield Thisallowsyoutofindprojectsthatothershavewritten.Codebendermakesallthefilespublic,soyoucansearchthem.
Home Clickingonthehousegetsyoutoyourhomepage.Thereitshowsallthesketchesyouhavewritten.
ExamplesandLibraries
ThisisagreatplacetogetstartercodeorlearnthingsyoucandowithArduinos.Forexample,under“Basic”youcanseeourblinkcode.ThefadecodeisalsointerestingasitallowsthebrightnessoftheLEDtogetdimmeranddimmer,andthenreversetogetbrighterandbrighter.
GettingStarted
Thistakesyouthroughtheinstallationsteps.
KeyboardShortcuts
Ctrl+h Find/replaceCtrl+f FindCtrl+Alt+[ Reformatcode(toindentmeaningfully)Ctrl+shift+d DuplicateselectedcodeCtrl+z Undo
Page16of16
LabelandColorCodeWorksheetDirections:Colorthenegativewiresredandthepositivewiresblue.
Labelthefollowingpartsofthediagram:
• Sensor• Button• Lights• LilypadOnSwitch• LilypadUSBPort
LightsLights