Tkool Electronics

DescriptionTheweatherinthepasttwodayshassuddenlycooleddown,andIforgottoinstallaswitchonthebedside,andIdontwanttogetoutofbedtoturnoffthelightbecauseofthecold.Atthistime,itwouldbenicetohaveanintelligentcontrolswitch.ThisblogintroducesasmartswitchcontrollerbasedonATMEGA328P-PU.Thecontroller,withoutchangingtheexistingswitchesandcircuits,canautomaticallyturnoffthelightsafterapowerfailure.Atthesametime,thewirelesscontrollightswitchfunctioncanalsoberealizedthroughtheBluetoothmodule,andthelightcanbeturnedonandoffwhilelyingdown,andthereisnoneedtogetoutofbed.ATMEGA328P-PUCatalogDescriptionIIntroductionIIATmega328P-PUBasedSystemPricipleIIIATmega328P-PUBasedSystemHardwareDesign3.1Centralcontrolmodule3.2Lightdetectioncircuit3.3BluetoothmoduleIVATmega328P-PUBasedStructureDesignVATmega328P-PUBasedSystemSoftwareDesignVIConclusionComponentDatasheetFAQOrdering&QuantityIIntroductionThesmartswitchlightcontrollerbasedonATmega328P-PUintroducedinthisblogconsistsofthefollowingmodules:LightDetectionModule:Perceivethechangeofindoorlightintensity;BluetoothModule:controlandrealizeautomaticlightswitch;SteeringGearandMechanicalLinkageMechanism:Itcanalsoautomaticallyturnoffthelights.Thecontrollerusestheorganiccombinationofmechatronics,whichisreliableandeasytocontrol.IIATmega328P-PUBasedSystemPricipleTheintelligentswitchlightcontrollersystemismainlycomposedoflightdetectionmodule,Bluetoothmodule,steeringgearandArduinocontrolsystem.Thesystemcontrolprocessisasfollows:Thelightdetectionmoduleperceivestheenvironmentfrombrighttodark;ThelightdetectionmodulesendsthesensedinformationtotheArduino;Arduinoturnsoffthelightingequipmentbycontrollingthesteeringgearaccordingtothisinformation;Or,tocompletetheoperationofturningoffthelights,youcanalsodirectlycontrolitthroughthemobilephoneAPPBluetooth.ThesystemprinciplediagramoftheintelligentswitchlightcontrollerisshowninFigure1.Figure1.SystemschematicdiagramIIIATmega328P-PUBasedSystemHardwareDesign3.1CentralcontrolmoduleThemostwidelyusedmicrocontrollersforthecentralcontrolmoduleareAVRand51microcontrollers.Fromtheperspectiveoffunctionandupgradepotential,theAVR8-bitmicrocontrollerATMEGA328P-PUwasselectedasthecentralcontrolmodule.So,whataretheadvantagesofATMEGA328P-PUcontrolmodule?Whychooseit?ATMEGA328P-PU,asacentralcontrolmodule,hasflexibleI/Oportresourcesandpowerfulfunctions.Itnotonlyhaslowpowerconsumptionbutisreliable,andcanmeettheneedsofsubsequentequipmentupdates.Figure2showstheminimumsystemdiagramofATMEGA328P.Figure2.ATMEGA328Pminimumsystem3.2LightdetectioncircuitHere,thelightdetectioncircuitisafour-wiresystem.TheAOportisananalogsignaloutputport,whichconvertstheexternallightintensityintoacontinuousoutputvoltagevalue.Whenthebrightnessofthelightchanges,howdoestheDOportactasadigitalsignaloutputport?Whentheambientlightbrightnessdoesnotreachthesetthreshold,theDOterminaloutputsahighlevel;Whenthebrightnessoftheambientlightexceedsthesetthreshold,theDOterminaloutputsalowlevel.Becausethesignaloutputbythecircuitisstableandreliable,thecontrollerselectsthedigitalsignaloutputbytheDOportastheinputsignalofthecontrolmodule.Inthisway,thesensitivityandreliabilityofthesystemcanbeimproved.IlluminationdetectioncircuitdiagramshowninFigure3.Figure3.Illuminationdetectioncircuitdiagram3.3BluetoothmoduleThisblogusestheHC-05master-slaveintegratedBluetoothmodule.ItscircuitdiagramisshownasinFig.4.Figure4.BluetoothdetectioncircuitThemoduleadoptsCSRmainstreamBluetoothchip,BluetoothV2.0protocolstandard,andcanworkwith3.3Vlowvoltage.Itischeap,smallinsize,stableinsignal,lowinpower,andcanbeusedinconjunctionwithmobileAPPtorealizewirelesscontrolofthesystem.Inthisdesign,Bluetoothonlyactsasaslave,receivinginstructionsfromthemobilephone.IVATmega328P-PUBasedStructureDesignTakethedormitoryasanexampletodesignthecontrollerfortheswitch(asshowninFigure5).Figure5.PowerswitchAftermeasurement,whentheswitchisintheequilibriumposition,thatis,betweentheclosedandopenpositions,ifthelight-offpositionispressedmorethan2mm,thebuttonwillturnoffthepower.Whenthelight-onpositionispresseddownmorethan2mm,thebuttonwillturnonthepower.Wecandesignalinkmechanismconnectedwiththesteeringgeartomake:Whenthesteeringgearrotatesto180,theconnectingrodpositionisthehighest;Whenthesteeringgearrotatesto0,theconnectingrodpositionislowest.Then,settheinitialpositionofthesteeringgearto90,sothatthebuttonisatthevalueofthebalanceposition.Atthistime,coincidethemiddlepositionoftheT-shapedfixingbracketwiththemiddlepositionofthebutton.Inaddition,inordertofacilitatetherealizationoffunctions,thecentralpositioncanbesetasachute.Figure6showsthedesignandinstallation.Figure7showsthatthecontrollerisdesignedasarectangularbox.Figure8showsthelayoutofeachmodule.Figure9showsthephysicalobjectandinstallationdiagramofthesmartswitchcontroller.Figure6.DesignandinstallationdrawingofconnectingrodpartFigure7.OverallviewofthecontrollerFigure8.SchematicdiagramofeachmoduleinstallationFigure9.PhysicalimageofsmartswitchcontrollerVATmega328P-PUBasedSystemSoftwareDesignThesoftwarepartcompletestheprocessingofthesignalsreceivedbythelightdetectionmoduleandtheBluetoothmodule,andthencontrolsthemechanicalstructuretoswitchthelights.Figure10showsthesystemsoftwareflowchart.Thelightdetectionmodule(theschematicdiagramofthelightdetectionmoduleisshowninFigure11)isusedtodetectchangesinbrightnessanddarknessofthesurroundingenvironment.Whenthesurroundingenvironmentisalwaysinalightstate,thelightdetectioncircuitwillcontinuouslysendalow-levelsignal0tothecentralcontrolmodule;Whenthesurroundingenvironmenthasbeeninadarkstate,thelightdetectioncircuitwillcontinuouslysendahighlevelsignal1tothecentralcontrolmodule.Whenthesurroundingenvironmentchangesfromnolighttolight(judgingthedaybreak),inthiscase,thesystemdoesnotact.Whenthesurroundingenvironmentchangesfromlighttonolight(judgedasamomentofpowerfailure),thelightdetectioncircuitwillstarttosendahighlevelsignal1tothecentralcontrolmodule.Atthemomentoftransition,thecentralcontrolmodulewillcontrolthesystemtoexecuteaworkcycle.Afterturningoffthelight,thesystemwillautomaticallyresetandwaitforthenextchangefromlighttonolight.Becausetheportmemoryofthecentralcontrolmoduleislimited,andthelightdetectioncircuitcontinuouslytransmitsdatatotheport.Thiswillcausethecentralcontrolmoduletorestartinashorttimeduetoexhaustionofmemory,makingthesystemunstableandunreliable.Therefore,aportclearingfunctionisspeciallywrittenwhencompilingthesystemtoensurethattheexpireddatasentbythelightdetectioncircuitisclearedintime.Therebyimprovingthestabilityandreliabilityofthesystem.Figure10.SystemsoftwareflowchartAftertalkingaboutthelightdetectionmodule,howdoestheBluetoothmoduleprocessthereceivedsignaltocontroltheswitch?WecanusemobilephoneAPPandBluetoothmoduletocontrolthesystemtoturnonandoffthelightsthroughwirelesstransmission.WhenthemobilephonesendsthecommandcharacterAtothecentralcontrolmodulethroughtheBluetoothmodule,thesystemwillexecuteacycleofturningoffthelights,andthenautomaticallyreset;Inthesameway,whenthemobilephonesendsthecommandcharacterBtothecentralcontrolmodulethroughtheBluetoothmodule,thesystemexecutesalight-oncommandforaworkingcycle,andthenautomaticallyresets.Figure11.SchematicdiagramofthelightmoduleVIConclusionThesmartswitchlightcontrollerdiscussedinthisbloghassignificantadvantages:*Donotchangethecircuitoftheoriginalpush-typepowerswitch.Therefore,itisnotonlysafe,butalsoeasytodisassembleandassemble;*TurnonandoffthelightsviaBluetoothwirelesscontrol.Therefore,ithasstrongoperability;*Aftercompletingtheswitchlampworkcycle,realizeautomaticreset.Inaddition,whilerealizingautomation,wecanalsomoveourfingerstoeasilyswitchlightsonthebed;*ATmega328P-PUhasgreatdevelopmentpotential.Thereasonforusingitistomeettheneedsofexpandingfunctionsinthefuture.suchas:CooperatewithWIFImodule:canrealizeultra-remotecontrol;Cooperatewithtimer:itcanrealizethefunctionofturningonthelightsatatime.Insummary,theintelligentswitchlightcontrollerbasedonATmega328P-PUweintroducedissimpleandreasonableinstructure,easytoinstall,safe,convenientandefficienttooperate.WiththesmartswitchlightcontrollerofATmega328P-PU,whenwelazilylieonthebedandplaywiththemobilephone,weusethemobilephonetocontrolthelightswitch.Atnight,weareafraidthatweforgettoturnoffthelightswhenwefallasleep,andwedontneedtogetoutofbed.Itcanalsoautomaticallyturnoffthelightswhenitgetsdark.ComponentDatasheetATMEGA328PDatasheetFAQWhatismeantbyATMEGA328P?ATMEGA328Pishighperformance,lowpowercontrollerfromMicrochip.ATMEGA328Pisan8-bitmicrocontrollerbasedonAVRRISCarchitecture.ItisthemostpopularofallAVRcontrollersasitisusedinARDUINOboards.WhatisthedifferencebetweenATMEGA328andATMEGA328P?ATMEGA328PandATMEGA328arethesameeverysensearchitecturally.ATMEGA328PjustconsumeslowerpowerthanATMEGA328,whichmeansthatthe328Pismanufacturedinafinerprocessthanthe328.WhyATMEGA328isusedinArduino?TheATMEGA328/Pisalow-powerCMOS8-bitmicrocontrollerbasedontheAVRenhancedRISC(reducedinstructionsetcomputer)architecture.InOrdertomaximizeperformanceandparallelism,theAVRusesHarvardarchitecturewithseparatememoriesandbusesforprogramanddata.HowdoyoucodeATMEGA328P?IsATMEGA328Pamicrocontroller?TheATMEGA328isasingle-chipmicrocontrollercreatedbyAtmelinthemegaAVRfamily(laterMicrochipTechnologyacquiredAtmelin2016).IthasamodifiedHarvardarchitecture8-bitRISCprocessorcore.CantheATMEGA328PmicrocontrollerbeusedwithouttheArduinoboard?Yes.YoucanuseATMega328Pwithoutarduinoboard....YoucanusearduinoboardwiththeIC.ProgramtheICandthentakeitoutanduseitinyourcircuit.Youwillhavetouse16MHZOscillatorwithcapacitors.HowdoIprogramAtmega328Pwithoutbootloader?ProgrammingAVRWithArduinoAsISPWithoutBootloaderandExternalCrystalStep1:ThingsYouNeed....Step2:UploadArduinoISPCodeonArduinoBoard....Step3:OpenCommandPrompt(inWindowsOS)...Step4:RequiredDownloads.....Step5:InstallationofWinAVR(onlyHelpforWindowsOSIsCoveredforNow)

74LS02

DescriptionTheweatherinthepasttwodayshassuddenlycooleddown,andIforgottoinstallaswitchonthebedside,andIdontwanttogetoutofbedtoturnoffthelightbecauseofthecold.Atthistime,itwouldbenicetohaveanintelligentcontrolswitch.ThisblogintroducesasmartswitchcontrollerbasedonATMEGA328P-PU.Thecontroller,withoutchangingtheexistingswitchesandcircuits,canautomaticallyturnoffthelightsafterapowerfailure.Atthesametime,thewirelesscontrollightswitchfunctioncanalsoberealizedthroughtheBluetoothmodule,andthelightcanbeturnedonandoffwhilelyingdown,andthereisnoneedtogetoutofbed.ATMEGA328P-PUCatalogDescriptionIIntroductionIIATmega328P-PUBasedSystemPricipleIIIATmega328P-PUBasedSystemHardwareDesign3.1Centralcontrolmodule3.2Lightdetectioncircuit3.3BluetoothmoduleIVATmega328P-PUBasedStructureDesignVATmega328P-PUBasedSystemSoftwareDesignVIConclusionComponentDatasheetFAQOrdering&QuantityIIntroductionThesmartswitchlightcontrollerbasedonATmega328P-PUintroducedinthisblogconsistsofthefollowingmodules:LightDetectionModule:Perceivethechangeofindoorlightintensity;BluetoothModule:controlandrealizeautomaticlightswitch;SteeringGearandMechanicalLinkageMechanism:Itcanalsoautomaticallyturnoffthelights.Thecontrollerusestheorganiccombinationofmechatronics,whichisreliableandeasytocontrol.IIATmega328P-PUBasedSystemPricipleTheintelligentswitchlightcontrollersystemismainlycomposedoflightdetectionmodule,Bluetoothmodule,steeringgearandArduinocontrolsystem.Thesystemcontrolprocessisasfollows:Thelightdetectionmoduleperceivestheenvironmentfrombrighttodark;ThelightdetectionmodulesendsthesensedinformationtotheArduino;Arduinoturnsoffthelightingequipmentbycontrollingthesteeringgearaccordingtothisinformation;Or,tocompletetheoperationofturningoffthelights,youcanalsodirectlycontrolitthroughthemobilephoneAPPBluetooth.ThesystemprinciplediagramoftheintelligentswitchlightcontrollerisshowninFigure1.Figure1.SystemschematicdiagramIIIATmega328P-PUBasedSystemHardwareDesign3.1CentralcontrolmoduleThemostwidelyusedmicrocontrollersforthecentralcontrolmoduleareAVRand51microcontrollers.Fromtheperspectiveoffunctionandupgradepotential,theAVR8-bitmicrocontrollerATMEGA328P-PUwasselectedasthecentralcontrolmodule.So,whataretheadvantagesofATMEGA328P-PUcontrolmodule?Whychooseit?ATMEGA328P-PU,asacentralcontrolmodule,hasflexibleI/Oportresourcesandpowerfulfunctions.Itnotonlyhaslowpowerconsumptionbutisreliable,andcanmeettheneedsofsubsequentequipmentupdates.Figure2showstheminimumsystemdiagramofATMEGA328P.Figure2.ATMEGA328Pminimumsystem3.2LightdetectioncircuitHere,thelightdetectioncircuitisafour-wiresystem.TheAOportisananalogsignaloutputport,whichconvertstheexternallightintensityintoacontinuousoutputvoltagevalue.Whenthebrightnessofthelightchanges,howdoestheDOportactasadigitalsignaloutputport?Whentheambientlightbrightnessdoesnotreachthesetthreshold,theDOterminaloutputsahighlevel;Whenthebrightnessoftheambientlightexceedsthesetthreshold,theDOterminaloutputsalowlevel.Becausethesignaloutputbythecircuitisstableandreliable,thecontrollerselectsthedigitalsignaloutputbytheDOportastheinputsignalofthecontrolmodule.Inthisway,thesensitivityandreliabilityofthesystemcanbeimproved.IlluminationdetectioncircuitdiagramshowninFigure3.Figure3.Illuminationdetectioncircuitdiagram3.3BluetoothmoduleThisblogusestheHC-05master-slaveintegratedBluetoothmodule.ItscircuitdiagramisshownasinFig.4.Figure4.BluetoothdetectioncircuitThemoduleadoptsCSRmainstreamBluetoothchip,BluetoothV2.0protocolstandard,andcanworkwith3.3Vlowvoltage.Itischeap,smallinsize,stableinsignal,lowinpower,andcanbeusedinconjunctionwithmobileAPPtorealizewirelesscontrolofthesystem.Inthisdesign,Bluetoothonlyactsasaslave,receivinginstructionsfromthemobilephone.IVATmega328P-PUBasedStructureDesignTakethedormitoryasanexampletodesignthecontrollerfortheswitch(asshowninFigure5).Figure5.PowerswitchAftermeasurement,whentheswitchisintheequilibriumposition,thatis,betweentheclosedandopenpositions,ifthelight-offpositionispressedmorethan2mm,thebuttonwillturnoffthepower.Whenthelight-onpositionispresseddownmorethan2mm,thebuttonwillturnonthepower.Wecandesignalinkmechanismconnectedwiththesteeringgeartomake:Whenthesteeringgearrotatesto180,theconnectingrodpositionisthehighest;Whenthesteeringgearrotatesto0,theconnectingrodpositionislowest.Then,settheinitialpositionofthesteeringgearto90,sothatthebuttonisatthevalueofthebalanceposition.Atthistime,coincidethemiddlepositionoftheT-shapedfixingbracketwiththemiddlepositionofthebutton.Inaddition,inordertofacilitatetherealizationoffunctions,thecentralpositioncanbesetasachute.Figure6showsthedesignandinstallation.Figure7showsthatthecontrollerisdesignedasarectangularbox.Figure8showsthelayoutofeachmodule.Figure9showsthephysicalobjectandinstallationdiagramofthesmartswitchcontroller.Figure6.DesignandinstallationdrawingofconnectingrodpartFigure7.OverallviewofthecontrollerFigure8.SchematicdiagramofeachmoduleinstallationFigure9.PhysicalimageofsmartswitchcontrollerVATmega328P-PUBasedSystemSoftwareDesignThesoftwarepartcompletestheprocessingofthesignalsreceivedbythelightdetectionmoduleandtheBluetoothmodule,andthencontrolsthemechanicalstructuretoswitchthelights.Figure10showsthesystemsoftwareflowchart.Thelightdetectionmodule(theschematicdiagramofthelightdetectionmoduleisshowninFigure11)isusedtodetectchangesinbrightnessanddarknessofthesurroundingenvironment.Whenthesurroundingenvironmentisalwaysinalightstate,thelightdetectioncircuitwillcontinuouslysendalow-levelsignal0tothecentralcontrolmodule;Whenthesurroundingenvironmenthasbeeninadarkstate,thelightdetectioncircuitwillcontinuouslysendahighlevelsignal1tothecentralcontrolmodule.Whenthesurroundingenvironmentchangesfromnolighttolight(judgingthedaybreak),inthiscase,thesystemdoesnotact.Whenthesurroundingenvironmentchangesfromlighttonolight(judgedasamomentofpowerfailure),thelightdetectioncircuitwillstarttosendahighlevelsignal1tothecentralcontrolmodule.Atthemomentoftransition,thecentralcontrolmodulewillcontrolthesystemtoexecuteaworkcycle.Afterturningoffthelight,thesystemwillautomaticallyresetandwaitforthenextchangefromlighttonolight.Becausetheportmemoryofthecentralcontrolmoduleislimited,andthelightdetectioncircuitcontinuouslytransmitsdatatotheport.Thiswillcausethecentralcontrolmoduletorestartinashorttimeduetoexhaustionofmemory,makingthesystemunstableandunreliable.Therefore,aportclearingfunctionisspeciallywrittenwhencompilingthesystemtoensurethattheexpireddatasentbythelightdetectioncircuitisclearedintime.Therebyimprovingthestabilityandreliabilityofthesystem.Figure10.SystemsoftwareflowchartAftertalkingaboutthelightdetectionmodule,howdoestheBluetoothmoduleprocessthereceivedsignaltocontroltheswitch?WecanusemobilephoneAPPandBluetoothmoduletocontrolthesystemtoturnonandoffthelightsthroughwirelesstransmission.WhenthemobilephonesendsthecommandcharacterAtothecentralcontrolmodulethroughtheBluetoothmodule,thesystemwillexecuteacycleofturningoffthelights,andthenautomaticallyreset;Inthesameway,whenthemobilephonesendsthecommandcharacterBtothecentralcontrolmodulethroughtheBluetoothmodule,thesystemexecutesalight-oncommandforaworkingcycle,andthenautomaticallyresets.Figure11.SchematicdiagramofthelightmoduleVIConclusionThesmartswitchlightcontrollerdiscussedinthisbloghassignificantadvantages:*Donotchangethecircuitoftheoriginalpush-typepowerswitch.Therefore,itisnotonlysafe,butalsoeasytodisassembleandassemble;*TurnonandoffthelightsviaBluetoothwirelesscontrol.Therefore,ithasstrongoperability;*Aftercompletingtheswitchlampworkcycle,realizeautomaticreset.Inaddition,whilerealizingautomation,wecanalsomoveourfingerstoeasilyswitchlightsonthebed;*ATmega328P-PUhasgreatdevelopmentpotential.Thereasonforusingitistomeettheneedsofexpandingfunctionsinthefuture.suchas:CooperatewithWIFImodule:canrealizeultra-remotecontrol;Cooperatewithtimer:itcanrealizethefunctionofturningonthelightsatatime.Insummary,theintelligentswitchlightcontrollerbasedonATmega328P-PUweintroducedissimpleandreasonableinstructure,easytoinstall,safe,convenientandefficienttooperate.WiththesmartswitchlightcontrollerofATmega328P-PU,whenwelazilylieonthebedandplaywiththemobilephone,weusethemobilephonetocontrolthelightswitch.Atnight,weareafraidthatweforgettoturnoffthelightswhenwefallasleep,andwedontneedtogetoutofbed.Itcanalsoautomaticallyturnoffthelightswhenitgetsdark.ComponentDatasheetATMEGA328PDatasheetFAQWhatismeantbyATMEGA328P?ATMEGA328Pishighperformance,lowpowercontrollerfromMicrochip.ATMEGA328Pisan8-bitmicrocontrollerbasedonAVRRISCarchitecture.ItisthemostpopularofallAVRcontrollersasitisusedinARDUINOboards.WhatisthedifferencebetweenATMEGA328andATMEGA328P?ATMEGA328PandATMEGA328arethesameeverysensearchitecturally.ATMEGA328PjustconsumeslowerpowerthanATMEGA328,whichmeansthatthe328Pismanufacturedinafinerprocessthanthe328.WhyATMEGA328isusedinArduino?TheATMEGA328/Pisalow-powerCMOS8-bitmicrocontrollerbasedontheAVRenhancedRISC(reducedinstructionsetcomputer)architecture.InOrdertomaximizeperformanceandparallelism,theAVRusesHarvardarchitecturewithseparatememoriesandbusesforprogramanddata.HowdoyoucodeATMEGA328P?IsATMEGA328Pamicrocontroller?TheATMEGA328isasingle-chipmicrocontrollercreatedbyAtmelinthemegaAVRfamily(laterMicrochipTechnologyacquiredAtmelin2016).IthasamodifiedHarvardarchitecture8-bitRISCprocessorcore.CantheATMEGA328PmicrocontrollerbeusedwithouttheArduinoboard?Yes.YoucanuseATMega328Pwithoutarduinoboard....YoucanusearduinoboardwiththeIC.ProgramtheICandthentakeitoutanduseitinyourcircuit.Youwillhavetouse16MHZOscillatorwithcapacitors.HowdoIprogramAtmega328Pwithoutbootloader?ProgrammingAVRWithArduinoAsISPWithoutBootloaderandExternalCrystalStep1:ThingsYouNeed....Step2:UploadArduinoISPCodeonArduinoBoard....Step3:OpenCommandPrompt(inWindowsOS)...Step4:RequiredDownloads.....Step5:InstallationofWinAVR(onlyHelpforWindowsOSIsCoveredforNow)

