Upload
luis-figueiredo
View
217
Download
0
Embed Size (px)
Citation preview
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 1/18
Constructional Project
10 Everyday Practical Electronics, August 2009
eectronic sys-tes have now been deveoped for
keyess entry. hese incude systesthat require a coded eectronic keysuch as and infrared transitters2&)$S2ADIO&REQUENCY)DENTIÚCATIONevices keypads and swipe cards.here are aso units that do not require acoded eectronic key and these incudeÚNGERPRINTFACEANDIRISRECOGNITION
2EGARDLESSOFFORMATELECTRONICKEYSusuay coprise a sa keyfob-styeTRANSMITTER ANDA RECEIVER THAT GOES
with the door ock echanis. heTRANSMITTERSENDSASTRINGOFDATATHATis unique to each individua ock andthis data ust atch the data storedin the receiver before the ock wi beRELEASED4HECONCEPTISROUGHLYSIMI-ar to a standard eta key which hasAPATTERNOFPEAKSANDVALLEYSALONGITSLENGTH4HESEPEAKSANDVALLEYSMUSTatch the tubers within the ock in
order for the ock to open.ith any type of ock there is awaysa probe of security. eys can easiy
be copied whie any conventiona and infrared transitters are far frotaper-proof. ne technique is to usea specia receiver to intercept and copythe transitted code. nce copied theSIGNALCANTHENBERETRANSMITTEDTOTHE
DOORLOCKTOGAINUNAUTHORISEDENTRYn fact this technique was co-ony used by car thieves in carparksANDPROVEDVERYEFFECTIVEAGAINSTEARLYELECTRONIC LOCKING SYSTEMS )T COULDALSOBEUSEDTOOPENAUTOMATICGARAGEDOORSANDGAINACCESSTOBUILDINGS
oig code securityodern transitters now circu-
VENTTHISPROBLEMBYCHANGINGTHEIRCODEEACHTIMETHEYSENDASIGNAL3Oif an unauthorised person capturesTHETRANSMITTEDCODERESENDINGTHIS
code wi not unock the door. his is because the door ock is now expect-INGANEWCODEBASEDONANALGORITHM
dea for keyess etry for doors i cars, hoesad idustry, this eyess try yste featuresa roig code to esure high security. t asohas two door-strike outputs, a aar syste
ad provisio to use up to 6 separate keyfobtrasitters with the sae receiver.
Rolling Code KeylessEntry System
Versatile IR unit also
functions as an alarmPart.1: By JOHN CLARKE
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 2/18
Constructional Project
Everyday Practical Electronics, August 2009 11
that both the transitter and receiverhave in coon.
his code changing technique iscoony caed a ‘roing code’athough it is soeties aso caed‘code hopping’. t renders copyinguseess and thus provides a very higheve of security. t is aso virtuay i-possibe to send a correct code withouthaving a vaid roing code transitter.his is because of the huge nuber of code variations possibe.
ecause of its security advantages aroing code transitter fors the basisof the oing ode eyess ntry ys-te described here. n fact the odds of picking a correct code at rando forour roing code transitter are one
in 1. triion or roughy one in 11
.f you want to know ore aboutroing code transissions refer to theseparate pane esewhere in this artice.
ai featuresur new oing ode eyess ntry
yste coprises a sa keyfob-styetransitter and a separate receiver.he transitter is sa enough to
be attached to a keyring and has twopushbutton switches each capabe of sending a separate code. ach tieone of the switches is pressed a sa
INDICATOR,%$ÛASHESTOINDICATETHATthe transitter has sent its code.
he arger of the two switchesactivates the aar functions of thereceiver. t ars the unit so that itwi sound an aar shoud there beunauthorised access.
he aar functions incude an eec-tric door strike contro (this aows thedoor to be opened two aar inputs(eg to onitor doors windows or othersensors and an ar/disar output.he door strike can optionay be set tooperate on aring on disaring or both.
n addition an aar output isprovided to sound a siren if required.
he second saer pushbuttonswitch on the transitter is independ-ent of the aar. t can be used tooperate a separate door strike or soeother device connected to the receiver.uch devices can incude a ight or asiren that can be used as a panic aar.his can be optionay set to operateoentariy or can be togged on andoff with each switch pressing.
he door strike outputs can be set to
operate fro between to 6 secondswhie the inputs can incude deayedoperation fro to 6 seconds. hese
deayed inputs aow the aar to beared whie giving the user enough
tie to exit the door without setting off the aar. n identica deay period a-ows the aar to be disared on entry.
uring the exit deay period the INDICATOR,%$INTHERECEIVERUNITÛASHESon and off at a one second rate. t theend of the exit deay this indicatesTHATTHEUNITISARMEDBYÛASHINGBRIEÛYonce every second. his conservespower and increases its effectivenesswhen it coes to attracting attention.
n cknowedge/ower is asoincuded in the receiver. his norayÛASHES WITHAVERY SHORT DUTYCYCLEowever when the receiver picks upa signa fro the transitter the ck/0OWER,%$ÛASHESATAVERYHIGHRATE)Taso shows if the received code is invaid
by oentariy binking off and on.f the code is correct the receiver
responds to the signa. he transis-sion range is about which shoud
BESUFÚCIENTFORMOSTPURPOSESote,however, that it wi ot work if the receiver is i direct suight.
ettig it up
efore using the nfrared oingode ar both the transitter andthe receiver ust be set up correcty.
irst each transitter ust be given aseparate identity ranging fro 1 to 16.
his is seected using ink options onthe transitter board but note that notwo transitters shoud be given thesae identity.
econd the transitter ust berandoised. his changes the initiaroing code and agorith paraetersto ensure that the transitter code isgoing to be unique.
he third step invoves synchronisingthe transitter and receiver. his proc-ess invoves sending the roing codeparaeters to the receiver as describednext onth. ou can synchronise fro1 to 16 transitters provided each hasa different identity.
so incuded is a faciity to preventany or a transitters fro operatingthe receiver once they have been syn-chronised. his ‘ockout’ feature can beusefu if a transitter has been ost andyou no onger want it to work with youraar syste.
transitter identity can beocked out individuay but if youdon’t know the identity of a osttransitter a identities can be
ocked out. he transitters that areto be used with the receiver are thenre-synchronised.
Features
Transmitter
s Rolling code infrared transmission
s Small keyfob style case
s Dual function buttons
s Randomisation of code parameters feature
s Synchronising of parameters feature
s Up to 16 identifications
Receiver
s 12V operation
s Up to 16 separate transmitters can be synchronised
s Dual function with an independent output
s Two alarm inputs with exit and entry delays
s Two door strike outputs
s Alarm output
s Arm/disarm output and LED indicator
s IR receive acknowledge LED
s Strike 1 operates on arm, disarm or both
s Strike 2 operates independently with momentary operation or toggleoutput
s Arm output invert option
s Adjustable door strike, entry/exit delay and alarm periods
s 200-code look ahead feature
s Transmitter lockout feature
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 3/18
Constructional Project
12 Everyday Practical Electronics, August 2009
rasitter circuit so uch for the background
detais. et’s now take a ook at howthe circuit works starting with thetransitter – see ig.1.
1 a 1668 icrocontroer
fors the heart of the transittercircuit. he circuit ight ook quitesipe but there are a ot of ‘sarts’
hidden inside the icro incudingthe software necessary to generate theroing code.
nder nora conditions switches1 and are open circuit and transis-tor is off so no power is appied.
his is done to ensure ong battery ife.f power were continuousy appiedthe current drawn fro the battery
woud be around because of thequiescent current of the 5 reguator.
onversey pressing either 1 or connects the 1 battery to theinput of reguator 1 via diode1 or . Ω resistor is incudedin series between the battery and theswitches to iit the initia chargingcurrent into the 1μ bypass capacitorat 1’s input. his iniises wearon the switch contacts.
hen power is appied to 1’sinput its output deivers a reguated+5 rai to 1. s a resut the icropowers up and runs its interna soft-ware progra.
witch check
NEOFTHEÚRSTTHINGSTHEPROGRAMdoes is check which switch waspressed (this happens after a shortdeay to ake sure the switch is fuycosed. n operation the progra candecide if 1 or is pressed because of the 1kΩ resistor connected between and the icro’s input.
t works ike this. nitiay isset ow by the progra. his pin isthen ade open circuit so that it can
be pued high if switch was cosed.owever if 1 was cosed instead the pin wi stay at . y checking
the votage on the progra canthus deterine which switch waspressed and initiate the correct func-tion codes for that switch.
he 1kΩ resistor is necessary toiit the current into the internacaping diodes at when iscosed. n practice the positive capdiode wi conduct caping the input to .6 above the +5 suppy.his protects the input fro daage.
iodes 1 and protect the regu-ator fro reverse poarity shoud the
battery be inserted the wrong wayaround. hese diodes aso isoate theswitch outputs fro each other so thatthe input wi ony go high if is pressed. f 1 is pressed the 1 at1’s input reverse biases and sois bocked fro reaching .
ext the progra sets at pin 1of the icro high. his output drivesthe base ( of NPN transistor 1via a 1kΩ resistor. s a resut 1switches on and this in turn switcheson transistor .
his action atches the suppy to
reguator 1 even if switch 1 or is reeased. his is necessary to aowtie for the roing code cacuations to
Parts List – Rolling Code Keyless Entry System
Receiver
ᗂ1 PC board, code 721, size61mm × 122mm
1 UB3-type plastic box, size130mm × 68mm × 44mm
5 2-way PC-mount screwterminal blocks (5mm or 5.08mm pin spacing)
1 SPST vertical mount microtactile switch, with 0.7mmactuator (S1)
3 3-way pin header terminalstrips (2.54mm spacing)
4 2.54mm jumper shunts3 PC stakes
1 25mm length of 0.8mm tinnedcopper wire
Semiconductors
1 PIC16F88-I/P microcontroller programmed with irrcroll.hex(IC1)
1 78L05 low-power 5V regulator (REG1)
1 38kHz infrared receiver (IRD1)2 BD681 Darlington NPN
transistors (Q1,Q2)2 BC337 NPN transistors (Q3,Q4)1 16V 1W Zener diode (ZD1)
4 1N4004 1A diodes (D1-D4)1 1N5404 3A diode (D5)2 3mm red LEDs (LED1,LED2)
Capacitors5 100μF 16V PC electrolytic3 100nF MKT polyester 3 10nF MKT polyester 1 1nF MKT polyester
Resistors (0.25W, 1%)4 10kΩ 1 220Ω2 2.2kΩ 2 100Ω
2 1kΩ 1 10Ω2 680Ω
Test Components4 red LEDs4 2.2kΩ 0.25W 1% resistors
Transmitter
ᗂ1 PC board, code 722,measuring 30 × 36mm
1 keyfob remote controlcase (Jaycar HB-5605 or equivalent)
1 12V A23 car alarm battery (9.5diameter × 27mm)
2 SPST SMD tactile switches 6 ×6 × 3.85mm (S1,S2)
1 TO-3P transistor siliconeinsulating washer, cut to 20 ×24mm
5 PC stakes1 25mm length of 0.8mm tinned
copper wire1 ICSP 5-pin connector (CON1)
Semiconductors1 PIC16F628A-20/SO
18-lead SOIC microcontroller,programmed with irxmroll.hex(IC1)
1 MC78M05 DPAK 5V regulator (REG1)
1 MMBT100 SOT-23 SMD NPN
transistor (Q1)1 MMBT200 SOT-23 SMD PNP
transistor (Q2)
2 1N4148 diodes (D1,D2)1 3mm infrared emitting LED
(LED1)1 green gull wing style surface
mount LED (2.2 × 2.2mm)(LED2)
Capacitors2 1μF monolithic ceramic1 100nF monolithic ceramic
Resistors (0.25W, 1%)2 10kΩ 2 22Ω
3 1kΩ2 10kΩ horizontal trimpots
(VR1,VR2)
ᗂ Printed circuit boards availablefrom the EPE PCB Service
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 4/18
Constructional Project
Everyday Practical Electronics, August 2009 13
be ade and stored without interrup-tion otherwise the code ay becoecorrupted. t aso ensures that the ro-ing code is transitted in its entirety.
he next stage in the progra in-voves cacuating the code and storingthe vaues. his cacuation is basedon the previousy transitted codeand uses an interna agorith. ncecacuated the new code appears atoutputs to 5 which in turndrive an infrared (1. he Ω resistor in series with 1 iits thecurrent to a safe vaue.
n operation 1 is driven using1 puses at a rate of 8.6kz.
high (or a ‘1’ is transitted as a 51μs burst of 8.6kz signa foowed by51μs of no transission. onversey aow (or a ‘’ consists of a 51μs periodof no transission foowed by a 51μs
burst of 8.6kz signa. is the ransit and is
driven by output during codetransission. asicay goes higheach tie there is a ‘1’ in the transit-ted code and ow each tie there is alm!SARESULT,%$ÛASHESTOMIMICthe transission code.
rasitter idetityransitter identity is seected usingthe 1 to ink connections to 1
7 and 6. s shown eachindividua input can be connected toeither the +5 suppy or the ground (
suppy but to both or the suppywi be shorted. he nuber of possibecobinations is 16.
ach of these inputs is initiay tiedto +5 on the board (via thin tracks and this seection is identity 1.he other 15 identities are seected by
breaking one or ore of these connec-tions to the +5 rai and connectingthe instead to an adjacent rai.
e’ tak ore about this in theconstruction.
-circuit prograigive-pin header 1 is provided
on the circuit to aow for n-ircuiteria rograing ( of 1 us-ing a prograer. ternativeywe have deveoped a surface-ountconverter board that wi aow 1 to
be prograed directy using a prograer. e’ pubish the detaison this next onth.
he connections on thetransitter are aso used to run therandoisation and synchronisationfunctions using a bridge between pins
and 5 and and respectivey.1 runs at a noina z asprovided by an interna osciator.
his osciator has a 1 toeranceANDITSACCURACYISSUFÚCIENTFORTHISappication (ie there’s no need for a
crysta osciator. owever becausethe osciator frequency can varywith teperature we have incudeda eans for the receiver to ock ontothe transitter’s cock rate so thatvariations over a ong tie period donot atter.
y the way the transitter usessevera surface-ount coponentsSOTHATTHECIRCUITWILLÚTINTOASMALLkeyfob case. hese surface-ountparts incude 1 1 1 1 and . he reaining parts
are standard through-hoe coponentTYPESTHATARESMALLENOUGHTOÚTONTOthe board.
eceiver circuitefer now to ig. which shows
the receiver circuit. t’s buit aroundinfrared receiver 1 and i-crocontroer 1 the atter operatingat z to atch the transitter’sfrequency. nce again uch of thecopexity is hidden by the softwareprograed into the icrocontroer.
1 ony has three eads but inside
it coprises a copete infrared de-tector and processor. irst it receivesthe 8kz infrared puse signa fro
+5V
INFRARED ROLLING CODE TRANSMITTER
ig.: a 6628 icrocotroer fors the heart of the trasitter circuit. t cotais a the software ecessaryto geerate the roig code ad drives a ifrared (.
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 5/18
Constructional Project
14 Everyday Practical Electronics, August 2009
THETRANSMITTERANDAMPLIÚESTHISTOACONSTANTLEVEL4HISSIGNALISTHENFEDTO
AKZBANDPASSÚLTERTOREMOVEANYZORZMAINSSIGNALANDOTHERNOISE)TTHENDEMODULATESTHESIGNALTOPRODUCEASERIALDATABURSTAT)2$mSPINOUTPUT
4HISSERIALDATASIGNALFROM)2$ISFEDTOTHE2"INPUTOF)#VIAAΩ RESISTOR!N&CAPACITORÚLTERSOUTANYTRANSIENTS
)2$ISPOWEREDFROMTHERECEIVERmSSUPPLYRAIL!ΩRESISTORANDAμ&CAPACITORPROVIDESUPPLYDE-COUPLINGANDÚLTERINGTOPREVENTTHERECEIVERFROMPRODUCINGFALSESIGNALS
DUETOPOWERLINECHANGES!S WELL AS THE )2 RECEIVER THERE
ARE TWO OTHER INPUTS TO THE 0)#
MICROCONTROLLER 4HESE ARE ALARMSENSOR INPUTS )NPUT AND )NPUT
ANDTHESECONNECTTOTHE2"AND2"INPUTSOF)#VIAKΩRESISTORS%ACHINPUTISALSOBYPASSEDUSINGAN&CAPACITORTOÚLTEROUTTRANSIENTSAND THUS PREVENT FALSE TRIGGERINGOFTHEALARM
HENTHESEINPUTSAREOPENBOTH2" AND 2" ARE HELD HIGH IE AT VIA INTERNAL PULLUP RESISTORS)NPRACTICETHISMEANSTHATYOUCANUSENORMALLYOPENORNORMALLYCLOSEDREEDSWITCHANDMAGNETASSEM-
BLIESTOTRIGGERTHEINPUTS)FYOUUSEANSWITCHTHEINPUT
WILLNORMALLYBEHIGHANDTHESYSTEMWILLTRIGGERIFASWITCHISCLOSED#ON-VERSELYIFAN#SWITCHISUSEDTHE
INPUTWILLNORMALLYBEPULLEDLOWBUTWILLGOHIGHIFTHESWITCHISOPENED
"ASICALLYANYCHANGEINLEVELWHENAREEDSWITCHOPENSORCLOSESWILLBEDETECTEDANDSOUNDTHEALARMATTHE
END OF THE ENTRYPERIOD PROVIDEDTHATTHERECEIVERISINITSARMEDSTATEOTEHOWEVERTHATTHEALARMWILLNOTSOUNDIFTHERECEIVERISSTILLWITHINITSEXITDELAYPERIOD
oor strike outputsHEN AN )2 SIGNAL TRANSMISSION
ISRECEIVEDTHEOUTPUTFROM)2$ISPROCESSED BY )# 4HIS THEN DRIVES$ARLINGTONTRANSISTORSANDASAPPROPRIATETOCONTROLTHEDOORSTRIKEOUTPUTSIE3TRIKEAND3TRIKE
!SSHOWNANDAREDRIVENVIAΩRESISTORSFROM)#mS2"AND2!OUTPUTSRESPECTIVELY$IODES$AND$CLAMPTHEVOLTAGEPRODUCED
BY THE DOOR STRIKE SOLENOID TO THESUPPLY RAIL WHEN THE TRANSISTOR ISSWITCHEDOFF
4RANSISTORS AND ARE BOTH"$ $ARLINGTON TYPES ANDCANBEUSED TO DRIVE LOADS UP TO ! !TYPICALELECTRICDOORSTRIKEONLYDRAWSABOUTM!AT
4HEOTHERTWOOUTPUTSARETHE!LARMAND!RMOUTPUTSANDTHESEARECON-
TROLLEDBYTRANSISTORSANDBOTH"#RESPECTIVELYISDRIVENBY)#mS2"OUTPUTVIAAΩCURRENTLIMITINGRESISTOROWEVERTHEBASECURRENTISSUFÚCIENTFORTHETRANSISTORTOREMAINFULLYSATURATEDFORAM!LOADANDTHISISIDEALFORMANYPIEZOSIRENS
3IMILARLYTRANSISTORISDRIVENVIAAKΩRESISTORFROM)#mS2"OUTPUTmSCOLLECTORPROVIDESTHE!RMOUTPUTANDTHISCANBEUSEDASATOGGLEOUTPUTTOSETASECONDALARMSYSTEM
4YPICALLY YOU WOULD USE A KΩ
PULLUP RESISTOR BETWEEN THE !RMOUTPUTANDTHERAILSOTHATTHELEVELCANSWINGBETWEENAND!LTERNATIVELYmSCOLLECTORCOULDBEUSEDTODRIVEARELAYCOIL)NTHISCASETHEKΩBASERESISTORWILLNEEDTOBEREDUCEDTOKΩSOTHATTHETRANSISTORCANREMAININSATURATIONWHILEDRIVINGa 85ΩRELAYCOIL
4HEUNITCANBEOPTIONALLYCONÚG-UREDWITHEITHERONOROFFWHENARMED4HISISSETUSINGLINK,
HEN,ISINTHElmPOSITIONISONWHENTHEUNITISARMEDANDOFF
WHENDISARMED)NTHISCASETHE2"INPUTISHELDATVIAANINTERNALPULLUPRESISTORWITHIN)#
Specifications
Transmitter
Standby current: 0mATotal transmit current: rolling code transmission = 35mA for 80ms;synchronise = 35mA for 100ms; randomisation = 10mA.
Infrared transmit frequency: 38.46kHz
Code transmission rate: 1.024ms
Encoding: a high (or a 1 bit) is transmitted as a 512μs burst of 38.46kHzinfrared signal, followed by 512μs of no transmission. A low (or 0 bit) istransmitted by a 512μs period of no transmission, followed by a 512μsburst of 38.46kHz infrared signal.
Rolling code: sends four start bits, an 8-bit identifier, the 48-bit code plusfour stop bits. The start bits include a 16.4ms gap between the secondstart bit and the third start bit.
Synchronise code: sent as two blocks. Block 1 sends four start bits, the8-bit identifier, a 32-bit seed code and four stop bits. Block 2 sends four start bits, a 24-bit multiplier, the 8-bit increment and 8-bit scramble values,and four stop bits. The start bits include a 16.4ms gap between the secondstart bit and the third start bit.
Code randomisation: alters the multiplier values, the increment value, thescramble value and the seed code at a 40μs rate.
Infrared transmission range: 4m
Receiver
Supply Current: 7.6mA typical when armed and with no external devicespowered.
Strike 1 period: adjustable from 0-64 seconds in 0.25s steps
approximately.Strike 2 period: adjustable from 0-64 seconds in 0.25s stepsapproximately.
Input 1 delay: adjustable from 0-64 seconds in 0.25s steps approximatelyfor exit and entry delays.
Input 2 delay: adjustable from 0-64 seconds in 0.25s steps approximatelyfor exit and entry delays.
Alarm period: adjustable from 0-128 seconds in 0.50s stepsapproximately
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 6/18
Constructional Project
Everyday Practical Electronics, August 2009 15
INFRARED ROLLING CODE RECEIVER
SYNCHRONISE
oving to the ‘–’ position pus to ground and changes the senseof the r output. n this case is off when the unit is ared and on
when disared. indicates the state of the unit.t’s driven fro the output of 1via a 1kΩRESISTORANDÛASHESWHENthe unit is ared.
4HEREARETWODIFFERENTÛASHSTYLES$URINGTHEENTRYANDEXITDELAYPERI-ODSTHE,%$ÛASHESWITHADUTYCYCLEIEITISONFORHALFTHETIMEANDoff for haf the tie. owever at theENDOFTHEDELAYPERIODITÛASHESONFORONLYOFTHEDUTYCYCLEIEEACHÛASHISVERYBRIEF
ther ik optiosinks 1 and are in-cuded to provide further options.
&OR EXAMPLE , CAN BE TIED TOEITHERTHERAILORTOORITCAN
BE LEFT OPEN 4HESE THREE OPTIONSdeterine how the trike1 output
OPERATES"ASICALLY3TRIKECANBESETto operate when the unit is aredWHENITISDISARMEDORONBOTHARM-ing and disaring.
n operation the software pro-graed into the icro decidesWHERETHELINKISINSERTEDBYRUNNINGAfew tests. irst it takes the 7 outputHIGHANDTHENSETSTHE2!PINASan input to read the votage. f the vot-AGEISNOWLOWTHENTHELINKMUSTBEINthe ‘–’ position. owever if the inputreains high then the ink is eitherin the ‘+’ position or is open circuit
ITREMAINSHIGHWHENTHELINKISOPEN BECAUSEOFTHECHARGEONTHEASSOCIATEDN&CAPACITORTOGROUND
o test if the ink is in the ‘+’ positionor open the 7 pin is ade an outputAGAINANDISDRIVENLOWTO4HE7 pin is then changed to an input
and the eve checked again. f the vot-AGEISNOWHIGHTHENTHELINKMUSTBEINTHElmPOSITION#ONVERSELYIFTHEvotage is ow then the ink is open.
4HEKΩ resistor in series with 7is there to prevent shorting when thispin is taken high and ow with a inkin position.
sets trike’s operation forEITHER MOMENTARY OPERATION OR FORtogge operation. his ink pus the2!INPUTEITHERTOWHENITISINTHElmPOSITIONMOMENTARYORTOWHENITISINTHElmPOSITIONTOGGLE
OTETHATTHISLINKCANNOTBELEFTOPEN BECAUSETHE2!PINCANONLYBEUSEDas an input.
ig.2: ifrared receiver ad icrocotroer are the ai parts i the receiver. picks up addeoduates the ifrared trasissios, whie decodes the data ad drives the various outputs.
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 7/18
Constructional Project
16 Everyday Practical Electronics, August 2009
addition if 1 is cosed during power-up it seects the transitter identityockout function.
ower suppyower for the circuit is fro a
1 suppy such as a battery or pugpack. iode 5 provides reversepoarity protection and is rated at so that it can hande the currents thatay be drawn by an eectric door strikeand siren.
he 1Ω resistor and ener diode
1 provide transient protection withthe ener caping votages over 16.he 1Ω resistor iits the currentthrough 1 to a safe eve.
&OLLOWING:$THESUPPLYISÚLTEREDusing a 1μ capacitor and appiedto the -terina reguator 1. heresuting reguated +5 rai is then
Resistor Colour Codes (Transmitter)
❏ No. Value 4-Band Code (1%) 5-Band Code (1%)
❏ 2 10kΩ brown black orange brown brown black black red brown
❏ 3 1kΩ brown black red brown brown black black brown brown
❏ 2 22Ω red red black brown red red black gold brown
Capacitor Codes
Value μF Code IEC Code EIA Code
100nF 0.1μF 100n 104
10nF .01μF 10n 103
1nF .001μF 1n0 102
is used in conjunction withtripots 1 and to set the varioustie periods. hese incude the trike1and trike oentary on periods theentry and exit deays for nput1 andnput and the aar period.
s shown in ig. tripots 1 and are connected across the 5 sup-py and their wipers (oving contactconnect to anaogue inputs and1 respectivey. he votage appied
to each anaogue input is converted toa digita vaue within the software andit is these vaues that deterine thetieout periods.
ychroise switchwitch 1 is the ynchronise switch
and this connects to the 7 input.his input is noray hed high viaan interna pu-up resistor but when1 is cosed it pus 7 to .
asicay1 is used to
synchronisethe receiverw i t h t h etransitter.t is aso usedwhen set-ting the tieperiods. n
Note: transistor Q2mounts under 10kΩresistor
hese two arger-tha-ife-size photos ceary show how the parts are outed o the trasitter board. ou wi eed alNETIPPEDªSOLDERINGªIRONªMMªDIAMETERªORªLESSªANDªAªMAGNIFYINGªGLASSªTOªDOªTHEªASSEMBLY
ig.: foow these parts ayout diagras to buid the trasitter board. oteTHATªYOUªHAVEªTOªSETªTHEªTRANSMITTERSªIDENTITYªBEFOREªINSTALLINGª)#ªSEEªTEXTªANDªDONTªFORGETªTRANSISTORª1ªnªITªGOESªUNDERªAªKΩªRESISTORªJUSTªBELOWª3
&IGªTHISªENLARGEDªTRACKªSECTIONªSHOWSªTHEªLOCATIONSªOFªLINKSª++ªONªTHEªtrasitter board. he trasitterIDENTITYªISªCHANGEDªBYªBREAKINGªONEªORªMOREªOFª THEª THINNEDª LINKªCONNECTIONSªTOªTHEªªRAILªANDªBRIDGINGªTHEMªWITHªSOLDERªTOªTHEªADJACENTªªRAILªINSTEAD
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 8/18
Constructional Project
Everyday Practical Electronics, August 2009 17
he keyfob case is suppied withthe key switch covers outed asshow here. his asseby ust bereoved.
ig.5: oce the switch covers have BEENªREMOVEDªTHEªmANGESªAREªGROUNDªdow usig 80-grit sadpaper, sothat oy the tops reai (see text.
bove: the fiished trasitter board iside its keyfob-stye pasticcase. ower coes fro a 2 2car aar battery. ote how thekeyswitch covers are outed othe id, usig a 20 × 24 siicoewasher – see text.
ight: the two keyswitchcovers are attached to the20 × 24 siicoe washeras show here. se siicoeseaat to ‘gue’ the i
pace. he keyfob id ca beused as a tepate to positiothe correcty.
breaks in the copper or shorts betweentracks. epair any fauts that you doÚNDRARETHESEDAYSTHENCHECKTHE
shape of the board. t shoud have acurved front edge and a sa circuarCUTOUTATTHEOTHEREND)NADDITIONthere shoud be two sots for the bat-tery cips.
EXTCHECKTHATTHE 0#BOARDÚTSneaty into the base of the keyfob case.)FITDOESNOTÚTITmSJUSTAMATTEROFÚLINGit neaty aong the edges unti it does.
ettig the idetityefore outig ay of the
PARTSª ITSª lRSTª NECESSARYª TOª SETª THEª
trasitter’s idetity – but oy if oretha oe trasitter is to be used. f ore tha oe trasitter is used, the
each wi require a uique idetity.!S SUPPLIED THE 0# BOARD INI-
tiay ties inks 1 to to the SUPPLYRAIL 4HIS IS)DENTITYor 1. f ony one transitter is to
BEUSED THEN YOUDONmTHAVE TODOATHINGJUSTLEAVEITATTHEDEFAULTIDENTITY)$
f you do wish to change the iden-TITYITmSJUSTAMATTEROFALTERINGONEORore of the inks as shown in abe9OUDOTHATBYBREAKINGTHELINKmSthinned connection to the +5 track
USED TOPOWER )# AND THE INFRAREDRECEIVER)2$
0OWERONOFFINDICATIONISPROVIDED BY ,%$ WHICH ALSO ACKNOWLEDGESTHE INFRARED SIGNALORMALLY ,%$ÛASHES WITH ADUTYCYCLEABOUTTWICEPERSECONDOWEVERWHENANINFRAREDSIGNALISRECEIVEDITÛASHESat the infrared reception rate.
,%$ALSOÛASHESWITHANEVENDUTYcyce for a short tie at the end of synchronisation and if the infraredsigna is incorrect.
ostructio4HE 2OLLING #ODE EYLESS
%NTRY3YSTEMISBUILTONTWO0# BOARDSA2ECEIVERBOARDCODE ANDA 4RANSMITTER BOARDcode 7. oth boards are avai-abe fro the EPE PCB Service.
EmLLSTARTWITHTHETRANSMITTERASSEMBLYWHICHISTHETRICKIEROFTHE
TWO)NORDERTOÚTINTHEKEYFOBCASETHETRANSMITTERBOARDMEASURESJUST¯MMANDUSESLOTSOFSURFACEMOUNTcoponents.
OWEVERTHESEARENOTTOODIFÚCULTTO SOLDER IN PROVIDED YOU HAVE ASOLDERINGIRONTIPTHATISJUSTMMINDIAMETERORÚNER!MAGNIFYINGGLASSOR PREFERABLY A lMAGGIE LAMPm ISALSOREQUIREDTOCHECKYOURSOLDERINGwhie a ength of 1.5 de-sodering
BRAID3OLDERWICKWOULDALSOBEUSE-fu for ceaning up any excess soderTHATMAYÛOWBETWEENCONNECTIONS
&IGSHOWSTHECOMPONENTLAYOUTONTHE0#BOARD4HEÚRSTSTEPISTOCHECKTHE0#BOARDCAREFULLYFORANY
Table 1: Transmitter Identity
Iden-tity
LK1 LK2 LK3 LK4
1 + + + +
2 + + + -
3 + + - +
4 + + - -
5 + - + +
6 + - + -
7 + - - +
8 + - - -
9 - + + +
10 - + + -
11 - + - +
12 - + -
13 - - + +
14 - - + -
15 - - - +
16 - - - -
eproduced by arrangeentWITH3),)##)0
MAGAZINEwww.siiconchip.co.au
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 9/18
Constructional Project
18 Everyday Practical Electronics, August 2009
and connecting it to the adjacent track instead via a sa soder bridge.
ake sure however that a ink con-nection is not ade to both the +5 and tracks. e have abeed the +5connection with a pus (+ sign and the connection with a inus (– sign.
t is iportat to seect the idetityow because the 5 track sectiocaot be accessed whe is i
pace. he +5 connections shoudony be broken with a sharp craftknife and once broken shoud not beresodered. hat’s because 1 woudno onger sit propery on the boardMAKINGITDIFÚCULTTOSOLDERITSPINS
he seected identity shoud bearked on the back of the boardusing a arker pen. or exape if the identity is write on the
board. his nuber can aso be writtenon the back of the keyfob transittercase in the indentation provided.
oftwaref you are buiding the unit froa kit then 1 wi be suppied pre-prograed. f not you wi have
to progra the yoursef using asuitabe prograer. s previousyentioned we have provided two pro-GRAMMINGOPTIONSTHEÚRSTOFWHICHis to use the in-circuit prograingconnector on the board.
ternativey you can buid and usethe surface ount adaptor board to bedescribed next onth so that 1 can
be prograed out of circuit.
4HESOFWAREÚLESWILLBEAVAILABLEvia the EPE ibrary site accessed viawww.epeag.co. re-prograeds wi aso be avaiabe fro a-genta ectronics – see their advert inthe issue for contact detais.
arts assebyxcept for a singe wire ink a
parts for the transitter ount onthe copper side of the board. on’tinsta the ink yet though – that stepcoes after you insta 1.
o insta 1 position it on the
board with its pin 1 at top right – seeig. (pin 1 is indicated by a saadjacent dot in the body of the .arefuy adjust it so that its pins ine
up with the tracks and use a cothespeg (or soe other sa spring-capto hod it in position.
hat done soder a coupe of di-agonay opposite pins check thateverything is correct then reove thepeg and carefuy soder the reain-ing pins.
he ain thing to watch out for hereis unwanted soder bridges betweenadjacent copper tracks. f this doeshappen use soe soder wick to drawup the excess soder to cear the short. agnifying gass wi be handy hereto inspect your work.
ote that pins 6 to and 1 and11 are connected together anyway sosoder between these pins is .
nce the is in you can insta theink beneath it on the other side of the
BOARD4HIS LINKMUST SITÛATAGAINSTthe board otherwise the board wi notsit down in the case correcty.
he reaining surface ount
coponents – 1 and1 – can now be sodered in pace.rasistor Q has a abe o itstop, whie Q2 has a 2 abe istead.
Resistor Colour Codes (Receiver)
❏ No. Value 4-Band Code (1%) 5-Band Code (1%)
❏ 4 10kΩ brown black orange brown brown black black red brown
❏ 2 2.2kΩ red red red brown red red black brown brown
❏ 2 1kΩ brown black red brown brown black black brown brown
❏ 2 680Ω blue grey brown brown blue grey black black brown
❏ 1 220Ω red red brown brown red red black black brown
❏ 2 100Ω brown black brown brown brown black black black brown
❏ 1 10Ω brown black black brown brown black black gold brown
ig.6: foow this diagra to out the parts o the receiver board. se a socket for the icrocotroer adtake care to esure that a poarised parts are correcty orietated. he ifrared receiver odue ( ca either
be outed o the board (as i the prototype or coected via shieded cabe (see diagra ext oth.
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 10/18
Constructional Project
Everyday Practical Electronics, August 2009 19
hese nubers reate to the 1and types respectivey.on’t get the ixed up.
staig the seicoductorshe orientation of the two transistors
is obvious – they have one pin on oneside of the body and two on the otherside. 1 has a tab pus and pins that ust be sodered to the
board. he centra pin between the and pins is eft unconnected.e carefu with the orietatio of
2 – its cathode ead is the ogerof the two.
ext soder in switches 1 and THENINSTALLÚVE0#STAKESFORTHE)#30header. hese pins are inserted frothe non-copper side of the boardand sodered in position. he pinsare then tried on the copper sideto in height. n the undersideTHEYARETRIMMEDANDÚLEDTOMM
he standard coponents can now
be instaed. hese ust be ountedÛATAGAINSTTHE0#BOARDORASCLOSETOITASPOSSIBLEINTHECASEOFTHEKΩ RESISTORTHATSTRADDLES4AKECAREwith the orientation of diodes 1 and and note that the tops of the threeonoithic capacitors ust be no orethan above the board.
n particuar the two capacitors near2%'CANBELAIDOVERATABOUTWHILEthe one adjacent to 1 needs to have itseads adjusted so it can be pushed downonto the board far enough to eet the height requireent.
ut a the eads beneath the BOARDIEONTHENONCOPPERSIDEÛUSHwith the surface.
1 can go in next. ts anode eadISTHELONGEROFTHETWOUNLIKE,%$and this ead ust go towards 1. oMOUNTITÚRSTBENDITSLEADSDOWNBYEXACTLYMMFROMITSBODYTHENinsert the eads into the board. i-nay push the a the way downonto the board soder the eadsANDCUTTHEMÛUSHWITHTHEUNDERSIDE
ote that a sa circuar notch isREQUIREDINTHERIMOFTHEKEYFOBBASEfor the to sit in. his can be adeUSINGASMALLRATTAILÚLEHENTHISNOTCHHASBEENMADEÚLEAMATCHINGNOTCHINTHETOPHALFOFTHEKEYFOBCASE
attery teriashe battery terinas are instaed
BYÚRSTPLACINGTHE0#BOARDINTHEBASEof the case. hat done the terinasare sid into position and sodered.AKESURETHATTHETERMINALWITHTHEspring is ocated as shown in ig..
3WITCHªCOVERªMODIlCATIONS4HEKEYSWITCHCOVERSTHATARESUP-PLIEDWITHTHEKEYFOBCASEHAVETOBEMODIÚEDTOSUITTHETWOSWITCHESONthe board.
s suppied the two switch coversAREALREADYSECUREDINPLACEINTHEKEY-fob id. his asseby ust be reovedand the covers carefuy ground downTOMMTHICKSEE&IG4HISISDONE
by pacing soe 18-grit sandpaperONTOAÛATBENCHANDSANDINGTHESWITCHCOVERSUNTILTHEYAREÛATONTHEIRBASE
hat done cut out a ×
rectanguar piece fro a siicone -WASHER ¯MMTOMAKEANEWswitch cover asseby. t’s then sipy
a atter of attaching the switch coversto this washer using siicone seaant –SEEPHOTOSETHEKEYFOBLIDASATEM-pate to position the covers correcty.
eceiver assebyow for the receiver – see ig.6.
!S USUAL START BY CHECKING THE 0# BOARDFORANYDEFECTS#HECKALSOTHATthe hoe sizes for the screw terina
BLOCKSARECORRECTANDENLARGETHEMIFnecessary.4HATDONECHECKTHATTHE0#BOARD
ÚTSINSIDE THESPECIÚEDUTILITYCASE&ILETHEBOARDEDGESTOGETITTOÚTIFNECESSARYBUTDONmTÚLETHEMTOOMUCHOTHERWISETHEBOARDWILLNOTLOCKCOR-recty into the wa sots.
ig.6 shows the asseby detais.)NSTALLTHEWIRELINKÚRSTTHENINSTALLthe resistors. he accopanying tabeshows the resistor coour codes butYOUSHOULDALSOCHECKTHEMUSINGAdigita utieter.
4HEDIODESANDTHE)#SOCKETCANGOINNEXTTAKINGCARETOORIENTEACHWITHthe correct poarity. oow these withTHECAPACITORSAGAINMAKINGSURETHATthe eectroytics go in correcty. heTHREE0#STAKESFOR4040AND40'can then be instaed.
epending on your requireentss 1 and can either be ounteddirecty on the board or ountedexternay and connected using wireeads. e sure to ount each with its cathode ead (the shorter of the two towards the ower edge of
the board.iiary 1 can either be ounted
directy on the board or connected
he assebed board cips eaty ito a stadardpastic utiity case. he fu istaatio ad settig up
detais for the receiver wi be i art 2 ext oth.
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 11/18
Constructional Project
20 Everyday Practical Electronics, August 2009
using twin-core shieded cabe (seediagra in art next onth.
ripots 1 and and the-way and -way pin headers for 1- are next on the ist. hat done
insta 1 and transistors 1 to-.1 and ust be instaed with theireta faces towards 1.
inay copete the board asse- by by instaing switch 1 and thescrew terina bocks. ote that the6-way terinas at the righthand edgeof the board are ade up using
three -way bocks. hese are joined by siding their dovetai joints together before instaing the on the board.
hat’s a we have space for thisonth. ext onth we’ copete theconstruction and describe the instaa-tion and setting-up procedures incud-ing setting the entry and exit deays.
e’ aso describe the optiona adapator board so that you can prograthe icrocontroer out of circuit.
One question that’s often asked
about rolling code systems is what
happens if the transmitter is outof range and one of the transmit
switches is pressed? Will the receiver
still work when the transmitter is later
brought within range and the button
pressed again?
This question is asked because the
code the receiver was expecting has
already been sent and the transmit-
ter has rolled over to a new code. So
how does the system get around this
problem?
The answer to this is that the receiver
will acknowledge a signal that is the
correct length and data rate, but it willnot trigger unless it receives the correct
code. So if the signal format is correct
but the code is incorrect, the receiver
then calculates the next code that it
would expect, and checks this against
the received code. If the code is now
correct the receiver will unlock the door.
If the code is still incorrect, the
receiver calculates the next expected
code and will do this up to 200 times.
If none of these are correct, the re-
ceiver keeps its original code, but it
will not trigger. In fact, the only way
to trigger the receiver after this is to
re-synchronise it to the transmitter.
Of course, a second transmitter will
still operate the receiver (provided
they have been synchronised in the
first place). That’s because this trans-
mitter has a different identity and a
different code to the other transmitter.
Automatic synchronisationSome rolling code transmitters sys-
tems offer automatic synchronisation
if the transmitter and receiver lose
sync. In these systems, the receiver includes a code ‘look-ahead’ feature,
as described above, but the number
of look-ahead codes is usually limited
to fewer than 200. What happens is
that if the code is not recognised after
all the look-ahead calculations have
been made, the receiver changes its
synchronisation method.
Basically, the receiver requires twoseparate transmission codes before
restoring correct operation. On the
first transmission, it calculates the
next code it should receive using this
received code as the basis for calcu-
lation. If the second code sent by the
transmitter is the same as the code that
was calculated, the receiver operates.
The drawback of this latter scheme
is somewhat less security since, in
theory, two successive transmission
codes could be intercepted and re-
corded. These codes could then be
re-transmitted to synchronise andthus trigger the receiver.
Calculating the codeAnother question that’s often
asked is how does the receiver know
which code to expect from the trans-
mitter, since this changes each time?
The answer to this is that the trans-
mitter and the receiver both use the
same calculation to determine the
next code. They also both use the
same variables in the calculation and
these variables tend to be unique
values that no other transmitter uses.
For example, if the calculation for
consecutive codes requires the origi-
nal calculated code to be multiplied
by 100 and the number 7 added to it,
then both the transmitter and receiver
will use these numbers to perform
the calculation.
Without knowing both the mul-
tiplier and the increment value, it
would be very difficult to predict the
next code. This is particularly true
because of the very large numbers
involved. The values quoted for themultiplier and increment value are not
as simple as 100 and 7 but are 24 bits
and eight bits respectively in length.
In addition, the code length is 48 bits
with as many as 2.8 x 1014 combina-
tions. This reduces by a factor of 200
because of the look ahead feature to a 1
in 1.4 × 1012 chance of striking the cor-
rect code – still impossibly long odds.
Code scramblingA further complication with the
transmitted code is that the code is not
necessarily sent in sequence. There
are also 32 possible scrambling vari-
ations that can be applied to the code.
What if the transmitter sends two
consecutive codes that are the same
and the code is intercepted and re-
transmitted to open the lock? This is
highly improbable and our rolling code
transmitter has safeguards to prevent
the same code appearing twice in suc-cession. For each code calculation,
a comparison is made between the
current and last code. If the code is the
same, the code is recalculated after an
increment of the code value to ensure
successive code calculations diverge.
It is this new code that is transmitted.
The receiver performs the same
recalculation so that the new code
will be accepted.
Another question concerns the use
of different transmitters. Does each
transmitter use the same rolling code
calculation and if so, wouldn’t the
receiver lose its synchronisation if
several transmitters were used? The
answer is that the receiver will not
lose synchronisation, even if one of
the transmitters is not generally used.
This is because each transmitter op-
erates independently from the others.
Only 16 transmitters can be used
with a given receiver and each must
have its own different identity from
1 to 16. The identity is built into each
transmitter and synchronisation is
required for each transmitter.The codes sent by each transmitter
are different and the code includes the
transmitter identity value. The receiver
has 16 different rolling code and
calculation parameters, and so each
transmitter is treated independently.
Frequently Asked Questions
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 12/18
Constructional Project
24 Everyday Practical Electronics, September 2009
H copleted the receiver board assebly as described last
onth it can be housed in a -sizedplastic box s shown in the photo lastonth it siply clips into place butÚRSTYOUWILLNEEDTODRILLAHOLEINONEend for 1 plus a hole in the otherend for the external wiring
ou will also have to drill atching
holes in the lid for the ckower andr s (1 and 2)
ow for the initial set-up irstinstall a juper link in the inus
Last month, we described the circuitry andgave the PC board assembly details forour Rolling Code Keyless Entry System.This month, we cover the installation andsetting-up procedures and describe an
optional SOIC adaptor board, so that youcan program the PIC micro out of circuit.
(–) position for 2 his will set thetrike2 output to toggle ode (note:2 ust always have a juper con-nection either to the ‘+’ or ‘–’ posi-tion) eave jupers 1 and out for now
ext set tripots 1 and 2 toid-range hese tripots are laterused to set the various tie periods
Transmitter set-upt this stage the transitter is
already partially set up because its
identity is selected during construc-tion f the transitter’s icro-controller has not been prograedthen progra it now via the connection his connection can beMADEBYSOLDERING ÚVE LEADS TOTHEtransitter’s pins and then con-necting the other ends of these leads
to a 5-way socket to plug into the prograer
fter the has been prograedclip in the 12 battery and check thatthe green acknowledge lightswhen a switch is pressed
f course if you buy a copletekit the icrocontroller (and the in the receiver) will be suppliedpre-prograed so you won’t haveto worry about that last step
Testing the receiverhe receiver can now be tested irst
with 1 out of its socket connect a 12power source that can supply at least60 hat done switch on and checkthat there is 5 between pins 1 and 5
Rolling Code KeylessEntry System
Versatile IR unit also
functions as an alarm
art2: y J
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 13/18
Constructional Project
Everyday Practical Electronics, September 2009 25
of the socket f this is within 10 of 5 (5 to 55) switch off and plug1 into its socket aking sure that it
is correctly orientatedext wire up the test s as shownin ig6 hese are all wired in serieswith 22kΩ current-liiting resistorsnce the s are wired up applypower and check that the receiver’sPOWER,%$ÛASHESBRIEÛYATABOUTONCEper second f it does then so far so good
4HETRANSMITTERMUSTNOWBERAN-doised and then synchronised withthe receiver et’s now take a look atthese two procedures
Randomising
andoisation of the transitterensures that it uses a unique set of pa-raeters to calculate the rolling code4HISPROCEDUREISIMPORTANTBECAUSEthe original paraeters prograedin are the sae for every transitter
asically you need to personalise theparaeters to prevent another trans-itter that has the sae identity frooperating your receiver f randoisa-tion is not done there is the real riskthat soeone else’s transitter that has
ALSONOTBEENRANDOMISEDWILLOPERATEyour receiver
o randoise a transitter siply
connect pins and 5 of its con-nector together and then press switch34HETRANSMIT,%$WILLÛASHATAone-second rate for the duration e-lease the switch when you are readyAFTER BETWEEN SEVERAL SECONDS ANDseveral inutes)
he paraeters are all altered every0μs (that’s 25000 ties a second) soTHEYWILLBEDIFFERENTFOREACHTRANSMIT-ter after even short presses
Synchronisingfter randoising the transitter
MUSTTHENBESYNCHRONISEDWITHTHEreceiver o do this disconnect pins and 5 of the header and connectpins and together instead hatdone press and hold down 1 on thereceiver and then press one of theswitches on the transitter
4HE TRANSMIT,%$ WILL NOW ÛASHtwice oentarily and the receiver’sACKNOWLEDGE,%$WILL ÛASH ONANDoff at a one-second rate until switch1 on the receiver is released
olling ode rotection: eeping t ecret As previously noted, the Rolling Code Keyless Entry System provides a high
level of security because the transmitted code changes each time it is sent.
However, to further improve security, we have also included code protection for
both the transmitter and receiver.
Basically, code protection prevents the program and data within the PIC micro-
controllers from being read by a PIC programmer. As a result, the parameters used
to calculate successive rolling codes are kept safe within the microcontrollers.
In particular, this effectively prevents a transmitter from being ‘interrogated’, in
order to make a duplicate transmitter that will operate the door lock.
So, while the hex files can be used to program the microcontrollers, they can-
not be read back once programming has been verified. The parameters used
for calculating the rolling code are then randomised in the transmitter using the
set-up procedure already described. It is these parameter and the rolling code
seed values that are hidden by the code protection.
Fig.6: the test LEDs are connected to the receiver as shown here. Follow theprocedure in the text to synchronise the transmitters and test the receiver.
.OWREMOVETHELINKBETWEENPINSand on the transitter’s header/NCETHATmSDONEYOUSHOULDNOWÚNDthat the transitter operates the receiv-
er f it doesn’t try synchronising againand ake sure that the receiver hasa clear ‘view’ of the transitting
4HEABOVERANDOMISATIONANDSYN-CHRONISATIONPROCEDURESMUSTBEDONEfor each new transitter ote that aTRANSMITTERTHATHASNOTBEENSYNCHRO-NISEDWILLNOT BEABLE TOOPERATE ITSreceiver even if their rolling codes arethe sae ote also that synchronisinga new transitter prevents the use of a previously synchronised transitterthat has the sae identity
ext press the ain switch on the
transitter and check that the receiver’s3TRIKE,%$LIGHTSFORABOUTÚVESEC-onds he external r shouldALSOLIGHTWHILETHERECEIVERmSONBOARD!RM,%$SHOULDÛASHWITHANEVENONOFFDUTYCYCLE4HISÛASHINGSHOWSthe exit delay
!FTER ABOUT S THE EXIT DELAYshould expire and the r shouldTHENÛASHBRIEÛYONCEPERSECOND
ow check the operation of thesecond (saller) switch which is onthe transitter his switch should
toggle the trike2 on and off withsuccessive pressings
Testing the alarmo test the alar ar the unit and
short nput1 on the receiver to ground(0) using a clip lead he externalalar () should light after20s and should then stay on for 60s
ou can check the operation of THEDELAYEDEXITBYARMINGTHEUNITand oentarily shorting nput1 ornput2 to 0 during the exit periodhe alar should not light after
the exit period has expired
Receiver options4HERECEIVERCANBEPOWEREDFROM
A$#PLUGPACKORABATTERY7HENPOWEREDBYAPLUGPACKMAKEsure it can supply the necessary cur-rent for the electric striker and anALARM SIREN IF ÚTTED ANY ELECTRICstrikes draw around 800 so a 1PLUGPACKWILLBEREQUIRED
ote that the ared status is storedin case the power goes off; the aredORDISARMEDMODE WILL BE RETURNEDwhen power is reconnected o if the receiver was ared when powerwas lost then the ared ode will BERESTOREDWHENPOWERISRETURNED
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 14/18
Constructional Project
2 Everyday Practical Electronics, September 2009
hen powering fro a 12 batterya charger should also be connected toaintain battery charge – see ig 12 50 charger for sealed lead-acid batteries would be suitable hese charg-ers are fully autoatic – they charge the battery when required and aintain fullcharge with a trickle current
epending on your applicationtrike1 can be optioned to operate onaring on disaring or on both aringand disaring hese options are selected
using link 1 able 1 shows what eachlink connection does ou ay also wishto place a sall buzzer across the doorstrike connection to give an audible in-dication of door strike operation
he trike2 output can be oentar-ily activated whenever the secondaryswitch on the transitter is pressedlternatively it can be toggled on oroff with each switch pressing ink 2selects these options
Receiver time periodsripots 1 and 2 are used to set
the tie periods for trike1 and trike2the exit and entry delays for nput1 andnput2 and the alar period ink provides the eans to set each tieperiod – see able
ith in the ‘+’ position 1 and2 set the strike period for trike1 andtrike2 respectively able shows thevarious voltages that 1 and 2 canprovide to set the strike periods hesevoltages can be easured at 1 for1 and at 2 for 2
o set the strike periods siply adjust1 and 2 to the voltage settings re-quired and press the synchronise switch(1) on the receiver board
he delayed inputs (ie the entry
delays for nput1 and nput2) are setwhen is in the ‘–’ position nceagain it’s siply a atter of setting thevoltages at 1 and 2 and pressing1 to set the values
inally when is out 1 sets thealar period (2’s setting is ignored) Just set the required voltage at 1 andpress 1 to progra the period in
ote that because pressing switch 1progras in the tiing adjustentssynchronisation will also alter thetiing his eans that if you syn-chronise a transitter to the receiver
at a later date you will have to akesure that 1 and 2 are inthe correct positions for the option selected beforepressing 1
Table 1: Strike1 operation (LK1)
LK1 + – Open
Strike1
operateson
Arm OnlyDisarmOnly
Arm andDisarm
Table 2: Strike2 operation (LK2)
LK2 + – Open
Strike2
operation
Momen-
taryToggle Not valid
Table 3: LK3, VR1 and VR2 settings
LK3 + – Open
Operates whenS1 pressed
VR1 sets Strike1periodVR2 sets Strike2period
VR1 sets Input1 delayVR2 sets Input2 delay
VR1 sets alarm period
Notes
5V sets 64s2.5V sets 32s1.25V sets 16s0.625V sets 8s0.313V sets 4s0.156Vsets 2s
5V sets 64s2.5V sets 32s1.25V sets 16s0.625V sets 8s0.313V sets 4s0.156Vsets 2s
5V sets 128s2.5V sets 64s1.25V sets 32s0.625V sets 18s0.313V sets 8s0.156Vsets 4s
here o et he itsSuitable reed switch assemblies, door strikes and sirens are
available from Jaycar electronics. They can also supply kits
for this project.
The parts available from Jaycar include: (1) the LA-5072
normally closed (NC) reed switch magnet assembly;
(2) the LA-5078 door strike; and (3) the LA-5255 and
LA-5256 piezo sirens.
Above right: door strike available from Jaycar.
n practice this just eans leavingAND,INTHEIRÚNALPOSITIONSAFTERYOUÚNISHTHETIMINGADUSTMENTShat way if you synchronise a transit-
ter later on the last set tiing values aresiply reset to the sae values
Arm output optionink sets the ar output option
– see able hen is in the ‘+’position the r output is low on arand open on disar onversely when is in the ‘–’ position the r outputis open on ar and low on disar t alldepends on how you intend to use thisoutput as to which option you choose
Receiver lockoutny transitter that has been syn-
chronised can later be locked out frooperating the receiver his is done bysetting links 1 2 and in the receiver and pressing switch 1during power up
able 5 shows the link options foreach transitter identity ote thatthese link settings correspond exactlyto the links used in the transitter toset the transitter identity
hen lockout is perfored thePOWER,%$ÛASHESTHEIDENTITYNUMBER
to indicate that the procedure has been successfully copleted o forexaple if you lock-out an identity TRANSMITTERTHEPOWER,%$WILLÛASHthree ties at a noinal 1s rate beforea s break until 1 is released
hen 1 is released the receiverthen operates norally but with theselected transitter now locked out
f 1 is held closed the cycle of ,%$ÛASHINGCONTINUES!TTHEENDOFthe third cycle all identities will belocked out and the power will staylit until 1 is released his feature is
included as a short cut to locking outall identities
f one transitter is locked out and asecond one also needs to be lockedout then the power will have to be
switched off and links 1- repo-sitioned for that transitter identityhe power ust then be re-applied
with 1 pressedOnce the lockout procedure has
been completed, you must relocatelinks LK1-LK4 to their correct posi-tions for the receiver functions thatyou wish to select. t is then best to testthat everything is correct by pressingthe switches on another (non-locked-out) transitter and verifying that thereceiver operates as expected
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 15/18
Constructional Project
Everyday Practical Electronics, September 2009 2
Undoing lockoutt’s easy to get a locked out transit-
ter to operate the receiver again (ie tounlock it) Just synchronise the trans-itter with the receiver and all will be back to noral
The rolling code for the infrared
transmitter comprises four start bits,a 48-bit code and four stop bits.
A calculation comprising a multi-
plier and an increment value is usedto generate the 48-bit code. First, youstart with a number (called the seed),
then you multiply this seed by themultiplier and then add the increment.
The result becomes the next value forrandom code.
Normally, if the calculation is con-tinued, the random code will become
larger and larger as we multiply andthen add the increment value. How-
ever, this is prevented by limiting theseed value used in the calculation to
a certain width; 32 bits in this case.In practice then, the 24-bit multiplier
multiplies the 32-bit seed. The 8-bitincrement value is then added and the
result is limited to 48-bits by eliminatingthe more significant bits. This resulting
48-bit code is the code used for the roll-ing code transmission. In addition, the
order of transmission for these bits isjumbled using an 8-bit scramble code
with 32 possible combinations.
The calculations do not necessarilyproduce random numbers, but they doproduce variations from one transmis-
sion to the next. However, in somecases, the result could converge to
settle at the same value, so it is impor-
tant to check this and make sure thecalculations do give diverging values
each time.To do this, the result of each calcula-
tion is compared to the last value toensure it is not repeated. If the result is
the same as before, the duplicate codeis not transmitted and a new calcula-tion is made after incrementing the
result. Subsequent calculations willthen begin to diverge again.
andoisationTo avoid conflict, each transmitter
must have a unique set of parameters
for making the rolling code calcula-tions. As a result, we have included
a ‘randomisation’ function, wherebythe multiplier value, the increment
value, the scramble value and theseed value are all changed in a rela-
tively random way.There are 16.7 million multipliers
available and 54 possible incrementvalues. Together with the 32 scramble
variations, these provide 29 billion dif-ferent combinations. In addition, the
minimum multiplier value is 8192 toensure a significant change in value
with each calculation.Even if two transmitters do end up
with the same parameter values, the
fact that the seed value is a part of
the calculation means that you needto be within 200 values of the correct
value in order to unlock someoneelse’s lock. The probability of this is
224 divided by 200, or one in 83,000.
This is in addition to the one in 29billion chance of having the same
parameter values!There are up to 16 different trans-
mitters that can be used with the onereceiver, and each transmitter uses
a different set of seed, multiplier,increment and scramble values. The
transmitter sends out its identificationcode that is embedded in the rolling
code, so the receiver knows which setof values it must use in the calculationfor each transmitter.
When the transmitter is sendingsynchronising code to the receiver,
it sends the 8-bit identifier, the 24-bitseed, the 24-bit multiplier, the 8-bit
increment value and the 8-bit scram-ble values. The identifier value is also
stored, so that the receiver knows thatthis identity has been synchronised.
An identity that has not been synchro-
nised will not operate the receiver.Once the receiver has these param-eters, the transmitter and receiver will
remain in lock because they use thesame calculation values.
alculating he olling ode
Installationhe olling ode eyless ntry
yste is suitable for use in hoesfactories and cars ig showshow to wire the unit for a typicalinstallation. Note that IRD1 must
be shielded from direct sunlight,otherwise the reception range will
be severely affected.n soe cases it ay be necessary
to connect the infrared receiver (1)via extended leads using twin-core
Fig.7: here’s how to connect the receiver in a typical installation. Note that you can use both NO (normally open) and NC(normally closed) sensors on the alarm inputs (Input1 and Input2). The battery charger keeps the battery topped up.
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 16/18
Constructional Project
2 Everyday Practical Electronics, September 2009
shielded cable (eg if the receiver isounted on one side of a wall but in-frared reception is needed on the otherside) ig8 shows how this is done
he two alar inputs (nput1 andnput2) can be used in conjunctionwith reed switch agnet assebliesthat change state when a door orwindow is opened or closed oucan use either norally closed ()or norally open () types (eelast onth’s weather station projectfor the lowdown on reed switches)
s shown in ig9 types areconnected in series while typesare connected in parallel oweverfor best security use only one sensorper input
lternatively you can use a de-tector or a glass breakage detector onone or both of the inputs EPE
Table 5: Receiver lockoutselections
LockoutIdentity
LK1 LK2 LK3 LK4
1 + + + +
2 + + + –
3 + + – +
4 + + – –
5 + – + +
6 + – + -
7 + – – +
8 + – – –
9 – + + +
10 – + + –
11 – + – +
12 – + – –
13 – – + +
14 – – + –
15 – – – +
16 – – – –
Table 4: Arm output (LK4)
LK4 + –
Arm output low
on arm, open ondisarm
Arm output open
on arm, low ondisarm
Fig.8: the IR receiver (IRD1) can be connected via twin-core shielded cable as shown here.
Above: you can buy both NO andNC reed switchassemblies.
Fig.9: here’s how to wire the two different sensor types (NO and NC) to thealarm inputs on the receiver board.
eproduced by arrangeentwith
agazine 2009wwwsiliconchipcoau
Get your magazine ‘instantly’
anywhere in the world –
buy and download from the
web.
TAKE A LOOK, A FREE
ISSUE
IS AVAILABLE
A one year subscription (12 issues)costs just $18.99(US)
Back issues are also available
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 17/18
HandsOn Technology
http://www.handsontec.com
Low Cost 8051C Starter Kit/ Development Board HT-MC-02
HT-MC-02 is an ideal platform for small to medium scale embedded systemsdevelopment and quick 8051 embedded design prototyping. HT-MC-02 can be used as
stand-alone 8051 C Flash programmer or as a development, prototyping andeducational platform
Main Features:
8051 Central Processing Unit.
On-chip Flash Program Memory with In-System Programming (ISP) and In ApplicationProgramming (IAP) capability.
Boot ROM contains low level Flash programming routines for downloading code via theRS232.
Flash memory reliably stores program code even after 10,000 erase and program cycles. 10-year minimum data retention. Programmable security for the code in the Flash. The security feature protects against
software piracy and prevents the contents of the Flash from being read.
4 level priority interrupt & 7 interrupt sources.
32 general purpose I/O pins connected to 10pins header connectors for easy I/O pinsaccess.
Full-duplex enhanced UART – Framing error detection Automatic address recognition. Programmable Counter Array (PCA) & Pulse Width Modulation (PWM).
Three 16-bits timer/event counters. AC/DC (9~12V) power supply – easily available from wall socket power adapter. On board stabilized +5Vdc for other external interface circuit power supply.
Included 8x LEDs and pushbuttons test board (free with HT-MC-02 while stock last) for fastsimple code testing.
Industrial popular window Keil C compiler and assembler included (Eval. version).
Free Flash Magic Windows software for easy program code down loading.
PLEASE READ HT-MC-02 GETTING STARTED MANUAL BEFORE OPERATE THIS BOARD
INSTALL ACROBAT READER (AcrobatReader705 Application) TO OPEN AND PRINT ALL DOCUMENTS
7/28/2019 Rolling Code
http://slidepdf.com/reader/full/rolling-code 18/18
HandsOn Technology is a manufacturer of high
quality educational and professional electronics
kits and modules, uController
development/evaluation boards. Inside you willfind Electronic Kits and fully assembled and tested
Modules for all skil l levels. Please check back with
us regularly as we will be adding many new kits
and products to the site in the near future.
Do you want to stay up to date with electronics
and computer technology? Always looking for
useful hints, tips and interesting offers?
spiration and goals...andsOn Technology provides a multimedia and
eractive platform for everyone interested in
ectronics. From beginner to diehard, from student to
cturer... Information, education, inspiration and
tertainment. Analog and digital; practical and
eoretical; software and hardware...
andsOn Technology provides Designs, ideas and
lutions for today's engineers and electronics
bbyists.
reativity for tomorrow's better living...
andsOn Technology believes everyone should have the tools, hardware, and resources to play
th cool electronic gadgetry. HandsOn Technology's goal is to get our "hands On" current
chnology and information and pass it on to you! We set out to make finding the parts and
ormation you need easier, more intuitive, and affordable so you can create your awesome
ojects. By getting technology in your hands, we think everyone is better off
e here at HandsOn like to think that we exist in the same group as our customers >> curious
udents, engineers, prototypers, and hobbyists who love to create and share. We are
owboarders and rock-climbers, painters and musicians, engineers and writers - but we all have
e thing in common...we love electronics! We want to use electronics to make art projects,
dgets, and robots. We live, eat, and breathe this stuff! !
you have more questions, go ahead and poke around the website, or send an email to
[email protected]. And as always, feel free to let your geek shine - around here, we encourage
.