led cube 8x8x8
DESCRIPTION
LED Cube 8x8x8TRANSCRIPT
-
Createyourown8x8x8LEDCube3dimensionaldisplay!
WebelievethisInstructableisthemostcomprehensivestepbystepguidetobuildan8x8x8LEDCubeeverpublishedontheintertubes.Itwillteachyoueverythingfromtheoryofoperation,howtobuildthecube,totheinnerworkingsofthesoftware.Wewilltakeyouthroughthesoftwarestepbystep,boththelowleveldrivers/routinesandhowtocreateawesomeanimations.ThesoftwareaspectofLEDcubesisoftenoverlooked,butaLEDcubeisonlyasawesome
(http://cdn.instructables.com/FUX/O1RW/GICYBAOS/FUXO1RWGICYBAOS.LARGE.jpg)
AboutThisInstructable
Posted:Jan1,20113,855,842views
http://cdn.instructables.com/FUX/O1RW/GICYBAOS/FUXO1RWGICYBAOS.LARGE.jpg -
asthesoftwareitruns.
AbouthalfwaythroughtheInstructable,youwillactuallyhaveafullyfunctionalLEDcube.Theremainingstepswillshowyouhowtocreatethesoftware.
Avideoisworthathousandwords.I'lljustleaveituptothisvideotoconvinceyouthatthisisthenextprojectyouwillbebuilding:
ImadethisLEDcubetogetherwithmyfriendchiller.Thebuildtookabout4daysfromsmallscaleprototypingtocompletedcube.Thenanothercoupleofhourstodebugsomefaultytransistors.
Thesoftwareisprobablyanother45daysofworkcombined.
License:2,995favorites
(/member/chr/)
chr(/member/chr/)Follow
IlikemicrocontrollersandLEDs:D
1288
Bio:
(/id/ReverseEngineeringRGBLEDBulbwithIRremote)
(/id/Iceboxairconditioner)
(/id/USBcontrolledhomeautomationhack)
Morebychr
ledcube(/tag/typeid/categorytechnology/keyword
ledcube/)
ledcubeavratmega(/tag/typeid/category
technology/keywordledcubeavratmega/)
microcontroller(/tag/typeid/category
technology/keywordmicrocontroller/)
programmingc(/tag/typeid/category
technology/keywordprogrammingc/)
Tags:
http://www.instructables.com/member/chr/http://www.instructables.com/id/Reverse-Engineering-RGB-LED-Bulb-with-IR-remotehttp://www.instructables.com/tag/type-id/category-technology/keyword-led%20cube%20avr%20atmega/http://www.instructables.com/id/USB-controlled-home-automation-hackhttp://www.instructables.com/tag/type-id/category-technology/keyword-led%20cube/http://www.instructables.com/member/chr/http://www.instructables.com/tag/type-id/category-technology/keyword-programming%20c/http://www.instructables.com/id/Ice-box-air-conditionerhttp://www.instructables.com/tag/type-id/category-technology/keyword-micro%20controller/ -
Step1:SkillsrequiredRelated
SeeMore(/tag/typeid/?q=)(http://cdn.instructables.com/FOL/S1PK/GI0TMHA2/FOLS1PKGI0TMHA2.LARGE.jpg)
Group
Addinstructableto:
LEDCube4x4x4(/id/LEDCube4x4x4/)bychr(/member/chr/)
CHR's8X8X8LEDCubeRevisitedwithimprovements!(/id/CHRs8X8X8LEDCubeRevisitedwith444LedCube(/id/LedCube8/)bypbajusz(/member/pbajusz/)
SimpleLEDCube4xwithArduino/328p(/id/SimpleLEDCube4xwithArduino328p/)byakki5230MakingaflexibleringofLED's(/id/MakingaflexibleringofLEDs/)bycontrechoc(/member/contrechoc/)
http://www.instructables.com/tag/type-id/?q=http://www.instructables.com/member/SuperTech-IT/http://www.instructables.com/id/Led-Cube-8/http://www.instructables.com/member/akki5230/http://www.instructables.com/member/pbajusz/http://www.instructables.com/id/CHRs-8X8X8-LED-Cube-Revisited-with-improvements/http://www.instructables.com/id/LED-Cube-4x4x4/http://www.instructables.com/member/contrechoc/http://www.instructables.com/id/Making-a-flexible-ring-of-LEDs/http://www.instructables.com/id/Simple-LED-Cube-4x-with-Arduino328p/http://www.instructables.com/member/chr/http://www.instructables.com/id/Making-a-flexible-ring-of-LEDs/http://www.instructables.com/id/LED-Cube-4x4x4/http://www.instructables.com/id/Led-Cube-8/http://www.instructables.com/id/CHRs-8X8X8-LED-Cube-Revisited-with-improvements/http://cdn.instructables.com/FOL/S1PK/GI0TMHA2/FOLS1PKGI0TMHA2.LARGE.jpghttp://www.instructables.com/id/Simple-LED-Cube-4x-with-Arduino328p/ -
Atfirstglancethisprojectmightseemlikeanoverlycomplexanddauntingtask.However,wearedealingwithdigitalelectronicshere,soeverythingiseitheronoroff!
I'vebeendoingelectronicsforalongtime,andforyearsistruggledwithanalogcircuits.Theanalogcircuitsfailedoverhalfthetimeevenififollowedinstructions.Oneresistororcapacitorwithaslightlywrongvalue,andthecircuitdoesn'twork.
About4yearsago,Idecidedtogivemicrocontrollersatry.Thiscompletelychangedmyrelationshipwithelectronics.Iwentfromonlybeingabletobuildsimpleanalogcircuits,tobeingabletobuildalmostanything!
Adigitalcircuitdoesn'tcareifaresistoris1kohmor2kohm,aslongasitcandistinguishhighfromlow.Andbelieveme,thismakesitALOTeasiertodoelectronics!
Withthatsaid,therearestillsomethingsyoushouldknowbeforeventuringoutandbuildingthisratherlargeproject.
Youshouldhaveanunderstandingof:Basicelectronics.(Wewouldrecommendagainstbuildingthisasyourveryfirstelectronicsproject.ButpleasereadtheInstructable.You'llstilllearnalot!)Howtosolder.Howtouseamultimeteretc.WritingcodeinC(optional.Weprovideafullyfunctionalprogram,readytogo)
Youshouldalsohavepatienceandagenerousamountoffreetime.
-
Step2:Componentlist
(http://cdn.instructables.com/FIB/V133/GI0TMHAK/FIBV133GI0TMHAK.LARGE.jpg)
http://cdn.instructables.com/FIB/V133/GI0TMHAK/FIBV133GI0TMHAK.LARGE.jpg -
HereiswhatyouneedtomakeaLEDcube:512xLEDs(plussomeextraformakingmistakes!)64xresistors.(seeseparatestepforohmvalue)1xor2xlargeprototypePCBs.Thetypewithcopper"eyes",seeimage.1xATmega32microcontroller(youcanalsousethepincompatibleATmega16)3xstatusLEDs.Youchoosecolorandsize.3xresistorsforthestatusLEDs.8x74HC574ICs16xPN2222transistors16x1kresistors1x74HC138IC1xMaximMAX232IC1x14.7456MHzcrustal2x22pFceramiccapacitors16x0.1uFceramiccapacitors3x1000uFelectrolyticcapacitor3x10uFelectrolyticcapacitor
(http://cdn.instructables.com/FYF/VSSI/GI0TMHAI/FYFVSSIGI0TMHAI.LARGE.jpg)
(http://cdn.instructables.com/F8I/9FOL/GI0TK31D/F8I9FOLGI0TK31D.LARGE.jpg)
(http://cdn.instructables.com/FHU/MXDO/GI0TK42U/FHUMXDOGI0TK42U.LARGE.jpg)
(http://cdn.instructables.com/FE7/QJ1V/GI0TDOUJ/FE7QJ1VGI0TDOUJ.LARGE.jpg)
(http://cdn.instructables.com/FEM/Q0VK/GICYB3TQ/FEMQ0VKGICYB3TQ.LARGE.jpg)
ShowAll12Items
http://cdn.instructables.com/FE7/QJ1V/GI0TDOUJ/FE7QJ1VGI0TDOUJ.LARGE.jpghttp://cdn.instructables.com/FYF/VSSI/GI0TMHAI/FYFVSSIGI0TMHAI.LARGE.jpghttp://cdn.instructables.com/FEM/Q0VK/GICYB3TQ/FEMQ0VKGICYB3TQ.LARGE.jpghttp://cdn.instructables.com/F8I/9FOL/GI0TK31D/F8I9FOLGI0TK31D.LARGE.jpghttp://cdn.instructables.com/FHU/MXDO/GI0TK42U/FHUMXDOGI0TK42U.LARGE.jpg -
1x100uFelectrolyticcapacitors8x20pinICsockets1x40pinICsocket2x16pinICsocket1x2pinscrewterminal1x2wirecablewithplugs9x8pinterminalpins1x4pinterminalpins,rightangle2x16pinribboncableconnector1x10pinribboncableconnectorRibboncable2xpushbuttons2xribboncableplugs9x8pinfemaleheaderplugsSerialcableand4pinfemalepinheaderPieceofwoodfortemplateandbase8xoptionalpullupresistorsforlayers5vpowersupply(seeseparatestepforpowersupply)
Totalestimatedbuildcost:67USD.Seeattachedpricelist.
pricelist.xls (/files/orig/FI7/UP2U/GIJG3QAC/FI7UP2UGIJG3QAC.xls)12KB
Step3:Orderingcomponents
http://www.instructables.com/files/orig/FI7/UP2U/GIJG3QAC/FI7UP2UGIJG3QAC.xls -
(http://cdn.instructables.com/FOZ/UK3Y/GICYB6W6/FOZUK3YGICYB6W6.LARGE.jpg)
(http://cdn.instructables.com/FR2/AFHF/GICYB6W3/FR2AFHFGICYB6W3.LARGE.jpg)
http://cdn.instructables.com/FOZ/UK3Y/GICYB6W6/FOZUK3YGICYB6W6.LARGE.jpghttp://cdn.instructables.com/FR2/AFHF/GICYB6W3/FR2AFHFGICYB6W3.LARGE.jpg -
WeseealotofpeopleaskingforpartnumbersforDigiKey,Mouserorotherbigelectronicsstores.
Whenyou'reworkingwithhobbyelectronics,youdon'tnecessarilyneedthemostexpensivecomponentswiththebestquality.
Mostofthetime,itismoreimportanttoactuallyhavethecomponentvalueathandwhenyouneedit.
WearebigfansofbuyingreallycheapcomponentlotsoneBay.Youcangetassortmentsofresistor,capacitors,transistorsandeverythinginbetween.Ifyoubuythesetypesofassortments,youwillalmostalwayshavethepartsyouneedinyourpartcollection.
For17USDyoucanget2000resistorsof50differentvalues.Greatvalue,andveryconvenient.
TrydoingsomeBaysearchesandbuysomecomponentsforfutureprojects!
AnotheroneofourfavoritestoresisFuturlec(http://www.futurlec.com/(http://www.futurlec.com/)).Theyhaveeverythingyouneed.Thethingtheydon'thaveis1000differentversionsofthatthingthatyouneed,sobrowsingtheirinventoryisalotlessconfusingthanbuyingfromthosebiggercompanies.
(http://cdn.instructables.com/F9G/M4VV/GICYB6W2/F9GM4VVGICYB6W2.LARGE.jpg)
(http://cdn.instructables.com/FDU/N9GO/GICYB6W0/FDUN9GOGICYB6W0.LARGE.jpg)
(http://cdn.instructables.com/FWL/G825/GICYB6VZ/FWLG825GICYB6VZ.LARGE.jpg)
(http://cdn.instructables.com/FLU/D611/GICYB6W1/FLUD611GICYB6W1.LARGE.jpg)
http://cdn.instructables.com/FWL/G825/GICYB6VZ/FWLG825GICYB6VZ.LARGE.jpghttp://cdn.instructables.com/FLU/D611/GICYB6W1/FLUD611GICYB6W1.LARGE.jpghttp://cdn.instructables.com/FDU/N9GO/GICYB6W0/FDUN9GOGICYB6W0.LARGE.jpghttp://www.futurlec.com/http://cdn.instructables.com/F9G/M4VV/GICYB6W2/F9GM4VVGICYB6W2.LARGE.jpg -
Step4:WhatisaLEDcube
(http://cdn.instructables.com/F9W/CPGS/GICYB3QA/F9WCPGSGICYB3QA.LARGE.jpg)
http://cdn.instructables.com/F9W/CPGS/GICYB3QA/F9WCPGSGICYB3QA.LARGE.jpg -
ALEDcubeislikeaLEDscreen,butitisspecialinthatithasathirddimension,makingit3D.Thinkofitasmanytransparentlowresolutiondisplays.Innormal
(http://cdn.instructables.com/F7U/FAFE/GI0TK41S/F7UFAFEGI0TK41S.LARGE.jpg)
http://cdn.instructables.com/F7U/FAFE/GI0TK41S/F7UFAFEGI0TK41S.LARGE.jpg -
displaysitisnormaltotrytostackthepixelsascloseaspossibleinordertomakeitlookbetter,butinacubeonemustbeabletoseetroughit,andmorespacingbetweenthepixels(actuallyit'svoxelssinceitisin3d)isneeded.Thespacingisatradeoffbetweenhoweasythelayersbehinditisseen,andvoxelfidelity.
SinceitisalotmoreworkmakingaLEDcubethanaLEDdisplay,theyareusuallylowresolution.ALEDdisplayof8x8pixelsisonly64LEDs,butaLEDcubein8x8x8is512LEDs,anorderofmagnitudehardertomake!ThisisthereasonLEDcubesareonlymadeinlowresolution.
ALEDcubedoesnothavetobesymetrical,itispossibletomakea7x8x9,orevenoddlyshapedones.
Step5:HowdoesaLEDcubework
-
(http://cdn.instructables.com/FTI/0UCQ/GICYB3A7/FTI0UCQGICYB3A7.LARGE.jpg)
http://cdn.instructables.com/FTI/0UCQ/GICYB3A7/FTI0UCQGICYB3A7.LARGE.jpg -
(http://cdn.instructables.com/FIV/IJHX/GICYB39I/FIVIJHXGICYB39I.LARGE.jpg)
http://cdn.instructables.com/FIV/IJHX/GICYB39I/FIVIJHXGICYB39I.LARGE.jpg -
ThisLEDcubehas512LEDs.Obviously,havingadedicatedIOportforeachLEDwouldbeveryimpractical.Youwouldneedamicrocontrollerwith512IOports,andrun512wiresthroughthecube.
Instead,LEDcubesrelyonanopticalphenomenoncalledpersistenceofvision(POV).
Ifyouflashaledreallyfast,theimagewillstayonyourretinaforalittlewhileaftertheledturnsoff.
Byflashingeachlayerofthecubeoneafteranotherreallyreallyfast,itgivestheillusionofa3dimage,whenintfactyouarelookingataseriesof2dimagesstackedontoponeanother.Thisisalsocalledmultiplexing.
Withthissetup,weonlyneed64(fortheanodes)+8(foreachlayer)IOportstocontroltheLEDcube.
Inthevideo,theprocessissloweddownenoughforyoutoseeit,thenitrunsfasterandfasteruntiltherefreshrateisfastenoughforthecameratocatchthePOVeffect.
(http://cdn.instructables.com/F55/OUWY/GI0TMH4I/F55OUWYGI0TMH4I.LARGE.jpg)
(http://cdn.instructables.com/FY9/VSJ6/GI0TK33H/FY9VSJ6GI0TK33H.LARGE.jpg)
http://cdn.instructables.com/F55/OUWY/GI0TMH4I/F55OUWYGI0TMH4I.LARGE.jpghttp://cdn.instructables.com/FY9/VSJ6/GI0TK33H/FY9VSJ6GI0TK33H.LARGE.jpg -
Step6:TheanatomyofaLEDcube
-
(http://cdn.instructables.com/FHT/WYK3/GI0TDMW9/FHTWYK3GI0TDMW9.LARGE.jpg)
(http://cdn.instructables.com/F4B/H8ND/GI0TK2DZ/F4BH8NDGI0TK2DZ.LARGE.jpg)
http://cdn.instructables.com/F4B/H8ND/GI0TK2DZ/F4BH8NDGI0TK2DZ.LARGE.jpghttp://cdn.instructables.com/FHT/WYK3/GI0TDMW9/FHTWYK3GI0TDMW9.LARGE.jpg -
Wearegoingtobetalkingaboutanodes,cathodes,columnsandlayers,soletstakeamomenttogetfamiliarwiththeanatomyofaLEDcube.
AnLEDhastwolegs.Onepositive(theanode)andonenegative(cathode).InordertolightupanLED,youhavetoruncurrentfromthepositivetothenegativeleg.(Ifiremembercorrectlytheactualflowofelectronsistheotherwayaround.Butlet'ssticktotheflowofcurrentwhichisfrompositivetonegativefornow).
TheLEDcubeismadeupofcolumnsandlayers.ThecathodelegsofeveryLEDinalayeraresolderedtogether.Alltheanodelegsinonecolumnaresolderedtogether.
Eachofthe64columnsareconnectedtothecontrollerboardwithaseparatewire.Eachcolumncanbecontrolledindividually.Eachofthe8layersalsohaveaseparatewiregoingtothecontrollerboard.
Eachofthelayersareconnectedtoatransistorthatenablesthecubetoturnonandofftheflowofcurrentthrougheachlayer.
Byonlyturningonthetransistorforonelayer,currentfromtheanodecolumnscanonlyflowthroughthatlayer.Thetransistorsfortheotherlayersareoff,andtheimageoutputtedonthe64anodewiresareonlyshownontheselectedlayer.
Todisplaythenextlayer,simplyturnoffthetransistorforthecurrentlayer,changetheimageonthe64anodewirestotheimageforthenextlayer.Thenturnonthetransistorforthenextlayer.Rinseandrepeatveryveryfast.
Thelayerswillbereferredtoaslayers,cathodelayersorgroundlayers.Thecolumnswillbereferredtoascolumns,anodecolumnsoranodes.
(http://cdn.instructables.com/FJX/R7WS/GI0TDMW5/FJXR7WSGI0TDMW5.LARGE.jpg)
http://cdn.instructables.com/FJX/R7WS/GI0TDMW5/FJXR7WSGI0TDMW5.LARGE.jpg -
Step7:CubesizeandIOportrequirements
(http://cdn.instructables.com/FKD/2RXG/GI0TMG91/FKD2RXGGI0TMG91.LARGE.jpg)
http://cdn.instructables.com/FKD/2RXG/GI0TMG91/FKD2RXGGI0TMG91.LARGE.jpg -
TodriveaLEDcube,youneedtwosetsofIOports.OnetosourcealltheLEDanodecolumns,andonetosinkallthecathodelayers.
Fortheanodesideofthecube,you'llneedx^2IOports,wherex^3isthesizeofyourLEDcube.Foran8x8x8(x=8),youneed64IOportstodrivetheLEDanodes.(8x8).Youalsoneed8IOportstodrivethecathodes.
KeepinmindthatthenumberofIOportswillincreaseexponentially.SowillthenumberofLEDs.YoucanseealistofIOpinrequirementfordifferentcubesizesintable1.
(http://cdn.instructables.com/FM4/9FA0/GI0TMG94/FM49FA0GI0TMG94.LARGE.jpg)
http://cdn.instructables.com/FM4/9FA0/GI0TMG94/FM49FA0GI0TMG94.LARGE.jpg -
ForasmallLEDcube,3x3x3or4x4x4,youmightgetawaywithconnectingthecathodelayersdirectlytoamicrocontrollerIOpin.Foralargercubehowever,thecurrentgoingthroughthispinwillbetoohigh.Foran8x8x8LEDcubewithonly10mAperLED,youneedtoswitch0.64Ampere.Seetable2foranoverviewofpowerrequirementsforaLEDlayerofdifferentsizes.ThistableshowsthecurrentdrawwithallLEDson.
Ifyouareplanningtobuildalargercubethan8x8x8orrunningeachLEDatmorethan10ishmA,remembertotakeintoconsiderationthatyourlayertransistorsmustbeabletohandlethatload.
Step8:IOportexpansion,moremultiplexing
-
Wegatheredfromthelaststepthatan8x8x8LEDcuberequires64+8IOlinestooperate.NoAVRmicrocontrollerwithaDIPpackage(thekindofthroughholechipyoucaneasilysolderoruseinabreadboard,DualInlinePackage)havethatmanyIOlinesavailable.
Togetgettherequired64outputlinesneededfortheLEDanodes,wewill
(http://cdn.instructables.com/F84/E01I/GI0TK2FJ/F84E01IGI0TK2FJ.LARGE.jpg)
http://cdn.instructables.com/F84/E01I/GI0TK2FJ/F84E01IGI0TK2FJ.LARGE.jpg -
createasimplemultiplexercircuit.Thiscircuitwillmultiplex11IOlinesinto64outputlines.
Themultiplexerisbuiltbyusingacomponentcalledalatchoraflipflop.Wewillcallthemlatchesfromhereon.
Thismultiplexerusesan8bitlatchICcalled74HC574.Thischiphasthefollowingpins:
8inputs(D07)8outputs(Q07)1"latch"pin(CP)1outputenablepin(OE)
Thejobofthelatchistoserveasakindofsimplememory.Thelatchcanhold8bitsofinformation,andthese8bitsarerepresentedontheoutputpins.ConsideralatchwithanLEDconnectedtooutputQ0.ToturnthisLEDon,applyV+(1)toinputD0,thenpulltheCPpinlow(GND),thenhigh(V+).
WhentheCPpinchangesfromlowtohigh,thestateoftheinputD0is"latched"ontotheoutputQ0,andthisoutputstaysinthatstateregardlessoffuturechangesinthestatusofinputD0,untilnewdataisloadedbypullingtheCPpinlowandhighagain.Tomakealatcharraythatcanremembertheon/offstateof64LEDsweneed8oftheselatches.TheinputsD07ofallthelatchesareconnectedtogetherinan8bitbus.
Toloadtheon/offstatesofallthe64LEDswesimplydothis:Loadthedataofthefirstlatchontothebus.pulltheCPpinofthefirstlatchlowthenhigh.Loadthedataofthesecondlatchontothebus.pulltheCPpinofthesecondlatchlowthenhigh.Loadthedataofthethirdlatchontothebus.pulltheCPpinofthethirdlatchlowthenhigh.Rinseandrepeat.
Theonlyproblemwiththissetupisthatweneed8IOlinestocontroltheCPline
-
foreachlatch.Thesolutionistousea74HC138.ThisIChas3inputlinesand8outputs.Theinputlinesareusedtocontrolwhichofthe8outputlinesthatwillbepulledlowatanytime.Therestwillbehigh.Eachouttheoutputsonthe74HC138isconnectedtotheCPpinononeofthelatches.
Thefollowingpseudocodewillloadthecontentsofabufferarrayontothelatcharray:
//PORTA=databus//PORTB=addressbus(74HC138)//charbuffer[8]holds64bitsofdataforthelatcharray
PORTB=0x00//ThispullsCPonlatch1low.for(i=0i
-
multiplex_theoretical.sch (/files/orig/FHJ/ASA2/GICYB6DA/FHJASA2GICYB6DA.tmp)21KB
Step9:IOportexpansion,alternativesolution
(http://cdn.instructables.com/FMS/0ULI/GI0TMG9R/FMS0ULIGI0TMG9R.LARGE.jpg)
http://www.instructables.com/files/orig/FHJ/ASA2/GICYB6DA/FHJASA2GICYB6DA.tmphttp://cdn.instructables.com/FMS/0ULI/GI0TMG9R/FMS0ULIGI0TMG9R.LARGE.jpg -
Thereisanothersolutionforprovidingmoreoutputlines.Wewentwiththelatchbasedmultiplexerbecausewehad8latchesavailablewhenbuildingtheLEDcube.
Youcanalsouseaserialinparalleloutshiftregistertoget64outputlines.74HC164isan8bitshiftregister.Thischiphastwoinputs(mayalsohaveanoutputenablepin,butwewillignorethisinthisexample).
dataclock
Everytimetheclockinputchangesfromlowtohigh,thedatainQ6ismovedintoQ7,Q5intoQ6,Q4intoQ5andsoon.Everythingisshiftedonepositiontotheright(assumingthatQ0istotheleft).ThestateofthedatainputlineisshiftedintoQ0.
Thewayyouwouldnormallyloaddataintoachiplikethis,istotakeabyteandbitshiftitintothechiponebitatatime.ThisusesalotofCPUcycles.However,wehavetouse8ofthesechipstogetourdesired64outputlines.Wesimplyconnectthedatainputofeachshiftregistertoeachofthe8bitsonaportonthemicrocontroller.AlltheclockinputsareconnectedtogetherandconnectedtoapinonanotherIOport.
Thissetupwilluse9IOlinesonthemicrocontroller.
Intheprevioussolution,eachbyteinourbufferarraywasplacedinit'sownlatchIC.Inthissetupeachbytewillbedistributedoverall8shiftregisters,withonebitineach.
Thefollowingpseudocodewilltransferthecontentsofa64bitbufferarraytotheshiftregisters.
//PORTA:bit0connectedtoshiftregister0'sdatainput,bit1toshiftregister1andsoon.
-
//PORTB:bit0connectedtoalltheclockinputs//charbuffer[8]holds64bitsofdata
for(i=0i
-
Thisstepiseasytooverlook,asLEDsthemselvesdon'tdrawthatmuchcurrent.Butrememberthatthiscircuitwilldraw64timesthemAofyourLEDsiftheyareallon.Inadditiontothat,theAVRandthelatchICsalsodrawscurrent.
TocalculatethecurrentdrawofyourLEDs,connectaledtoa5Vpowersupplywiththeresistoryouintendtouse,andmeasurethecurrentinmA.Multiplythisnumberby64,andyouhavethepowerrequirementsforthecubeitself.Addtothat1520mAfortheAVRandacoupleofmAforeachlatchIC.
(http://cdn.instructables.com/FNB/P4Z6/GI0TK41W/FNBP4Z6GI0TK41W.LARGE.jpg)
http://cdn.instructables.com/FNB/P4Z6/GI0TK41W/FNBP4Z6GI0TK41W.LARGE.jpg -
Ourfirstattemptatapowersupplywastouseastepdownvoltageregulator,LM7805,witha12Vwallwart.Atover500mAand12Vinput,thischipbecameextremelyhot,andwasn'tabletosupplythedesiredcurrent.
Welaterremovedthischip,andsolderedawirefromtheinputtotheoutputpinwherethechipusedtobe.
Wenowusearegulatedcomputerpowersupplytogetastablehighcurrent5Vsupply.
Step11:Buyapowersupply
-
(http://cdn.instructables.com/FAY/1SNJ/GI0TDMXN/FAY1SNJGI0TDMXN.LARGE.jpg)
http://cdn.instructables.com/FAY/1SNJ/GI0TDMXN/FAY1SNJGI0TDMXN.LARGE.jpg -
Ifyoudon'thavethepartsnecessarytobuilda5VPSU,youcanbuyone.
(http://cdn.instructables.com/FL7/ZQWV/GI0TK2FS/FL7ZQWVGI0TK2FS.LARGE.jpg)
http://cdn.instructables.com/FL7/ZQWV/GI0TK2FS/FL7ZQWVGI0TK2FS.LARGE.jpg -
eBayisagreatplacetobuythesethings.
Searchfor"5vpowersupply"andlimitthesearchto"Business&Industrial",andyou'llgetalotofsuitablepowersupplies.About15buckswillgetyouanicePSU.
Step12:Buildapowersupply
-
(http://cdn.instructables.com/FSC/AS9Q/GI0TK41X/FSCAS9QGI0TK41X.LARGE.jpg)
(http://cdn.instructables.com/FOV/5AJW/GICYB3QU/FOV5AJWGICYB3QU.LARGE.jpg)
http://cdn.instructables.com/FSC/AS9Q/GI0TK41X/FSCAS9QGI0TK41X.LARGE.jpghttp://cdn.instructables.com/FOV/5AJW/GICYB3QU/FOV5AJWGICYB3QU.LARGE.jpg -
AcoupleofyearsbeforewebuilttheLEDcube,wemadeourselfanicelittlelabpowersupplyfromanoldexternalSCSIdrive.ThisiswhatwehavebeenusingtopowertheLEDcube.
PCpowersuppliesarenice,becausetheyhaveregulated12Vand5VrailswithhighAmpereratings.
YoucanuseeitheraregularATorATXpowersupplyorandoldexternalharddriveenclosure.
IfyouwanttouseanATXpowersupply,youhavetoconnectthegreenwireonthemotherboardconnectortoground(black).Thiswillpoweritup.
Externalharddriveenclosuresareespeciallynicetouseaspowersupplies.Theyalreadyhaveaconvenientenclosure.Theonlythingyouhavetodoistoaddexternalpowerterminals.
Powersupplieshavealotofwires,buttheeasiestplacetogetthepoweryouneedisthroughamolexconnector.Thatisthekindofplugyoufindonharddrives(beforetheageofSATA).
BlackisGNDYellowis+12VRedis+5V
HereisanimageofourlabPSU.Wehave12Voutput,5Voutputwithanamperemeterand5Voutputwithoutanamperemeter.Weusethesecond5Voutputtopoweran80mmPCfantosuckorblowfumesawaywhenwesolder.
Wewon'tgetintoanymoredetailsofhowtomakeapowersupplyhere.I'msureyoucanfindanotherinstructableonhowtodothat.
(http://cdn.instructables.com/FTP/ON1Y/GI0TK41Y/FTPON1YGI0TK41Y.LARGE.jpg)
http://cdn.instructables.com/FTP/ON1Y/GI0TK41Y/FTPON1YGI0TK41Y.LARGE.jpg -
Step13:ChooseyourLEDs
(http://cdn.instructables.com/F4P/ZYNZ/GI0TMHA5/F4PZYNZGI0TMHA5.LARGE.jpg)
http://cdn.instructables.com/F4P/ZYNZ/GI0TMHA5/F4PZYNZGI0TMHA5.LARGE.jpg -
(http://cdn.instructables.com/FB7/MNVU/GICYB3R9/FB7MNVUGICYB3R9.LARGE.jpg)
http://cdn.instructables.com/FB7/MNVU/GICYB3R9/FB7MNVUGICYB3R9.LARGE.jpg -
TherearemanythingstoconsiderwhenchoosingLEDs.
1)YouwanttheLEDcubetobeequallyvisiblefromallsides.ThereforewestronglyrecommendusingdiffusedLEDs.AclearLEDwillshootthemajorityofit'slightoutthetopoftheLED.AdiffusedLEDwillbemoreorlessequallybrightfromallsides.ClearLEDsalsocreateanotherproblem.IfyourcubeismadeupofclearLEDs.TheLEDswillalsopartiallyilluminatetheLEDsabovethem,sincemostofthelightisdirectedupwards.Thiscreatessomeunwantedghostingeffects.
WeactuallyordereddiffusedLEDsfromeBay,butgot1000clearLEDsinstead.ShippingthembacktoChinatoreceiveareplacementwouldhavetakentoomuchtime,sowedecidedtousedtheclearLEDsinstead.Itworksfine,butthecubeisalotbrighterwhenviewedfromthetopasopposedtothesides.
TheLEDsweorderedfromeBaywereactuallydescribedas"DefusedLEDs".Maybeweshouldhavetakenthehint)Defusingissomethingyoudotoabombwhenyouwanttopreventitfromblowingup,hehe.
2)LargerLEDsgivesyouabiggerandbrighterpixel,butsincesincethecubeis8layersdeep,youwantenoughroomtoseeallthewaythroughtothefurthestlevel.Wewentwith3mmLEDsbecausewewantedthecubetobeas"transparent"aspossible.Ourrecommendationistouse3mmdiffusedLEDs.
(http://cdn.instructables.com/F1U/XKRK/GI0TDOU4/F1UXKRKGI0TDOU4.LARGE.jpg)
(http://cdn.instructables.com/F7C/E14Y/GICYB3RH/F7CE14YGICYB3RH.LARGE.jpg)
http://cdn.instructables.com/F1U/XKRK/GI0TDOU4/F1UXKRKGI0TDOU4.LARGE.jpghttp://cdn.instructables.com/F7C/E14Y/GICYB3RH/F7CE14YGICYB3RH.LARGE.jpg -
3)Youcanbuyverycheaplotsof1000LEDsoneBay.Butkeepinmindthatthequalityoftheproductmaybereflectedinit'sprice.WethinkthatthereislesschanceofLEDmalfunctionifyoubuybetterquality/moreexpensiveLEDs.
4)SquareLEDswouldprobablylookcoolto,butthenyouneedtomakeasolderingtemplatethatcanaccommodatesquareLEDs.With3mmroundLEDs,allyouneedisa3mmdrillbit.
5)Sincethecubereliesonmultiplexingandpersistenceofvisiontocreateimages,eachlayerisonlyturnedonfor1/8ofthetime.Thisiscalleda1/8dutycycle.Tocompensateforthis,theLEDshavetobebrightenoughtoproducethewantedbrightnesslevelat1/8dutycycle.
6)Leglength.ThecubedesigninthisinstructableusesthelegsoftheLEDsthemselvesastheskeletonforthecube.TheleglengthoftheLEDsmustbeequaltoorgreaterthanthedistanceyouwantbetweeneachLED.
Step14:Chooseyourresistors
-
Therearethreethingstoconsiderwhenchoosingthevalueofyourresistors,theLEDs,the74HC574thatdrivetheLEDs,andthetransistorsusedtoswitchthe
(http://cdn.instructables.com/F5S/0LOM/GICYB3SB/F5S0LOMGICYB3SB.LARGE.jpg)
http://cdn.instructables.com/F5S/0LOM/GICYB3SB/F5S0LOMGICYB3SB.LARGE.jpg -
layersonandoff.
1)IfyourLEDscamewithadatasheet,thereshouldbesomeampereratingsinthere.Usually,therearetworatings,onemAforcontinuousload,andmAforburstloads.TheLEDswillberunningat1/8dutycycle,soyoucanrefertotheburstrating.
2)The74HC574alsohassomemaximumratings.IfalltheLEDsononeanodecolumnareon,thischipwillsupplycurrent8/8ofthetime.YouhavetokeepwithinthespecifiedmaximummAratingfortheoutputpins.Ifyoulookinthedatasheet,Youwillfindthisline:DCOutputSourceorSinkCurrentperOutputPin,IO:25mA.AlsothereisaVCCorGNDcurrentmaximumratingof50mA.Inordernottoexceedthis,yourLEDscanonlyrunat50/8mAsincethe74HC574has8outputs.Thisgivesyou6.25mAtoworkwith.
3)Thetransistorshavetoswitchonandoff64xthemAofyourLEDs.IfyourLEDsdraw20mAeach,thatwouldmeanthatyouhavetoswitchonandoff1.28Ampere.Theonlytransistorswehadavailablehadamaximumratingof400mA.
Weendedupusingresistorsof100ohms.
WhileyouarewaitingforyourLEDcubepartstoarriveinthemail,youcanbuildtheguyinthepicturebelow:http://www.instructables.com/id/Resistorman/(http://www.instructables.com/id/Resistorman/)
http://www.instructables.com/id/Resistor-man/ -
Step15:Choosethesizeofyourcube
WewantedtomaketheLEDcubeusingasfewcomponentsaspossible.Wehadseensomepeopleusingmetalrodsfortheirdesigns,butwedidn'thaveanymetalrods.Manyofthemetalroddesignsalsolookedalittlecrooked.
WefiguredthattheeasiestwaytobuildaledcubewouldbetobendthelegsoftheLEDssothatthelegsbecomethescaffoldingthatholdstheLEDsinplace.
(http://cdn.instructables.com/FOT/II3A/GI0TDN1V/FOTII3AGI0TDN1V.LARGE.jpg)
http://cdn.instructables.com/FOT/II3A/GI0TDN1V/FOTII3AGI0TDN1V.LARGE.jpg -
WebentthecathodelegononeoftheLEDsandmeasuredittobe26mmfromthecenteroftheLED.BychoosingaLEDspacingof25mm,therewouldbea1mmoverlapforsoldering.(1inch=25.4mm)
Withasmall3mmLED25mmbetweeneachledgaveusplentyofopenspaceinsidethecube.Seeingallthewaythroughtothefurthestlayerwouldn'tbeaproblem.Wecouldhavemadethecubesmaller,butthenwewouldhavetocuteverysingleleg,andvisibilityintothecubewouldbecompromised.
OurrecommendationistousethemaximumspacingthatyourLEDcanallow.Add1mmmarginforsoldering.
Step16:Howtomakestraightwire
-
InordertomakeanicelookingLEDCube,youneedsomestraightsteelwire.Theonlywirewehadwasonspools,soithadtobestraightened.
Ourfirstattemptatthisfailedhorribly.Wetriedtobenditintoastraightwire,butnomatterhowmuchwebent,itjustwasn'tstraightenough.
Thenwerememberedanepisodeof"Howit'smade"fromtheDiscoveryChannel.Theepisodewasabouthowtheymakesteelwire.Theystartoutwith
(http://cdn.instructables.com/FSF/CNSP/GI0TMGB4/FSFCNSPGI0TMGB4.LARGE.jpg)
http://cdn.instructables.com/FSF/CNSP/GI0TMGB4/FSFCNSPGI0TMGB4.LARGE.jpg -
aspoolofreallythickwire,thentheypullitthroughsmallerandsmallerholes.Werememberedthatthewirewastotallystraightandsymmetricalafterbeingpulledlikethat.
Sowefiguredweshouldgivepullingatry,anditworked!100%straightmetalwirefromaspool!
Hereishowyoudoit.cutofthelengthofwireyouneedfromthespool,plusaninchortwo.Removetheinsulation,ifany.GetafirmgripofeachendofthewirewithtwopairsofpliersPullhard!Youwillfeelthewirestretchalittlebit.
Youonlyneedtostretchitacoupleofmillimeterstomakeitniceandstraight.
Ifyouhaveavice,youcansecureoneendintheviceanduseonepairofpliers.Thiswouldprobablybealoteasier,butwedon'townavice.
Step17:Practiceinsmallscale
-
WheneverMythBustersaretestingacomplexmyth,theystartbysomesmallscaleexperiments.
Werecommendthatyoudothesamething.
Beforewebuiltthe8x8x8LEDcube,westartedbymakingasmallerversionofit,4x4x4.Bymakingthe4x4x4versionfirst,youcanperfectyourcubesolderingtechniquebeforestartingonthebigone.
(http://cdn.instructables.com/FJN/F0KM/FE7ITU05/FJNF0KMFE7ITU05.LARGE.jpg)
http://cdn.instructables.com/FJN/F0KM/FE7ITU05/FJNF0KMFE7ITU05.LARGE.jpg -
Checkoutour4x4x4LEDcubeinstructableforinstructionsonbuildingasmaller"prototype".
http://www.instructables.com/id/LEDCube4x4x4/(http://www.instructables.com/id/LEDCube4x4x4/)
Step18:Buildthecube:createajig
http://www.instructables.com/id/LED-Cube-4x4x4/ -
(http://cdn.instructables.com/FEM/G3OZ/GI0TDN4A/FEMG3OZGI0TDN4A.LARGE.jpg)
http://cdn.instructables.com/FEM/G3OZ/GI0TDN4A/FEMG3OZGI0TDN4A.LARGE.jpg -
(http://cdn.instructables.com/F51/ATJT/GI0TK2HA/F51ATJTGI0TK2HA.LARGE.jpg)
http://cdn.instructables.com/F51/ATJT/GI0TK2HA/F51ATJTGI0TK2HA.LARGE.jpg -
InordertomakeanicelookingLEDcube,itisimportantthatitiscompletelysymmetrical,thatthespacebetweeneachLEDisidentical,andthateachLEDpointsthesameway.Theeasiestwaytoaccomplishthisistocreateatemporarysolderingjig/template.
1)Findapieceofwoodorplasticthatislargerthanthesizeofyourcube.
2)FindadrillbitthatmakesaholethatfitsaLEDsnuglyinplace.Youdon'twantittobetotight,asthatwouldmakeitdifficulttoremovethesolderedlayerfromthejigwithoutbendingit.Iftheholesaretoobig,someoftheLEDsmightcomeoutcrooked.
3)Usearulerandanangleirontodrawupagridof8by8linesintersectingat64points,usingtheLEDspacingdeterminedinapreviousstep.
4)Useasharppointyobjecttomakeindentionsateachintersection.Theseindentionswillpreventthedrillfromslidingsidewayswhenyoustartdrilling.
5)Drilloutalltheholes.
(http://cdn.instructables.com/FPR/52ON/GI0TMGC5/FPR52ONGI0TMGC5.LARGE.jpg)
(http://cdn.instructables.com/FRY/BMXF/GI0TK2H9/FRYBMXFGI0TK2H9.LARGE.jpg)
http://cdn.instructables.com/FPR/52ON/GI0TMGC5/FPR52ONGI0TMGC5.LARGE.jpghttp://cdn.instructables.com/FRY/BMXF/GI0TK2H9/FRYBMXFGI0TK2H9.LARGE.jpg -
6)TakeanLEDandtryeveryholeforsize.Iftheholeistoosnug,carefullydrillitagainuntiltheLEDfitssnuglyandcanbepulledoutwithoutmuchresistance.
7)Somewherenearthemiddleofoneofthesides,drawasmallmarkorarrow.Asteelwirewillbesolderedinhereineverylayertogivethecubesomeextrastiffening.
Step19:Buildthecube:solderingadvice
-
(http://cdn.instructables.com/FAX/RZD9/GI0TDOUE/FAXRZD9GI0TDOUE.LARGE.jpg)
http://cdn.instructables.com/FAX/RZD9/GI0TDOUE/FAXRZD9GI0TDOUE.LARGE.jpg -
YouaregoingtobesolderingVERYclosetotheLEDbody,andyouareprobablygoingtobeusingreallycheapLEDsfromeBay.LEDsdon'tlikeheat,
(http://cdn.instructables.com/FR4/B3EM/GI0TMHA8/FR4B3EMGI0TMHA8.LARGE.jpg)
http://cdn.instructables.com/FR4/B3EM/GI0TMHA8/FR4B3EMGI0TMHA8.LARGE.jpg -
cheapLEDsprobablymoresothanothers.ThismeansthatyouhavetotakesomeprecautionsinordertoavoidbrokenLEDs.
SolderingironhygieneFirstofall,youneedtokeepyoursolderingironniceandclean.Thatmeanswipingitonthespongeeverytimeyouuseit.Thetipofyoursolderingironshouldbecleanandshiny.Whenevertheyouseethetipbecomingdirtywithfluxoroxidizing,thatmeansloosingit'sshinyness,youshouldcleanit.Evenifyouareinthemiddleofsoldering.HavingacleansolderingtipmakesitALOTeasiertotransferheattothesolderingtarget.
SolderingspeedWhensolderingsoclosetotheLEDbody,youneedtogetinandoutquickly.Wipeyourironclean.Applyatinyamountofsoldertothetip.Touchthepartyouwanttosolderwiththesideofyourironwhereyoujustputalittlesolder.Letthetargetheatupfor0.51seconds,thentouchtheothersideofthetargetyouaresolderingwiththesolder.Youonlyneedtoapplyalittlebit.Onlythesolderthatistouchingthemetalofbothwireswillmakeadifference.Abigblobofsolderwillnotmakethesolderjointanystronger.Removethesolderingironimmediatelyafterapplyingthesolder.
MistakesandcooldownIfyoumakeamistake,forexampleifthewiresmovebeforethesolderhardensoryoudon'tapplyenoughsolder.Donottryagainrightaway.AtthispointtheLEDisalreadyveryhot,andapplyingmoreheatwiththesolderingironwillonlymakeithotter.ContinuewiththenextLEDandletitcooldownforaminute,orblowonittoremovesomeheat.
SolderWerecommendusingathinsolderforsolderingtheLEDs.Thisgivesyoualotmorecontrol,andenableyoutomakenicelookingsolderjointswithoutlargeblobsofsolder.Weuseda0.5mmgaugesolder.Don'tusesolderwithoutflux.
-
Ifyoursolderisveryoldandthefluxisn'tcleaningthetargetproperly,getnewersolder.Wehaven'texperiencedthis,butwehaveheardthatitcanhappen.
Areweparanoid?Whenbuildingthe8x8x8LEDCube,wetestedeachandeveryLEDbeforeusingitinthecube.WealsotestedeveryLEDafterwefinishedsolderingalayer.SomeoftheLEDsdidn'tworkafterbeingsolderedinplace.Weconsideredthesethingsbeforemakingasinglesolderjoint.Evenwithcarefulsoldering,someLEDsweredamaged.ThelastthingyouwantisabrokenLEDnearthecenterofthecubewhenitisfinished.Thefirstandsecondlayerfromtheoutsidecanbefixedafterwards,butanyfurtherinthanthat,andyou'llneedendoscopicsurgicaltools)
Step20:Buildthecube:testtheLEDs
-
WegotourLEDsfromeBay,reallycheap!
WetestedsomeoftheLEDbeforewestartedsoldering,andrandomlystumbledonaLEDthatwasalotdimmerthantherest.SowedecidedtotesteveryLEDbeforeusingit.WefoundacoupleofdeadLEDsandsomethatweredimmerthantherest.
ItwouldbeverybadtohaveadimLEDinsideyourfinishedLEDcube,sospend
(http://cdn.instructables.com/FEW/IH1E/GI0TK33N/FEWIH1EGI0TK33N.LARGE.jpg)
http://cdn.instructables.com/FEW/IH1E/GI0TK33N/FEWIH1EGI0TK33N.LARGE.jpg -
thetimetotesttheLEDsbeforesoldering!ThismightbelessofaproblemifyouareusingLEDsthataremoreexpensive,butwefounditworthwhiletotestourLEDs.
Getoutyourbreadboard,connectapowersupplyandaresistor,thenpoptheLEDsinoneatatime.YoumightalsowanttohaveanotherLEDwithitsownresistorpermanentlyonthebreadboardwhiletesting.Thismakesiteasiertospotdifferencesinbrightness.
Step21:Buildthecube:solderalayer
-
(http://cdn.instructables.com/FYH/EBS4/GI0TMGE1/FYHEBS4GI0TMGE1.LARGE.jpg)
(http://cdn.instructables.com/FCQ/KLVJ/GI0TMGDW/FCQKLVJGI0TMGDW.LARGE.jpg)
http://cdn.instructables.com/FCQ/KLVJ/GI0TMGDW/FCQKLVJGI0TMGDW.LARGE.jpghttp://cdn.instructables.com/FYH/EBS4/GI0TMGE1/FYHEBS4GI0TMGE1.LARGE.jpg -
Eachlayerismadeupof8columnsofLEDsheldtogetherbythelegsofeachLED.AtthetopofeachlayereachLEDisrotated90degreesclockwise,sothatthelegconnectswiththetopLEDofthenextcolumn.Onthecolumntotherightthislegwillstickoutofthesideofthelayer.WeleavethisinplaceanduseittoconnectgroundwhentestingalltheLEDsinalaterstep.
1)Prepare64LEDsBendthecathodelegofeachLED90degrees.MakesurethelegsarebentinthesamedirectiononalltheLEDs.LookingattheLEDsittinginaholeinthetemplatewiththenotchtotheright,webentthelegupwards.
2)StartwiththerowatthetopStartbyplacingthetoprightLEDinthetemplate.Thenplacetheonetotheleft,positioningitsothatit'scathodelegistouchingthecathodelegofthepreviousLED.RinseandrepeatuntilyoureachtheleftLED.Solderallthejoints.
3)Solderall8columnsIfyouarerighthanded,werecommendyoustartwiththecolumntotheleft.Thatwayyourhandcanrestonthewoodentemplatewhenyousolder.Youwillneedasteadyhandwhensolderingfreehandlikethis.StartbyplacingtheLEDsecondfromthetop,aligningitsoit'slegtouchesthesolderjointfromthe
(http://cdn.instructables.com/FWP/5C93/GI0TMGGL/FWP5C93GI0TMGGL.LARGE.jpg)
(http://cdn.instructables.com/FVW/932Y/GICYAZHY/FVW932YGICYAZHY.LARGE.jpg)
(http://cdn.instructables.com/F3Q/IEC8/GI0TMGCZ/F3QIEC8GI0TMGCZ.LARGE.jpg)
(http://cdn.instructables.com/FXA/85QT/GI0TMGFF/FXA85QTGI0TMGFF.LARGE.jpg)ShowAll13Items
http://cdn.instructables.com/F3Q/IEC8/GI0TMGCZ/F3QIEC8GI0TMGCZ.LARGE.jpghttp://cdn.instructables.com/FXA/85QT/GI0TMGFF/FXA85QTGI0TMGFF.LARGE.jpghttp://cdn.instructables.com/FWP/5C93/GI0TMGGL/FWP5C93GI0TMGGL.LARGE.jpghttp://cdn.instructables.com/FVW/932Y/GICYAZHY/FVW932YGICYAZHY.LARGE.jpg -
previousstep.ThenplacetheLEDbelowthatsothatthecathodelegtouchestheLEDabove.Repeatuntilyoureachthebottom.Solderallthejoints.
4)AddbracesYounowhavealayerthatlookslikeacomb.Atthispointthewholethingisveryflimsy,andyouwillneedtoaddsomesupport.Weusedonebracingnearthebottomandonenearthemiddle.Takeastraightpeaceofwire,roughlyalignitwhereyouwantitandsolderoneendtothelayer.Finetunethealignmentandsoldertheotherendinplace.Now,makesolderjointstotheremaining6columns.Dothisforbothbraces.
5)TestalltheLEDsThisiscoveredinthenextstep.Justmentioningheresoyoudon'tremovethelayerjustyet.
6)RemovethelayerThefirstlayerofyourLEDcubeisalldone,nowallyouhavetodoisremoveitfromthetemplate.Dependingonthesizeofyourholes,someLEDsmighthavemoreresistancewhenyoutrytopullitout.SimplygrabbingbothendsofthelayerandpullingwouldprobablybreakthewholethingifacoupleoftheLEDsarestuck.
StartbyliftingeverysingleLEDacoupleofmillimeters.Justenoughtofeelthatthereisn'tanyresistance.WhenalltheLEDsarefreedfromtheirholes,tryliftingitcarefully.Ifitisstillstuck,stopandpullthestuckLEDsout.
Repeat8times!
Noteonimages:Ifyouarehavingtroubleseeingthedetailinanyofourpictures,youcanviewsthefullresolutionbyclickingonthelittleLiconinthetopleftcornerofeveryimage.Allourcloseuppicturesaretakenwithaminitripodandshouldhave
-
excellentmacrofocus.Ontheimagepage,choosetheoriginalsizefromthe"Availablesizes"menuonthelefthandside.
Step22:Buildthecube:testthelayer
(http://cdn.instructables.com/FIY/J2SY/GI0TMGJ2/FIYJ2SYGI0TMGJ2.LARGE.jpg)
http://cdn.instructables.com/FIY/J2SY/GI0TMGJ2/FIYJ2SYGI0TMGJ2.LARGE.jpg -
SolderingthatclosetothebodyoftheLEDcandamagetheelectronicsinside.WestronglyrecommendthatyoutestallLEDsbeforeproceeding.
Connectgroundtothetabyouleftstickingoutattheupperrightcorner.Connectawireto5Vthrougharesistor.UseanyresistorthatlightstheLEDupanddoesn'texceeditsmaxmAratingat5V.470Ohmwouldprobablyworkjustfine.
Takethewireandtapitagainstall64anodelegsthatarestickingupfromyourtemplate.IfaLEDdoesn'tflashwhenyoutapit,thatmeansthatsomethingiswrong.
1)Yoursolderingisn'tconductingcurrent.2)TheLEDwasoverheatedandisbroken.3)Youdidn'tmakeaproperconnectionbetweenthetestwireandtheled.(tryagain).
Ifeverythingchecksout,pullthelayerfromthecubeandstartsolderingthenextone.
Step23:Buildthecube:straigthenthepins
-
(http://cdn.instructables.com/FET/NJR0/GI0TMGKA/FETNJR0GI0TMGKA.LARGE.jpg)
(http://cdn.instructables.com/F4M/0QHY/GI0TMGKV/F4M0QHYGI0TMGKV.LARGE.jpg)
http://cdn.instructables.com/FET/NJR0/GI0TMGKA/FETNJR0GI0TMGKA.LARGE.jpghttp://cdn.instructables.com/F4M/0QHY/GI0TMGKV/F4M0QHYGI0TMGKV.LARGE.jpg -
Inouropinion,aLEDcubeisapieceofartandshouldbeperfectlysymmetricalandstraight.IfyoulookattheLEDsinyourtemplatefromtheside,theyareprobablybentinsomedirection.
Youwantallthelegstopointstraightup,ata90degreeanglefromthetemplate.
Whilelookingatthetemplatefromtheside,straightenallthelegs.Thenrotatethetemplate90degrees,toviewitfromtheotherside,thendothesameprocess.
Younowhaveaperfectlayerthatisreadytoberemovedfromthetemplate.
Step24:Buildthecube:bendthepins
(http://cdn.instructables.com/FAA/LBKF/GI0TMGJT/FAALBKFGI0TMGJT.LARGE.jpg)
(http://cdn.instructables.com/FBA/YE5U/GI0TMGK1/FBAYE5UGI0TMGK1.LARGE.jpg)
(http://cdn.instructables.com/FDU/97KW/GI0TMGKW/FDU97KWGI0TMGKW.LARGE.jpg)
(http://cdn.instructables.com/FWO/UIPD/GI0TMGJR/FWOUIPDGI0TMGJR.LARGE.jpg)
http://cdn.instructables.com/FAA/LBKF/GI0TMGJT/FAALBKFGI0TMGJT.LARGE.jpghttp://cdn.instructables.com/FDU/97KW/GI0TMGKW/FDU97KWGI0TMGKW.LARGE.jpghttp://cdn.instructables.com/FBA/YE5U/GI0TMGK1/FBAYE5UGI0TMGK1.LARGE.jpghttp://cdn.instructables.com/FWO/UIPD/GI0TMGJR/FWOUIPDGI0TMGJR.LARGE.jpg -
(http://cdn.instructables.com/F4Z/FIYQ/GISO5193/F4ZFIYQGISO5193.LARGE.jpg)
http://cdn.instructables.com/F4Z/FIYQ/GISO5193/F4ZFIYQGISO5193.LARGE.jpg -
(http://cdn.instructables.com/FDM/2K6V/GI0TMGLZ/FDM2K6VGI0TMGLZ.LARGE.jpg)
http://cdn.instructables.com/FDM/2K6V/GI0TMGLZ/FDM2K6VGI0TMGLZ.LARGE.jpg -
IntheLEDcubecolumns,wewanteachLEDtositcenteredpreciselyabovetheLEDsbelow.ThelegsontheLEDscomeoutfromtheLEDbodyhalfamillimeterorsofromtheedge.Tomakeasolderjoint,wehavetobendtheanodelegsothatittouchestheanodelegontheLEDbelow.
Makeabendintheanodelegtowardsthecathodelegapproximately3mmfromtheendoftheleg.ThisisenoughforthelegtobendaroundtheLEDbelowandmakecontactwithit'sanodeleg.
Step25:Buildthecube:solderthelayerstogether(http://cdn.instructables.com/FJL/OZ5V/GI0TMGLP/FJLOZ5VGI0TMGLP.LARGE.jpg)
(http://cdn.instructables.com/F9V/CTZL/GI0TMGLQ/F9VCTZLGI0TMGLQ.LARGE.jpg)
http://cdn.instructables.com/FJL/OZ5V/GI0TMGLP/FJLOZ5VGI0TMGLP.LARGE.jpghttp://cdn.instructables.com/F9V/CTZL/GI0TMGLQ/F9VCTZLGI0TMGLQ.LARGE.jpg -
(http://cdn.instructables.com/FSU/YYBT/GICYAZPM/FSUYYBTGICYAZPM.LARGE.jpg)
(http://cdn.instructables.com/FJB/6THL/GI0TMGN4/FJB6THLGI0TMGN4.LARGE.jpg)
http://cdn.instructables.com/FJB/6THL/GI0TMGN4/FJB6THLGI0TMGN4.LARGE.jpghttp://cdn.instructables.com/FSU/YYBT/GICYAZPM/FSUYYBTGICYAZPM.LARGE.jpg -
Nowcomesthetrickypart,solderingitalltogether!
Thefirsttwolayerscanbequiteflimsybeforetheyaresolderedtogether.Youmaywanttoputthefirstlayerbackinthetemplatetogiveitsomestability.
Inordertoavoidtotaldisaster,youwillneedsomethingtoholdthelayerinplacebeforeitissolderedinplace.Luckily,thewidthofa9Vbatteryisprettycloseto25mm.Probablycloserto25.526mm,butthat'sOK.
Warning:The9voltsfroma9VbatterycaneasilyoverloadtheLEDsifthecontactsonthebatterycomesincontactwiththelegsoftheLEDs.WetapedoverthebatterypolestoavoidaccidentallyruiningtheLEDsweweresoldering.
Wehadplentyof9Vbatterieslyingaround,soweusedthemastemporarysupports.Startbyplacinga9Vbatteryineachcorner.Makesureeverythingisalignedperfectly,thensolderthecornerLEDs.
NowsolderalltheLEDsaroundtheedgeofthecube,movingthe9Vbatteriesalongasyougoaround.Thiswillensurethatthelayersaresolderedperfectlyparalleltoeachother.
(http://cdn.instructables.com/FNW/MWL7/GICYAZQK/FNWMWL7GICYAZQK.LARGE.jpg)
(http://cdn.instructables.com/FQ0/8FBN/GI0TMGN6/FQ08FBNGI0TMGN6.LARGE.jpg)
(http://cdn.instructables.com/FY9/34UO/GICYAZPB/FY934UOGICYAZPB.LARGE.jpg)
(http://cdn.instructables.com/FSU/XWOI/GI0TMGN5/FSUXWOIGI0TMGN5.LARGE.jpg)ShowAll10Items
http://cdn.instructables.com/FY9/34UO/GICYAZPB/FY934UOGICYAZPB.LARGE.jpghttp://cdn.instructables.com/FQ0/8FBN/GI0TMGN6/FQ08FBNGI0TMGN6.LARGE.jpghttp://cdn.instructables.com/FSU/XWOI/GI0TMGN5/FSUXWOIGI0TMGN5.LARGE.jpghttp://cdn.instructables.com/FNW/MWL7/GICYAZQK/FNWMWL7GICYAZQK.LARGE.jpg -
Nowmovea9Vbatterytothemiddleofthecube.Justslideitinfromoneofthesides.SolderacoupleoftheLEDsinthemiddle.
Thewholethingshouldbeprettystableatthispoint,andyoucancontinuesolderingtherestoftheLEDswithoutusingthe9Vbatteriesforsupport.
However,ifitlookslikesomeoftheLEDsaresaggingalittlebit,slideina9Vbatterytoliftthemup!
Whenyouhavesolderedallthecolumns,itistimetotesttheLEDsagain.Rememberthattabstickingoutfromtheupperrightcornerofthelayer,thatwetoldyounottoremoveyet?Nowit'stimetouseit.Takeapieceofwireandsolderthetabofthebottomlayertothetabofthelayeryoujustsolderedinplace.
Connectgroundtothethegroundtab.
Testeachledusingthesamesetupasyouusedwhentestingtheindividuallayers.Sincethegroundlayershavebeenconnectedbythetesttabs,andalltheanodesineachcolumnsareconnectedtogether,allLEDsinacolumnshouldlightupwhenyouapplyvoltagetothetopone.IftheLEDsbelowitdoesnotlightup,itprobablymeansthatyouforgotasolderjoint!ItisALOTbettertofigurethisoutatthispoint,ratherthanwhenallthelayersaresolderedtogether.Thecenterofthecubeisvirtuallyimpossibletogettowithasolderingiron.
Younowhave2/8ofyourLEDcubesolderedtogether!Yay!
Forthenext6layers,usetheexactsameprocess,butspendevenmoretimealigningthecornerLEDsbeforesolderingthem.Lookatthecubefromabove,andmakesurethatallthecornerLEDsareonastraightlinewhenlookingatthemfromabove.
-
Rinseandrepeat!
Step26:Buildthecube:createthebase
(http://cdn.instructables.com/FD4/UR9R/GI0TK2M6/FD4UR9RGI0TK2M6.LARGE.jpg)
http://cdn.instructables.com/FD4/UR9R/GI0TK2M6/FD4UR9RGI0TK2M6.LARGE.jpg -
(http://cdn.instructables.com/FR4/HJCM/GICYAZVW/FR4HJCMGICYAZVW.LARGE.jpg)
http://cdn.instructables.com/FR4/HJCM/GICYAZVW/FR4HJCMGICYAZVW.LARGE.jpg -
Wedidn'thaveanyfancytoolsatourdisposaltocreateafancystandorboxforourLEDcube.Instead,wemodifiedthetemplatetoworkasabaseforthecube.
WeencourageyoutomakesomethingcoolerthanwedidforyourLEDcube!
Forthetemplate,weonlydrilledacoupleofmmintothewood.Totransformthetemplateintoabase,wejustdrilledalltheholesthroughtheboard.Thenwedrilled8smallerholesforthe8cathodewiresrunninguptothe8cathodelayers.
Ofcourse,youdon'twanttohaveyourLEDcubeonawoodcoloredbase.Wedidn'thaveanyblackpaintlyingaround,butwedidfindagiantblackmagicmarker!Stainingthewoodblackwithamagicmarkerworkedsurprisinglywell!Ithinktheoneweusedhada10mmpoint.
Step27:Buildthecube:mountthecube
(http://cdn.instructables.com/FJZ/6KGY/GICYAZW5/FJZ6KGYGICYAZW5.LARGE.jpg)
(http://cdn.instructables.com/FTC/Q6FC/GI0TK2M9/FTCQ6FCGI0TK2M9.LARGE.jpg)
http://cdn.instructables.com/FJZ/6KGY/GICYAZW5/FJZ6KGYGICYAZW5.LARGE.jpghttp://cdn.instructables.com/FTC/Q6FC/GI0TK2M9/FTCQ6FCGI0TK2M9.LARGE.jpg -
Mountthecube.Thatsoundsveryeasy,butit'snot.Youhavetoalign64LEDlegstoslidethrough64holesatthesametime.It'slikethreadinganeedle,times64.
Wefounditeasiesttostartwithoneend,thengraduallypoppingthelegsintoplace.UseapenorsomethingtopokeattheLEDlegsthatmisstheirholes.
Onceall64LEDlegsarepokingthroughthebase,carefullyturnitonit'sside.
(http://cdn.instructables.com/FGZ/RAUG/GI0TDNGW/FGZRAUGGI0TDNGW.LARGE.jpg)
http://cdn.instructables.com/FGZ/RAUG/GI0TDNGW/FGZRAUGGI0TDNGW.LARGE.jpg -
Thenbendall64legs90degrees.Thisisenoughtoholdthecubefirmlymountedtothebase.Noneedforglueoranythingelse.
Step28:Buildthecube:cathoderisers
(http://cdn.instructables.com/FBD/G9GB/GI0TDOUF/FBDG9GBGI0TDOUF.LARGE.jpg)
http://cdn.instructables.com/FBD/G9GB/GI0TDOUF/FBDG9GBGI0TDOUF.LARGE.jpg -
YounowhaveaLEDcubewith64anodeconnectionsontheundersideofthebase.Butyouneedtoconnectthegroundlayerstoo.
(http://cdn.instructables.com/FKN/0CRX/GICYB3SX/FKN0CRXGICYB3SX.LARGE.jpg)
http://cdn.instructables.com/FKN/0CRX/GICYB3SX/FKN0CRXGICYB3SX.LARGE.jpg -
Rememberthose8smallholesyoudrilledinapreviousstep?Wearegoingtousethemnow.
Makesomestraightwireusingthemethodexplainedinapreviousstep.
Westartwithgroundforlayer0.Takeashortpieceofstraightwire,Makeabendapproximately10mmfromtheend.Pokeitthroughtheholeforgroundlayer0.Leave10mmpokingthroughtheundersideofthebase.Positionitsothatthebendyoumaderestsonthebackwireofgroundlayer0.Nowsolderitinplace.Layer1through7arealittletrickier.Weusedahelpinghandtoholdthewireinplacewhilesoldering.
Takeastraightpieceofwireandbendit90degrees10mmfromtheend.Thencutittolengthsothat10mmofwirewillpokeoutthroughtheundersideofthebase.Pokethewirethroughtheholeandletthewirerestonthebackwireofthelayeryouareconnecting.Clampthehelpinghandontothewire,thensolderitinplace.
Rinseandrepeat7moretimes.
Carefullyturnthecubeonit'ssideandbendthe8groundwires90degrees.
Step29:Buildthecube:attachcables
-
(http://cdn.instructables.com/FIF/65W8/GICYAZYL/FIF65W8GICYAZYL.LARGE.jpg)
(http://cdn.instructables.com/FNN/OY41/GI0TK2MK/FNNOY41GI0TK2MK.LARGE.jpg)
http://cdn.instructables.com/FIF/65W8/GICYAZYL/FIF65W8GICYAZYL.LARGE.jpghttp://cdn.instructables.com/FNN/OY41/GI0TK2MK/FNNOY41GI0TK2MK.LARGE.jpg -
64+8wireshavetogofromthecontrollertotheLEDcube.Weusedribboncabletomakethingsalittleeasier.
Thegroundlayersusean8wireribboncable.
Thecathodesareconnectedwith416wireribboncables.Eachoftheseribboncablesaresplitintwoateitherend,togettwo8wirecables.
Atthecontrollerside,weattached0.1"femaleheaderconnectors.Theseplugintostandard0.1"singlerowPCBheaderpins.
Theheaderconnectorisamodularconnectorthatcomesintwoparts,metalinsertsandaplasticbody.
Themetalinsertsaresupposedtobecrimpedonwithatool.Wedidn'thavetheappropriatetoolonhand,soweusedpliers.Wealsoaddedalittlesoldertomakesurethewiresdidn'tfallofwithuse.
1)Prepareone8wireribboncableand416wireribboncablesofthedesiredlength2)Crimporsolderonthemetalinserts.
(http://cdn.instructables.com/FG3/56N6/GI0TK2ML/FG356N6GI0TK2ML.LARGE.jpg)
(http://cdn.instructables.com/FA3/XZVS/GI0TDNI6/FA3XZVSGI0TDNI6.LARGE.jpg)
(http://cdn.instructables.com/FW5/S541/GI0TMGO2/FW5S541GI0TMGO2.LARGE.jpg)
(http://cdn.instructables.com/FT4/9LPK/GICYAZZ1/FT49LPKGICYAZZ1.LARGE.jpg)ShowAll10Items
http://cdn.instructables.com/FA3/XZVS/GI0TDNI6/FA3XZVSGI0TDNI6.LARGE.jpghttp://cdn.instructables.com/FW5/S541/GI0TMGO2/FW5S541GI0TMGO2.LARGE.jpghttp://cdn.instructables.com/FG3/56N6/GI0TK2ML/FG356N6GI0TK2ML.LARGE.jpghttp://cdn.instructables.com/FT4/9LPK/GICYAZZ1/FT49LPKGICYAZZ1.LARGE.jpg -
3)Insertthemetalinsertintotheplasticconnectorhousing.4)Solderthe8wireribboncabletothecathoderisers.Pretinthecablesbeforesoldering!5)Solderintherestofthecables.Theredstripeonthefirstwireindicatesthatthisisbit0.6)Tightenthescrewsonthestrainrelieftomakesureeverythingstaysinplace.7)ConnectalltheribboncablestothePCBsinthecorrectorder.Seepicturesbelow.Our8wireribboncabledidn'thavearedwire.Justfliptheconnector180degreesifyourcubeisupsidedown.
Step30:Buildthecontroller:layout
-
(http://cdn.instructables.com/FB6/QBNQ/GI0TMGO5/FB6QBNQGI0TMGO5.LARGE.jpg)
http://cdn.instructables.com/FB6/QBNQ/GI0TMGO5/FB6QBNQGI0TMGO5.LARGE.jpg -
(http://cdn.instructables.com/FYZ/8EHJ/GI0TK2MU/FYZ8EHJGI0TK2MU.LARGE.jpg)
http://cdn.instructables.com/FYZ/8EHJ/GI0TK2MU/FYZ8EHJGI0TK2MU.LARGE.jpg -
WetookoutthebiggesttypeofPCBwehadavailable(9x15cm)andstartedexperimentingwithdifferentboardlayouts.Itsoonbecameclearthatcrammingallthecomponentsontooneboardwasn'tagoodsolution.Insteadwedecidedtoseparatethelatcharrayandpowersupplypartofthecircuitandplaceitonaseparateboard.Aribboncabletransfersdatalinesbetweenthetwoboards.
Choosingtwoseparateboardswasagooddecision.Thelatcharraytookupalmostallthespaceofthecircuitboard.Therewouldn'thavebeenmuchspaceforthemicrocontrollerandotherparts.
Youmaynothavetheexactsamecircuitboardsaswedo,ormaywanttoarrangeyourcomponentsinadifferentway.Trytoplaceallthecomponentsonyourcircuitboardtoseewhichlayoutbestfitsyourcircuitboard.
multiplexer_board.sch (/files/orig/FAU/I50K/GICYB6CJ/FAUI50KGICYB6CJ.tmp)238KB
avr_board.sch (/files/orig/FA9/26YI/GICYB6CH/FA926YIGICYB6CH.tmp)249KB
Step31:Buildthecontroller:clockfrequency
(http://cdn.instructables.com/FJA/4IZJ/GICYB5XH/FJA4IZJGICYB5XH.LARGE.jpg)
(http://cdn.instructables.com/FJ4/7RE1/GICYB6CI/FJ47RE1GICYB6CI.LARGE.jpg)
http://www.instructables.com/files/orig/FA9/26YI/GICYB6CH/FA926YIGICYB6CH.tmphttp://www.instructables.com/files/orig/FAU/I50K/GICYB6CJ/FAUI50KGICYB6CJ.tmphttp://cdn.instructables.com/FJA/4IZJ/GICYB5XH/FJA4IZJGICYB5XH.LARGE.jpghttp://cdn.instructables.com/FJ4/7RE1/GICYB6CI/FJ47RE1GICYB6CI.LARGE.jpg -
(http://cdn.instructables.com/F2K/WL27/GI0TK2MZ/F2KWL27GI0TK2MZ.LARGE.jpg)
(/files/deriv/F7Q/4LXV/GI0TMGO6/F7Q4LXVGI0TMGO6.LARGE.jpg)
http://cdn.instructables.com/F2K/WL27/GI0TK2MZ/F2KWL27GI0TK2MZ.LARGE.jpghttp://www.instructables.com/files/deriv/F7Q/4LXV/GI0TMGO6/F7Q4LXVGI0TMGO6.LARGE.jpg -
Weuseanexternalcrystalof14.7456MHztodrivetheATmegasystemclock.
Youmaybethinkingthatthisisanoddnumbertouse,andwhywedidn'truntheATmegaatthe16MHzitisratedfor.
WewanttobeabletocontroltheLEDcubefromacomputer,usingRS232.Serialcommunicationrequiresprecisetiming.Ifthetimingisoff,onlybyalittlebit,somebitsaregoingtobemissedorcounteddoublefromtimetotime.Wewon'tberunninganyerrorcorrectingalgorithmsontheserialcommunications,soanyerroroverthelinewouldberepresentedintheLEDcubeasavoxelbeingonoroffinthewrongplace.
Togetflawlessserialcommunication,youhavetouseaclockfrequencythatcanbedividedbytheserialfrequencyyouwanttouse.
14.7456MHzisdividablebyallthepopularRS232baudrates.(14.7456MHz*1000*1000)/9600baud=1536.0(14.7456MHz*1000*1000)/19200baud=768.0(14.7456MHz*1000*1000)/38400baud=384.0(14.7456MHz*1000*1000)/115200baud=128.0
(http://cdn.instructables.com/F89/AREY/GI0TK2MY/F89AREYGI0TK2MY.LARGE.jpg)
(http://cdn.instructables.com/FGI/NT42/GI0TK2N0/FGINT42GI0TK2N0.LARGE.jpg)
(http://cdn.instructables.com/FJZ/61SE/GI0TMGOE/FJZ61SEGI0TMGOE.LARGE.jpg)
http://cdn.instructables.com/F89/AREY/GI0TK2MY/F89AREYGI0TK2MY.LARGE.jpghttp://cdn.instructables.com/FGI/NT42/GI0TK2N0/FGINT42GI0TK2N0.LARGE.jpghttp://cdn.instructables.com/FJZ/61SE/GI0TMGOE/FJZ61SEGI0TMGOE.LARGE.jpg -
TheformulainsidetheparenthesesconvertsfromMHztoHz.First*1000givesyouKHz,thenextHz.
AsyoucanseealloftheseRS232baudratescanbecleanlydividedbyourclockrate.Serialcommunicationwillbeerrorfree!
Step32:Buildthecontroller:protoboardsolderingadvice
WeseepeopledoalotofweirdstuffwhentheysolderonprototypePCBs.
(http://cdn.instructables.com/FME/U2JU/GI0TK2NC/FMEU2JUGI0TK2NC.LARGE.jpg)
http://cdn.instructables.com/FME/U2JU/GI0TK2NC/FMEU2JUGI0TK2NC.LARGE.jpg -
Beforeyoucontinue,wejustwanttosharewithyoutheprocessweusetocreatetracksonprototypePCBswithsoldereyes.Onceyoumasterthistechnique,youwillprobablystartusingitalot.
1)Filleachpointofthetrackyouwanttomakewithsolder.2)Connecteveryotherpointsbyheatingthemandaddingalittlesolder.3)Connectthe2holelongpiecesyounowhavespanningthedesiredtrack.4)Lookhowbeautifultheresultis.
Youcanseeinthevideohowwedoit.Wehadtotouchsomeofthepointstwicetojointhem.Itwasabithardtohavethecamerainthewaywhenweweresoldering)
-
Step33:Buildthecontroller:Powerterminalandfilteringcapacitors
(http://cdn.instructables.com/FJG/78B4/GI0TMGP4/FJG78B4GI0TMGP4.LARGE.jpg)
http://cdn.instructables.com/FJG/78B4/GI0TMGP4/FJG78B4GI0TMGP4.LARGE.jpg -
Thecubeiscomplete,nowallthatremainsisamonstercircuittocontrolthething.
Let'sstartwiththeeasiestpart,the"powersupply".
ThepowersupplyconsistsofascrewterminalwhereyouconnecttheGNDandVCCwires,somefilteringcapacitors,aswitchandaanLEDtoindicatepoweron.
Initially,wehaddesignedanonboardpowersupplyusinganLM7805stepdownvoltageregulator.However,thisturnedouttobeabigfail.
Weusedthiswitha12Vwallwart.Butasyoumayalreadyknow,mostwallwartsoutputhighervoltagesthantheonesspecifiedonthelabel.Oursoutputtedsomethinglike14volts.TheLM7805isn'taverysophisticatedvoltageregulator,itjustusesresistancetostepdownthevoltage.Toget5voltsoutputfrom14voltsinputmeansthattheLM7805hastodrop9volts.Theexcessenergyisdispersedasheat.Evenwiththeheatsinkthatyouseeinthepicture,itbecameveryveryhot.Waytohottotouch!Inadditiontothat,theperformancewasn'tgreateither.Itwasn'tabletosupplythenecessarycurrenttorunthecubeatfullbrightness.
TheLM7805waslaterremoved,andawirewassolderedbetweentheinputandoutputpins.Insteadweusedanexternal5Vpowersource,ascoveredina
(http://cdn.instructables.com/FUC/ZDZ6/GI0TK2NG/FUCZDZ6GI0TK2NG.LARGE.jpg)
(http://cdn.instructables.com/F6B/65GZ/GI0TDNNW/F6B65GZGI0TDNNW.LARGE.jpg)
http://cdn.instructables.com/F6B/65GZ/GI0TDNNW/F6B65GZGI0TDNNW.LARGE.jpghttp://cdn.instructables.com/FUC/ZDZ6/GI0TK2NG/FUCZDZ6GI0TK2NG.LARGE.jpg -
previousstep.
Whysomanycapacitors?
TheLEDcubeisgoingtobeswitchingabout500mAonandoffseveralhundredtimespersecond.Themomentthe500mAloadisswitchedon,thevoltageisgoingtodropacrosstheentirecircuit.Manythingscontributetothis.Resistanceinthewiresleadingtothepowersupply,slownessinthepowersupplytocompensatefortheincreaseinload,andprobablysomeotherthingsthatwedidn'tknowabout)
Byaddingcapacitors,youcreateabufferbetweenthecircuitandthepowersupply.Whenthe500mAloadisswitchedon,therequiredcurrentcanbedrawnfromthecapacitorsduringthetimeittakesthepowersupplytocompensatefortheincreaseinload.
Largecapacitorscansupplylargercurrentsforlongerperiodsoftime,whereassmallercapacitorscansupplysmallbutquickburstsofenergy.
Weplaceda1000uFcapacitorjustafterthemainpowerswitch.Thisworksasourmainpowerbuffer.Afterthat,thereisa100uFcapacitor.ItiscommonpracticetohavealargecapacitorattheinputpinofanLM7805andasmallercapacitoratit'soutputpin.The100uFcapacitorprobablyisn'tnecessary,butwethinkcapacitorsmakeyourcircuitlookcooler!
TheLEDisconnectedtoVCCjustafterthemainpowerswitch,viaaresistor.
-
Step34:Buildthecontroller:ICsockets,resistorsandconnectors
(http://cdn.instructables.com/FA7/8F69/GI0TK2NJ/FA78F69GI0TK2NJ.LARGE.jpg)
http://cdn.instructables.com/FA7/8F69/GI0TK2NJ/FA78F69GI0TK2NJ.LARGE.jpg -
Inthisstepyouwillbesolderinginthemaincomponentsofthemultiplexerarray.
(http://cdn.instructables.com/FUM/BFZQ/GI0TDNOM/FUMBFZQGI0TDNOM.LARGE.jpg)
http://cdn.instructables.com/FUM/BFZQ/GI0TDNOM/FUMBFZQGI0TDNOM.LARGE.jpg -
Ourmaindesignconsiderationherewastominimizesolderingandwiring.WeoptedtoplacetheconnectorsasclosetotheICsaspossible.Ontheoutputside,thereisonlytwosolderjointsperLEDcubecolumn.ICresistor,resistorconnector.Theoutputsofthelatchesarearrangedinorder07,sothisworksoutgreat.Ifweremembercorrectly,thelatchweareusingisavailableintwoversions,onewiththeinputsandoutputsinsequentialorder,andonewiththeinandoutputsinseeminglyrandomorder.Donotgetthatone!)Don'tworry,ithasadifferent74HCxxxname,soyou'llbegoodifyousticktoourcomponentlist.
Inthefirstpicture,youcanseethatwehaveplacedalltheICsockets,resistorsandconnectors.Wesqueezeditastightaspossible,toleaveroomforunforeseenstuffinthefuture,likebuttonsorstatusLEDs.
Inthesecondpicture,youcanseethesolderjointsbetweentheresistorsandtheICsocketsandconnectors.NotethattheinputsideofthelatchICsocketshaven'tbeensolderedyetinthispicture.
Step35:Buildthecontroller:PowerrailsandICpower
-
(http://cdn.instructables.com/FVY/329L/GICYB1BJ/FVY329LGICYB1BJ.LARGE.jpg)
http://cdn.instructables.com/FVY/329L/GICYB1BJ/FVY329LGICYB1BJ.LARGE.jpg -
Rememberthatprotoboardsolderingtrickweshowedyouinapreviousstep?Wetoldyouitwouldcomeinhandy,andhereiswhereyouuseit.
(http://cdn.instructables.com/FDG/RX36/GICYB1BM/FDGRX36GICYB1BM.LARGE.jpg)
http://cdn.instructables.com/FDG/RX36/GICYB1BM/FDGRX36GICYB1BM.LARGE.jpg -
Largecircuitboardslikethisone,withlotsofwires,canbecomequiteconfusing.WealwaystrytoavoidliftingtheGNDandVCClinesofftheboard.Wesolderthemascontinuoussolderlines.ThismakesitveryeasytoidentifywhatisGND/VCCandwhatissignallines.
IftheVCCandGNDlinesneedstocrosspaths,simplyrouteoneofthemovertheotherusingapieceofwireonthetopsideofthePCB.
Inthefirstpictureyoucanseesomesoldertracesinplace.
Thetwohorizontaltracesisthe"mainpowerbus".ThelowestoneisVCCandthetoponeisGND.ForeveryrowofICsaGNDandVCClineisforkedoffthemainpowerbus.TheGNDlinerunsundertheICs,andtheVCClinerunsundertheresistors.
Wewentalittleoverboardwhenmakingstraightwireforthecube,andhadsomepiecesleftover.WeusedthatfortheVCClinethatrunsundertheresistors.
Inthebottomrightcorner,youcanseethatwehavestartedsolderingthe8+1bitbusconnectingallthelatchICs.Lookhoweasyitistoseewhatissignalwiresandwhatispowerdistribution!
Inthesecondpicture,youcanseetheboardrightsideup,withsomeadditionalcomponentssolderedin,justignorethemforthemoment.
ForeverylatchIC(74HC574),thereisa100nF(0.1uF)ceramiccapacitor.Thesearenoisereductioncapacitors.Whenthecurrentontheoutputpinsareswitchedonandoff,thiscancausethevoltagetodropenoughtomesswiththeinternalworkingsoftheICs,forasplitsecond.Thisisunlikely,butit'sbettertobesafethansorry.Debuggingacircuitwithnoiseissuescanbeveryfrustrating.
-
Besides,capacitorsmakethecircuitlookthatmuchcoolerandprofessional!The100nFcapacitorsmakesurethatthereissomecurrentavailablerightnexttotheICincasethereisasuddendropinvoltage.Wereadsomewherethatitiscommonengineeringpracticetoplacea100nFcapacitornexttoeveryIC,"Usethemlikecandy".Wetendtofollowthatprinciple.
Beloweachrowofresistors,youcanseeatinypieceofwire.ThisistheVCClinemakingalittlejumptothetopsideoftheboardtocrossthemainGNDline.
Wealsoaddedacapacitoronthefarendofthemainpowerbus,forgoodmeasure.
Step36:Buildthecontroller:ConnecttheICs,8bitbus+OE
-
Inthepicture,you'llnoticealotofwireshavecomeintoplace.
Allthetinybluewiresmakeupthe8+1bitbusthatconnectsallthelatchICs.8bitsarefordata,andthe+1bitistheoutputenableline.
Atthetopoftheboard,wehaveaddeda16pinconnector.Thisconnectsthelatchboardtothemicrocontrollerboard.Nexttothat,youseethe74HC138.
(http://cdn.instructables.com/FUO/UVFT/GI0TDNOZ/FUOUVFTGI0TDNOZ.LARGE.jpg)
http://cdn.instructables.com/FUO/UVFT/GI0TDNOZ/FUOUVFTGI0TDNOZ.LARGE.jpg -
ThetinybluewiresareKynarwire.Thisisa30or32AWG(americanwiregauge)wire.Verytiny.Weloveworkingwiththistypeofwire.Becauseitissothin,itdoesn'ttakeupthatmuchspaceonthecircuitboard.Ifwehadusedthickerwire,youwouldn'tbeabletoseetheboardthroughallthewires.Kynarwireiscoatedwithtin,soyoucansolderdirectlyafterstrippingit.Noneedforpretinning.ThetinybluewiresareconnectedtothesamepinoneverylatchIC.
Fromtheconnectoratthetop,youcansee8greenwiresconnectedtothebus.Thisisthe8bitdatabus.Weuseddifferentcolorsfordifferentfunctionstobettervisualizehowthecircuitisbuilt.
Theorangewireconnectedtothebusistheoutputenable(OE)line.
Ontherighthandsideoftheconnector,thefirstpinisconnectedtoground.
Step37:Buildthecontroller:Addressselector
-
(http://cdn.instructables.com/FFC/WI1T/GICYB1D8/FFCWI1TGICYB1D8.LARGE.jpg)
http://cdn.instructables.com/FFC/WI1T/GICYB1D8/FFCWI1TGICYB1D8.LARGE.jpg -
The74HC138isresponsiblefortogglingtheclockpinonthe74HC574latchICs.Wecallthisanaddressselectorbecauseitselectswhichoneofthe8bytes
(http://cdn.instructables.com/F9F/H61T/GI0TK2NV/F9FH61TGI0TK2NV.LARGE.jpg)
http://cdn.instructables.com/F9F/H61T/GI0TK2NV/F9FH61TGI0TK2NV.LARGE.jpg -
inthelatcharraywewanttowritedatato.Thethreebluewiresrunningfromtheconnectortothe74HC138isthe3bitbinaryinputusedtoselectwhichofthe8outputsispulledlow.Fromeachoftheoutputsonthe74HC138,thereisawire(white)runningtotheclockpinonthecorresponding74HC574latchIC.
StartbysolderingtheGNDandVCCconnections.IfyouusethesoldertracemethodtorunGND/VCClinesyouwanttodothisbeforeyousolderanyotherwiresinplace.A100nFceramicfilteringcapacitorisplacedclosetotheVCCandGNDpinsofthe74HC138.
Thenconnecttheaddresslinesandthe8clocklines.
Ifyoulookcarefullyattheconnector,youcanseetwopinsthatarenotused.ThesewillbeusedforabuttonanddebugLEDlater.
Step38:Buildthecontroller:AVRboard
-
(http://cdn.instructables.com/F47/L5JE/GICYB1EZ/F47L5JEGICYB1EZ.LARGE.jpg)
http://cdn.instructables.com/F47/L5JE/GICYB1EZ/F47L5JEGICYB1EZ.LARGE.jpg -
(http://cdn.instructables.com/F45/JMFQ/GICYB1F5/F45JMFQGICYB1F5.LARGE.jpg)
http://cdn.instructables.com/F45/JMFQ/GICYB1F5/F45JMFQGICYB1F5.LARGE.jpg -
Braaaaainzz!!!
ThisboardisthebrainoftheLEDcube.ThemaincomponentisanAtmelAVRATmega32.
Thisisan8bitmicrocontrollerwith32KBofprogrammemoryand2KBRAM.TheATmega32has32GPIO(GeneralPurposeIO)pins.Twoofthesewillbeusedforserialcommunication(TX+RX).ThreeIOpinsareusedforISP(IncircuitSerialProgramming).Thisleavesuswith27GPIOtodrivetheLEDcube,buttonsandstatusLEDs.
Agroupof8GPIO(8bits,onebyte)iscalledaport.TheATmega32has4ports.PORTA,PORTB,PORTCandPORTD.OnPORTCandPORTDsomeofthepinsareusedforTX/RXandISP.OnPORTAandPORTB,allthepinsareavailable.Weusetheseportstodrivethedatabusofthelatcharrayandlayerselecttransistorarray.
PORTAisconnectedtothedatabusonthelatcharray.
EachpinonPORTCisconnectedtoapairoftransistorsthatdriveagroundlayer.
Theaddressselectoronthelatcharray(74HC138)isconnectedtobit02onPORTB.Outputenable(OE)isconnectedtoPORTBbit3.
(http://cdn.instructables.com/FDS/0O6S/GI0TMGRC/FDS0O6SGI0TMGRC.LARGE.jpg)
(http://cdn.instructables.com/FWE/P48I/GI0TMGRB/FWEP48IGI0TMGRB.LARGE.jpg)
http://cdn.instructables.com/FWE/P48I/GI0TMGRB/FWEP48IGI0TMGRB.LARGE.jpghttp://cdn.instructables.com/FDS/0O6S/GI0TMGRC/FDS0O6SGI0TMGRC.LARGE.jpg -
Inthefirstimage,youseetheAVRboardrightsideup.
Thelarge40pinPDIP(PlasticDualInlinePackage)chipinthecenteroftheboardistheATmega32,thebrainz!JusttotheleftoftheATmega,youseethecrystaloscillatorandit'stwocapacitors.OneithersideoftheATmegathereisa100nFfilteringcapacitor.OneforGND/VCCandoneforAVCC/GND.
Inthetopleftcorner,thereisatwopinconnectorsandtwofilteringcapacitors.One10uFandone100nF.TheLEDisjustconnectedtoVCCviaaresistor,andindicatespoweron.
Thelarge16pinconnectordirectlyabovetheATmegaconnectstothelatcharrayboardviaaribboncable.Thepinoutonthiscorrespondstothepinoutontheotherboard.
Thesmaller10pinconnectortotheleft,isastandardAVRISPprogrammingheader.IthasGND,VCC,RESET,SCK,MISOandMOSI,whichareusedforprogramming.Nexttoit,thereisajumper.Whenthisisinplace,theboardcanbepoweredfromtheprogrammer.
Caution:DONOTpowertheboardfromtheprogrammerwhentheactualLEDcubeisconnectedtothecontroller.ThiscouldpossiblyblowtheprogrammerandeventheUSBporttheprogrammerisconnectedto!
Thesecondimageshowstheunderside.AgainallGNDandVCClinesaresolderedastracesontheprotoboardorbarewire.Wehadsomemoreleftoverstraightmetalwire,soweusedthis.
TheorangewiresconnecttheATmega'sRESET,SCK,MOSIandMISOpinstotheISPprogrammingheader.
-
TheGreenwiresconnectPORTAtothedatabus.
Thebluewiresaretheaddressselectlinesforthe74HC138andoutputenable(OE)forthelatcharray.
1)Startbyplacingthe40pinICsocket,the10pinISPconnectorwithajumpernexttoitandthe16pindatabusconnector.2)Solderinplacethepowerconnector,capacitorsandpowerindicatorLED.3)ConnectalltheGNDandVCClinesusingsoldertracesorwire.Placea100nFcapacitorbetweeneachpairofGND/VCCpinsontheATmega.4)Solderinthecrystalandthetwo22pFcapacitors.EachcapacitorisconnectedtoapinonthecrystalandGND.5)Runallthedatabus,addressselectandOEwires,andtheISPwires.Transistors,buttonsandRS232willbeaddedinlatersteps.Atthistime,theAVRboardcanbeconnectedtoanISPprogrammerandtheATmegashouldberecognized.
Step39:Buildthecontroller:Transistorarray
-
(http://cdn.instructables.com/FM4/3HOU/GI0TK43T/FM43HOUGI0TK43T.LARGE.jpg)
(http://cdn.instructables.com/F9Z/FMQ9/GI0TK43P/F9ZFMQ9GI0TK43P.LARGE.jpg)
http://cdn.instructables.com/F9Z/FMQ9/GI0TK43P/F9ZFMQ9GI0TK43P.LARGE.jpghttp://cdn.instructables.com/FM4/3HOU/GI0TK43T/FM43HOUGI0TK43T.LARGE.jpg -
ThetransistorarrayisresponsibleforswitchingonandoffGNDforeachlayerintheLEDcube.
Ourfirstattemptatthiswasanepicfail.Weboughtsometransistorsratedforover500mA,thinkingthatwouldbeplentyofjuice.Wedon'trememberthemodelnumber.
TheLEDcubeworked,butitwasn'tverybright,andthebrightnesswasinverselyproportionaltothenumberofLEDsswitchedoninanygivenlayer.Inadditiontothat,therewassomeghosting.Layersdidn'tswitchcompletelyoffwhentheyweresupposedtobeoff.
Needlesstosay,wewerekindofdisappointed,andstarteddebugging.Thefirstthingwedidwastoaddpullupresistorstotrytocombattheghosting.Thisremovedalmostalltheghosting,yay!Butthecubewasstillverydim,bah!
Wedidn'thaveanypowerfultransistorsorMOSFETslyingaround,sowehadtocomeupwithanothersolution.
WepostedathreadintheelectronicssectionoftheAVRFreaks.netforum,askingifitwaspossibletousetwosmallertransistorsinparallel.Thisistheonlyoptionavailabletoususingthepartswehadonhand.Thegeneralresponsewas,thiswillneverworksodon'tevenbothertrying.Theyevenhadvalidtheoriesandstuff,butthatdidn'tdeterusfromtrying.Itwasouronlysolutionthatdidn'tinvolvewaitingfornewpartstoarriveinthemail.
WeendeduptryingPN2222A,NPNgeneralpurposeamplifier.Ideally,you'dwantaswitchingtransistorforthiskindofapplication,butweneeded16transistorsofthesametype.Thistransistorwasratedat1000mAcurrent,sowedecidedtogiveitatry.
(http://cdn.instructables.com/F5A/9M3H/GI0TDOUP/F5A9M3HGI0TDOUP.LARGE.jpg)
http://cdn.instructables.com/F5A/9M3H/GI0TDOUP/F5A9M3HGI0TDOUP.LARGE.jpg -
Foreachlayer,weusedtwoPN2222Asinparallel.ThecollectorsconnectedtogethertoGND.Theemittersconnectedtogether,thenconnectedtoagroundlayer.Thebaseofeachtransistorswasconnectedtoit'sownresistor,andthetworesistorsconnectedtoanoutputpinontheATmega.
Wesolderedinallthetransistorsandturnedthethingonagain,anditworked,perfectly!
Ifyouknowwhatyouaredoing,youshouldprobablydosomeresearchandfindamoresuitabletransistororMOSFET.Butoursolutionistriedandtestedandalsodoesthetrick!
1)Startbyplacingall8alltransistorsonthePBCandsolderingeachoftheirpins.
2)Runasoldertracebetweenthetheemittersofall16transistors.ConnectthissoldertracetoGND.
3)Solderinaresistorforeachtransistor,thesoldertheresistorstogetherinpairsoftwo.
4)RunkynarwirefromtheoutputpinsontheATmegatoeachofthe8resistorpairs.
5)Soldertogetherthecollectorsofthetransistorsinpairsoftwoandrunsoldertraceorwirefromthecollectorpairstoan8pinheader.
Step40:Buildthecontroller:ButtonsandstatusLEDs
-
(http://cdn.instructables.com/F02/189Q/GI0TMGRN/F02189QGI0TMGRN.LARGE.jpg)
http://cdn.instructables.com/F02/189Q/GI0TMGRN/F02189QGI0TMGRN.LARGE.jpg -
YoucanmakeaLEDcubewithoutanybuttonsatall,butit'snicetohaveatleastonebuttonandsomestatusLEDsfordebugging.
WeaddedoneawesomelookingbuttonwithtwobuiltinLEDs,andoneregularbuttonwithanLED.
ThefirstbuttonismountedonthelatcharrayPCB,sincethiswillsitontopoftheAVRboard,andwewantthebuttoneasilyaccessible.Thewiresareroutedthroughtheribboncable.ThesecondbuttonandLEDsitsontheAVRboardandwasmostlyusedfordebuggingduringconstruction.
ThebuttonsareconnectedbetweenGNDandtheIOpinontheATmega.AninternalpullupresistorinsidetheATmegaisusedtopullthepinhighwhenthebuttonisnotpressed.Whenthebuttonispressed,theIOpinispulledlow.Alogic0indicatesthatabuttonhasbeenpressed.
TheLEDsarealsoconnectedbetweenGNDandtheIOpinviaaresistorofappropriatesize.Don'tconnectanLEDtoamicrocontrollerIOpinwithouthavingaresistorconnectedinseries.Theresistoristheretolimitthecurrent,andskippingitcanblowtheIOportonyourmicrocontroller.
Tofindtheappropriateresistor,justplugtheledintoabreadboardandtestdifferentresistorswitha5vpowersupply.ChoosetheresistorsthatmaketheLEDlightupwiththebrightnessyouwant.IfyouuseLEDswithdifferentcolors,youshouldtestthemsidebyside.DifferentcolorLEDsusuallyrequiredifferentresistorstoreachthesamelevelofbrightness.
WewillleaveituptoyoutodecidetheplacementofyourstatusLEDs,butyoucanseeinthepicturesbelowhowwedidit:
(http://cdn.instructables.com/FBX/85NJ/GI0TMGRM/FBX85NJGI0TMGRM.LARGE.jpg)
(http://cdn.instructables.com/F2I/9WBT/GI0TK2P3/F2I9WBTGI0TK2P3.LARGE.jpg)
http://cdn.instructables.com/FBX/85NJ/GI0TMGRM/FBX85NJGI0TMGRM.LARGE.jpghttp://cdn.instructables.com/F2I/9WBT/GI0TK2P3/F2I9WBTGI0TK2P3.LARGE.jpg -
Step41:Buildthecontroller:RS232
(http://cdn.instructables.com/FRS/SY2Q/GICYB1I2/FRSSY2QGICYB1I2.LARGE.jpg)
http://cdn.instructables.com/FRS/SY2Q/GICYB1I2/FRSSY2QGICYB1I2.LARGE.jpg -
Togetthetrulyamazinganimations,weneedtoconnecttheLEDcubetoaPC.ThePCcandofloatingpointcalculationsthatwouldhavetheAVRworkingin
(http://cdn.instructables.com/FO2/ULPZ/GI0TMGRR/FO2ULPZGI0TMGRR.LARGE.jpg)
http://cdn.instructables.com/FO2/ULPZ/GI0TMGRR/FO2ULPZGI0TMGRR.LARGE.jpg -
slowmotion.
TheATmegahasabuiltinserialinterfacecalledUSART(UniversalSynchronousandAsynchronousserialReceiverandTransmitter).
TheUSARTcommunicatesusingTTLlevels(0/5volts).ThecomputertalksserialusingRS232.ThesignallevelsforRS232areanywherefrom+/5voltsto+/15volts.
ToconverttheserialsignalsfromthemicrocontrollertosomethingtheRS232portonaPCcanunderstand,andviceversa,weusetheMaximMAX232IC.Actually,thechipweareusingisn'tfromMaxim,butitisapincompatibleclone.
Therearesome100nFceramiccapacitorssurroundingtheMAX232.TheMAX232usesinternalchargepumpsandtheexternalcapacitorstostepupthevoltagetoappropriateRS232levels.Oneofthe100nFcapacitorsisafiltercapacitor.
TheRS232connectorisata90degreeangleforeasyaccesswhenthelatcharrayboardismountedontopoftheAVRboard.Weuseda4pinconnectorandcutoneofthepinsouttomakeapolarizedconnector.ThisremovesanyconfusionastowhichwaytoplugintheRS232cable.
InthesecondpictureyoucanseetwoyellowwiresrunningfromtheATmegatotheMAX232.ThesearetheTTLlevelTXandRXlines.
1)ConnecttheGNDandVCCpinsusingsoldertraceorwire.Placea100nFcapacitorclosetotheGNDandVCCpins.
2)Solderinplacetherestofthe100nFcapacitors.Youcansolderthesewithsoldertraces,soitsbesttodothisbeforeyouconnectthetx/rxwires.
-
3)Solderinplacea4pin0.1"headerwithonepinremoved.ConnectthepinnexttotheonethatwasremovedtoGND.
4)Connectthetx/rxinputlinestothemicrocontroller,andthetx/rxoutputlinestothe4pinheader.
Thewiresgoingtothe4pinheaderarecrossedbecausethefirstserialcableweusedhadthispinout.
Step42:Buildthecontroller:MakeanRS232cable
-
(http://cdn.instructables.com/FFC/F3PV/GI0TK2Q0/FFCF3PVGI0TK2Q0.LARGE.jpg)
(http://cdn.instructables.com/FS1/EWQ8/GI0TMGRW/FS1EWQ8GI0TMGRW.LARGE.jpg)
http://cdn.instructables.com/FFC/F3PV/GI0TK2Q0/FFCF3PVGI0TK2Q0.LARGE.jpghttp://cdn.instructables.com/FS1/EWQ8/GI0TMGRW/FS1EWQ8GI0TMGRW.LARGE.jpg -
ToconnecttheLEDcubetoaserialportonyourcomputer,youneedtomakeaserialcablewithafemaleDSub9pinconnector.
Ouremployerdeployed70Ethernetswitcheswithmanagementlastyear.WitheachswitchcomesanRS232cablethatisneverused.WeliterallyhadabigpileofRS232cable,sowedecidedtomodifyoneofthose.
OntheLEDcube,a0.1"pinheaderisused,sotheRS232cableneedsanewconnectoronthecubeside.
Wedidn'thavea4pinfemale0.1"connector,soweuseda4pinfemalePCBheaderinstead.
TheconnectorontheLEDcubePCBhasonepinremoved,tovisualizethedirectionalityoftheconnector.Thepinnumbersgoesfromrighttoleft.
PinoutoftheRS232connector:
1)GND(DSub9pin5)2)Notconnected3)RX(DSub9pin3)
(http://cdn.instructables.com/F1M/DKJE/GICYB1J4/F1MDKJEGICYB1J4.LARGE.jpg)
(http://cdn.instructables.com/F6P/8MWJ/GI0TDNU1/F6P8MWJGI0TDNU1.LARGE.jpg)
(http://cdn.instructables.com/FJX/C1BV/GI0TK2PP/FJXC1BVGI0TK2PP.LARGE.jpg)
(http://cdn.instructables.com/FF1/KJBJ/GI0TDNU0/FF1KJBJGI0TDNU0.LARGE.jpg)ShowAll10Items
http://cdn.instructables.com/F1M/DKJE/GICYB1J4/F1MDKJEGICYB1J4.LARGE.jpghttp://cdn.instructables.com/FF1/KJBJ/GI0TDNU0/FF1KJBJGI0TDNU0.LARGE.jpghttp://cdn.instructables.com/F6P/8MWJ/GI0TDNU1/F6P8MWJGI0TDNU1.LARGE.jpghttp://cdn.instructables.com/FJX/C1BV/GI0TK2PP/FJXC1BVGI0TK2PP.LARGE.jpg -
4)TX(DSub9pin2)
FollowthesestepstomakeyourownRS232cable:
1)Cutoftheconnectoratoneendofthecable.Ifyourcablehasafemaleandamaleconnector,makesuretoremovethemaleconnector!
2)Stripawaytheoutersheathontheendwhereyouremovedtheconnector.
3)Stripallthewiresinside.
4)Setyourmultimetertocontinuitytestmode.Thismakesthemultimeterbeepwhentheprobesareconnected.Ifyourmultimeterdoesn'thavethisoption,usetheresistancemode.Itshouldgetcloseto0ohmwhenyouconnecttheprobes.
5)ConnectonemultimeterprobetotheDSub9'spin5,thenprobeallthewiresuntilyouthemultimeterbeeps.YouhavenowidentifiedthecolorofGNDinyourcable.Repeatforpin2and3(TXandRX).
6)Writedownthecolorsyouidentified,thencutofftheotherwires.
7)Cutthethreewiresdowntosize,30mmshoulddo.
8)Pretinthewirestomakesolderingeasier.Justapplyheatandsoldertothestrippedwires.
9)Slideashrinktubeoverthecable.Slidethreesmallershrinktubesovertheindividualwires.
10)Solderthewirestotheconnector.
11)Shrinkthesmallertubesfirst,thenthelargeone.Ifyouusealighter,don't
-
holdtheshrinktubeabovetheflame,justholditclosetothesideoftheflame.
Don'tmakeyourcablebasedonthecolorsweused.Testthecabletofindthecorrectcolors.
Step43:Buildthecontroller:Connecttheboards
(http://cdn.instructables.com/F0P/JT0O/GICYB3E2/F0PJT0OGICYB3E2.LARGE.jpg)
http://cdn.instructables.com/F0P/JT0O/GICYB3E2/F0PJT0OGICYB3E2.LARGE.jpg -
Thetwoboardsareconnectedbytwocables:AribboncablefortheDATAandAddressBUS.
(http://cdn.instructables.com/FUJ/6V1V/GICYB6R2/FUJ6V1VGICYB6R2.LARGE.jpg)
http://cdn.instructables.com/FUJ/6V1V/GICYB6R2/FUJ6V1VGICYB6R2.LARGE.jpg -
A2wirecableforGNDandVCC.
Afterconnectingthesetwocables,yourboardiscomplete.
Step44:Buildthecontroller:Connectthecube
(http://cdn.instructables.com/FER/UACC/GICYB1O0/FERUACCGICYB1O0.LARGE.jpg)
http://cdn.instructables.com/FER/UACC/GICYB1O0/FERUACCGICYB1O0.LARGE.jpg -
(http://cdn.instructables.com/FPC/6VY7/GICYB1O4/FPC6VY7GICYB1O4.LARGE.jpg)
http://cdn.instructables.com/FPC/6VY7/GICYB1O4/FPC6VY7GICYB1O4.LARGE.jpg -
Connecttheribboncablesaccordingtothepinoutsshowninpicture2and3.Thegroundlayerribboncableconnectstothepinheadernearthetransistorarray.Ifthecubeisupsidedown,justplugitintheotherway.
Step45:ProgramtheAVR:Setthefusebits
(http://cdn.instructables.com/FMJ/7V6H/GI0TMHB1/FMJ7V6HGI0TMHB1.LARGE.jpg)
(http://cdn.instructables.com/FZG/JCSY/GI0TDNV9/FZGJCSYGI0TDNV9.LARGE.jpg)
http://cdn.instructables.com/FMJ/7V6H/GI0TMHB1/FMJ7V6HGI0TMHB1.LARGE.jpghttp://cdn.instructables.com/FZG/JCSY/GI0TDNV9/FZGJCSYGI0TDNV9.LARGE.jpg -
(http://cdn.instructables.com/FAC/2E2E/GI0TMHE8/FAC2E2EGI0TMHE8.LARGE.jpg)
(http://cdn.instructables.com/F79/FMGC/GI0TMGS5/F79FMGCGI0TMGS5.LARGE.jpg)
http://cdn.instructables.com/FAC/2E2E/GI0TMHE8/FAC2E2EGI0TMHE8.LARGE.jpghttp://cdn.instructables.com/F79/FMGC/GI0TMGS5/F79FMGCGI0TMGS5.LARGE.jpg -
TheATmega32hastwofusebytes.ThesecontainsettingsthathavetobeloadedbeforetheCPUcanstart,likeclocksourceandotherstuff.YouhavetoprogramyourATmegatouseanexternalhighspeedcrystaloscillatoranddisableJTAG.
Wesetthelowerfusebyte(lfuse)to0b11101111,andthehighfusebyteto0b11001001.(0bmeansthateverythingafterthebisinbinary).
WeusedavrdudeandUSBtinyISP(http://www.ladyada.net/make/usbtinyisp/)toprogramourATmega.
Inallthefollowingexamples,wewillbeusinganUbuntuLinuxcomputer.ThecommandsshouldbeidenticalifyourunavrdudeonWindows.
avrdudecusbtinypm32Ulfuse:w:0b11101111:mavrdudecusbtinypm32Uhfuse:w:0b11001001:m
Warning:Ifyougetthiswrong,youcouldeasilybrickyourATmega!Ifyouforexampledisabletheresetbutton,youwon'tbeabletoreprogramit.Ifyouselectthewrongclocksource,itmightnotbootatall.
(http://cdn.instructables.com/FUH/6PI2/GI0TK2QA/FUH6PI2GI0TK2QA.LARGE.jpg)
(http://cdn.instructables.com/FED/6901/GICYB1P3/FED6901GICYB1P3.LARGE.jpg)
(http://cdn.instructables.com/FI6/0DJN/GI0TDNVG/FI60DJNGI0TDNVG.LARGE.jpg)
http://cdn.instructables.com/FI6/0DJN/GI0TDNVG/FI60DJNGI0TDNVG.LARGE.jpghttp://cdn.instructables.com/FED/6901/GICYB1P3/FED6901GICYB1P3.LARGE.jpghttp://cdn.instructables.com/FUH/6PI2/GI0TK2QA/FUH6PI2GI0TK2QA.LARGE.jpg -
Step46:ProgramtheAVRwithtestcode
TimetotestifyourbrandnewLEDcubeactuallyworks!
WehavepreparedasimpletestprogramtocheckifalltheLEDsworkandif
(http://cdn.instructables.com/FOS/NXR5/GI0TK2QC/FOSNXR5GI0TK2QC.LARGE.jpg)
(http://cdn.instructables.com/FDG/4UZQ/GI0TDNVP/FDG4UZQGI0TDNVP.LARGE.jpg)
http://cdn.instructables.com/FDG/4UZQ/GI0TDNVP/FDG4UZQGI0TDNVP.LARGE.jpghttp://cdn.instructables.com/FOS/NXR5/GI0TK2QC/FOSNXR5GI0TK2QC.LARGE.jpg -
theyarewiredcorrectly.
Youcandownloadthefirmwaretest.hexinthisstep,ordownloadthesourcecodeandcompileityourself.
Asinthepreviousstep,weuseavrdudeforprogramming:avrdudecusbtinypm32B1Uflash:w:test.hex
cusbtinyspecifiesthatweareusingtheUSBtinyISPfromLadyadapm32specifiesthatthedeviceisanATmega32B1tellsavrdudetoworkatahigherthandefaultspeed.Uflash:w:test.hexspecifiesthatweareworkingonflashmemory,inwritemode,withthefiletest.hex.
test.hex (/files/orig/FQX/H9M5/GICYB93T/FQXH9M5GICYB93T.tmp)14KB
Step47:Testthecube
(http://cdn.instructables.com/F5T/13Q6/GI0TMGSL/F5T13Q6GI0TMGSL.LARGE.jpg)
http://cdn.instructables.com/F5T/13Q6/GI0TMGSL/F5T13Q6GI0TMGSL.LARGE.jpghttp://www.instructables.com/files/orig/FQX/H9M5/GICYB93T/FQXH9M5GICYB93T.tmp -
Thetestcodeyouprogrammedinthepreviousstepwillletyouconfirmthateverythingiswiredupcorrectly.
Itwillstartbydrawingaplanealongoneaxis,thenmovingitalongall8positionsofthataxis.(byplanewemeanaflatsurface,notanairplane:p)Thetestcodewilltraverseaplanethroughallthreeaxis.
Afterthat,itwilllighttheLEDsinalayeronebyone,startingatthebottomlayer.
(http://cdn.instructables.com/FLU/2HHF/GICYB1R3/FLU2HHFGICYB1R3.LARGE.jpg)
http://cdn.instructables.com/FLU/2HHF/GICYB1R3/FLU2HHFGICYB1R3.LARGE.jpg -
Ifanyofthelayersorcolumnsseemtolightupinthewrongorder,youhaveprobablysolderedthewrongwiretothewronglayerorcolumn.Wehadonemistakeinourcube)
Ifyoufindanythingthatisoutoforder,justdesolderthewiresandsolderthembackintherightorder.Youcouldofcoursemakeaworkaroundinsoftware,butthatwouldeatCPUcycleseverytimetheinterruptroutineruns.
Youcancompareyourcubetothetestvideobelow:
-
Step48:ProgramtheAVRwithrealcode
(http://cdn.instructables.com/F3X/MRID/GICYB1RZ/F3XMRIDGICYB1RZ.LARGE.jpg)
(http://cdn.instructables.com/FII/HXWN/GI0TMGST/FIIHXWNGI0TMGST.LARGE.jpg)
http://cdn.instructables.com/FII/HXWN/GI0TMGST/FIIHXWNGI0TMGST.LARGE.jpghttp://cdn.instructables.com/F3X/MRID/GICYB1RZ/F3XMRIDGICYB1RZ.LARGE.jpg -
Soeverythingcheckedoutinthetest.It'stimetoprogramtheATmegawiththerealfirmware!
Forthemostpart,theprocessisthesameasinthepreviousprogrammingstep.ButinadditionyouhavetoprogramtheEEPROMmemory.TheLEDcubehasabasicbitmapfontstoredinEEPROM,alongwithsomeotherdata.
Firmwareisprogrammedusingthesameprocedureaswiththetestcode.
Firmware:avrdudecusbtinypm32B1Uflash:w:main.hex
EEPROM:avrdudecusbtinypm32B1Ueeprom:w:main.eep
Ueeprom:w:main.eepspecifiesthatweareaccessingEEPROMmemory,inwritemode.AvrgccputsalltheEEPROMdatainmain.eep.
Ifyoudon'twanttoplayaroundwiththecode,yourLEDcubeisfinishedatthispoint.Butwerecommendthatyouspendsometimeonthesoftwaresideofthingsaswell.That'satleastasmuchfunasthehardware!
Ifyoudownloadthebinaryfiles,youhavetochangethefilenamesinthecommandstothenameofthefilesyoudownloaded.Ifyoucompilefromsource
(http://cdn.instructables.com/FG5/Q7SV/GI0TK2QP/FG5Q7SVGI0TK2QP.LARGE.jpg)
(http://cdn.instructables.com/FVB/35IW/GICYB1SC/FVB35IWGICYB1SC.LARGE.jpg)
(http://cdn.instructables.com/FYS/SF2F/GI0TDNX8/FYSSF2FGI0TDNX8.LARGE.jpg)
http://cdn.instructables.com/FVB/35IW/GICYB1SC/FVB35IWGICYB1SC.LARGE.jpghttp://cdn.instructables.com/FG5/Q7SV/GI0TK2QP/FG5Q7SVGI0TK2QP.LARGE.jpghttp://cdn.instructables.com/FYS/SF2F/GI0TDNX8/FYSSF2FGI0TDNX8.LARGE.jpg -
thenameismain.hexandmain.eep.
ledcube_8x8x8_eeprom.eep (/files/orig/F53/QFDQ/GICYB944/F53QFDQGICYB944.tmp)1KB
ledcube_8x8x8.hex (/files/orig/FVZ/Y8K2/GICYB945/FVZY8K2GICYB945.tmp)46KB
Step49:Software:Introduction
http://www.instructables.com/files/orig/FVZ/Y8K2/GICYB945/FVZY8K2GICYB945.tmphttp://www.instructables.com/files/orig/F53/QFDQ/GICYB944/F53QFDQGICYB944.tmp -
ThesoftwareiswritteninCandcompiledwiththeopensourcecompileravrgcc.ThisisthemainreasonweuseAtmelAVRmicrocontrollers.ThePICseriesfromMicrochipisalsoanicechoice,butmostoftheCcompilerscostmoney,andthefreeversionshavelimitationsoncodesize.
TheAVRrouteismuchmorehasslefree.Justaptgetinstalltheavrgcccompiler,andyou'reinbusiness.
(http://cdn.instructables.com/FI2/CBSY/GICYB7KV/FI2CBSYGICYB7KV.LARGE.jpg)
http://cdn.instructables.com/FI2/CBSY/GICYB7KV/FI2CBSYGICYB7KV.LARGE.jpg -
ThesoftwareontheAVRconsistsoftwomaincomponents,thecubeinterruptroutineandeffectcodeformakingfancyanimations.
Whenwefinallyfinishedsoldering,wethoughtthiswouldbetheeasypart.Butitturnsoutthatmakinganimationsinmonochromeatlowresolutionsisharderthanitsounds.
Ifthedisplayhadahigherresolutionandmorecolors,wecouldhaveusedsin()andcos()functionsandallthattomakefancyeyecandy.Withtwocolors(onandoff)andlowresolution,wehavetousealotofif()andfor()tomakeanythingmeaningful.
Inthenextfewsteps,wewilltakeyouonatourofsomeoftheanimationswemadeandhowtheywork.Ourgoalistogiveyouanunderstandingofhowyoucanmakeanimations,andinspireyoutocreateyourown!Ifyoudo,pleasepostavideointhecomments!
ledcube_8x8x8v0.1.2.tar.gz (/files/orig/FJG/AU0K/GICYB94U/FJGAU0KGICYB94U.tmp)20KB
Step50:Software:Howitworks
http://www.instructables.com/files/orig/FJG/AU0K/GICYB94U/FJGAU0KGICYB94U.tmp -
Asmentionedinthepreviousstep,thesoftwareconsistsoftwopars.Theinterruptroutineandtheeffectcode.
Communicationbetweenthesetwohappensviaavoxelarray.ThisarrayhasabitforeveryLEDintheLEDcube.Wewillrefertothisasthecubearrayorcubebufferfromnowon.
Thecubearrayismadeof8x8bytes.Sinceeachbyteis8bits,thisgivesusabufferthatis8voxelswide,8woxelshighand8voxelsdeep(1bytedeep).
(http://cdn.instructables.com/F00/4K0H/GICYB3XX/F004K0HGICYB3XX.LARGE.jpg)
http://cdn.instructables.com/F00/4K0H/GICYB3XX/F004K0HGICYB3XX.LARGE.jpg -
volatileunsignedcharcube[8][8]
TheinterruptroutinereadsfromthecubearrayatgivenintervalsanddisplaystheinformationontheLEDcube.
TheeffectfunctionswritesthedesiredLEDstatusestothisarray.
Wedidnotuseanysynchronizationordoublebuffering,sincethereisonlyoneproducer(eithertheeffectscurrentlyrunning,orinputfromRS232)andoneconsumer(theinterruptcodethatupdatesthecube).Thismeansthatsomevoxelscouldbefromthenextorprevious"frame",butthisisnotaproblem,sincetheframerateissohigh.
Whenworkingwithmicrocontrollers,codesizeiscritical.Tosavecodesizeandprogrammingwork,andtomakethecodeeasiertoread,wehavetriedtowritereusablecodeasoftenaspossible.
TheLEDcubecodehasabaseoflowleveldrawingfunctionsthatareusedbythehigherleveleffectfunctions.Thedrawfunctionscanbefoundindraw.c.Drawfunctionsincludeeverythingfromsettingorclearingasinglevoxeltodrawinglinesandwireframeboxes.
Step51:Software:IOinitialization
-
(http://cdn.instructables.com/FC0/CBMR/GICYB7YO/FC0CBMRGICYB7YO.LARGE.jpg)
http://cdn.instructables.com/FC0/CBMR/GICYB7YO/FC0CBMRGICYB7YO.LARGE.jpg -
ThefirstthingtheATmegadoesafterboot,istocalltheioinit()function.
ThisfunctionsetsupIOports,timers,interruptsandserialcommunications.AllIOportsontheATmegaarebidirectional.Theycanbeusedeitherasaninputoranoutput.Weconfigureeverythingasoutputs,excepttheIOpinswherethetwobuttonsareconnected.TheRXpinfortheseriallineautomatically
(http://cdn.instructables.com/F75/D9SJ/GICYB7YN/F75D9SJGICYB7YN.LARGE.jpg)
http://cdn.instructables.com/F75/D9SJ/GICYB7YN/F75D9SJGICYB7YN.LARGE.jpg -
becomesaninputwhenUSARTRXisenabled.
1)DDRxsetsthedatadirectionoftheIOpins.(DataDirectionRegister).1meansoutput,0meansinput.
2)Afterdirectionalityhasbeenconfigured,wesetalloutputsto0toavidanyblinkingLEDsetcbeforetheinterrupthasstarted.
3)Forpinsconfiguredasinputs,thePORTxbitchangesitsfunction.Settinga1inthePORTxregisterbitenablesaninternalpullupresistor.TheportispulleduptoVCC.ThebuttonsareconnectedbetweentheportandGND.WhenabuttonispressedthecorrespondingPINxbitreadsalogic0.
4)Timer2isconfiguredandatimerinterruptenabled.Thisiscoveredinaseparatestep.
5)Serialcommunicationsisconfiguredandenabled.Thisisalsocoveredinaseparatestep.
Step52:Software:Modeselectionandrandomseed
-
Whenwefirststartedwritingeffectsanddebuggingthem,wenoticedthatthefunctionsusingrandomnumbersdisplayedtheexactsameanimationseverytime.Itwasrandomalright,butthesamerandomsequenceeverytime.TurnsouttherandomnumbergeneratorintheATmeganeedstobeseededwitharandomnumbertocreatetruerandomnumbers.
Wewroteasmallfunctioncalledbootwait().Thisfunctionservestwopurposes.
1)Createarandomseed.2)Listenforbuttonpressestoselectmodeofoperation.
(http://cdn.instructables.com/F1B/8RBN/GI0TK45B/F1B8RBNGI0TK45B.LARGE.jpg)
http://cdn.instructables.com/F1B/8RBN/GI0TK45B/F1B8RBNGI0TK45B.LARGE.jpg -
Itdoesthefollowing:
1)Setcounterxto0.
2)Startaninfiniteloop,while(1).
3)Incrementcounterxbyone.
4)Usexasarandomseed.
5)Delayforawhileandsetredstatusledon.
6)Checkforbuttonpresses.Ifthemainbuttonispressed,thefunctionreturns1.IfthePGMbuttonispresseditreturnes2.Thereturnstatementsexitsthefunctionthusendingtheinfiniteloop.
7)Delayagainandsetgreenledon.
8)Checkforbuttonpressesagain.
9)Loopforeveruntilabuttonispressed.
Thelooploopsveryfast,sotheprobabilitythatyouwillstopitatthesamevalueofxtwotimesinarowisveryremote.Thisisaverysimplebuteffectivewaytogetagoodrandomseed.
Bootwait()iscalledfromthemain()functionanditsreturnvalueassignedtothevariablei.
Ifi==1,themainloopstartsaloopthatdisplayseffectsgeneratedbytheATmega.Ifi==2,itentersintoRS232modeandwaitsfordatafromacomputer.
Step53:Software:Interruptroutine
-
(http://cdn.instructables.com/FJU/HIM1/GI0TK2QT/FJUHIM1GI0TK2QT.LARGE.jpg)
(http://cdn.instructables.com/FTH/KRXN/GI0TMGT7/FTHKRXNGI0TMGT7.LARGE.jpg)
http://cdn.instructables.com/FTH/KRXN/GI0TMGT7/FTHKRXNGI0TMGT7.LARGE.jpghttp://cdn.instructables.com/FJU/HIM1/GI0TK2QT/FJUHIM1GI0TK2QT.LARGE.jpg -
TheheartoftheLEDcubecodeistheinterruptroutine.
Everytimethisinterruptruns,thecubeisclear