IDescriptionDS18B20isawidelyuseddigitaltemperaturesensor,anditsoutputisadigitalsignal.DS18B20hasthecharacteristicsofsmallsize,lowhardwareoverhead,stronganti-interferenceabilityandhighprecision.TheDS18B20digitaltemperaturesensoriseasytowireandcanbeusedinmanyoccasionsafterbeingpackaged.Suchaspipe,thread,magnetadsorption,stainlesssteelpackageandsoon.ThisArduinoforbeginnerstutorialwillteachyouhowtoreadtheDS18B201-wiretemperaturesensor.CatalogIDescriptionIIIntroductiontoDS18B202.1DS18B20BasicInformation2.2DS18B20Features2.3DS18B20StructureIIIIntroductiontoComponents3.1Memory3.264-bitLithographyROM3.3ConnectionofExternalPowerSupply3.4ConfigurationRegister3.5TemperatureReadingIVDS18B20WorkingPrincipleVConclusionFAQOrdering&QuantityIIIntroductiontoDS18B202.1DS18B20BasicInformationDS18B20isanimprovedintelligenttemperaturesensornewlylaunchedbyAmericanDALLASSemiconductorafterDS1820.Comparedwiththetraditionalthermistor,DS18B20candirectlyreadthemeasuredtemperatureandcanrealizethe9-12-digitdigitalvaluereadingmodethroughsimpleprogrammingaccordingtoactualrequirements.Itcanalsocomplete9-bitand12-bitdigitalquantitiesin93.75msand750ms,respectively.Moreover,theinformationreadfromtheDS18B20ortheinformationwrittenintotheDS18B20onlyneedsoneportline(single-wireinterface)toreadandwrite,andthetemperatureconversionpowercomesfromthedatabus.ThebusitselfcanalsosupplypowertotheconnectedDS18B20withouttheneedforanadditionalpowersupply.Therefore,theuseofDS18B20canmakethesystemstructuresimplerandmorereliable.DS18B20hasgreatlyimprovedcomparedwithDS1820intermsoftemperaturemeasurementaccuracy,conversiontime,transmissiondistance,andresolution.Itbringsmoreconvenientuseandmoresatisfyingeffectstousers.2.2DS18B20FeaturesUnique1-WireInterfaceRequiresOnlyOnePortPinforCommunicationReduceComponentCountwithIntegratedTemperatureSensorandEEPROMMeasuresTemperaturesfrom-55Cto+125C(-67Fto+257F)0.5CAccuracyfrom-10Cto+85CProgrammableResolutionfrom9Bitsto12BitsNoExternalComponentsRequiredParasiticPowerModeRequiresOnly2PinsforOperation(DQandGND)SimplifiesDistributedTemperature-SensingApplicationswithMultidropCapabilityEachDeviceHasaUnique64-BitSerialCodeStoredinOn-BoardROMFlexibleUser-DefinableNonvolatile(NV)AlarmSettingswithAlarmSearchCommandIdentifiesDeviceswithTemperaturesOutsideProgrammedLimitsAvailablein8-PinSO(150mils),8-PinSOP,and3-PinTO-92Packages2.3DS18B20StructureTheexternalstructureofDS18B20isshowninthefigure1.Amongthem:VDDisthepowerinputterminal;DQisthedigitalsignalinput/outputterminal;GNDisthepowerground.Figure1.DS18B20ExternalStructureTheinternalstructureofDS18B20mainlyincludes4parts:64-bitlithographyROM;Temperaturesensor;Non-volatiletemperaturealarmtriggersTHandTL;Configurationregister.Figure2.DS18B20ExternalStructureInthe64-bitROM,themanufacturerhasa64-bitserialnumberburnedbythemanufacturerbeforetheproductleavesthefactory.TheserialnumbercanberegardedastheaddressserialcodeofDS18B20,usedtodistinguisheachDS18B20.Soastobetterrealizethemulti-pointmeasurementoffieldtemperature.IIIIntroductiontoComponents3.1MemoryThememoryofDS18B20includeshigh-speedscratchpadRAMandelectricallyerasableRAM.TheelectricallyerasableRAMalsoincludestemperaturetriggersTHandTL,andaconfigurationregister.Thememorycancompletelydeterminethecommunicationoftheone-lineport,andthenumberiswrittenintotheregisterwiththecommandofwritingtheregister.Thenyoucanusethereadregistercommandtoconfirmthesenumbers.Afterconfirmation,youcanusethecopyregistercommandtotransferthesenumberstotheelectricallyerasableRAM.Whenthenumberintheregisterismodified,thisprocesscanensuretheintegrityofthenumber.ThescratchpadRAMiscomposedof8bytesofmemory.Theninthbytecanbereadwiththereadregistercommand.Thisbyteistocheckthepreviouseightbytes.3.264-bitLithographyROMFor64-bitlithographyROM:Thefirst8bitsaretheowncodeofDS18B20Thenext48bitsareconsecutivedigitalcodesThelast8bitsaretheCRCcheckofthefirst56bits.The64-bitlithographyROMalsoincludes5ROMfunctioncommands:readROM,matchROM,skipROM,searchROMandalarmsearch.3.3ConnectionofExternalPowerSupplyDS18B20canuseexternalpowerVDDorinternalparasiticpower.WhentheVDDportisconnectedtoavoltageof3.0V-5.5V,anexternalpowersupplyisused.AninternalparasiticpowersupplyisusedwhentheVDDportisgrounded.Inaddition,whetheritisaninternalparasiticpowersupplyoranexternalpowersupply,theI/Oportlineshouldbeconnectedtoapull-upresistorofabout5K.3.4ConfigurationRegisterTheconfigurationregisteristoconfiguredifferentdigitstodeterminethetemperatureanddigitalconversion.ItcanbeknownthatR1andR0arethedeterminingbitsoftemperature.DifferentcombinationsofR1andR0canbeconfiguredas9-digit,10-digit,11-digit,and12-digittemperaturedisplay.Inthisway,theconversiontimecorrespondingtodifferenttemperatureconversionpositionscanbeknown.Theresolutionsofthefourconfigurationsare0.5C,0.25C,0.125Cand0.0625C,respectively,andareconfiguredto12bitsatthefactory.3.5TemperatureReadingDS18B20isconfiguredas12bitsatthefactory,and16bitsarereadwhenreadingtemperature.Thefirst5bitsaresignbits.Whenthefirst5digitsare1,thetemperaturereadisanegativenumber;whenthecurrent5digitsare0,thetemperaturereadisapositivenumber.Themethodofreadingwhenthetemperatureispositiveis:justconvertthehexadecimalnumbertodecimal.Whenthetemperatureisnegative,thereadingmethodis:invertthehexadecimalnumber,thenadd1onthisbasis,andthenconverttodecimal.Example:0550H=+85degrees,FC90H=-55degrees.IVDS18B20WorkingPrincipleThereadandwritesequenceandtemperaturemeasurementprincipleofDS18B20arethesameasDS1820.Onlythenumberofdigitsofthetemperaturevalueobtainedvarieswiththeresolution.Andthedelaytimeduringtemperatureconversionisreducedfrom2sto750ms.ThetemperaturemeasurementprincipleofDS18B20isshowninFigure3.Figure3.DS18B20TemperatureMeasurementPrincipleDiagramTheoscillationfrequencyofthecrystaloscillatorwithlowtemperaturecoefficientinthepictureislittleaffectedbytemperature.Itisusedtogenerateafixedfrequencypulsesignalandsendittothesubtractioncounter1.Thehightemperaturecoefficientcrystaloscillatorchangesitsoscillationfrequencysignificantlywithtemperaturechanges.Atthesametime,thegeneratedsignalisusedasthepulseinputofthesubtractioncounter2.Thefigurealsoimpliesacountinggate.Whenthecountinggateisopened,DS18B20countstheclockpulsesgeneratedbythelowtemperaturecoefficientoscillatortocompletethetemperaturemeasurement.Theopeningtimeofthecountinggateisdeterminedbythehightemperaturecoefficientoscillator.Beforeeachmeasurement,firstputthebasecorrespondingto-55℃intothesubtractioncounter1andthetemperatureregisterrespectively.Thesubtractioncounter1andthetemperatureregisterarepresettoabasevaluecorrespondingto-55℃.Thesubtractioncounter1subtractsthepulsesignalgeneratedbythelowtemperaturecoefficientcrystaloscillator.Whenthepresetvalueofthesubtractioncounter1isreducedto0,thevalueofthetemperatureregisterwillincreaseby1,thepresetofthesubtractioncounter1willbereloaded,andthesubtractioncounter1willrestartcountingthepulsesignalsgeneratedbythelowtemperaturecoefficientcrystaloscillator.Thisloopuntilthesubtractioncounter2countsto0,stoptheaccumulationofthetemperatureregistervalue.Thevalueinthetemperatureregisteristhemeasuredtemperatureatthistime.Figure4.DS18B20Theslopeaccumulatorisusedtocompensateandcorrectthenonlinearityinthetemperaturemeasurementprocess,anditsoutputisusedtocorrectthepresetvalueofthesubtractioncounter.Aslongasthecountinggateisnotclosed,repeattheaboveprocessuntilthetemperatureregistervaluereachesthemeasuredtemperaturevalue.ThisisthetemperaturemeasurementprincipleofDS18B20.Inaddition,becausetheDS18B20single-wirecommunicationfunctioniscompletedintimesharing,ithasastrictconceptoftimeslots.Therefore,thereadandwritetimingisveryimportant.VariousoperationsofthesystemtoDS18B20mustbecarriedoutaccordingtotheagreement.Theoperatingprotocolis:initializeDS18B20(sendresetpulse)sendROMfunctioncommandsendmemoryoperationcommandprocessdata.ThetimingdiagramofvariousoperationsisthesameasthatofDS1820.VConclusionInconclusion,thisblogsummarizesthefollowing3aspectsofDS1820:Features,structureandworkingprinciple.DS1820mainlychangesitsappearanceaccordingtodifferentapplications.ThepackagedDS18B20canbeusedinvariousnon-limitingtemperatureapplications.Includingcabletrenchtemperaturemeasurement,blastfurnacewatercirculationtemperaturemeasurement,boilertemperaturemeasurement,machineroomtemperaturemeasurement,agriculturalgreenhousetemperaturemeasurement,cleanroomtemperaturemeasurement,ammunitionstoragetemperaturemeasurement,etc.Inaddition,DS1820isabrasion-resistantandimpact-resistant,smallinsize,easytouse,anddiverseinpackaging,suitablefordigitaltemperaturemeasurementandcontrolofvariousnarrowspaceequipment.FAQWhatisDS18B20temperaturesensor?TheDS18B20isa1-wireprogrammabletemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.HowdoestheDS18B20work?Itworksontheprincipleofdirectconversionoftemperatureintoadigitalvalue.IsDS18B20athermistor?Athermistorisathermalresistor-aresistorthatchangesitsresistancewithtemperature....Thermistorshavesomebenefitsoverotherkindsoftemperaturesensorssuchasanalogoutputchips(LM35/TMP36)ordigitaltemperaturesensorchips(DS18B20)orthermocouples.HowaccurateisDS18B20?TheDS18B20readswithanaccuracyof0.5Cfrom-10Cto+85Cand2Caccuracyfrom-55Cto+125C.Whatisds1820?TheDS18B20isonetypeoftemperaturesensoranditsupplies9-bitto12-bitreadingsoftemperature....Thecommunicationofthissensorcanbedonethroughaone-wirebusprotocolwhichusesonedatalinetocommunicatewithaninnermicroprocessor.HowdoIconnectmyDS18B20tomyRaspberryPi?OnceyouveconnectedtheDS18B20,powerupyourPiandlogin,thenfollowthesestepstoenabletheOne-Wireinterface:1.Atthecommandprompt,entersudonano/boot/config.txt,thenaddthistothebottomofthefile:2.dtoverlay=w1-gpio.3.ExitNano,andrebootthePiwithsudoreboot.WhatistheworkingprincipleofDS18B20?TheDS18B20DigitalThermometerprovides9to12-bit(configurable)temperaturereadingswhichindicatethetemperatureofthedevice.Itcommunicatesovera1-Wirebusthatbydefinitionrequiresonlyonedataline(andground)forcommunicationwithacentralmicroprocessor.Inadditionitcanderivepowerdirectlyfromthedataline(parasitepower),eliminatingtheneedforanexternalpowersupply.ThecorefunctionalityoftheDS18B20isitsdirect-to-digitaltemperaturesensor.Theresolutionofthetemperaturesensorisuser-configurableto9,10,11,or12bits,correspondingtoincrementsof0.5C,0.25C,0.125C,and0.0625C,respectively.Thedefaultresolutionatpower-upis12-bit.WheretouseDS18B20Sensor?TheDS18B20isa1-wireprogrammableTemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.Itcanmeasureawiderangeoftemperaturefrom-55Cto+125withadecentaccuracyof5C.EachsensorhasauniqueaddressandrequiresonlyonepinoftheMCUtotransferdatasoitaverygoodchoiceformeasuringtemperatureatmultiplepointswithoutcompromisingmuchofyourdigitalpinsonthemicrocontroller.HowconnectDS18B20toArduino?FirstplugthesensoronthebreadboardtheconnectitspinstotheArduinousingthejumpersinthefollowingorder:pin1toGND;pin2toanydigitalpin(pin2inourcase);pin3to+5Vor+3.3V,attheendputthepull-upresistor.OnanATMega328P,whyisaDS18B20temperaturesensorreturningincorrecttemperaturevalues?Severalpossibilities:1.Ifitisjustreadingalittlehigh,itmightbecausedbyselfheating.Addaheatsinkand/ormakemeasurementslessfrequently.2.Especiallyifthevaluesarereallywhacky,itmightbecodewitherrorsormis-wiring.Useapublishedsketchtocheckoperation.3.TheDS18B20mightbedefective.Tryanother.4.Itsaccurateto0.5C.Areyouexpectingittobemoreaccurate(likedowntotheLSBofthereadvalue)?IDescriptionInthisblog,wewillintroduceamultifunctionalelectronicthermometer.Thiskindofthermometercannotonlyaccuratelyandconvenientlymeasurebodytemperatureandfoodtemperature,butalsocanbeusedtomeasureindoorandoutdoortemperature,refrigeratortemperature,etc.Inaddition,italsohasmultiplefunctionssuchastemperaturemeasurementtiming,temperaturememory,soundprompt,backlightdisplay,andautomaticshutdown.Moreover,ithasthecharacteristicsofaccuratemeasurement,simpleoperation,portabilityandlowprice.Therefore,itcanbewidelyusedinhospitalsandhomesasageneraltemperaturemeasuringinstrument.Intermsofitsworkingprinciple,thethermometerusesthedigitaltemperaturesensorDS18B20todetecttemperatureandtransmitsthedigitaltemperaturesignaltothesingle-chipmicrocomputer.Thetemperaturevalueandmeasurementtimecalculatedandcorrectedbythesingle-chipmicrocomputeraredisplayedinrealtimebytheliquidcrystaldisplay.AtutorialonhowtousetheDallasMaxim1-WireDS18B20digitaltemperaturesensorwiththeArduino.CatalogIDescriptionIIDS18B20IntroductionIIIHardwareCircuit3.1PowerCircuit3.2DigitalTemperatureSensorandCalibration3.3MCUCircuit3.4LCDDisplay3.5AudioCircuitIVSoftwareDesignVConclusionFAQOrdering&QuantityIIDS18B20IntroductionDS18B20isasingle-wiredigitaltemperaturesensorproducedbyDALLAS.Itintegratestemperaturesensing,signalconversion,A/Dconversionandheatingfunctionsintoonechip,andbelongstoanewgenerationofintelligentdigitaltemperaturesensorswithmicroprocessors.DS18B20hasatotalof3pins,(respectivelydigitalsignalinput/output,ground,powersupply),usingTO-92small-volumepackaging.DS18B20MainSpecifications:Thetemperaturemeasurementrangeis-55℃~+125℃;Programmableto9to12bitA/Dconversionaccuracy;Thetemperaturemeasurementresolutioncanreach0.0625℃,andtheerroris0.5℃;Theworkingpowersupplycanbeintroducedattheremoteend(3-wireworkingmode)orgeneratedbyparasiticpowersupply(2-wireworkingmode);Themeasuredtemperatureisseriallyoutputwithasign-extended16-bitdigitalquantity;Eachsensorhasaunique64-bitserialnumber,whichisstoredintheROMofthesensor;Thesensoralsohastwotemperatureupperandlowerlimitstorageunits.IIIHardwareCircuitThemultifunctionalelectronicthermometerismainlycomposedofthefollowingparts:PowercircuitDigitaltemperaturesensorSinglechipcomputerLCDMonitorAudiocircuit...ItshardwarecircuitschematicdiagramisshownasinFig.1.Figure1.HardwareCircuit(rightclicktoviewbigpicture)3.1PowerCircuitU1isthemicropowerconsumptionstep-downDC/DCconverterLT3470introducedbyLinearTechnology.Here,U1convertsthe9Vdrybatteryvoltageinto5VDCvoltagetopowertheentirecircuit.So,howtostartandshutdownautomatically?WeonlyneedtopressthestartbuttonS2.Afterstarting,pin1(SHDN)ofU1getsahighlevel,pin5ofU1outputsa5VstableDCvoltage,andthethermometerstartstoworkatthistime.Then,the14-pin(P1.2)oftheone-chipcomputeroutputsahighlevelthroughD2tokeepthe1pinofU1high.When6minutesareup,the14-pinofthesingle-chipmicrocomputeroutputsalowlevel,andthe1pinofU1becomesalowlevel,andthecircuitautomaticallypowersdown.3.2DigitalTemperatureSensorandCalibrationThedigitaltemperaturesensorDS18B20isusedasatemperaturemeasuringprobetocollecttemperaturesignals.Andthedigitizedtemperaturesignalisinputthroughthe19-pin(P1.7)ofthemicrocontroller.DS18B20adopts2-wireworkingmode,andtheworkingpowerisgeneratedbyparasiticpower.Forexample,usethisthermometertomeasurethetemperatureofababy.Wecanfixthetemperatureprobeonaspecialbandageandtieittothearm.Sothatthesensorislocatedunderthearmpit.Inthisway,itcanbeavoidedthatthetemperaturemeasuringprobeisdetachedfromthetestsite.Duetoinfantactivitiesorcryingwhenmeasuringthebodytemperatureoftheinfant,andthemeasurementisconvenient.Foranotherexample,thetemperatureprobecanalsomeasureindoorandoutdoortemperature,refrigeratortemperature,etc.Thespecialprobeformeasuringfoodtemperatureadoptsnon-toxicstrawandnon-toxicsilicagelpackage,whichiseasytoclean.SinceDS18B20isintherangeof-10℃~85℃,itsmeasurementerroris0.5℃.Inordertoaccuratelymeasurebodytemperature,thisblogusesaself-madeconstanttemperaturewaterbathsystemtodeterminethetemperaturecurveofeachsensor.WecancalibratetheDS18B20accordingtothetemperaturecurvetomakethemeasurementerrorwithintherangeof25℃~50℃be0.1℃.3.2.1ConstantTemperatureWaterBathSystemTheconstanttemperaturewaterbathsystemconsistsofthefollowingthreeparts:anelectriccookerwithheatpreservation,acylindricalcopperbodywithgoodheatconduction,andanautomatictemperaturecontroller.Weneedtomake50roundholeswithadiameterof5mmandaheightof30mmonacylindricalcopperbodywithadiameterof120mmandaheightof80mm.Inthisway,thetemperaturesensorcanbefixedandthetemperatureofallthesensorsinthecopperbodycanbekeptconsistent.Putthecylindricalcopperbodyintotheelectriccooker,andadddistilledwatertosubmergethecopperbody.3.2.2DS18B20ActualTemperatureCurveMeasurementInsertmultipleencapsulatedsensorstobetested(nomorethan49)intothesmallholesofthecopperbodyoftheconstanttemperaturewaterbath;Insertthehigh-precisiondigitalthermometerintothesmallholeofthecopperbodytoaccuratelymeasurethecurrenttemperature;Thewiresofallsensorsareledoutthroughtheuppercoverholeoftheelectriccookerandconnectedtotheuppercomputer.Covertheelectriccookerwithheatpreservationmaterial;Turnonthepower,changethetemperaturesettingoftheautomaticthermostat,andcontrolthetemperatureoftheconstanttemperaturewaterbath;Monitorthetemperaturevalueofthedigitalthermometer.Wheneverthespecifiedtemperaturevalueisreached,starttheuppercomputertemperaturemeasurementprogramandsimultaneouslymeasurethecurrenttemperatureofallthesensorstobetested;From25℃~60℃,measure1setofdataevery5℃,andautomaticallygeneratetheactualtemperaturecurveofeachsensor.3.2.3CorrectionofDS18B20Byanalyzingthemeasuredtemperaturecurveofthesensor,wecanfindthatwithintherangeof25℃~50℃,theerroris-0.1℃~-0.3℃.Inthedesignofthisblog,thecurrenttemperaturevalueofDS18B20plus0.2℃isusedastheactualmeasuredtemperature,sothatthemeasurementerrorintherangeof25℃~50℃isreducedto0.1℃.3.3MCUCircuitThemicrocontroller(U2)isthecorecomponentofthethermometer.Ithasthefollowingfunctions:Temperaturesignalreading,processingcalculation,correctionTemperaturemeasurementtimingTemperaturememorySoundprompt,Automaticshutdown...ThisdesignadoptsAT89C2051single-chipmicrocomputerproducedbyAmericanATMELcompany.Itisabuilt-inflashmemorymicrocontrollerthatisfullycompatiblewiththeMCS-51series,withonly20pins.Itisthemostcompact,smallest,andcheapestFlashROMmicrocontrollerintheAT89C51series.Providesthefollowingstandardfunctions:An8-bitCPU;2kBflashmemory;128bytesRAM;Two16-bittimers;Acomplete8-bitbidirectionalI/Oport;5interruptsources.Afterstartingthethermometer,themicrocontrollerstartsaninternaltimertorecordthetemperaturemeasurementtime.ItalsoreadsthedigitaltemperaturesignalsentbyDS18B20,processesandcorrectsittoobtainthereal-timetemperaturevalue.ThetemperaturevalueandtemperaturemeasurementtimearesenttotheLCDdisplayviaserialcommunicationviapin1(P3.0)andpin2(P3.1);Whenthetemperaturemeasurementtimereaches5minutes,thecurrenttemperaturevalueisautomaticallyregistered,andpin11outputsalowleveltocontroltheaudiocircuittogiveasoundprompt;Whenthetemperaturemeasurementtimereaches6minutes,thesingle-chip14pinoutputslowlevel,andthethermometerisautomaticallypoweredoff.3.4LCDDisplayThisblogusesa3andahalfliquidcrystaldisplay(LCD)todisplaytemperatureandtemperaturemeasurementtime.Thedisplayhasthefollowingcharacteristics:Useglassencapsulation;Thereare5pinsintotal;SerialcommunicationWith3andahalfdisplayareaand℃unitdisplay;Functionwithbacklight;Thepowersupplyvoltagerangeis2V~5V.Thisdesignusesthemaindisplayareatoindicatethetemperature,andthesub-displayareatoindicatethetemperaturemeasurementtime.3.5AudioCircuitTheaudiocircuitconsistsofthefollowingparts:TransistorQ2(9015)resistanceR12;CapacitanceC12;BuzzerB1;Whenthepin11ofthesingle-chipmicrocomputeroutputslowlevel,thetransistorQ2issaturatedandturnedon,andthebuzzergeneratesanaudibleprompt.IVSoftwareDesignTheprogramiswrittenin89C51seriesClanguageanddebuggedonthesingle-chipsimulationsystem.TheprogramflowchartisshowninFigure2.Figure2.BlockDiagramofMainProgramAfterpower-onreset,initializetheDS18B20,inputandoutputports,timers,etc.ReadthetemperaturevalueofthelastmeasurementandstoragefromthelowertemperaturelimitstorageunitofDS18B20anddisplayitfor3seconds.StarttheinternaltimerT0ofthemicrocontrollertorecordthetemperaturemeasurementtime.Obtainthetemperaturevalueandcorrecttheerror.AccordingtothecommunicationprotocolofDS18B20,thetemperaturesignalisreadfromthesensor,thesignisdistinguished,andthetemperaturevalueisobtainedaftercalculationandprocessing.Then,add0.2Ctothetemperaturevalueastheactualtemperature,andcorrectthemeasurementerrorwithintherangeof25Cto50Cto0.1C.Displayoftemperature.Accordingtothecommunicationprotocoloftheliquidcrystaldisplay,thetemperaturevalueandtemperaturemeasurementtimearesenttothedisplayfordisplay.Themaindisplayareaindicatesthetemperature,andthesecondarydisplayareaindicatesthetemperaturemeasurementtime.Whenthetemperaturemeasurementtimereaches5minutes,the11-pinofthesingle-chipmicrocomputeroutputsalow-levelcontrolaudiocircuittoemitapromptsound,andthecurrenttemperatureissenttothelowertemperaturestorageunitofDS18B20forregistration,andsenttothesecondarydisplayareafordisplay.Whenthetemperaturemeasurementtimereaches6minutes,the14-pinofthesingle-chipmicrocomputeroutputslowlevel,andthethermometerautomaticallypowersdown.VConclusionComparedwithtraditionalthermometers,theDS18B20Multi-functionElectronicThermometerdesignedinthisbloghasmanyadvantages.Thelatterovercomesthedifficultyofreadingmercurythermometersandiseasytobebrokenandpollutetheenvironment.Atthesametime,comparedwithsimpleelectronicthermometers,multifunctionalelectronicthermometersalsoovercometheshortcomingsofpoormeasurementaccuracy.Becauseofitscompletefunctions,stableperformance,smallsize,lightweight,lowpowerconsumption,andlowprice,itcanbeusedasageneraltemperaturemeasuringinstrumentandwidelyusedinhospitalsandhomes.FAQWhatisDS18B20temperaturesensor?TheDS18B20isa1-wireprogrammabletemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.HowdoestheDS18B20work?Itworksontheprincipleofdirectconversionoftemperatureintoadigitalvalue.IsDS18B20athermistor?Athermistorisathermalresistor-aresistorthatchangesitsresistancewithtemperature....Thermistorshavesomebenefitsoverotherkindsoftemperaturesensorssuchasanalogoutputchips(LM35/TMP36)ordigitaltemperaturesensorchips(DS18B20)orthermocouples.HowaccurateisDS18B20?TheDS18B20readswithanaccuracyof0.5Cfrom-10Cto+85Cand2Caccuracyfrom-55Cto+125C.Whatisds1820?TheDS18B20isonetypeoftemperaturesensoranditsupplies9-bitto12-bitreadingsoftemperature....Thecommunicationofthissensorcanbedonethroughaone-wirebusprotocolwhichusesonedatalinetocommunicatewithaninnermicroprocessor.HowdoIconnectmyDS18B20tomyRaspberryPi?OnceyouveconnectedtheDS18B20,powerupyourPiandlogin,thenfollowthesestepstoenabletheOne-Wireinterface:1.Atthecommandprompt,entersudonano/boot/config.txt,thenaddthistothebottomofthefile:2.dtoverlay=w1-gpio.3.ExitNano,andrebootthePiwithsudoreboot.WhatistheworkingprincipleofDS18B20?TheDS18B20DigitalThermometerprovides9to12-bit(configurable)temperaturereadingswhichindicatethetemperatureofthedevice.Itcommunicatesovera1-Wirebusthatbydefinitionrequiresonlyonedataline(andground)forcommunicationwithacentralmicroprocessor.Inadditionitcanderivepowerdirectlyfromthedataline(parasitepower),eliminatingtheneedforanexternalpowersupply.ThecorefunctionalityoftheDS18B20isitsdirect-to-digitaltemperaturesensor.Theresolutionofthetemperaturesensorisuser-configurableto9,10,11,or12bits,correspondingtoincrementsof0.5C,0.25C,0.125C,and0.0625C,respectively.Thedefaultresolutionatpower-upis12-bit.WheretouseDS18B20Sensor?TheDS18B20isa1-wireprogrammableTemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.Itcanmeasureawiderangeoftemperaturefrom-55Cto+125withadecentaccuracyof5C.EachsensorhasauniqueaddressandrequiresonlyonepinoftheMCUtotransferdatasoitaverygoodchoiceformeasuringtemperatureatmultiplepointswithoutcompromisingmuchofyourdigitalpinsonthemicrocontroller.HowconnectDS18B20toArduino?FirstplugthesensoronthebreadboardtheconnectitspinstotheArduinousingthejumpersinthefollowingorder:pin1toGND;pin2toanydigitalpin(pin2inourcase);pin3to+5Vor+3.3V,attheendputthepull-upresistor.OnanATMega328P,whyisaDS18B20temperaturesensorreturningincorrecttemperaturevalues?Severalpossibilities:1.Ifitisjustreadingalittlehigh,itmightbecausedbyselfheating.Addaheatsinkand/ormakemeasurementslessfrequently.2.Especiallyifthevaluesarereallywhacky,itmightbecodewitherrorsormis-wiring.Useapublishedsketchtocheckoperation.3.TheDS18B20mightbedefective.Tryanother.4.Itsaccurateto0.5C.Areyouexpectingittobemoreaccurate(likedowntotheLSBofthereadvalue)?

