ApplicationReportSLAA178–August2003DTMF-ControlledRemoteSwitchingApplicationUsingtheMSP430ArthurMusahMSP430ABSTRACTThisreferencedesigndemonstrateshowtheMSP430ultra-lowpower,mixedsignalprocessorcanbeusedtoperformthereal-timesignalprocessingnecessarytoimplementadualtonemulti-frequency(DTMF)decodingapplication.ADTMFdecodingalgorithm,whichuseswavedigitalfilterstoprocesselectricalsignalssampledfromatelephoneline,formsthecoreoftheremotetouch-tonephonecontrolledswitchapplicationwhoseconstructionandfunctionarediscussedinthisreport.TheADC10peripheralavailableontheMSP430F1232isusedtoperformthesamplingandconversionoftelephonelinevoltages,whiletheTimer_Aperipheralisusedtogeneratesquarewavestooutputnotificationtonesontothetelephoneline.1IntroductionThisMSP430applicationconnectstoanordinaryanalogtelephonelineinparalleltoauserphoneandallowstheusertocontroleightelectricswitchesbymakingacalltothephonetowhichtheMSP430deviceisattachedandpunchinginanaccesscodeandsimpleinstructionsequencetoturnanyoftheeightlinesonoroff.Inotherwords,onecouldremotelyturnonthesprinklersinone’slawnortheairconditioningathome,orturnoffthelightsmistakenlyleftoninone’sapartmentiftheyareeachconnectedtooneofthetelephone-controlledswitchingoutputsontheMSP430application.TherequirementsforbuildinganapplicationliketheonedescribedpreviouslyincludehardwaretoformtheinterfacebetweenthetelephonelineandtheMSP430microcontroller,signalprocessingcapabilities,providedbytheMSP430,fordecipheringinformationencodedaselectricalsignalsonthetelephoneline,andacontrolprogramfortheMSP430.2DecodingDTMF2.1DTMFDualtonemulti-frequency(DTMF)isaschemeforencoding16charactersusingthesumsofsinusoidalsignalsoftwodistinct,harmonicallyunrelatedfrequencies.Thefollowingtableshowshowthe16charactersareeachrepresentedbyonefrequencyfromalowfrequencygroup(rangingfrom697Hzto941Hz)andonefromahighfrequencygroup(rangingfrom1209Hzto1633Hz).1SLLA178–August2003Table1.TheDTMFencodingschemeFrequency1209Hz1336Hz1477Hz1633Hz697Hz123A770Hz456B852Hz789C941Hz*(E)0#(F)DDTMFiswidelyusedintelecommunicationsystems.Totransmitaparticularcharacteronatelephoneline,thetwofrequenciesrepresentingthatcharacteraregeneratedaselectricalsignals,addedandsentdowntheline.Aspecifiedperiodofsilence(40millisecondsormore)separatesonetransmittedDTMFcharacterfromanother.Areceivingdevicedecodesthecharacterbeingtransmittedbyidentifyingthetwofrequenciespresentineachsumitreceives.2.2IdentifyingDTMFSignalsToidentifytheDTMFcharacterreceivedbytheMSP430application,theanalogvoltagesignalonthetelephonelineissampledandconvertedtoadigitalvalueusingthe10-bitanalog-to-digitalconverter(ADC10)peripheralontheMSP430F1232chip.Thesamplingfrequencyusedis3640Hz,whichismorethantwotimesthehighestDTMFfrequency.ThissatisfiestheNyquistcriterionandthereforeensuresthattheintegrityofthesignalispreservedaftersampling.Thesampledsignalisthenpassedthrougheachof8wavedigitalfilterstoidentifywhichtwoDTMFfrequencies,ifany,arepresentinthesampledsignal.2.3WaveDigitalFiltersThedigitalprocessingofvoltagesignalseliminatestheneedforadditionalcircuitryexternaltotheMSP430forimplementinganalogfilters.Wavedigitalfiltersareused,whichareimplementedinsoftwareandhavemanydesirablefeaturessuchasresponsestabilityandgooddynamicrange.ADTMFdecodingalgorithmfortheMSP430[1]makesuseof8wavedigitalfilters,whichareconvenientlyimplementedwithshift-and-addmultiplicationstoeliminatetheneedforahardwaremultiplier.EachofthefiltersisdesignedtohavearesonantfrequencycorrespondingtooneoftheDTMFfrequencies.Thus,asignalwhosefrequencymatchestheresonantfrequencyofthefilteritispassedthroughwillbemagnifiedbyaknownfactorcharacteristictothefilter,whilenoiseandsignalsofallotherfrequencieswillbesignificantlyattenuated.Theoutputofafiltercanthenbeanalyzedtodetermineifaparticularfrequencywaspresentinasignalornot.2DTMF-ControlledRemoteSwitchingApplicationUsingtheMSP430SLLA178–August20033Hardware3.1FunctionofCircuitComponentsThecircuitschematicinFigure1showsthehardwarethatinterfacesthetipandringtelephonelineswiththeMSP430,theJTAGinterface,and8LEDsfordemonstratingtheswitchingactionoftheapplication.TheinterfacebetweenthephonelineandtheMSP430consistsoffourfunctionalparts:•Ringdetection:U3combinestheringdetectfunctionandasolid-staterelayforimplementingthetelephonehookswitchinoneIC.ThecapacitorC1dc-filtersthe15-Hzringsignalfromthetelephoneline,whichisthenpassedthroughthecurrent-limitingresistorR1intotheringdetectportionofU3.Whenthereisnoringsignalonthephoneline,theringdetectoutputmaintainsalogichigh.Alogiclowvalueontheoutputindicatesadetectedtelephonering.TheringdetectoutputofU3isconnectedtoanMSP430I/Opin(pin10)togenerateaninterrupttotheMSP430oneachtelephonering.•Hookswitch:AdedicatedI/Opin(pin21)ontheMSP430isconnectedtotherelaycontrolpinofU3.Itisusedtoturnthesolid-staterelayportionofU3onoroff,tocloseoropenthecircuitontheprimarysideofthetransformerT1.•DTMFinputline:ThiscomprisesthesecondarysideofthetransformerT1,feedingintotheoperationalamplifier(opamp)inputandfromtheopampoutputtopin8(ADCchannelA0)oftheMSP430.SinceDTMFsignalsa