Título VII: Régimen del Buen Vivir
4.7. Generación y evaluación de desechos líquidos, desechos sólidos y emisiones energéticas
5.1.1. Área de Influencia de las Actividades (directa)
Status var PortB.Bit1 Load var PortB.Bit2 InputB1
InputB2
; Main
HighRB0 ;turnontheIPS511andapplypowertoload
Pause2 ;DelaytoensureIPS511isfullyon
;nowcheckthestatuswhentheIPS511shouldbeon
If(Status=1)AND(Load=1)ThenGoSubNormalOn
If(Status=0)AND(Load=0)ThenGoSubOverload
LowRB0 ;turntheIPS511off
Pause2 ;nowcheckthestatuswhenoff
If(Status=0)AND(Load=0)ThenGoSubNormalOff
If(Status=1)AND(Load=1)ThenGoSubOpenLoad
NormalOn;SubroutineifallisOKattheloadwhenon
;--- CodetobeexecutedifresultisOK Return
NormalOff;SubroutineifallisOKatloadwhenoff
;--- CodetobeexecutedifresultisOK Return
OpenLoad;Subroutinetobeexecutedifloadisopen
;--- Codetobeexecutediftheloadisopen Return
OverLoad;Subroutinetobeexecutedifexcessivecurrent
;--- orovertemperature
Codetobeexecutedforovercurrentcondition
Orovertemperaturecondition.Determinethedifference
Betweenthetwobycheckingforcyclingorsteadystate
LowonLoad
IfLoadiscycling—problemisovertemperature Return
Separatingcertainfaults,suchasovertemperatureandovercurrentmayrequirerepeatedpollingofthesta-tusandoutputpinstodeterminewhetherthefaultperiodicallyclearsitself(asthedevicecoolsdownandthe
thermaltripresets)orremainsstatic.Additionally,iftheonsetofcurrentlimitingmustbedetecteditmaybe
necessarytoalterR3,R4andR5tocauseabnormallylow,butnotzero,voltageacrosstheloadtoreadasa
lowonRB2.
IsolatedSwitching
Althoughwewilldiscussavarietyofdevicesundertheisolatedswitchingcategory,ofcoursethesemay
alsobeusedforlowsideorhighsideswitching.
RelaySwitching
Relayspre-dateelectronics,astheyweredevelopedtoextendtherangeofmanualMorsetelegraphsystemsin
themid1800s.Nonetheless,weshouldnotquicklydiscardtherelaysolutiontoswitching.Relaysareavailable
inarichvarietyofcontactconfigurations,contactmaterial,powerrating,voltageratingandcoilrating.
Goodthingsaboutrelays
• Resistanttodamagefromoverloadsandpolarity
reversal
• Excellentisolationbetweenswitchedloadand
controllingcircuitry
• Widerangeofratings
• CanswitchAC,DC,video,RF,lowlevelaudio,etc.
byproperselectionofdevice.
Notsogoodthingsaboutrelays
• Limitedlife,althoughmanyrelaysareratedfor
tensofmillionsofoperations
• Noise
• Speedofoperationandrelease,usuallyinthe
millisecondrange.
• Sizemaybeanissue
• Contactbounce
• Requirespowertoholdrelayoperated,unlessitis
alatchingrelay.
We’lllookatthreerelays:
Make/Model CoilRating
Contact
Configuration ContactRating Comments StandexJG102-12-1 12V/24mA SPST(1A) 48V/1A Veryhighspeedreedrelay
OmronG5V-2-H1 12V/12.5mA DPDT(2C) 125VAC/0.5A 30VDC/2A
Lowsignalrelaywithbifurcated
contacts;ultrasensitive
OmronG2RL-24 12V/33.3mA DPDT(2C) 250VAC/8A
30VDC/8A
General-purposepowerrelay
Totestthecontactclosureandoperate/releasetime,we’ll
usethecircuitofFigure3-34.Figure3-34shouldbe
familiar;a2N7000lowsideswitchdrivestherelaycoil.
Asweearlierdetermined,thecurrentandvoltagerequired
tooperatetherelaysundertestiswellwithinthelimits
fora2N7000.Tosensecontactclosureandbounce,we
usea5Vsourceinserieswitha56ohmresistortopass
approximately90mAthroughthecontacts.Inorderto
makemeasurements,V2’snegativeterminalisconnected
toground;butinordertoemphasizetheabilityofrelays
toswitchisolatedcircuits,Figure3-34showstheloadin
itsmostgeneral“floating”form.
Sincearelaycoilisaninductiveload,wemustuseasnubbingdiodetoavoiddamagingthe2N7000.To
illustratethevoltagespikeevenasmallinductiveloadgenerates,compareFigures3-35and3-36.With-outasnubbingdiode,theinductivespikeexceeds76V,atwhichpointthe2N7000breaksdown.Addinga
1N4001snubbingdiodereducesthespiketo12.7V—thatis,0.7Vabovethe12Vrelaysupplyvoltage.
Finally,althoughtheoperatingandreleasetimesfortheserelaysislongcomparedwithpureelectronic
switches,formanyapplicationsafewmillisecondsdelaybetweenPICoutputandrelaypull-inisoflittle
consequence.
Figure3-34:Relaytestcircuit.
StandexJG102-12-1
Reedrelaysarewellknownforhighspeedoperation,
andtheJG102-12-1(sincereplacedbymodelJG100-12-1)meetsourexpectations.Figures3-37,3-38and
3-39showoperatingtimesforthisdevice.TheJG102-12-1relayturnsonin250µs,butanadditional150µs
isnecessaryforcontactbouncetocease.Turnofftime
isalsoapproximately250µs.Sincetheturn-onand
turn-offtimesareapproximatelyequal,theoverall
relayhightimeisveryclosetothePICcontrolpinhigh
time,althoughdelayedbyapproximately400µs.(The
terms“operatetime”or“pull-intime”and“release
time”areusuallyusedwhendiscussingrelayspeeds,
insteadofturn-onandturn-off.However,toillustrate
thecommonalitywithtransistorswitching,we’lluse
theturn-onandturn-offterminologyaswell.)
Figure3-36:JG102-12-1RelaywithSnubberCh1:
PICOutput;Ch2:2N7000Drain.
Figure3-35:JG102-12-1RelayWithoutSnubber
Ch1:PICOutput;Ch2:2N7000Drain.
Figure 3-37: JG102-12-1 Reed relay Ch1: PIC
output;Ch2:relaycontact.
Figure3-38:JG102-12-1Reedrelayturn-ondelay
andcontactbounceCh1:PICoutput;Ch2:relay
contact.
Figure3-39:JG102-12-1Reedrelayturn-offdelay
Ch1:PICoutput;Ch2:relaycontact.
Reedrelaysarecommonlyusedintelecommunicationsequipmenttoswitchvoice,dataandhighfrequency
signalsandarenotoftenemployedforswitchingpowercircuits.
OmronG5V-2-H1
TheG5V-2-H1isamemberofOmron’stelecommunica-tionsfamily,optimizedforlowlevelsignalsandisusedfor
purposessimilartothoseofreedrelaysaswellasforlow
levelpowerswitching.TheG2Visofconventionalrelay
construction,butwithbifurcatedcross-pointgoldplated
silvercontacts.Eventhoughthecontactsareofprecious
metal,Omronquotesaminimumcontactloadof10µAand
10mVDC.Atlowerlevels,oxidesandcontaminantsmay
preventreliableoperation.
Althoughconstructedwithbifurcatedcross-pointcontacts,
contactbounceisstillapparentwiththeG5V-2-H1,as
reflectedinFigure3-40.Operateandreleasetimesareap-proximately4ms.
OmronG2RL-24
TheG2RL-24isapowerrelay,suitableforswitchingAC
andDCupto8amperes.Asmightbeexpected,relays
designedtoswitchhighercurrentsaremoresubstantially
constructedandhencetakemoretimetooperateandre-lease.Figure3-41showstheG2RL-24requiresnearly
8mStooperateanddampencontactbounce.Releasetime
isshorter,only4ms.Sincereleaseisshorterthanoperate,
theoriginal10msPICoutputonlyresultsin6msofuseful
relayclosure.
4N25OpticalIsolatedNPNSwitch
Opticalcouplersor“optoisolators”consistofanLED
packagedwithaphoto-diodeoraphototransistor.When
illuminated,lightfromtheLEDsaturatesthereceptorand
itconducts.ThereisnoelectricalconnectionbetweentheLEDinputandphotodeviceoutput,sothetwo
circuithalvesareindependentandmaybeatapotentialdifferenceofhundredsoreventhousandsofvolts.
Optoisolatorsareavailableinawiderangeofoperatingspeedsandconfigurations.We’ll
firstlookatalowpoweroptoisolator,thevenerable4N25device,followedbyamodern
highpoweropticallycoupledMOSFET,thePS710A-1A-1.
Figure3-42showshowsimpleitistoconnectan
optoisolatortoaPIC.R1isselectedtoachievethe
desiredLEDon-currentusingthemethodology
developedearlierinthischapter.The220ohmresis-torisintendedtoprovideapproximately10mALED
on-current.The4N25’soutputtransistorisconfigured
asalowsideswitchintheexample.
Figure3-40:G5V-2-H1relayCh1:PICoutput;Ch2:
relaycontact.
Figure3-41:G2RL-24relayCh1:PICoutput;Ch2:
relaycontact.
Figure3-42:4N25Optoisolatorconnection.
Withamaximumcurrentratingofonly150mA,
the4N25isnotintendedtoswitchlargecur-rentssoitwilloftenbeusedasthefirststagein
amultistageswitchingarrangement,suchasthat
showninFigure3-43.Inthisdesign,the4N25
operatesasanemitterfollower.WhentheLED
isilluminatedviaRB0goinghigh,currentflows
throughthe4N25’soutputtransistorandR3,tak-ingthegateofQ1intoconduction.Currentthen
flowsthroughtheloadandQ1.WhentheLEDis
dark,the4N25’soutputtransistoriscutoffandQ1’sVGSisclosetozeroandQ1iscutoff.Ofcourse,anyof
themoremodernIPSproductsmaybesubstitutedfortheIRF510.
LowpoweroptoisolatorsarealsooftenusedtoisolatedataorsignalcircuitsfromthePIC,andanoptical
coupledRS-232circuitpermitsisolatingaPICfromtheassociatedcomputerorcontrolleddevices.
PS710A-1AAC/DCOpticallyIsolatedMOSFET
NEC’sPS710A-1AisahighpowerMOSFEToptoisolator.Unlikethe4N25,thePS710Aisapowerdevice,
capableofswitchingloadsupto1.8Aat60V,anditsseriesMOSFETdesignwillswitchbothACandDC.
EachMOSFEThasanRDS(ON)of0.1ohmand,forDCswitching,maybeparalleledhandle3.6A.
ThePS701A-1AisconnectedasillustratedinFigure3-44
forACorDCswitching.Otherconfigurationsarepossible
forDCswitchingandyoushouldconsultthedatasheetfor
additionalinformation.
Figure3-45showstheresultsforthecircuitofFigure3-44,
switching1Aat5V.Figure3-45confirmsthedatasheet’s
1mstypicalturn-ontimeand50µstypicalturn-offtime.
Inswitchinghighcurrentsinmicrosecondtimes,undesiredtransientsandoscillationsareoftenseen,partic-ularlywhenusingaplug-inboardandlabpowersupplieswithlongleads.Whenthedesignistransferredto
aprintedcircuitboardwithwidepowertracesandintegratedpowerdistributionfilteringtheproblemisoften
solved.Insomecasesadditionalfilteringandbypassingwillbenecessary.Figure3-46showsanexpanded
Figure3-43:4N25withIRF510.
Figure3-44:AC/DCisolatedswitchingwithNEC’s
PS710A-1A.
Figure 3-45: Switching with a PS107A-1A Ch1:
PICoutput;Ch2:load.
Figure3-46:Undesiredoscillationinplugboard
layoutofPS107A-1ACh1:PICoutput;Ch2:load.
viewofthePS710A-1A’sturn-offintervalillustratesthetypeofextraneoustransientssometimesseenina
plugboardlayout.Don’tbesurprisedtoseesimilarunwantedoscillationsinsomeofyourlayouts.Evenina
breadboardlayout,youcanusuallystoporatleastreducetheseextraneoussignalsbybetterattentiontolead
dressandgroundingjumperlocations,combinedwithadditionalpowerleadbypasscapacitors