74LS02

DescriptionDS18B20isatemperaturesensorofMaxim.Thesingle-chipmicrocomputercancommunicatewithDS18B20through1-Wireprotocolandfinallyreadthetemperature.Thehardwareinterfaceofthe1-Wirebusisverysimple,justconnectthedatapinofDS18B20toanIOportofthemicrocontroller.ThisVideoIntroducesDS18B20withDatasheetCatalogDescriptionDocumentandMediaDS18B20PinoutParametersAdvantageFeaturesApplicationsDS18B20CircuitSchematicDS18B20TemperatureSensorDataDS18B20BlockDiagramHowtousetheDS18B20SensorWheretouseDS18B20SensorProductManufacturerFAQOrdering&QuantityDocumentandMediaComponentDatasheetDS18B20DatasheetDS18B20PinoutPinNameFunctionSOSOPTO-921,2,6,7,82,3,5,6,7-N.C.NoConnection383VDDOptionalVDD.VDDmustbegroundedforoperationinparasitepowermode.412DQDataInput/Output.Open-drain1-Wireinterfacepin.Alsoprovidespowertothedevicewhenusedinparasitepowermode(seethePoweringtheDS18B20section.)541GNDGroundParametersAccuracy(C)0.5ChannelsOneInterface1-WireMultiDroppableYesOper.Temp.(C)-55to+125Package/PinsSOIC(N)/8,TO92/3,UMAX/8ParasitePwr.YesPartNumberDS18B20SensorTypeLocalTemp.Resolution(bits)9,10,11,12Temp.Thresh.Programmable(NV)AdvantageTheDS18B20digitalthermometerprovides9-bitto12-bitCelsiustemperaturemeasurementsandhasanalarmfunctionwithnonvolatileuser-programmableupperandlowertriggerpoints.TheDS18B20communicatesovera1-Wirebusthatbydefinitionrequiresonlyonedataline(andground)forcommunicationwithacentralmicroprocessor.Inaddition,theDS18B20canderivepowerdirectlyfromthedataline(parasitepower),eliminatingtheneedforanexternalpowersupply.EachDS18B20hasaunique64-bitserialcode,whichallowsmultipleDS18B20stofunctiononthesame1-Wirebus.Thus,itissimpletouseonemicroprocessortocontrolmanyDS18B20sdistributedoveralargearea.ApplicationsthatcanbenefitfromthisfeatureincludeHVACenvironmentalcontrols,temperaturemonitoringsystemsinsidebuildings,equipment,ormachinery,andprocessmonitoringandcontrolsystems.FeaturesUnique1-WireInterfaceRequiresOnlyOnePortPinforCommunicationReduceComponentCountwithIntegratedTemperatureSensorandEEPROMMeasuresTemperaturesfrom-55Cto+125C(-67Fto+257F)0.5CAccuracyfrom-10Cto+85CProgrammableResolutionfrom9Bitsto12BitsNoExternalComponentsRequiredParasiticPowerModeRequiresOnly2PinsforOperation(DQandGND)SimplifiesDistributedTemperature-SensingApplicationswithMultidropCapabilityEachDeviceHasaUnique64-BitSerialCodeStoredinOn-BoardROMFlexibleUser-DefinableNonvolatile(NV)AlarmSettingswithAlarmSearchCommandIdentifiesDeviceswithTemperaturesOutsideProgrammedLimitsAvailablein8-PinSO(150mils),8-PinSOP,and3-PinTO-92PackagesApplicationsConsumerProductsIndustrialSystemsThermallySensitiveSystemsThermometersThermostaticControlsDS18B20CircuitSchematicDS18B20TemperatureSensorDataDS18B20canachievethehighest12-bittemperaturestoragevaluethroughprogramming.Thetemperaturestoragevalueisstoredintheregisterinacomplementformat.Thereare2bytesintotal,LSBisthelowbyteandMSBisthehighbyte.Amongthem,MSbisthehighbitofthebyte,andLSbisthelowbitofthebyte.Forbinarynumbers,themeaningofthetemperaturerepresentedbyeachofthemisexpressed.Amongthem,Srepresentsthesignbit,andthelower11bitsareallpowersof2,whichareusedtorepresentthefinaltemperature.ThetemperaturemeasurementrangeofDS18B20isfrom-55degreesto+125degrees.Themanifestationoftemperaturedatahaspositiveandnegativetemperatures.Eachnumberintheregisterisdistributedlikethescaleofacaliper.Thelowestbitofthebinarynumberchanges1,whichrepresentsthemappingrelationshipofatemperaturechangeof0.0625degrees.Whenthetemperatureis0℃,thecorrespondinghexadecimalnumberis0x0000.Whenthetemperatureis125℃,thecorrespondinghexadecimalnumberis0x07D0.Whenthetemperatureisminus55℃,thecorrespondinghexadecimalnumberis0xFC90.Conversely,whenthenumberis0x0001,thetemperatureis0.0625℃.DS18B20BlockDiagramHowtousetheDS18B20SensorThesensorworkswiththemethodof1-Wirecommunication.Itrequiresonlythedatapinconnectedtothemicrocontrollerwithapullupresistorandtheothertwopinsareusedforpowerasshownbelow.Thepull-upresistorisusedtokeepthelineinhighstatewhenthebusisnotinuse.Thetemperaturevaluemeasuredbythesensorwillbestoredina2-byteregisterinsidethesensor.Thisdatacanbereadbytheusingthe1-wiremethodbysendinginasequenceofdata.Therearetwotypesofcommandsthataretobesenttoreadthevalues,oneisaROMcommandandtheotherisfunctioncommand.TheaddressvalueofeachROMmemoryalongwiththesequenceisgiveninthedatasheetbelow.Youhavetoreadthroughittounderstandhowtocommunicatewiththesensor.IfyouareplanningtointerfaceitwithArduino,thenyouneednotworryaboutallthese.Youcandevelopthereadilyavailablelibraryandusethein-builtfunctionstoaccessthedata.WheretouseDS18B20SensorTheDS18B20isa1-wireprogrammableTemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.Itcanmeasureawiderangeoftemperaturefrom-55Cto+125withadecentaccuracyof5C.EachsensorhasauniqueaddressandrequiresonlyonepinoftheMCUtotransferdatasoitaverygoodchoiceformeasuringtemperatureatmultiplepointswithoutcompromisingmuchofyourdigitalpinsonthemicrocontroller.ProductManufacturerMaximIntegratedprovideseaseofdesign,andspeedstimetomarket,throughanalogintegration.ThecompanysanalogICsofferextrafeaturesandfunctionalitycarefullydesignedtostreamlinecircuitandsimplifydesign.LooktoMaximforsolutionsforconsumerelectronics,personalcomputersandperipherals,mobiledevices,wirelessandfibercommunications,testequipment,instrumentation,videodisplays,andautomotiveapplications.Maximsanalogandmixed-signalsolutionsincludedataconverters,interfacecircuits,power,RFwirelesscircuits,clocksandoscillators,microcontrollers(MCUs),operationalamplifiers(opamps),andsensors.FAQWhatisDS18B20temperaturesensor?TheDS18B20isa1-wireprogrammabletemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.HowdoestheDS18B20work?Itworksontheprincipleofdirectconversionoftemperatureintoadigitalvalue.IsDS18B20athermistor?Athermistorisathermalresistor-aresistorthatchangesitsresistancewithtemperature....Thermistorshavesomebenefitsoverotherkindsoftemperaturesensorssuchasanalogoutputchips(LM35/TMP36)ordigitaltemperaturesensorchips(DS18B20)orthermocouples.HowaccurateisDS18B20?TheDS18B20readswithanaccuracyof0.5Cfrom-10Cto+85Cand2Caccuracyfrom-55Cto+125C.Whatisds1820?TheDS18B20isonetypeoftemperaturesensoranditsupplies9-bitto12-bitreadingsoftemperature....Thecommunicationofthissensorcanbedonethroughaone-wirebusprotocolwhichusesonedatalinetocommunicatewithaninnermicroprocessor.HowdoIconnectmyDS18B20tomyRaspberryPi?OnceyouveconnectedtheDS18B20,powerupyourPiandlogin,thenfollowthesestepstoenabletheOne-Wireinterface:1.Atthecommandprompt,entersudonano/boot/config.txt,thenaddthistothebottomofthefile:2.dtoverlay=w1-gpio.3.ExitNano,andrebootthePiwithsudoreboot.WhatistheworkingprincipleofDS18B20?TheDS18B20DigitalThermometerprovides9to12-bit(configurable)temperaturereadingswhichindicatethetemperatureofthedevice.Itcommunicatesovera1-Wirebusthatbydefinitionrequiresonlyonedataline(andground)forcommunicationwithacentralmicroprocessor.Inadditionitcanderivepowerdirectlyfromthedataline(parasitepower),eliminatingtheneedforanexternalpowersupply.ThecorefunctionalityoftheDS18B20isitsdirect-to-digitaltemperaturesensor.Theresolutionofthetemperaturesensorisuser-configurableto9,10,11,or12bits,correspondingtoincrementsof0.5C,0.25C,0.125C,and0.0625C,respectively.Thedefaultresolutionatpower-upis12-bit.WheretouseDS18B20Sensor?TheDS18B20isa1-wireprogrammableTemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.Itcanmeasureawiderangeoftemperaturefrom-55Cto+125withadecentaccuracyof5C.EachsensorhasauniqueaddressandrequiresonlyonepinoftheMCUtotransferdatasoitaverygoodchoiceformeasuringtemperatureatmultiplepointswithoutcompromisingmuchofyourdigitalpinsonthemicrocontroller.HowconnectDS18B20toArduino?FirstplugthesensoronthebreadboardtheconnectitspinstotheArduinousingthejumpersinthefollowingorder:pin1toGND;pin2toanydigitalpin(pin2inourcase);pin3to+5Vor+3.3V,attheendputthepull-upresistor.OnanATMega328P,whyisaDS18B20temperaturesensorreturningincorrecttemperaturevalues?Severalpossibilities:1.Ifitisjustreadingalittlehigh,itmightbecausedbyselfheating.Addaheatsinkand/ormakemeasurementslessfrequently.2.Especiallyifthevaluesarereallywhacky,itmightbecodewitherrorsormis-wiring.Useapublishedsketchtocheckoperation.3.TheDS18B20mightbedefective.Tryanother.4.Itsaccurateto0.5C.Areyouexpectingittobemoreaccurate(likedowntotheLSBofthereadvalue)?IDescriptionFirst,thisblogwillintroducethe1wiredigitaltemperaturesensorDS18B20.Wemainlyintroduceitsstructure,characteristicsandworkingprinciplehere.Second,wewillintroduceatemperaturemeasurementsystembasedonDS18B20andAT89S52microcontroller.Herewemainlyintroduceitshardwarestructureandassembler.Third,therewillbepartofthesourceprogramthatisdetailedanalyed.Finally,theblogalsoexplainshowitperformstemperaturemeasurementintheagriculturalfield.Thetemperaturemeasuringdevicehasaseriesofadvantages.Suchas:highdisplayaccuracy,lowprice,simplestructure,convenientexpansionandwideapplication.DS18B20TemperatureSensorTutorialCatalogIDescriptionIIIntroductionIIIDS18B20Overview3.1DS18B20Advantages3.2DS18B20Features3.3DS18B20InternalStructureIVDS18B20MCUTemperatureMeasurementDevice4.1CompositionofSystemHardware4.2DesignofInterfaceVSoftwareDesignVIApplicationinAgriculturalProduction6.1TemperatureofMildew6.2TemperatureofAgriculturalProducts6.3TemperatureDetectioninGreenhouses6.4TemperatureofSoilVIIConclusionFAQOrdering&QuantityIIIntroductionWhatistemperature?Whataretherolesoftemperature?Temperatureisaphysicalquantitythatcharacterizesthedegreeofcoolingofanobject,anditisalsoabasicenvironmentalparameter.Inagro-industrialproductionanddailylife,themeasurementandcontroloftemperaturealwaysoccupyanextremelyimportantposition.Atpresent,atypicaltemperaturemeasurementandcontrolsystemconsistsofthefollowingparts:Analogtemperaturesensor;A/Dconversioncircuit;MCU.However,theanalogsignaloutputbytheanalogtemperaturesensorhastobeconverted.Itcaninterfacewithmicroprocessorssuchassingle-chipmicrocomputersonlyafterobtainingdigitalsignalsthroughtheA/Dconversionlink.Therefore,thehardwarecircuitstructureiscomplicatedandthecostishigh.ButDS18B20canhelpsolvethisproblem.Thenew1wiredigitaltemperaturesensorrepresentedbyDS18B20integratestemperaturemeasurementandA/Dconversion,anddirectlyoutputsdigitalquantities.Thestructureoftheinterfacecircuitwiththesingle-chipmicrocomputerissimple,anditiswidelyusedintheoccasionswithlongdistanceandmanynodes.Therefore,DS18B20hasstrongpromotionandapplicationvalue.IIIDS18B20Overview3.1DS18B20AdvantagesDS18B20type1wireintelligenttemperaturesensorproducedbyDALLASSemiconductorCompany.Itbelongstoanewgenerationofintelligenttemperaturesensorsadaptedtomicroprocessors.Comparedwiththetraditionalthermistor,ithasthefollowingadvantages:Itcandirectlyreadthemeasuredtemperature;Thereadingmodeof9-12digitscanberealizedthroughsimpleprogrammingaccordingtoactualrequirements;Itcanalsocomplete9-bitand12-bitdigitalquantitieswithin93.75msand750ms,respectively,withamaximumresolutionof0.0625C;ToreadorwritetheinformationofDS18B20,onlyoneportline(1wireinterface)isrequiredtoreadandwrite.3.2DS18B20FeaturesUnique1-WireInterfaceRequiresOnlyOnePortPinforCommunicationReduceComponentCountwithIntegratedTemperatureSensorandEEPROMMeasuresTemperaturesfrom-55Cto+125C(-67Fto+257F)0.5CAccuracyfrom-10Cto+85CProgrammableResolutionfrom9Bitsto12BitsNoExternalComponentsRequiredParasiticPowerModeRequiresOnly2PinsforOperation(DQandGND)SimplifiesDistributedTemperature-SensingApplicationswithMultidropCapabilityEachDeviceHasaUnique64-BitSerialCodeStoredinOn-BoardROMFlexibleUser-DefinableNonvolatile(NV)AlarmSettingswithAlarmSearchCommandIdentifiesDeviceswithTemperaturesOutsideProgrammedLimitsAvailablein8-PinSO(150mils),8-PinSOP,and3-PinTO-92Packages3.3DS18B20InternalStructureDS18B20adopts3-pinPR-35packageor8-pinSOICpackage.ItsDS18B20externalshapeandpindiagramareshowninFigure1.TheDS18B20internalstructureblockdiagramisshownasinFigure2.Thestructureof64-bitflashROMisshowninFigure3.Figure1.DS18B20PinoutFigure2.DS18B20InternalStructureFigure3.64bFlashROMStructureIVDS18B20MCUTemperatureMeasurementDevice4.1CompositionofSystemHardwareTheDS18B20single-chipmicrocomputerintelligenttemperaturemeasurementdeviceismainlycomposedofDS18B20temperaturesensor,AT89S52,displaymoduleandpowermodule,asshowninFigure4.Themaintechnicalindicatorsoftheproductare:MeasuringRange(℃):-55.0~+125.0MeasurementAccuracy(℃):0.1ResponseTime(s):1.5Figure4.SystemStructureDiagramThesystemusesDS18B20asatemperaturesensor.Theone-chipcomputerAT89S52ofATMELCompanyservesastheprocessor.Temperaturedisplayandlight-emittingdiodeastemperaturecontroloutputunit.Thewholesystemstrivestohaveasimplestructureandperfectfunctions.Theworkingprincipleofthesystemisasfollows:AfterDS18B20carriesonthefieldtemperaturemeasurement,themeasureddataissenttotheP3.5portofAT89S52.Thetemperaturevalueisdisplayedafterbeingprocessedbythemicrocontroller.Then,thistemperaturevalueiscomparedwiththeupperlimitofthesetalarmtemperature.Ifitishigherthanthesetupperlimit,theyellowLEDlightsup.ThemaincircuitdiagramofthesystemisshownasinFig.5.Figure5.DS18B20TemperatuerMeasurementDevice4.2DesignofInterfaceThereare2waystoconnectDS18B20tothehardwareofthemicrocontroller:Vccisconnectedtoexternalpowersupply,GNDisgrounded,andI/OisconnectedtotheI/Olineofthemicrocontroller;Useparasiticpowersupply,UDDandGNDaregroundedatthistime,andI/OisconnectedtoMCUI/O.Regardlessofthe1stor2ndpowersupplymode,theI/Olinemustbeconnectedtoapull-upresistorofabout4.7k.Figure6showsatypicalconnectionbetweenDS18B20andamicroprocessor.InFigure6(a),DS18B20adoptsparasiticpowersupply,anditsVDDandGNGterminalsarebothgrounded;InFigure6(b),theDS18B20usesanexternalpowersupply,anditsVDDterminalusesa3~5.5Vpowersupply.ThissystemadoptsthewiringmodeshowninFigure6(b),thatis,theworkingmodeofexternalpowersupply.TheactualconnectionpictureofthesystemisshowninFigure6.Figure6.PhysicalDiagramofSystemConnectionVSoftwareDesignItisworthnotingthatDS18B20hasveryhighrequirementsontwoaspects:timingandelectricalparameters.Therefore,theworkflowofthemainCPUaccessingtheDS18B20throughthesingle-businterfacemustfollowastrictoperatingsequence:first,initializetheDS18B20;second,sendROMcommands;andthen,sendfunctioncommands.Wecantakealookatthefollowingpartofthesourceprogramisasfollows:ORG0000HAJMPMAIN;StatementofMCUmemoryallocation!TEMPER_LEQU29H;usedtosavethelower8bitsofthereadtemperatureTEMPER_HEQU28H;usedtosavetheupper8bitsofthereadtemperatureFLAG1EQU38H;WhethertheDS18B20flagisdetectedPNFLAGEQU68H;DatapositiveandnegativeflagA_BITEQU20H;thesingledigitofthedigitaltubestoresthememorylocationB_BITEQU21H;ThetendigitsofthedigitaltubestorethememorylocationC_BITEQU22H;ThedecimalplacesofthedigitaltubestorethememorylocationT_INTEGEREQU26H;TheintegerpartafterFORMAT,whichintegratestwobytesoftemperatureintoonebyteT_DFEQU27H;ThedecimalfractionafterFORMAT,thedecimalfractionofnibbletemperature(therearelowfourdigits)MAIN:LCALLGET_TEMPER;CallthetemperaturereadingsubroutineLCALLT_FORMAT;Formattheread2bytetemperatureLCALLALARM;callthealarmsubroutineLCALLDISPLAY;callthedigitaltubedisplaysubroutineLCALLD1S;testafteradelayof0.5secondsAJMPMAIN;thisistheDS18B20resetinitializationsubroutineINIT_1820:SETBP3.5NOPCLRP3.5;thehostsendsoutaresetlowpulsewithadelayof537microsecondsMOVR1,#2TSR1:MOVR0,#250DJNZR0,$DJNZR1,TSR1SETBP3.5;thenpullupthedatalineNOPNOPNOPMOVR0,#25HTSR2:JNBP3.5,TSR3;waitingforDS18B20responseDJNZR0,TSR2;delayLJMPTSR4TSR3:SETBFLAG1;SettheflagbittoindicatethatDS1820existsLJMPTSR5TSR4:CLRFLAG1;cleartheflagbit,indicatingthatDS1820doesnotexistLJMPTSR7TSR5:MOVR0,#120TSR6:DJNZR0,TSR6;timingrequiresaperiodofdelayTSR7:SETBP3.5RET;readthetemperaturevalueafterconversionGET_TEMPER:;SETBP3.5LCALLINIT_1820;firstresetDS18B20JBFLAG1,TSS2RET;DeterminewhetherDS1820exists?IfDS18B20doesnotexistThenreturnTSS2:MOVA,#0CCH;skipROMmatchingLCALLWRITE_1820MOVA,#44H;IssuetemperatureconversioncommandLCALLWRITE_1820LCALLDISPLAYLCALLINIT_1820;resetbeforereadingtemperatureMOVA,#0CCH;SkipROMmatchingLCALLWRITE_1820MOVA,#0BEH;IssuereadtemperaturecommandLCALLWRITE_1820LCALLREAD_18200;savethereadtemperaturedatato28H/29HRET;WriteDS18B20subroutine(withspecifictimingrequirements)WRITE_1820:MOVR2,#8;atotalof8bitsofdata;CLRCWR1:CLRP3.5MOVR3,#6DJNZR3,$RRCAMOVP3.5,CMOVR3,#23DJNZR3,$SETBP3.5NOPDJNZR2,WR1SETBP3.5RET;readtheprogramofDS18B20,readtwobytesoftemperaturedatafromDS18B20READ_18200:MOV36H,#2;SetthehighandlowtemperatureReadfromDS18B20MOVR1,#29H;thelowbitisstoredin29H(TEMPER_L),thehighbitDeposit28H(TEMPER_H)RE00:MOVR2,#8;Thereare8bitsofdataRE01:;CLRCSETBP3.5NOPNOPCLRP3.5NOPNOPNOPSETBP3.5MOVR3,#9RE10:DJNZR3,RE10MOVC,P3.5MOVR3,#23RE20:DJNZR3,RE20RRCADJNZR2,RE01MOV@R1,ADECR1DJNZ36H,RE00RET;-----Integratethetwo-bytetemperaturereadout(pleaserefertotheinformationaboutthe2-bytetemperatureformatreadoutbyDS18B20)----------T_FORMAT:;AlarmsubroutineALARM:;DisplaysubroutineDISPLAY:;1MSdelay(calculatedby12MHZ)D1MS:MOVR7,#250llmm:nopnopDJNZR7,llmmRET;1MSdelay(calculatedby12MHZ)D1S:MovR6,#4LOOP2:movR5,#125;------------250LOOP1:LCALLD1mSDJNZR5,LOOP1DJNZR6,LOOP2RET;7-segmentdigitaltube0-9digitcommonanodedisplaycodeNUMTAB:DB0C0H,0f9H,0a4H,0b0H,99H,92H,82H,0f8H,80H,90H,0ffHXIAOSHU:DB00H,01H,01H,02H,03H,03H,04H,04H,05H,06H,06H,07H,08H,08H,09H,09HENDVIApplicationinAgriculturalProductionThistemperaturemeasurementsystemcandirectlyoutputdigitalquantities.Inaddition,ithasthecharacteristicsofsimplestructure,convenientuseandlowprice.Therefore,itcanbewidelyusedinagriculturalproduction.6.1TemperatureofMildewModerngrainwarehousescanusethissystemtomonitorthetemperatureofhundredsofpoints.Inthisway,youcaneasilygraspthetemperaturechangesatvariouspointsatdifferenttimes,increasestoragecapacity,andeffectivelyreducetheoccurrenceofmildew.6.2TemperatureofAgriculturalProductsAtpresent,low-temperaturerefrigerationmeasuresarewidelyadoptedforthepreservationoffruitsandvegetables.Thesystemcanbeinstalledinthetemperaturemeasurementpositionoftherefrigeratorcompartment.Inthisway,thetemperaturevaluecanbeconvenientlyobservedatanytimetocheckwhethertheoptimalpreservationtemperatureisreached.6.3TemperatureDetectioninGreenhousesThesystemisusedinplasticgreenhousesforgreenhousevegetablecultivationandflowerproduction.Inthisway,automatictemperaturedisplaycanberealized,andlaborandtimefortemperaturemeasurementcanbesaved.6.4TemperatureofSoilIntheprocessofplantingcropswithstrictrequirementsonsoiltemperature,thesystemcantestthechangesinsoiltemperatureasneededtofacilitatethegraspofaccuratetemperaturevalues.VIIConclusionThesingle-chiptemperaturemeasurementsystemtakesfulladvantageofthesimplicityofthehardwarestructureofDS18B20andAT89S52,using8-segmentdigitaltubedisplay,lowpriceandwideapplication.Accordingtoactualneeds,wecanalsouseLCDasadisplaydeviceorformadistributedtemperaturemeasurementandcontrolsystem.Althoughthedesigniseasytoexpand,italsohasitsshortcomings.Thesimplicityofthehardwarestructurecomesattheexpenseofsoftware.Therefore,specialattentionshouldbepaidtotheworkingsequencerequirementsofDS18B20duringprogramming.Inshort,thesystemcanbewidelyusedintemperaturemeasurementinagriculturalproduction.FAQWhatisDS18B20temperaturesensor?TheDS18B20isa1-wireprogrammabletemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.HowdoestheDS18B20work?Itworksontheprincipleofdirectconversionoftemperatureintoadigitalvalue.IsDS18B20athermistor?Athermistorisathermalresistor-aresistorthatchangesitsresistancewithtemperature....Thermistorshavesomebenefitsoverotherkindsoftemperaturesensorssuchasanalogoutputchips(LM35/TMP36)ordigitaltemperaturesensorchips(DS18B20)orthermocouples.HowaccurateisDS18B20?TheDS18B20readswithanaccuracyof0.5Cfrom-10Cto+85Cand2Caccuracyfrom-55Cto+125C.Whatisds1820?TheDS18B20isonetypeoftemperaturesensoranditsupplies9-bitto12-bitreadingsoftemperature....Thecommunicationofthissensorcanbedonethroughaone-wirebusprotocolwhichusesonedatalinetocommunicatewithaninnermicroprocessor.HowdoIconnectmyDS18B20tomyRaspberryPi?OnceyouveconnectedtheDS18B20,powerupyourPiandlogin,thenfollowthesestepstoenabletheOne-Wireinterface:1.Atthecommandprompt,entersudonano/boot/config.txt,thenaddthistothebottomofthefile:2.dtoverlay=w1-gpio.3.ExitNano,andrebootthePiwithsudoreboot.WhatistheworkingprincipleofDS18B20?TheDS18B20DigitalThermometerprovides9to12-bit(configurable)temperaturereadingswhichindicatethetemperatureofthedevice.Itcommunicatesovera1-Wirebusthatbydefinitionrequiresonlyonedataline(andground)forcommunicationwithacentralmicroprocessor.Inadditionitcanderivepowerdirectlyfromthedataline(parasitepower),eliminatingtheneedforanexternalpowersupply.ThecorefunctionalityoftheDS18B20isitsdirect-to-digitaltemperaturesensor.Theresolutionofthetemperaturesensorisuser-configurableto9,10,11,or12bits,correspondingtoincrementsof0.5C,0.25C,0.125C,and0.0625C,respectively.Thedefaultresolutionatpower-upis12-bit.WheretouseDS18B20Sensor?TheDS18B20isa1-wireprogrammableTemperaturesensorfrommaximintegrated.Itiswidelyusedtomeasuretemperatureinhardenvironmentslikeinchemicalsolutions,minesorsoiletc.Theconstrictionofthesensorisruggedandalsocanbepurchasedwithawaterproofoptionmakingthemountingprocesseasy.Itcanmeasureawiderangeoftemperaturefrom-55Cto+125withadecentaccuracyof5C.EachsensorhasauniqueaddressandrequiresonlyonepinoftheMCUtotransferdatasoitaverygoodchoiceformeasuringtemperatureatmultiplepointswithoutcompromisingmuchofyourdigitalpinsonthemicrocontroller.HowconnectDS18B20toArduino?FirstplugthesensoronthebreadboardtheconnectitspinstotheArduinousingthejumpersinthefollowingorder:pin1toGND;pin2toanydigitalpin(pin2inourcase);pin3to+5Vor+3.3V,attheendputthepull-upresistor.OnanATMega328P,whyisaDS18B20temperaturesensorreturningincorrecttemperaturevalues?Severalpossibilities:1.Ifitisjustreadingalittlehigh,itmightbecausedbyselfheating.Addaheatsinkand/ormakemeasurementslessfrequently.2.Especiallyifthevaluesarereallywhacky,itmightbecodewitherrorsormis-wiring.Useapublishedsketchtocheckoperation.3.TheDS18B20mightbedefective.Tryanother.4.Itsaccurateto0.5C.Areyouexpectingittobemoreaccurate(likedowntotheLSBofthereadvalue)?IDescriptionThisblogintroducesandanalyzes4simpleandeasy74LS00NandGatecircuitdiagrams.Itsincluding:SquareWaveGeneratorCircuit,PulseGeneratorCircuit,LEDLightCircuit.Andintheend,wewillanalyzethecircuitthatturnsthetimerintoacountdowntimerindetail.ThisVideoisAnIntroductionof7400LogicDevicesCatalogIDescriptionIISquareWaveGeneratorCircuitIIIPulseGeneratorCircuitIVLEDLightCircuitVTurnTimerintoCountdownTimer5.1SchemeDesign5.2ImplementationofSchemeDesignOrdering&QuantityIISquareWaveGeneratorCircuitLetstakealookatthefigurebelow.Itsasquarewavegeneratorcircuit.Thiscircuitcontainsa74LS00NandGateintegratedcircuit.Figure1.SquareWaveGeneratorCircuitDiagramAmongthiscircuitdiagram:NANDgates1,2andexternalRCtimeconstantcomponentsformanoscillatorcircuitNANDgate3isabufferoutputstage.AslongasthecapacityofCischanged,squarewaveoutputsofdifferentfrequenciescanbeobtained.IIIPulseGeneratorCircuitFigure2.PulseSignalGeneratorCircuitDiagramThecircuitdiagramisshowninFigure2anditsasimplepulsesignalgeneratorcircuit.ThesignalgeneratormainlyusestwoTTLintegratedcircuits(74LS00and74LS221).Sowhychoosethesetwocircuits?Thatisbecause,thesetwocircuitscanbeusedtogenerateapulsesignalof=4s.Besides,itusesfewercomponentsandisconvenientfordebuggingandmaintenance.IVLEDLightCircuitThiscircuitismadewithNE555,74LS00,74LS154,74LS193andLEDlights,andtheproductionprocessisverysimple.Whenweturnonthepower,hereishowitworksis:WhentheoutputQ0ofthe74LS154decoderislow,the74LS193isapositivecounter.Atthistime,theLEDsareindividuallylitfromD1...D16;WhentheoutputQ15ofthe74LS154decoderislow,the74LS193isacountdowncounter.Atthistime,theLEDsareindividuallylitfromD16...D1.Figure3.LEDLightCircuitDiagramFromtheabovewecanseethat:theLEDlightsturnonfromD1toD16,andthenbacktoD1fromD16,andsoon.VTurnTimerintoCountdownTimerGenerally,therearetwodesignideasforturningatimerintoacountdowntimer:First,changethecountingchipinthetimer;Second,resetthefunctionofthechip.Besides,thereisactuallyanotherwaytoachievethisgoal:Byappliyingthe74LS00and74LS20chipstoreversetheresultsonthedisplay,soastoachievethepurposeofcountingdown.5.1SchemeDesignTheresultdisplayedbyeachdigitofthetimerisanincrementalvalue,suchas0.1.2.3.4.5.6.7.8.9.Yet,thecountdowntimerdisplaysadecreasingvalue,suchas9.8.7.6.5.4.3.2.1.0.Aslongasthedisplayresultconversioniscompletedwithasuitablelogiccircuit,thetimercanbeturnedintoacountdowntimer.Atfirst,weneedtofindthelogicalrelationshipbetweenthetimerdisplayresultandthecountdowntimerdisplayresult.Table1belowliststheBCDcodescorrespondingtoeachdisplayresultofthetimerandcountdowntimer.Fromthistable,youcaneasilyfindtheBCDcodesofthetimerandcountdowntimer:ThelowestbitQ1andY1areopposite;WhileQ2andY2arethesame;RelationshipbetweenQ3andY3:Y3ofthecountdowntimeristheexclusiveORoftimerQ3andQ2;RelationshipbetweenQ4andY4:TheY4bitofthecountdowntimeristheoppositevalueoftheORofQ4,Q3,andQ2ofthetimer,whichisalsoequaltothenon-re-ANDofQ4,Q3,andQ2.Table1.CorrespondingBCDCodeDisplayedby(Down)TimerTheabovelogicalexpressionis:Therefore,aslongasyouchooseacircuitthatcancompletetheabovelogicconversionrelationship,youcanrealizethedesignfromatimertoacountdowntimer.Thefigure?showsatwo-digittimercircuit.Afteraddingtheaboveconversioncircuit,itbecomesthefigure3showsthecountdowncircuit.Figure4.TimerCircuitDisplaying2DigitsFigure5.CountdownCircuitDiagram5.2ImplementationofSchemeDesignTwokindsofchips74LS00and74LS20areuesdhere.Theformerarefourtwo-inputNANDgates,whichareusedtocompletetheconversionofY1andgeneratethenegationofQ4,Q3,andQ2.Thelatteraretwofour-inputNANDgates,whichareusedtoobtainY4fromthenon-reANDofQ4,Q3,andQ2.Insummary,wecanfollowthelogicalrelationshipasfollows:ThelogicdiagramisshowninFigure6.Figure6.LogicDiagramKnowingthattheXORgateoperationcanbecompleted,theY3conversioncanbecompleted.Theconnectioncircuitdiagramoftheabove-mentionedY4,Y3,Y1conversionspecificphysicalobjectsisshowninFigure7.Figure7.Y4,Y3,Y1ConversionSpecificPhysicalConnectionDiagramFigure8showstheactualpictureofthecountdowntimer.Figure8.CountdownTimerSofar,thetimerhasbecomeacountdowntimer.Throughthisdesignmethod,thereisnoneedtochangetheoriginalcountercircuit,isitparticularlytrouble-free?

