led light stick - cornell universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... ·...
TRANSCRIPT
![Page 1: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/1.jpg)
LEDLightStickECE4999IndependentStudy
Summer2016Author:StefanoBarbierAdvisor:BruceLand
![Page 2: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/2.jpg)
2
Introduction: Aonemeterlongstripof60neo-pixelsisconnectedtoanArduinoUnoandaportablebatterytorecreateimageswithalongexposurecamera.ImagescaneitherbedownloadedonlineorcreatedinAdobePhotoshop.Imagesarecompressedto60pixelshigh,whilemaintainingproportionalhorizontaldimensions,andexportedasaJPEG.ThisJPEGisreadinaJavaprogram(writteninEclipseNeon),whichexportsatextfilewitheachpixel’scolorasoneelementinalonglist.EachpixelintheJPEGimageisconvertedtoits’binaryRGBrepresentationandthencolormappedtotherainbowcolors(ROYGBIV).TheoutputtedlistiscopyandpastedintoanArduinoIDEscriptandsavedinflashmemory.Thescriptreadsthelistin60elementchunksandflashesthemtotheLEDstick.Acameraonatripodissetupwithanexposuretimeofaroundtenseconds.AuserwalksacrosstheframewhileholdinguptheLEDstickduringthedurationoftheexposure.ExampleImages:
![Page 3: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/3.jpg)
3
![Page 4: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/4.jpg)
4
Materials:
• 1onemeterlongflatwoodenstick(HomeDepot)• 1neopixelstrip(Adafruit.com)• 1ArduinoUno• Electricalwires• Electricaltape• 2Zipties• 1portableiPhonebattery
Construction:
1. PeeloffthebackoftheLEDstripandattachtothewoodstickwiththeprovided3Madhesive.
2. Reinforcetopandbottombywrappingwithaziptie.3. AttachtheArduinoUnotothebackofthewoodenstrip.4. ConnectLEDdatalinetoadigitalportontheArduinoUno.5. ConnectLEDgroundandpowertogroundand5VontheArduinoUno.6. Attachportablebatterytowoodstick.7. ConnectportablebatterytotheArduinoviathepowerjack.
![Page 5: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/5.jpg)
5
HowtotakeaPhoto:
1. SetupaDSLRonatripodandusetestshotstofinda10secondexposurethatisverydarkbutlightenoughtojustseetheforegroundandbackground.
2. DownloadtheArduinoscripttotheArduinoUno,unplugfromthecomputerandplugintotheportablebattery.
3. Setthecameraonatensecondtimerandpresstheshutterbutton.4. Listentothetenbeepsfromthecameraandbetweenthe8thand9thbeep
presstherestbuttonontheArduino.5. Atthesametimebeginwalkingacrosstheframeperpendiculartothe
directionthecameraispointingwhileholdinguptheLEDstickandmaintainaconstantvelocity,height,anddistancefromthecamera.
6. InPhotoshopraisetheshadowsanddarkssothatthebackgroundismorevisible.
ImageProcessing: ImageschosenfromtheInternetmustbesomewhatsimpleindesignsowhencompressedto60pixelshighthegraphicisstillrecognizableandalsomusthaveauniformbackgroundcolor.InAdobePhotoshopReplaceColorisusedtochangethebackgroundcolortoblack(bydefaulttheLEDstickdoesnotturnonapixelwhenitissentblackcolor).Theimageisthencompressedto60pixelsinheightwhilemaintainingproportions.ThemaximumwidththeArduinocanstoreisabout180pixels.TheimageisthensavedasaJPEGinthehighestquality. InJavatheJPEGisreadandeachpixelisconvertedtoitsbinaryrepresentation.ThebinaryrepresentationisthenconvertedtoaninstanceoftheclassColors,whichhasthreeintegerfieldsforR,G,andB.Thedistanceformulaisusedtodeterminewhichcolorfromtherainbowcolors(ROGYBIV)eachpixelisclosestto.TheR,G,andBareusedasx,y,andzwouldbewhencalculatingthedistancebetweentwopoints.Thescriptthencreatesalistwhereeachelementisan
![Page 6: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/6.jpg)
6
integerthatrepresentseachnewpixel’srainbowcolor.Thelistreadsfromthetoprightoftheimage,downthefirstlefthandcolumntothebottomandthenjumpsuptothetopofthesecondcolumnetc…Thescriptthenexportsatextfilewiththislist.
TheusercopyandpastesthislistintotheArduinoscript.Thislistmustbestoredintheflashmemory(32kbytes),astheSRAMisonly2kbytes.AnLEDlibrarymustbedownloadedfromthemanufacturer’swebsiteandaddedtotheArduinoprogramfiles.ThisprovidesfunctionssuchassetPixelColor,whichallowsyoutodirectlyaddresseachpixelwithaknownRGBvalue.InloopthescriptreadsonecolumnatatimeandtranslateseachintegerbacktoitscolorRGBrepresentation.Thesethreeintegersareusedtoseteachpixel.Attheendofsettingtheentirecolumnthescriptsaysstrip.show(),whichturnstheLEDstriponwithalltheassignedcolors.Attheendofthedisplaythescriptdelays30millisecondsandthenreturnstothelistandsetsthesecondcolumn(pixels60-119).AttheendofthelisttheLEDstripturnsoff.
![Page 7: LED Light Stick - Cornell Universitypeople.ece.cornell.edu/land/courses/eceprojectsland/... · 2016. 8. 23. · 1. Set up a DSLR on a tripod and use test shots to find a 10 second](https://reader035.vdocuments.mx/reader035/viewer/2022071014/5fccda43cb6c8e60c606b50e/html5/thumbnails/7.jpg)
7