74LS02

I.IntroductionTDA7294isaveryinnovativeDMOShigh-powerintegratedamplifiercircuitlaunchedbythefamousEuropeanSGS-THOMSONSTMicroelectronicstomainlandChinainthe1990s.Itsweepsawaytheraw,cold,andhardtonesofthepreviouslinearintegratedpoweramplifiersandthickfilmintegration,andiswidelyusedintheHI-FIfield:suchashometheater,activespeakers,etc.Thedesignofthischipfocusesontone,andhastheadvantagesofbipolarsignalprocessingcircuitandpowerMOS.Ithasthecharacteristicsofhighvoltageresistance,lownoise,lowdistortion,andveryaffinityforreplayingsound;andhasasilentstandbyfunction,short-circuitcurrentandoverheatprotectionfunctionstomakeitsperformancemoreperfect.ThisarticlewillintroduceseveralpoweramplifiercircuitdesignsbasedonTDA7294.CatalogI.IntroductionII.OCLCircuitIII.BTLCircuitIV.ConstantCurrentPowerAmplifierV.Hi-FiIntegratedPowerAmplifierVI.ActiveSubwooferAmplifierAddsStandbyFunctionVII.HighFidelityPowerAmplifierVIII.ClassABPowerAmplifierIX.Two-channelPowerAmplifierX.100WPowerAmplifierCircuitOrdering&QuantityII.OCLCircuitTheOCLcircuitdiagramisshowninFigure1.Thiscircuitisadual-channel70WpoweramplifiercomposedoftwoTDA7294.Therearefewexternalcomponentsandsimplecircuit.Whenthepowersupplyvoltageis35V,70Wcontinuousoutputpowercanbeobtainedonan8ohmload.Itisverysuitableforplaybackinanenvironmentbelow30squaremeters.Ifthespeakerimpedanceislessthan8ohms,thepowersupplyvoltageshouldbereducedaccordingly.Figure1OCLCircuitDiagramIII.BTLCircuitTheBTLcircuitisshowninFigure2.ItusestwoTDA7294bridgestoformaBTLpoweramplifiercircuit.Theoutputpowercanreachmorethan150W.Itissuitableforplacesthatrequirehighpowersuchasdancehalls.4TDA7294arerequiredforstereo.Whenthepowersupplyvoltageis25V,acontinuousoutputpowerof150Wcanbeobtainedonan8ohmload.Whenthepowersupplyis35V,acontinuousoutputpowerof180Wcanbeobtainedona16ohmload.WhenuseTDA7294asBTLpoweramplifier,theloadmustnotbelessthan8ohms.Figure2BTLCircuitDiagramIV.ConstantCurrentPowerAmplifierThispoweramplifiercircuitissomewhatdifferentfromtheprevioustwostructures.Itsfeedbackcircuitiscurrentsampling,voltagesummationandnegativefeedback.Thiskindofcircuitstructureistheconstantcurrentpoweramplifierthatpeopleoftensay.Thespecificanalysisofthecircuitwillnotbedetailed,onlythemoreprominentadvantagescomparedwiththetraditionalconstantvoltagepoweramplifierwillbeintroduced.(1)Theoutputcurrentofthepoweramplifierhasnothingtodowiththeloadimpedance.Eveniftheloadisshort-circuited,itwillnotcausetheamplifiertooverheat.(2)Theoutputpowerincreaseswiththeincreaseofloadimpedance.Pushingthespeakerloadwithinacertainpowerreservecanensurethebassstrengthandhighfrequencyresolutionoftheoriginalmusicsignal.(3)Theforceactingonthevoicecoilofthespeakeronlydependsonthecurrent.Theuseoffluid-controlledoscillationtopromotethespeakermustbefasterthanthevoltage-controlledoscillation,sothattheinputandoutputimpedanceofthespeakervibrationsystemcanbeeasilymatched.Theconstantcurrentpoweramplifiercircuitisactuallyacontrolledcurrentsourcecontrolledbytheinputsignalvoltage.Itsinternalfeedbackcircuitiscurrentsampling,voltagesummingnegativefeedback,andithasthecharacteristicsofhighinputandoutputimpedance.Theinputimpedanceishigh,whichisexactlywhatthepreviousstageconstantvoltageamplifiercircuitneeds,whichisbeneficialforthesignalvoltagetobesenttotheinputendofthepoweramplifierwithoutloss.Thehighoutputimpedancecanreducetheshuntoftheinternalresistancetothesignal,whichisconducivetoaddingtheoutputsignalcurrenttotheload.InFigure3,thepowersupplyvoltageisselectedas35V,anditsmagnificationisdeterminedbytheratioofthespeakertoR6.Figure3ConstantcurrentpoweramplifiercircuitdiagramV.Hi-FiIntegratedPowerAmplifierThefamousEuropeanSGS-THOMSONSTMicroelectronicshaslaunchedaHi-Fihigh-powerDMOSintegratedamplifiercircuitTDA7294.ThecircuitisshowninFigure4.Itintegratesthebestdesignofmodernpoweramplifiercircuit,combinestheadvantagesofbipolarsignalprocessingcircuitandpowerMOS,hasthecharacteristicsoflownoiseandlowdistortion;standbyandmutecircuitcompletelyeliminatestheimpactnoisecausedbypoweronandoff,andeliminatesspeakerprotectioncircuitoverheating,short-circuitcurrentprotectionandotherfunctionsmakeitsperformancemoreexcellent.ThisdeviceissuitableforhometheaterandHi-Fiamplifiers.Themainparametersare:VS(powersupplyvoltage)10~40V(maximumvoltagewithoutsignal50V);Io(peakoutputcurrent)10A;Po(RMScontinuousoutputpower)70Wwhenvs=35V8;vs=70Wwhen27V4;(effectivevalueofmusicoutputpower)100WwhenVS=38V8;100WwhenVS=29V4.Figure4Hi-FiIntegratedPowerAmplifierCircuitDiagramTheclosed-loopgainofthecircuitinFigure4is30dB.IncreasingR3canincreasethegain,andviceversa,buttheamplifiergainshouldbe24dB.TheamplifierhasthebestperformancewhenR1=R3.R7,C4andR5+R6,C3determinethestandbyandmutetimeconstants.Thelargerthevalue,thelongerthetime.Whenthecontrolterminalisconnectedtolowpotentialground,itismuteandstandby;whenthecontrolterminalisconnectedtoVS,because(R5+R6)R7,pin⑩risestoahigherpotentialthanpin⑨,andturnstoalowpotentialfirstwhenshuttingdown,whichmakesthestandbyandshutdownprocessesgooninasilentstate,ensuringthattheamplifieristurnedonandoffwithoutnoise.Figure5BTLPoweramplifierfinishedboardForhigh-powerprofessionalapplicationsfiledssuchasdancehalls,youcanchoosetheBTLpoweramplifierfinishedboardshowninFigure5.BothTDA7294areequippedwiththeirownprofessionalradiators.Whenvs=25V8,themaximumcontinuousoutputpowerreaches150W;when35V16,Themaximumcontinuousoutputpowerreaches170W.WeusedTDA7294standardapplicationcircuitandMarantzPM80andYAMAHAA-592tomakealisteningcomparison.Theformerisamid-pricedHi-FimachinewithaClassA,ClassAandBstatusswitch,andthelatterisa439.16dollarsclasswithAc-3inputAVpoweramplifier,audiosourceismusicfaxE60CD,speakerisTannerNo.5.ItturnsoutthatthesoundorientationofTDA7294hasadistinctiveEuropeanstyle,soft,mellow,delicate,andfullofbouncingfeeling.ItissimilartotheMarantzPM-80inClassAandBstatus,butthesoundfieldofPM-80isdeeperwhenworkinginpureClassA.ComparedwithYAMAHAA-592,thedifferenceislarger.ThelowfrequencyofA-592seemstobeslightlyimproved.Itsoundspowerful,butitisharderandthelinesareblurry.TDA7294issweetandnatural,withhigherresolution,reallylikelandscapepaintingdonewithsplashesofinkandfine-brushflowersandbirds(atechniqueofchineseink-painting),eachhasitsinfinitecharm.VI.ActiveSubwooferAmplifierAddsStandbyFunctionThiscircuitisanimprovementontheaudiocircuitusingtheintegratedcircuitTDA7294.ThecircuitdiagramisshowninFigure6.TDA729410pinhasamutefunction.WhentheexternalDCprovideshighlevel,theintegratedblockisintheworkingstate;whenthelowlevelisapplied,theintegratedblockisinthecut-offstate.Atthistime,thecircuitconsumeslittlepowerandIC114pinhasnooutput,thatis,standbyform.Thegeneralcircuitistoprovideahighleveltopin10tomakeitintheconductingstate,infact,thedevelopmentofthispinfunctioncanmeetsomespecialworkrequirements.Thiscircuitisbasedonthistoincreasethestandbyfunctionoftheactivesubwooferpoweramplifier,anditscircuitisreliableandresponsive.Figure6ActivesubwooferamplifieraddsstandbyfunctioncircuitdiagramVII.HighFidelityPowerAmplifierThecircuitisshowninFigure7.ThedrivestageadoptsTDA7294.Theinternaldrivestageandoutputstageofthechipusefieldeffecttubes,whicharepoweredby40V,andtheoutputpowercanreach70W(RL=8;THD=0.005%).Ithasadelicatetoneandanexcellentsenseofhearing.PoweroutputVT1,VT2adoptsShankenhigh-powerpairtube2SA1394,2SC3858.Thecircuitprincipleisasfollows:ThesignalisinputtotheTDA7294non-invertinginputpin③throughC1andR1.R7andR3,C3,C4ofICpin②formanegativefeedbacknetwork,theclosedloopgainofthisamplifierisabout34times.The⑨and⑩pinsarethestandbyandmuteterminalsrespectively.SincetheRCnetworktimeconstantofthe⑩pinislargerthanthatofthe⑨pin,theswitchingmachinesareallperformedundermutesatge,avoidingtheswitchingimpactsound,andC7isabootstrapcapacitor.Figure7High-fidelitypoweramplifierpromotedbyTDA7294Productionpoints:(1)InsulatingmicasheetsshouldbeaddedbetweenthemetalcapandtheheatsinkofTDA7294(themetalcapisconnectedtothepin⑧).(2)Thepowertransformerusesring-shaped300Wdouble20V,four50V/10000Ffiltercapacitors,two50V/100F,andtwo100V/0.1F.Thepowersupplypartshouldbetestedseparately,firstwithoutconnectingthepoweramplifier,measurewhetherthepositiveandnegativeoutputvoltageofthepowersupplyaresymmetrical,theerrorshouldbewithin0.6V.(3)Whentestingthemachine,forsafetyreasons,youshouldfirstusealowervoltagetest(suchas25V)withoutaddingasignal,andmeasuretheDCvoltageoftheoutputterminaltotheground.Normally,itshouldbewithin20mV.(4)R8,R9,R10,D1formthefinalbiascircuit.ThisbiasmakestheoutputtubesVT1andVT2notcutoffduringoperation,sothequiescentcurrentcanbesmall(about5mA).(5)Thepowertubeshouldbestrictlymatched(within3%)andgenuineproductsshouldbeselected.TheoutputresistanceR14isa5Wnon-inductivetype,andtheinductorLisformedbytightlywinding10turnsonR14withadiameterof1.5mmenameledwire.TDA7294uses60mmTimes,85mmTimes,20mm12-slotheatsink,andtheoutputpairtubeneedsaprofessionalheatsink.Thesectionswithhighcurrentontheprintedboardneedtobetin-rolled,whichisextremelybeneficialforthetransparencyandstrengthofthesound.Figure8PoweramplifierPCBpromotedbyTDA7294VIII.ClassABPowerAmplifierTDA7294integratedcircuitcanbeusedasahigh-fidelityaudioclassABpoweramplifier.Itcandrive4ohmor8ohmspeakers,andwhenconnectedtoan8ohmspeaker,itwillprovide50wattsofoutputpowerand0.1%THD.Figure9ClassABpoweramplifiercircuitdiagramYoumustinstallalargeenoughradiatorforTDA7294.Pin10isamuteinput,andpin9providesastandbymode.Muteshouldalwaysoccurwhenselectingstandbymode.TheIChasinternalthermalprotection,whichcausesmutereductionat145C,andtheamplifierentersstandbyat150C.TheTDA7294integratedcircuitheatsinkisinternallyconnectedtothenegativepowerrail.Ifthemoduleisinstalledinagroundedmetalenclosure,thentheICmustbeinsulatedfromtheheatsink.Ifnot,thenegativepowerrailwillbeshortedtoground.IX.Two-channelPowerAmplifierTDA7294high-powerintegratedcircuitICisspeciallydesignedforassemblinghigh-performanceaudioamplifiers.TwoTDA7294piecescanbeusedtomakeapowerfuldual-channelhigh-fidelitypoweramplifier.ThecircuitprincipleisshowninFigure10.TheoverallcircuitiscomposedoftwoTDA7294corecomponents,andtheperipheryincludessomeresistorsandcapacitors.Thecircuitsofthetwochannelsarealmostidenticalindesign.TheyallusethestandardcircuitofficiallyreleasedbyTDA7294,connectedtoanon-invertingamplifiercircuit,withavoltagegainof30.5dB,anoutputpowerofupto70Wperchannel,andadualpowersupplysymmetricalpowersupplyvoltage35V.Amongthem,Cl5andCl6areinputcouplingcapacitors.0.47Fisusedintheoriginalcircuit.Here,ifyouincreaseitto1F,youcanimprovethelow-frequencyresponseofthecircuit.Itisrecommendedtousepolypropylenespecialaudiocapacitors,suchasWIMAsMKT4seriescapacitors,itcangreatlyimprovethesoundresolution.R3andR4areinputresistances,whichdeterminetheinputimpedanceofTDA7294inthein-phaseamplificationstate.Here,22kisrelativelymoderate.Toolargeavaluecanreducetheburdenonthefront-endsignalsource,butitmayaffectthestabilityofTDA7294andmaketheoutputmidpointvoltagedriftincreased,toosmallvaluewillaffecttheresponseabilitytolowfrequency.ThetheoreticalvalueofthefeedbackresistorsR7andR8shouldbeequaltotheinputresistorsR3andR4,whichcanensurethebiascurrentbalanceoftheTDA7294inputdifferentialcircuitandreducesignaldistortion.ThefeedbackgroundresistanceR5,R6cooperateswithR7,R8tosetthecircuitgain.Here,thefeedbackDCblockingcapacitorsCl3andCl4areusedtoformACnegativefeedback,inhibitDCvoltageoutput,andprotectthespeaker.Figure10Two-channelpoweramplifiercircuitdiagramTDA7294hasastartmutefunction,andcooperateswithanexternalcircuittoachieveanon-impactsoundeffectwhenthepoweristurnedonandoff.R9,R1O,R11,Rl2,Cl7,Cl8andVD5,VD6intheschematicdiagramformanexternalmutecontrolcircuit.Delaytheenergizationofpins9and10ofTDA7294toachievethefunctionofsoftstart.Thepowersupplyrectifierfiltercircuitisalsoverysimple.Thefullbridgerectifiercircuitiscomposedof4EuropeanspeedrectifierdiodesVD1-VD4.CapacitorsC1andC2arethemainfiltercapacitors.Large-capacityandhigh-currentaudiofiltercapacitorsarerequired,suchasELNAsFORAUDIOseriesorBHCAerovoxindustrialgradecapacitors.DesignPCBisgenerallyabottleneckinamateurproduction,sothatmanyexcellentschematicdiagramshavenotbeentransformedintofinishedPCBsthatcanbeactuallyassembled.Here,thepopularProtel99sedesignsoftwareisusedtodrawtheprintedcircuitboardagainsttheschematicdiagram10,asshowninFigure11.The2mmthickFR-4board-baseddouble-sidedPCBisused,andthecopperfoilisthickenedto70mm,whichissuitableforhighcurrentpoweramplifiers.ThewholePCBtraceadoptsone-pointgroundingmethod,whicheffectivelyeliminatesgroundwireinterferencenoise.Insomehigh-currenttraces,tinplatingisalsoadoptedtoincreasetheadditionalcurrentcarryingcapacity.Thepowerinputandpoweroutputstructureuseshigh-currentscrewterminalstoensuresufficientover-currentcapabilityanddurabilityofrepeatedwiring.Figure11PrintedcircuitboardX.100WPowerAmplifierCircuitFigure12100WpoweramplifiercircuitdiagramcomposedofTDA7294Figure12isa100WpoweramplifiercomposedofamonolithicaudiopoweramplifierintegratedcircuitTDA7294.TDA7294includespre-opamplifier,finalpoweramplifier,temperatureprotection,shortcircuitprotection,mutecontrolandothercircuits.ThefinalstageadoptsbipolarDMOSpowertransistor,whichhasthecharacteristicsofhighoutputpower,bandwidth,lowdistortion,andgoodversatility.Theintegratedcircuitalsohasperfectanti-overload,anti-shortcircuitandtemperatureprotectioncircuitfunctions.Whenthechiptemperatureistoohigh,itautomaticallycutsofftheaudiosignaltoprotectthechipfromburningThepoweramplifiercircuitcomposedofTDA7294hasthecharacteristicsofsimpleperipheralcircuitandeasyproduction.Thecircuitinputimpedanceis20k,theinputsensitivityis750mV,thevoltagegainis32dB,thepowersupplyvoltagerangeis(25~40)V,andthequiescentcurrentis50mA.Whentheloadimpedanceis8,theoutputpoweris100W;whentheloadimpedanceis4,theoutputpowercanreach180W.Inactualproduction,TDA7294shouldbeequippedwithenoughheatsinks.Thesupportingpowercircuitshouldhavesufficientcapacity.Ifyouneedtoincreasethecircuitvoltagegain,youcanappropriatelychangetheratioofR3toR2,voltagegainA=201g(R3/R2)(dB).However,itisnotadvisabletoone-sidedlypursuethevoltagegainofthisstage.Excessivevoltagegaincaneasilycausecircuitself-excitation.Thesolutionistoincreasethevoltagegainofthepre-stage.I.DescriptionTDA2030Aisoneofthehigh-fidelityintegratedpoweramplifiers,andmanypoweramplifiercircuitsusethisintegrationmethod.TDA2030isalsoaHI-FIpoweramplifierintegratedblockusedbymanycomputeractivespeakers.Ithassimpleconnectionmethodandaffordableprice.Theratedpoweris14W.Thepowersupplyvoltageis6~18V.Theoutputcurrentislarge,theharmonicdistortionandthecrossoverdistortionaresmall(14V/4ohm,THD=0.5%).Ithasexcellentshortcircuitandoverheatprotectioncircuit.Thefollowingdescribesitsconnectionandapplicationcircuit.CatalogI.DescriptionII.Connection2.1SinglePowerConnection2.2DualPowerConnectionIII.ApplicationCircuit3.1OTLFormPowerAmplifier3.2OCLFormPowerAmplifier3.3BTLFormPowerAmplifier3.440WPowerAmplifierCircuit3.5High-fidelityActiveSpeakerCircuit3.625WBridgeLowFrequencyPowerAmplifierCircuitOrdering&QuantityII.ConnectionItsconnectionmethodisdividedintosinglepowersupplyanddualpowersupply:2.1SinglePowerConnectionFigure1TDA2030singlepowerconnectiondiagram2.2DualPowerConnectionFigure2TDA2030dualpowerconnectiondiagramIII.ApplicationCircuit3.1OTLFormPowerAmplifierOTLformpoweramplifier:singlepowersupply,outputcouplingcapacitor.TheR5(150k)andR4(4.7k)resistorsinthecircuitshowninFigure3determinetheclosed-loopgainoftheamplifier.ThesmallertheR4resistor,thegreaterthegain,buttoolargegaincaneasilycausesignaldistortion.Twodiodesareconnectedbetweenthepowersupplyandtheoutputterminaltopreventtheinductiveloadofthespeakerfromkickingbackandaffectingthesoundquality.ThecapacitorofC3(0.22uF)andtheresistanceofR6(1)areusedtocompensatetheinductiveload(speaker)toeliminateself-excitation.Thecircuitusesa36Vsinglepowersupplyandtheoutputpowerisabout20W.Figure3OTLtypepoweramplifiermadewithTDA2030A3.2OCLFormPowerAmplifierTheformoftheOCLpoweramplifieradoptsdualpowersuppliesandhasnooutputcouplingcapacitor.AsshowninFigure4,sincethelowfrequencyresponseoftheoutputcouplingcapacitorisimproved,itisahigh-fidelitycircuit.Thedualpowersupplyusesatransformerwiththemiddlepointoftheprimarycoilgroundedandtheupperandlowervoltagesaresymmetricalandequal.Afterrectificationandfiltering,a18Vdualpowersupplyisformed,andtheoutputpoweris20W.Figure4OCLtypepoweramplifiermadewithTDA20303.3.BTLFormPowerAmplifierThemainfeatureofBTLis:itiscomposedoftwoidenticalpoweramplifiers,andtheinputsignalsareinversetoeachother.Thein-phaseinputandtheinvertedinputoftheamplifierareactuallyusedtoensurethattheinputsignalsareinversetoeachother.Atthesametime,theamplitudesofthetwoinputsignalsshouldbethesame,sothatthebasicrequirementsoftheBTLcircuitformcanbemet.ThecircuitdiagramisshowninFigure5,whereR7(1k)andR8(33)resistorsdividethesignalandtheattenuationfactorisexactlythesameastheamplificationfactorofU1.TheattenuatedsignalisaddedtotheinvertinginputterminalofU2throughR5.Infact,twoopampscompleteasignalamplification,andtheactualmeasuredoutputlevelis1.5timeshigherthanthatofanintegratedcircuit.Thatis,theoriginaloutputpoweroftheopampis20W,andtheoutputpowerisnowabout50W.However,duetothecharacteristicsoftheBTLcircuit,whenchoosinganintegratedcircuit,usetwooperationalamplifiercircuitswiththesameparametersasmuchaspossibletoadjusttheinputsignalamplitude.Youcanuseanoscilloscopetoobservetheamplitudeofthetwoinputsignalsbyinputtingasinewave.Atthistime,adjustR7tomakethetwoinputsignalsTheamplitudeisthesametoensurethatthenonlinearsymmetrydistortionisminimizedwhileincreasingthepower.Figure5BTLtypepoweramplifiermadewithTDA2030A3.440WPowerAmplifierCircuitFigure6isa40WpoweramplifiercircuitmadebyTDA2030poweramplifierintegratedblockandBD907/908:Figure640WpoweramplifiercircuitmadebyTDA20303.5High-fidelityActiveSpeakerCircuitAhigh-fidelityactivespeakercircuitdesignedwithTDA2030,thecircuitdiagramisshowninFigure7.Usingdualpowersupply,addedhighandlowbassandvolumeadjustment.WhendesigningthePCB,thegroundwireshouldnotpassthroughthecomponentpinsasmuchaspossibletoreduceDCnoise.Figure7Highfidelityactivespeakercircuitdiagram3.625WBridgeLowFrequencyPowerAmplifierCircuitFigure825WbridgelowfrequencypoweramplifiercircuitThecircuitinFigure8usestwoTDA2030sconnectedtoformabridgecircuit,withthesamecircuitstructureandparametersonbothsides.Theintegratedcircuitontherightiscontrolledbytheintegratedcircuitontheleftthrougha22knegativefeedbackresistor,andviceversa.Thediode1N4001isusedtopreventthespeakerinductiveloadfromgeneratingovervoltageanddamagingthedevice.Theamplificationfactorofthecircuitcanbeadjustedbychangingthenegativefeedbackvoltageratiobetweentheoutputterminal(pin4)andtheinvertinginputterminal(pin2).

74LS02

IDescriptionThisblogintroducesthepoweramplifierwithNE5532andLM1875Tasthecorecomponents.Thepoweramplifierwearediscussinghereisahigh-fidelitytwo-channelstereosubwooferpoweramplifier.Here,wewilldiscussitsmethodsandprocedures,schematicdesign,assemblyanddebugging,andspeakerproduction.Hopethisblogcanprovideagoodreferenceforbeginners.Figure1.LM1875CatalogIDescriptionIILM1875TandNE5532Overview2.1PowerAmplifierLM1875T2.2Pre-amplificationComponentNE5532IIICompositionofPowerSupplyIVAssemblyandDebuggingSpeaker4.1ElectricalInspection4.2BoxProductionVIntheEndOrdering&QuantityIILM1875TandNE5532OverviewFirst,weintroducethecorecomponentsthatwewilluse.Andthen,thebasiccharacteristicsofthesecomponents.Audiopoweramplifierisgenerallycomposedofthefollowingthreeparts:powersupply,pre-amplifierandpost-amplifier.Here,wewillusehigh-efficiencyHI-FIpowerintegratedchipLM1875Tasthecoreoriginal.LM1875Tadoptsapositiveandnegative15Vdualpowersupply,theleft,andrightchannelsworkinOCLmode,andthebassworksinBTLmode.AsfarasthecharacteristicsofLM1875Tareconcerned,ithasthecharacteristicsofgoodsoundquality,goodfrequencyresponse,lowcostandrelativelysimplecircuit.Inaddition,thepre-amplifierpartusestheNE5532integratedoperationalamplifier.2.1PowerAmplifierLM1875TLM1875Thasexcellentperformance.Manyluxury-lookingactivespeakers,mid-rangepoweramplifiers,andsubwoofersonthemarketuseLM1875T.ThepoweramplifiercircuitcomposedofLM1875Tchiphasthefollowingcharacteristics:Theoutputpowerislarge,themaximumpowercanreachabout20W;Thestaticcurrentissmall,theloadcapacityisstrong,andthedynamiccurrentislarge,whichcandrive4~8speakers;Thecircuitissimple,easytomanufactureandlowcost;Withaninternalprotectioncircuit,itisahigh-fidelitypoweramplifiercomponentwithstableperformance.Theblogdesignofthisarticleisadual-channelstereosubwooferpoweramplifier,butLM1875Tisamono-channelpoweramplifierintegratedcircuit,sothedual-channelOCLworkingmodeusesoneLM1875Tforeachchannel.SincethebassworksinBTLmode,wehavetousetwopieces.LM1875Thas5pins.Theyarepositivepowersupply,negativepowersupply,positiveinput,reverseinput,andoutput.ThecircuitisshowninFigure2.Figure2.LM1875Circuit2.2Pre-amplificationComponentNE5532Beforethepoweramplifiercircuit,itisgenerallynecessarytoaddapreamplifier.Thepurposeofthisistoamplifythevoltageofvariousinputweakelectricalsignals.Inordertoensurethattheoutputelectricalsignalhashighfidelity,thepre-amplifierisNE5532.NE5532isahigh-performance,low-noise,dualoperationalamplifierintegratedcircuit.Comparedwithmanystandardopamps,NE5532hasbettersoundperformance,excellentoutputdrivecapability,relativelyhighsmallsignalbandwidth,andlargepowersupplyvoltagerange.Therefore,itisverysuitableforhigh-qualityandprofessionalaudioequipment,instruments,controlcircuitsandtelephonechannelamplifiers.Whenusedforaudioamplification,thetoneiswarmandhighfidelity.ThefunctionalblockdiagramofNE5532isshownasinFig.3.Figure3.NE5532FunctionalBlockDiagramIIICompositionofPowerSupplyLM1875Tadoptsapositiveandnegative15Vdualpowersupply.TheoperatingvoltageofNE5532isalso15V.Weneedtostepdownthemainspowerto15Vthroughastep-downtransformer,thenrectifyitthroughtherectifierbridgeKBL406,filteritthroughalargecapacitor,anddirectlysupplyittothepoweramplifier.Inthisway,largeroutputpowerisobtained.After7815and7915,theregulatedoutput15VisusedasthepowersupplyofthepreamplifierNE5532.ThecompositionofthepowersupplyisshowninFigure4.Figure4.PowerCircuitFigure5.PowerAmplifierCircuitBoardIVAssemblyandDebuggingSpeakerWhenstartingthecircuitinstallation,firstcheckthecircuitboardagainstthecircuitdiagram.Forexample,checkwhetherthemaincomponentsareinstalledcorrectly,andwhetherthesolderjointshavemissingsolderingorfalsesoldering.Thenturnonthepowertodebugthecircuit,andmakespeakersafterthedebuggingiscompleted.TheactualproductionisshowninFigure6.Figure6.PhysicalShootingPic4.1ElectricalInspectionUseanACsignalgeneratortoaddatinysinusoidalsignaltothesignalinput.Then,usetheoscilloscopetomeasurethethreeoutputsignalsofthepoweramplifierboard.Atthistime,observewhetherthesinemeetstherequirementsandwhethertheparametersinthetestarerelativelystable.Then,connecttwofull-rangespeakerstotheleftandrightchannels,andconnectawoofertothebassoutputport.Atthistime,addthesongsignaltocarefullycheckwhetherthethreespeakersareworkingproperlyandthesoundisgood.Iftheabovestepsarewellexpressed,thenproceedtothenextstep.4.2BoxProductionThekeytomakingspeakersistheselection,sizeandothersteps.Intheexperiment,weusedthelaminatesinthelaboratoryforsplicingandassembly.First,drawasketch.Thepaintingisdividedonthreedifferentsubstrates,andthenmadeintotwopartsrespectively.Afterdrilling,polishing,splicingandbonding,thecompletedcircuitpartsareinstalledintheirrespectiveparts.Then,wedividetheentirepoweramplifierintothreeparts.Twosatellitespeakers,aswellasawooferandpoweramplifierboard.Thesethreepartstogetherformacomplete2.1subwooferpoweramplifier.Here,thereisaplacethatneedsspecialattention.Whenmakingthebasspartofthecabinet,theimpactofvibrationshouldbefullyconsidered.Therefore,wehavetodesigndampingcomponents.VIntheEndAftertheinstallationisnormal,connectthemusicsignalsourceandlistentothemusiceffect.Thesoundreproducedbythiscircuithasastrongsenseofhierarchy,aclearsenseoforientation,andanobvioussenseofspaceanddistance.Inaddition,thesoundimageorientationisclear,thewidthisoutstanding,andthesounddynamicrangeislarge,givingpeoplearealfeeling.

IntroductionLM3886isahigh-performanceaudiopoweramplifier.ItexhibitsextremelylowTHD+Nvaluesof0.03%attheratedoutputintotheratedloadovertheaudiospectrum,andprovidesexcellentlinearitywithanIMD(SMPTE)typicalratingof0.004%.Itisverysuitablefortheenthusiastswhopursuebothbeautifulsoundqualityandstrongvolume.ThisarticleintroducesseveralpracticalapplicationsofLM3886inhometheatersystems.ThisisatechnicalexaminationvediooftheLM3886Amplifier.CatalogIntroductionCatalogIHighQualityDual-channelPowerAmplifierIIPowerfulBTLPowerAmplifierIIISubwooferSpeakerOrdering&QuantityIHighQualityDualChannelPowerAmplifierLM3886outputsnearly70Wpoweratratedvoltageandthepeakpoweris150W.Thedualchannelpoweramplifieradoptssimpleandtypicalcircuit,whichcanreplaceavarietyofHI-FIpoweramplifier,andissuitablefortheleftandrightmainchannelofpoweramplifierinhomecinema.ThewholecircuitisinstalledonthesamePCB.EachofthetwoLM3886sisequippedwithaspecialaluminumradiator(length140,thickness50,height75(mm)),whicharefixedonbothsidesofthePCBtofacilitateheatdissipation.Thepowertransformercanchoosedouble24~28V,3~5A.IIPowerfulBTLPowerAmplifierApureBTLbridgeamplifieriscomposedofanoperationalamplifierNE5532,anLM3886in-phaseamplifierandanLM3886invertingamplifier,whichcaneasilyoutputmorethan200Wundistortedpower.Itcanbeusedindancehalls,karaoke,theatersandotheroccasions.Thiscircuitcankeepthesoundqualitynaturalandsmoothwhenplayingatlowvolume.BTLPoweramplifiercircuitisshowninFigure1.Onecircuitboardforeachchannel,withindependentrectification.Thesizeoftworadiatorsis140mminlength,50mminthicknessand100mminheight.Figure1.BTLPowerAmplifierCircuitIIISubwooferSpeakerFigure2isthecircuitofahouseholdsubwooferspeaker.Figure2.circuitofsubwooferspeakerInthepicture,theLinkwitzactivecompensatoraccuratelycontrolsthecenterfrequencyf1ofthecompensationpeakanditsQvalue,sothattheclosedbox(seeFigure3)withanaturalcornerfrequencyabout50Hzandthefrequencyresponsecurve(seeFigure4)extendsdownflatly.Thelowend-3dBpointreaches25Hz.Figure3.ClosedboxFigure4.frequencyresponsecurveInFigure4,curveAisnaturalfrequencyresponse;Biscompensationcurve;andCissystemfrequencyresponse.Theturningfrequencyofthelow-passfilteriscontinuouslyadjustablefrom80Hzto200Hz,sothattheactivesubwoofercanmatchthereadersdualchannelspeakerwithdifferentfrequencylimits.TheloudspeakerusessilverfluteYD310-43.Thebasindiameteris310mm.Themagnetdiameteris158mm.Theresonancefrequencyis25Hz.Q=0.35.Thecontinuouspoweris50W,andthesensitivityisashighas95dB.ComparedwiththeHiviS8unitwithasensitivityof88dB,thesensitivitydifferencebetweenthetwois7dB.Fortheclosedbox,theoutputsoundpressureofYindiYD310-43whenitinput50WisequivalenttotheoutputofHiviS8unitwhenitinput200W.YindicanalsobereplacedbytheBlueWhaleYD310-8XA.Insteadofthebassreflexwithpoortransientperformanceandlowsensitivity,itisbettertousethesimplestclosedbox.Theboxshallbesolidandairtight,filledwithglassfibercottonoracryliccottonforwarmthabsorption,andthesmallcavityatthebottomoftheboxshallbeusedtoinstallthecircuitpart.Forthesakeofsimpleinstallation,allcircuitsareinstalledonthePCB.ThePCB,radiator,switchandI/Oconnectorarefixedonthemetalpanel,andthenfixedonthespeakerwith6screws.Then,itcanworkafterconnectingtohornandtransformer.Connectthesubwooferactivespeakerwiththehomestereospeakertoforma3Dplaybacksystem.IntroductionLM3886isahigh-performanceaudiopoweramplifier.ItexhibitsextremelylowTHD+Nvaluesof0.03%attheratedoutputintotheratedloadovertheaudiospectrum,andprovidesexcellentlinearitywithanIMD(SMPTE)typicalratingof0.004%.Itisverysuitablefortheenthusiastswhopursuebothbeautifulsoundqualityandstrongvolume.ThisarticleintroducesseveralpracticalapplicationsofLM3886inhometheatersystems.ThisisatechnicalexaminationvediooftheLM3886Amplifier.CatalogIntroductionCatalogIHighQualityDual-channelPowerAmplifierIIPowerfulBTLPowerAmplifierIIISubwooferSpeakerOrdering&QuantityIHighQualityDualChannelPowerAmplifierLM3886outputsnearly70Wpoweratratedvoltageandthepeakpoweris150W.Thedualchannelpoweramplifieradoptssimpleandtypicalcircuit,whichcanreplaceavarietyofHI-FIpoweramplifier,andissuitablefortheleftandrightmainchannelofpoweramplifierinhomecinema.ThewholecircuitisinstalledonthesamePCB.EachofthetwoLM3886sisequippedwithaspecialaluminumradiator(length140,thickness50,height75(mm)),whicharefixedonbothsidesofthePCBtofacilitateheatdissipation.Thepowertransformercanchoosedouble24~28V,3~5A.IIPowerfulBTLPowerAmplifierApureBTLbridgeamplifieriscomposedofanoperationalamplifierNE5532,anLM3886in-phaseamplifierandanLM3886invertingamplifier,whichcaneasilyoutputmorethan200Wundistortedpower.Itcanbeusedindancehalls,karaoke,theatersandotheroccasions.Thiscircuitcankeepthesoundqualitynaturalandsmoothwhenplayingatlowvolume.BTLPoweramplifiercircuitisshowninFigure1.Onecircuitboardforeachchannel,withindependentrectification.Thesizeoftworadiatorsis140mminlength,50mminthicknessand100mminheight.Figure1.BTLPowerAmplifierCircuitIIISubwooferSpeakerFigure2isthecircuitofahouseholdsubwooferspeaker.Figure2.circuitofsubwooferspeakerInthepicture,theLinkwitzactivecompensatoraccuratelycontrolsthecenterfrequencyf1ofthecompensationpeakanditsQvalue,sothattheclosedbox(seeFigure3)withanaturalcornerfrequencyabout50Hzandthefrequencyresponsecurve(seeFigure4)extendsdownflatly.Thelowend-3dBpointreaches25Hz.Figure3.ClosedboxFigure4.frequencyresponsecurveInFigure4,curveAisnaturalfrequencyresponse;Biscompensationcurve;andCissystemfrequencyresponse.Theturningfrequencyofthelow-passfilteriscontinuouslyadjustablefrom80Hzto200Hz,sothattheactivesubwoofercanmatchthereadersdualchannelspeakerwithdifferentfrequencylimits.TheloudspeakerusessilverfluteYD310-43.Thebasindiameteris310mm.Themagnetdiameteris158mm.Theresonancefrequencyis25Hz.Q=0.35.Thecontinuouspoweris50W,andthesensitivityisashighas95dB.ComparedwiththeHiviS8unitwithasensitivityof88dB,thesensitivitydifferencebetweenthetwois7dB.Fortheclosedbox,theoutputsoundpressureofYindiYD310-43whenitinput50WisequivalenttotheoutputofHiviS8unitwhenitinput200W.YindicanalsobereplacedbytheBlueWhaleYD310-8XA.Insteadofthebassreflexwithpoortransientperformanceandlowsensitivity,itisbettertousethesimplestclosedbox.Theboxshallbesolidandairtight,filledwithglassfibercottonoracryliccottonforwarmthabsorption,andthesmallcavityatthebottomoftheboxshallbeusedtoinstallthecircuitpart.Forthesakeofsimpleinstallation,allcircuitsareinstalledonthePCB.ThePCB,radiator,switchandI/Oconnectorarefixedonthemetalpanel,andthenfixedonthespeakerwith6screws.Then,itcanworkafterconnectingtohornandtransformer.Connectthesubwooferactivespeakerwiththehomestereospeakertoforma3Dplaybacksystem.

ⅠIntroductionAlinefollowingcardesignedwithLM393VoltageComparatorcapableoftrackingonaspecificrunway.Thelinefollowingcarmainlyincludesasolarpowersupplypartandatrackingcontrolpart.Thecontrolcircuitpartmainlyincludesabattery,aswitch,firstandsecondlightsensitivecircuits,aDCmotor,acomparisoncircuit,andamotordrivecircuit.ThisblogtestshowsthatthelinefollowingcarcontrolledbytheLM393voltagecomparatorhasthecharacteristicsofhighcontrolaccuracy,faststartandstop,etc.,andsolvestheproblemsofthecomplicatedcontrolcircuitstructureofthelinefollowingcarandthelargedeviationofthedrivingtrajectory.CatalogⅠIntroductionⅡWhatisLM393?ⅢWhatisALineFollowingCar?3.1SolarPowerDesign3.2LineFollowingDesignⅣCircuitDesignofLineFollowingCarⅤTestⅥConclusionOrdering&QuantityⅡWhatisLM393?TheLM393offersexceptionalvalueforcost-sensitiveapplicationswithaloweroffsetvoltage,highersupplyvoltagecapability,lowersupplycurrent,lowerinputbiascurrent,shorterpropagationdelay,aswellasimproved2kVESDperformanceandinputrobustnesswithdedicatedESDclamps.TheLM393devicesconsistoftwoindependentvoltagecomparatorsthataredesignedtooperatefromasinglepowersupplyoverawiderangeofvoltages.Thequiescentcurrentisindependentofthesupplyvoltage,andtheoutputscanbeconnectedtootheropen-collectoroutputstoachieveawiredANDrelationship.Figure1.LM393ⅢWhatisALineFollowingCar?Alinefollowingcarisacarthatcantravelalongapresettrajectory.Intheprocessofdrivingthelinefollowing,howtomakethecarcanaccuratelyfollowthetrajectorywithoutlargedeviationsisthefundamentalapplicationofthelinefollowingcar.However,theexistinglinefollowingcargenerallyusestheinfraredreflectionmethodtofeedbackthedrivingtrajectoryofthecar,thecontrolcircuitstructureismorecomplicated,andtheinfraredreflectioniseasilyaffected,sonotonlythecostishigher,butalsothedrivingtrajectoryofthecarispronetodeviation,soitoftendoesnotmatchthedesigntrajectory.UsingLM393voltagecomparatorasthemaincontrolchipofthetrackingcarwillbeabetterway.UsetheresistancechangeofthephotoresistorunderthelightintensityandtheLM393voltagecomparatortocontroltheleftandrightdrivingwheelsofthecartorealizethetrackingdriveofthecar,andcooperatewiththedisplaycircuittounderstandthestatusofthecar.TheprincipleblockdiagramoflinefollowingcarbasedonLM393voltagecomparatorisshowninFigure3.Figure2.LineFollowingCarⅣCircuitDesignofLineFollowingCarThecircuitdesignoflinefollowingcarbasedonLM393voltagecomparatormainlyincludessolarpowersupplyandcartrackingdesign.Themaincomponentsofthelinefollowingcarincludeabatterybox,acontrolcircuitboardattachedtothebottomofthebatteryboxbydouble-sidedadhesive,andseveralwheelassembliesinstalledonbothsidesofthecontrolcircuitboardandasolarbatterypanelinstalledabovethebatterybox.Figure3.BlockDiagramofLineFollowingCar3.1SolarPowerDesignThelinefollowingcaradoptsbatterypowersupplyandstorage.Thesolarbatteryboardprovidespowerforthebattery,thatis,thebatteryinthecarischargedfirst,andonlywhenthebatteryhasenoughpoweroutputvoltage,therequiredvoltagecanbeoutputattheoutputendofthebatterytodrivethetracingcar.ThedesignofthepowersupplypartmentionedinthisblogusesasinglelithiumbatterychargingmanagementchipTP4057withaninputvoltageof4V9V(typicalvalue5V),whichcanbeusedtochangetheresistancetocontrolthechargingcurrent,anditsadjustmentrangeis100mm500mAandthecut-offvoltageis4.2V.Thechargingcircuithassimpleperipherals,noexternalswitchtubeisrequired,andhasfunctionssuchaschargingindicationandfullindication,anti-reversebatterypositiveandnegativepolereverseconnectionprotection,andpowersupplyundervoltageprotection.Inadditiontousingsolarpanelstopowerthecircuit,itcanalsoworkwithUSBpowerandadapterpower.Figure4.SchematicDiagramofChargingCircuit3.2LineFollowingDesignThecartrackingadoptstheLM393voltagecomparatorasthecontrolcenteroftheentiretrackingcircuit.LM393isadualvoltagecomparatorintegratedcircuit,whichiscomposedoftwoindependentprecisionvoltagecomparators.Itsfunctionistocomparetwoinputvoltagesandchangetheleveloftheoutputvoltageaccordingtothelevelofthetwoinputvoltages.TheschematicdiagramusingtheLM393voltagecomparatorasthetrackingcontrolcircuitisshowninFigure5.ThiscarchoosesredLEDlightasitslightsource.Whenthelightsourceshinesonwhiteobjectsandblackobjects(thepredeterminedtrajectoryofthecarisblack),thereflectivityisdifferent.Thelightisreflectedontothephotoresistorthroughtheground.WhentheredLEDlightisprojectedonthewhiteareaandtheblacktrackline,theresistanceofthephotoresistorwillbesignificantlydifferentbecauseofthedifferentreflectance;Bydetectingtheresistancechangeofthephotoresistor,itcanbejudgedwhetherthecarisdrivingontheblacktrackline.ThiscarchoosesredLEDlightasitslightsource.Whenthelightsourceshinesonwhiteobjectsandblackobjects(thepredeterminedtrajectoryofthecarisblack),thereflectivityisdifferent.Thelightisreflectedontothephotoresistorthroughtheground.WhentheredLEDlightisprojectedonthewhiteareaandtheblacktrackline,theresistanceofthephotoresistorwillbesignificantlydifferentbecauseofthedifferentreflectance;Bydetectingtheresistancechangeofthephotoresistor,itcanbejudgedwhetherthecarisdrivingontheblacktrackline.Figure5.SchematicDiagramofTracingIftheresistanceofthephotoresistorchanges,itmeansthatthewhiteareahasbeendetected,andthecarhasdeviated;atthistime,themotoroftheleftorrightwheelofthecarisdeceleratedorevenstoppedtomakethecarreturntotheblacktrack.ThetrackcarrunsonasimilarS-shapedroutetoachievethelinefollowingfunction.Whenthereisanimbalance(forexample,onewheelispressedontheblacktrackline),themotorononesideisstoppedimmediately,andthemotorontheothersideisacceleratedtorotate,sothatthecarcancorrectthedirectionandreturntothecorrectdirection.Thewholeprocessisaclosedloopcontrol,soyoucanquicklyandsensitivelycontrolthemovementofthelinefollowingcar.Atthesametime,thephotoresistorcandetecttheintensityoftheexternallight.Thestrongertheexternallightis,thesmallertheresistancevalueofthephotoresistoris.TheleftandrightwheeldriveofthistrackingcarusesaDCmotorwithareductiongear.TheDCmotordrivesthecartoslowdown,otherwisethecarwillruntoofastifthespeedistoohigh.Moreover,thetorqueistoosmalltorunevenwithoutdeceleration.Themotorusedinthislinefollowingcarhasintegratedareductiongeartogreatlyreducethedifficultyofproductionanddebugging.Comparedwiththeuseofasingle-chipmicrocomputerasthecontrolcircuit,thecontrolcircuitcomposedoftheLM393voltagecomparatorhasasimplerstructure,isconvenientforassemblyanddebugging,andhasalowercost.ⅤTestFirstofall,placethecaronthewhitebackgroundtestfieldoftheblacktrackline(theblackrunwayisthecarspresettrack),andturnontheswitchesS1,S2,solarpanels(orbatteries)toprovideelectricity,sothatthevoltagecomparatorcontrolsthestartoftwoDCmotorstodrivethewheelassembliesonbothsidesofthecar.OurDIYlinefollowingcarbegantodrivealongthedesignedtrack(blackrunway)!Duringthedrivingofthecar,thelight-emittingdiodesD2andD3ontheleftandrightsidesofthecarbothemitredlightsources.Becausethelightsourceirradiatestheblackrunwayandthewhiterunwaywithdifferentreflectivity,andthephotoresistorcandetecttheexternallightintensity,thestrongertheexternallight,thesmallerthephotoresistorresistance,theweakertheexternallight,thegreatertheresistance.Therefore,whentheredLEDlightisprojectedontotheblackandwhiterunway,becauseofthedifferentreflectance,theresistanceofthephotoresistorwillbesignificantlydifferent.Figure6.RedLEDWhenthelightsourceisreflectedbytherunwaytothephotoresistorsR14andR15,thecomparatorcandeterminewhetherthecarisdrivingontheblacktracklineorthewhiteareaaccordingtothechangesintheresistanceofthephotoresistorsonbothsides.Andthroughthediodesandphotoresistorsontheleftandrightsides,wecanalsodeterminewhichsidethecarisdeflectingatthistime.Whenanimbalanceoccurs(forexample,thesideofthecarispressedagainstthewhitearea),theDCmotorononesideisimmediatelystopped,andtheDCmotorontheothersideisacceleratedtorotate,sothatthecarcancorrectthedrivingdirectionandreturntothecorrectdrivingdirection(blacktrackon-line.Actually,wecanseethattheleftandrightdrivingwheelsofthecarrotateinturnandstopdrivingthecarforward;thereisaprocessofdeviation,correction,deviation,andcorrection;butitalwaysadvancesalongtheestablishedblacktrajectory.ⅥConclusionThesolartrackingcardiscussedinthisblog:Passedthetestandsuccessfullyrealizedthecarslinefollowing;Canbepoweredbysolarenergyorbattery;Strongstabilityandanti-interferenceability,highcontrolaccuracy,faststartandstop;Solvedtheproblemsofcomplicatedcontrolcircuitoflinefollowingcarandlargedeviationofdrivingtrajectory.UsingonlytheLM393voltagecomparatorasthecontrollercircuitallowsustoassembleanddebugconvenientlyandatalowercost.Theuseofnon-singlechipcontrolisafeatureofthislinefollowingcar.Figure7.LM393Insummary,thelinefollowingcarbasedonLM393controlissuitablefortechnologicalinnovationandtechnologypromotion.Afterreadingtheblog,haveyoubetterunderstandLM393?Finally,ifyouhaveanyquestionsaboutLM393,pleasedonothesitatetoleaveamessageinthecommentsectionbelow!IDescriptionLM1875isapoweramplifierintegratedblockchip.Itssuperiorperformanceandattractivetonehavebeenacceptedbymanyenthusiasts,anditwasalltherageinthe1990s.LM1875adoptsTO-220packagestructure,whichisshapedlikeamid-powertube,smallinsize,simpleinperipheralcircuits,andlargeinoutputpower.Theintegratedcircuitintroducedinthisblogisequippedwithoverload,overheatingandinductiveloadreversepotentialsafetyprotection,whichisoneoftheidealchoicesforhigh-endaudio.Figure1.LM1875CatalogIDescriptionIILM1875ParametersIIILM1875CircuitPrincipleIVLM1875CircuitAssemblyandDebuggingVIntheEndOrdering&QuantityIILM1875ParametersVoltageRange16~60VQuiescentCurrent50MmAOutputPower25WHarmonicDistortion0.02%,whenf=1kHz,RL=8,P0=20WRatedGain26dB,whenf=1kHzWorkingVoltage25VConversionRate18V/SIIILM1875CircuitPrincipleThiscircuitiscomposedofanattenuatedtonecontrolcircuitcontrolledseparatelyforhighandlowsounds,LM1875amplifiercircuitandpowersupplycircuit.Amongthem,thesoundqualitycontrolpartusesanattenuatedtonecircuitcontrolledseparatelyforhighandlowsounds.Thespecificcomponentsareasfollows:R02,R03,C02,C01,W02formabasscontrolcircuit;C03,C04,W03formatreblecontrolcircuit;R04istheisolationresistance;W01isthevolumecontroller,whichadjuststhevolumeoftheamplifier;C05isanisolationcapacitortopreventthedownstreamLM1875DCpotentialelementfromaffectingtheprevioustonecircuit.TheamplifyingcircuitmainlyadoptsLM1875,whichiscomposedof1875,R08,R09,C066,etc.ThemagnificationofthecircuitisdeterminedbytheratioofR08toR09;C06isusedtostabilizethedriftoftheLM1875s4thpinDCzeropotential,butithasacertainimpactonthesoundquality;C07andR10functiontopreventtheamplifierfromgeneratinglow-frequencyself-excitation.InAddtion,theloadimpedanceofthisamplifieris416.Figure2.LM1875CircuitWhataboutthepowersupplycircuitofthepoweramplifier?Pleasetakealookatthepicturebelow.Inordertoensurethesoundqualityofthepoweramplifierboard,weneedtopayattentiontothefollowingwhendesigningthecircuit:Theoutputpowerofthepowertransformershallnotbelessthan80W;Theoutputvoltageis2*25V;Thefiltercapacitorusestwo4700UF/25Velectrolyticcapacitorsinparallel;Positiveandnegativepowersuppliesshare44700UF/25Vcapacitors;Thetwo104basecapacitorsarehigh-frequencyfiltercapacitors;Onlyiftheaboverequirementsaremet,theamplifiercanmaintainbettersoundquality.Figure3.LM1875CircuitIVLM1875CircuitAssemblyandDebuggingThisblogwillintroducethenecessarytoolsforcircuitassembly,howtoprepareforsoldering,andfinallyhowtodebugthecircuit.Ofcourse,ifyoustillfeellikeyouarestillcannotgetenough,intheendyoucanevenfollowourtipstotryanextrainterestingexperimentwiththiscircuit.ToolsThatYouNeedA20Welectricsolderingiron,preferablywithadjustabletemperature;Amultimeter;Apairofneedlenosepliers;Ascrewdriver;Somesolderwireandpineperfume.HowtoPrepareforWeldingWeldingsequence:①Weldingjumpers;②Weldingresistance;③Weldingcapacitor;④Weldedrectifiertube;⑤Weldingpotentiometer;⑥WeldLM1875.NotesFixtheLM1875withscrewsontheheatsinkbeforeweldingLM1875,otherwisethescrewswillbedifficulttodriveinwhentheheatsinkisinstalledattheend;ThepartofLM1875incontactwiththeheatsinkmustbecoatedwithasmallamountofheatdissipationgreasetofacilitateheatdissipation;Payattentiontotheweldingqualitywhenwelding.Forbeginners,youcanpracticeafewmoretimesontheoldcircuitboard,andthenformallysolder.HowtoDebugCorrectlyThedebuggingofthispoweramplifierboardisverysimple.Afterthecircuitboardissolderedwithelectroniccomponents,wemustcarefullycheckthecircuitboardforsolderingerrors.Specialattentionshouldbepaidtoelectronicpartswithpolarity,suchaselectrolyticcapacitorsandbridgerectifiers.Oncetheweldingisreversed,thereisariskofburningthecomponents.Whenthetransformerisconnected,theoutputterminaloftheamplifierisnotconnectedtothespeaker,butconnectedtoamultimeter(preferablydigitaldisplay,andthemultimeterissettoDC*2V).Inaddition,payattentiontothereadingofthemultimeterwhenpoweringonthepoweramplifierboard.Undernormalcircumstances,thereadingshouldbewithin30mV,otherwiseweshouldimmediatelycutoffthepowertocheckthecircuitboard.Ifthereadingoftheelectricmeteriswithinthenormalrange,itindicatesthatthefunctionofthepoweramplifierboardisbasicallynormal.Atthistime,weconnectedthespeaker,theninputthemusicsignal,andthenpoweronthetestmachine.Underthecorrectproceduresandspecifications,turnthevolumepotentiometer,thevolumeshouldchange,andturnthehighandlowknobs,thetoneofthespeakerwillchange.Figure4.LM1875ExperimentWorthTryingFirst,wewillshort-circuitC6andmeasuretheDCpotentialattheoutputofLM1875withamultimetertoseeifitiswithin30MV.Then,connectthespeakerandtestfortwohours.UseamultimetertomeasuretheDCpotentialattheoutputoftheLM1875toseeiftheDCpotentialiswithin30MV.IftheDCpotentialiswithin30MV,thecapacitorC6canbeomitted.Inthiscase,theamplifierboardbecomesapureDCpoweramplifier.VIntheEndSofar,thepoweramplifierboardhasbeensuccessfullyinstalledandadjusted.Lookingatthispieceofworkthatyoucanbeproudofandenjoyingthewonderfulmusic,areyousatisfied?

IDescriptionThisblogintroducesthedesignofalithiumbatterybackuppowercontrolboardbasedonLM393,whichissimple,stable,reliable,andlow-cost.Itcandirectlyoutputthemainsvoltagewhenthereismainspower,andcontinuouslymonitorthemainsvoltage.Notonlycanthisdesignautomaticallyturnontheinverterwithin10msafterthemainspowerisoff,butitalsohasapowermanagementfunction:whentheinternallithiumbatteryvoltageislowerthanthesetvalue,itwillautomaticallycharge.ThisVediointroducesHowDoesLM393WorksCatalogIDescriptionIIDesignandWorkingPrinciple2.1Design2.2WorkingPrincipleIIITestIVConclsionOrdering&QuantityIIDesignandWorkingPrincipleThedetailsofLM393basedlithiumbatterybackupcircuitareasfollows:2.1Design2.1.1MainsPowerFailureWhenthereisnomainspowerinput,thecontrolpanelwillturnontheinverterandoutput220VACwithin10msofthemainspowerfailure.2.1.2ChargingManagementFigure1.FunctionDiagramWhenthereismainsinput,thecontrolboardfirstshutsdowntheinverteroutputandswitchestothemainsoutput;thenentersthechargingmanagementstate(duetothefeatureofthelithiumbatteryprotectionboard,theprotectionboardstopschargingafteroverchargeprotection.WhenthebatteryvoltageWhenitdropstotheoverchargerecoveryvalueorbelow,itwillautomaticallyresumecharging.Whenthereismainsinputforalongtime,thelithiumbatterychargerwillberepeatedlycharged,whichwillaffectthelifeofthelithiumbattery).Whenthelithiumbatteryisfullycharged,itwillstopcharging.Whenitdropstoacertainlevel(thisparameterislowerthantheoverchargerecoveryvalueofthelithiumbatteryprotectionboard,thespecificparametervalueisadjustable)andthenresumecharginguntilitisfullycharged,andrepeattheaboveprocess.2.2WorkingPrincipleAccordingtothedesignrequirements,theprincipledesignofthiscontrolboardisdividedintotwoparts:lithiumbatteryvoltagedetectionandcontrol,andmainsvoltagedetectionandcontrol.ThemainvoltagecomparisonpartofthecontrolboardusesthedualvoltagecomparatorintegratedchipLM393.LM393integrates2independentcomparators,itsoperatingpowersupplyvoltagerangeiswide,itcanworkfor2~36Vwhensinglepowerinput,and1~18Vwhendualpowerinput.Inaddition,itscurrentconsumptionissmall,only0.8mA.AndwhatisthepinoutofLM393?WecantakealookatFigure2below:Pins3,5arethenon-invertinginputterminalsofthetwocomparatorsrespectively;Pins2,6aretheinvertinginputterminalsofthetwocomparatorsrespectively;Pins1,7arethecorrespondingoutputterminalsofthetwocomparatorsrespectively.Figure2.LM393PinoutWhenusedasabasiccomparisoncircuit,ifthevoltageatthenon-invertinginputterminalisgreaterthanthevoltageattheinvertinginputterminal,thecorrespondingoutputterminaloutputsahighlevel,andviceversa.Forexample,whenU5U6,U7outputshighlevel;whenU5U6,U7outputslowlevel.2.2.1LithiumBatteryVoltageDetectionandControlLithiumbatteryvoltagedetectioncontrolisshowninFigure3.(1)PowerSupplyThepowersupplyofthecontrolpartistakenfromthelithiumbatteryofthebackuppowersupply,andthevoltageofthecontrolboardis12VDC.Becausethelithiumbatteryinthisdesignis48V,itsvoltagerangeis32Vto54.6V,whichishigherthanthelargeinputvoltagerequiredbythestabilizerblock7812.Therefore,inordertoprotectthevoltageregulatorblock7812,weneedtoconnecta20Vvoltageregulatortubeinseriesattheinputtostepdown.Here,diodeD5actsasreversevoltageprotection(2)VoltageComparisonThepowermanagementadoptsthecomparatorLM393,thesamplingvoltageofthelithiumbatteryisdividedbyresistorsR11andR12,andtheninputtothenon-invertinginputofLM393.Thereferencevoltagedivides12VthroughtheresistorR4andthepotentiometer,andthenenterstheinvertinginputofLM393.WhenthesamplingvoltageU1ishigherthanthereferencevoltageU2,theoutputterminalcorrespondingtoLM393outputsahighlevel,thetransistor9012isturnedoff,therelaydoesnotoperate,andtheinverterstopsworking.WhenthesamplingvoltageU1islowerthanthereferencevoltageU2,theoutputterminalcorrespondingtoLM393outputsalowlevel,thetransistor9012isturnedon,therelayacts,andtheinverteristurnedon.ThereferencevoltagecanbeadjustedaccordingtotheactualparametersthroughthepotentiometerR5.Figure3.LM393LithiumBatteryVoltageDetectionandControl(3)HysteresisComparatorCircuitInasingle-limitcomparator,iftheinputsignalUinhasaslightinterferencenearthethreshold,theoutputvoltagewillproducecorrespondingjitter(fluctuation).Forexample,inthedesignoflithiumbatteryvoltagedetection,ifthesamplingvoltageofthelithiumbatteryfluctuatesnearthetargetvoltage(seeFigure3),thevoltageofU1ishigherthanthevoltageofU2,andtheoutputofthecomparatorshouldoutputahighlevel.However,iftheU1voltageorU2voltagefluctuatesslightlyatthistime,thetransistor9012islikelytobeturnedonandofffrequentlyatthistime,andthecontroloutputwillbeveryunstable.Thenhowtoovercomethisshortcoming?Wecanintroducepositivefeedbackinthedesign(thatis,thewayofhardwaretoachievereturndifference).Ifweneedtofixatrippointatacertainreferencevoltagevalue,wecaninsertanon-linearelement(suchasacrystaldiode)inthepositivefeedbackcircuit.Byusingtheunidirectionalconductivityofthediode(inFigure2,D10diode1N4148),theaboverequirementscanbeachieved.2.2.2MainsVoltageDetectionandControlThedescriptionofthemainsvoltagedetectioncontrolpartisshowninFigure4.(1)PowerSupplyPartThepowersupplypartusesthesamepowersupplyDC12Vasthelithiumbatteryvoltagedetectionandcontrolpart.(2)MainsVoltageDetectionTakingintoaccountthecostofthemainsvoltagedetectionpart,thisdesignabandonsthetraditionaltransformerorvoltagetransformerdetectionmethod,andusestwooptocouplerchipsPC817todetectthemains.PC817isacommonlyusedlinearoptocoupler,whichisoftenusedinfunctionalcircuitsthatrequiremoreprecision.Whenanelectricalsignalisappliedtotheinputend,thelightemitteremitslightandilluminatesthelightreceiver.Thelightreceiveristurnedonafterreceivingthelight,andgeneratesaphotocurrentoutputfromtheoutputend,thusrealizingtheelectricity-optical-electricityconversion.Thisconversionisoftenappliedtovariouscivilindustrialproductssuchasswitchingpowersupplies,UPS,adapters,etc.Figure4.LM393MainsVoltageDetectionandControlTakeAC220Vasanexample.Inordertoprotecttheoptocoupler,weusea1Mresistorinthedesigntolimitthecurrentoftheoptocoupleremitter.TheoptocouplerchipsU1andU2arerespectivelyturnedonundertheactionofalternatingcurrent,andcooperatewiththecapacitorC6toensurethatthevoltageofthenon-invertinginputterminalU3isgreaterthantheinvertinginputterminalU4undertheconditionofnormalmainsinput.Theoptocouplerchipusedinthisdesigncanalsobeusedforelectricalisolationbetweenthecontrolboardandthemains.Whenthereismainspower:LM393snon-invertinginputterminalU3voltageisDC12VInvertinginputterminalU4voltageis9V(R2,R10dividedvoltage)ThecorrespondingoutputterminalishighThetransistor9014isturnedonTherelayoperatesThenormallyclosedpointisopenThereisoutputbetweenmainsvoltageWhenthereisnomainspower:Thevoltageatthenon-invertinginputterminalU3ofLM393isDC0VThevoltageattheinvertinginputterminalU4is9VThecorrespondingoutputterminalislowlevelThetransistor9014iscutoffTherelaydoesnotoperateThenormallyclosedpointisclosedTheinverteroutputs220V.IIITestAftertesting,thiscontrolcircuitmeetsthedesignrequirements:whenthereismainspowersupply,itoutputsmainsvoltage,andautomaticallyconvertstobackuppowersupplywithin10msinthecaseofmainspowerfailure,andhasgoodchargingmanagementfunctions,asshowninFigure5andFigure6.Figure5.LithiumBatteryVoltageDetectionWaveformFigure6.MainsVoltageDetectionWaveformInpracticalapplications,MOStubesandtriacscanalsobeusedtoreplacetherelaysinthevoltagedetectionandcontrolpartofthelithiumbatteryandtherelaysinthemainsvoltagedetectionandcontrolparttoachievethecontroloutput.IVConclsionThiscontrolboardisdesignedaccordingtothecharacteristicsofthelithiumbatterybackuppowersupplythatisgraduallypopularizedatpresent.Ithastheadvantagesofstronganti-interferenceandlowcost,andhasstrongmarketpromotionvalue.Insubsequentdesigns,wecanalsoaddprotectionfunctionssuchasbatteryunder-voltageprotection,short-circuitprotection,overloadprotection,over-voltageprotection,andover-temperatureprotectionaccordingtouserrequirementstocontinuouslyimprovetheproduct.Afterreadingtheblog,haveyoubetterunderstandLM393?Finally,ifyouhaveanyquestionsaboutLM393,pleasedonothesitatetoleaveamessageinthecommentsectionbelow!IntroductionInordertosolvetheproblemoftransientdistortion,thetypicalapplicationcircuitofLM3886poweramplifierischangedtothecurrentnegativefeedbacktype.Thecurrentsampleflowingthroughthespeakervoicecoilisfedbacktothepoweramplifierinputterminalviaresistance,andtheloudspeakersystemisalsoincludedinthefeedbacksystem.CatalogIntroductionCatalogITypicalpoweramplifiercircuitIIImprovedPowerAmplifierCircuitOrdering&QuantityITypicalpoweramplifiercircuitThepoweramplifiercircuitmadeofLM3886consistsoftwoparts:pre-amplifierandpoweramplifier.ThepreamplifierconsistsofanintegratedoperationalamplifierNE5534,whichprovidesavoltagegainofabout5times.ThepoweramplifieriscomposedofLM3886,whichprovidesavoltagegainofabout10times.Therefore,thefullpoweroutputcanbeachievedbyinputtingabout0.5Vsignalattheinputend.Figure1onlyshowstheLM3886dualpowersupplycircuit,whichcanalsoworkinasinglepowersupply.Consideringfromtheaspectofsoundquality,theaudioamplifiercircuitgenerallydoesnotusesinglepowersupply,butdualpowersupply.Figure1.typicalpoweramplifiercircuitThetypicalapplicationcircuitofLM3886adoptsthetraditionalnegativevoltagefeedbackmode.Negativevoltagefeedbackcanimprovethefrequencycharacteristicsofpoweramplifierandreducenonlineardistortion,butthesoundislackofstrength.Asthevolumeincreases,thelowfrequencywillbecometight,dryandhard,andthedistortionwillincrease.Atthesametime,thehighfrequencybecomessharpandharsh,andthemusicanditsdefinitionaregreatlyreduced.Thisistheso-calledTransientIntermodulationDistortion.Thetransientintermodulationdistortionismainlycausedbytheintroductionofdeepnegativefeedback.Voltagetypenegativefeedbackiseffectivetoimprovethenonlineardistortionofpoweramplifier,butitcannottakeintoaccountthetransientdistortionatthesametime.IIImprovedPowerAmplifierCircuitTheimprovedcircuitisshowninFigure2.Thelow-frequencyspectralgainofpoweramplifierisdeterminedbytheratioofR3andR4.C3andR5determinethehigh-frequencygainofpoweramplifier.DuetothelargecapacitancereactanceofC3atlowfrequency,thecurrentfeedbackisterminatedatlowfrequency,whilethehighfrequencyisimprovedbycurrentnegativefeedback.Theresultisthatthetotalbandwidthisimprovedandthetransientdistortionisgreatlyreduced.Theselectionoffeedbackcomponentsshouldbebasedontheimpedanceandinductanceoftheloudspeaker,sothatthelow-frequencygainis2-3timesofthehigh-frequencygain.Formerpoweramplifiersoftendesignedthefrequencycharacteristicstobeflat,whichdidnotachievegoodsoundeffects.Inordertoimprovethesoundeffectofthepoweramplifier,weshouldusethenegativefeedbackcircuittoconsciouslyincreasethelowfrequencygaintoachievethebesteffect,whichalsomeetstherequirementsofthelargedynamicsoundeffectoftodayshometheater.Figure2.schematicdiagramofpoweramplifiercircuitThesoundeffectofthismachineisexcellent.Thelowfrequencyextensionisincreasedanditisflexible.Thehighfrequencyisclearandsmooth.Theresolutionisgreatlyimproved,andthemetallicsoundiscompletelydisappeared.Evenifthevolumewasdoubled,nosignificantdistortionwasheard.

访客,请您发表评论:

Powered By Tkool Electronics

Copyright Your WebSite.sitemap