Silicon ChipA 3-Channel UHF Rolling-Code Remote Control, Pt.1 - August 2009 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Tasers can be lethal
  4. Subscriptions
  5. Feature: What Ship Is That? by Stan Swan
  6. Project: Converting a Uniden Scanner To Pick Up AIS Signals by Stan Swan
  7. Feature: Digital Radio Is Coming, Pt.5 by Alan Hughes
  8. Project: An SD Card Music & Speech Recorder/Player by Mauro Grassi
  9. Review: JTAGMaster Boundary Scan Tester by Mauro Grassi
  10. Project: Lead-Acid/SLA Battery Condition Checker by Jim Rowe
  11. Project: A 3-Channel UHF Rolling-Code Remote Control, Pt.1 by John Clarke
  12. Vintage Radio: The unnamed console; an orphan from the 1930s by Rodney Champness
  13. Book Store
  14. Advertising Index
  15. Outer Back Cover

This is only a preview of the August 2009 issue of Silicon Chip.

You can view 33 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Digital Radio Is Coming, Pt.1 (February 2009)
  • Digital Radio Is Coming, Pt.1 (February 2009)
  • Digital Radio Is Coming, Pt.2 (March 2009)
  • Digital Radio Is Coming, Pt.2 (March 2009)
  • Digital Radio Is Coming, Pt.3 (April 2009)
  • Digital Radio Is Coming, Pt.3 (April 2009)
  • Digital Radio Is Coming, Pt.4 (June 2009)
  • Digital Radio Is Coming, Pt.4 (June 2009)
  • Digital Radio Is Coming, Pt.5 (August 2009)
  • Digital Radio Is Coming, Pt.5 (August 2009)
Items relevant to "An SD Card Music & Speech Recorder/Player":
  • dsPIC33FJ64GP802-I/SP programmed for the SD Card Music & Speech Recorder/Player [0110809A.HEX] (Programmed Microcontroller, AUD $25.00)
  • dsPIC33FJ64GP802-I/SP programmed for the SD Card Music & Speech Recorder/Player [0110809J.HEX] (Programmed Microcontroller, AUD $25.00)
  • dsPIC33 firmware and source code for the SD Card Music & Speed Recorder/Player [0110809A.HEX] (Software, Free)
  • SD Card Music & Speech Recorder/Player PCB pattern (PDF download) [01108092] (Free)
Items relevant to "Lead-Acid/SLA Battery Condition Checker":
  • Improved Lead-Acid Battery Condition Checker PCB [04108091] (AUD $15.00)
  • Lead-Acid Battery Condition Checker PCB pattern (PDF download) [04108091] (Free)
  • Lead-Acid Battery Condition Checker front panel artwork (PDF download) (Free)
Items relevant to "A 3-Channel UHF Rolling-Code Remote Control, Pt.1":
  • PIC16F88-I/P programmed for the 3-Channel Rolling Code UHF Remote Control Transmitter [1500809A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88-I/P programmed for the 3-Channel Rolling Code UHF Remote Control Receiver [1500809B.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the 3-Channel UHF Rolling Code Remote Control [1500809A/B.HEX] (Software, Free)
  • 3-Channel UHF Rolling Code Remote Control Transmitter PCB pattern (PDF download) [15008091] (Free)
  • 3-Channel UHF Rolling Code Remote Control Receiver PCB pattern (PDF download) [15008092] (Free)
  • 3-Channel UHF Rolling Code Remote Control Receiver front panel artwork (PDF download) (Free)
  • 3-Channel UHF Rolling Code Remote Control Transmitter front panel artwork (PDF download) (Free)
Articles in this series:
  • A 3-Channel UHF Rolling-Code Remote Control, Pt.1 (August 2009)
  • A 3-Channel UHF Rolling-Code Remote Control, Pt.1 (August 2009)
  • 3-Channel UHF Rolling-Code Remote Control, Pt.2 (September 2009)
  • 3-Channel UHF Rolling-Code Remote Control, Pt.2 (September 2009)

Purchase a printed copy of this issue for $10.00.

A Deluxe 3-channel Rolling Code Remot This high-security 3-button UHF transmitter and receiver can be used for keyless entry into homes and commercial premises and for controlling garage doors and external lighting. Three separate outputs on the receiver can be used to activate various electrical devices such as a door strike, a motorised garage door and 230VAC lights. Up to 16 transmitters can be used with the one receiver so it’s even suitable for a small business. M aybe you have been thinking of building the lowcost UHF remote switch which was featured in the January 2009 issue of SILICON CHIP. That was mainly intended as a cheap replacement for garage door controls and any application where security is not paramount – for example, when the garage does not have internal access to the home. This completely new design is for applications where you want high security and the ability to control more than one device. For example, you may want to control a garage door (one or two) and your house lights to illuminate the driveway or entry. Or maybe you want to control the garage door, the driveway lights and have keyless entry into your home. After all, you already have keyless entry into your car; why should you have to fumble with keys to open your front door? In fact, there are already commercial keyless entry systems for homes. Why shouldn’t you have it too. . . and at lower cost? Or how about this scenario? Say you have a 2-car garage in which the cars are tightly parked with not enough room for the passenger to get in before you drive out. So you turn on the lights in the garage and outside, reverse your car out, the passenger gets in and you then use the 3-button transmitter to close the garage door, turn off the lights and you drive away. When you return, you can turn on all the lights, your passenger alights and you can drive into the garage; all very civilised and convenient. . . And then you could also have keyless entry into the house itself! Rolling code for high security As with any type of lock, it is important that no one can gain access without the correct key. For UHF remote control systems, the “key” is a specific code sent by the transmitter to the receiver. Usually, this code is a long sequence of on and off signals sent in a specific sequence and over a set period. The code must be correct in order for the receiver to allow access. It’s effective – but there’s a problem. The coded signal is 72  Silicon Chip transmitted over a relatively wide area each time it is used to gain access. Intruders have, in the past, used a radio receiver and recorder to intercept the signal as the transmitter sends it. The intercepted signal could then be retransmitted to gain access. Another method they’ve used is to continuously generate access codes with a computer and send them one after the other to the receiver. Eventually, the code is broken and access is possible. Neither of these tampering methods will work with a “rolling code” or “code-hopping” system. In a rolling code system, the code transmitted is altered after each transmission. So intercepting the signal and resending the signal will not enable access because the door lock is now expecting a different code. The code is based on an algorithm (calculation) that both the transmitter and receiver have in common. Many cars now have rolling code keyless entry systems. The code possibilities of a rolling code system usually run into the trillions. This renders any attempt to break the code totally unrealistic. The odds of picking a correct code at random for our rolling code transmitter, for example, is one in 2.8 trillion. Even then, the code needs to be sent correctly at the required data rate, with the correct start and stop bit codes and other transmission requirements. As we said, rolling code is high security! Features Our UHF Rolling Code Security System has two parts: a keyfob-style transmitter and a separate receiver. The keyfob has three pushbutton switches and an acknowledge LED that briefly lights up each time one of the switches is pressed. Up to 16 separate keyfob transmitters can be used with one receiver. The receiver has three relays that can be switched independently using the three switches on the keyfob transmitter(s). Each relay can be set to toggle on or off, or remain energised for a set period. This can be adjusted from 0.26s to 4.4 minutes. The relay outputs can switch up to 10A and 230VAC. For siliconchip.com.au UHF te Control By JOHN CLARKE Features Transmitter • Three function buttons • Coding randomisation • Rolling code UHF transmission • Registering ability • 16 identifications encoding • 12V remote control battery operation • Keyfob case • Acknowledge LED indication Receiver • 12V DC plugpack operation • For use with up to 16 separate transmitters • 3 independent 230VAC rated relay contact outputs • Door strike driver output • Momentary or toggle operations for each output • Momentary outputs adjustable in duration from 0.26 seconds to 4.4 minutes • Acknowledge, power and output LED indicators • Look-ahead feature for 100 codes when transmitter code is ahead of receiver code • Lockout available for any registered transmitter • Local control of outputs available siliconchip.com.au August 2009  73 Specifications Transmitter Battery: ..............................12V 55mAH (A23 type) Battery life: ........................ >2.5 years expected with typical use Standby current: ............... Typically 2.5A with switches open (drawing 22mAH/ year from battery) Code Transmit current: ...... 3mA average over 160ms (133nAH / transmission drawn from battery) Register Transmit current:.. 3mA average over 2.75s Randomisation current: ..... 3.3mA “Stuck switch” current: ...... 220A (after transmission is ended if a switch is kept pressed) Code transmission rate:...... 1.024ms/ bit (1k baud) Encoding: ........................... A high (or a 1 bit) is transmitted as a 512s burst of 433MHz signal followed by 512s of no transmission. A low (or 0 bit) is transmitted by a 512s period of no transmission followed by a 512s burst of 433MHz signal. Rolling code: ..................... Sends four start bits, an 8-bit identifier, the 48-bit code plus four stop bits. The start bits include a 16.4ms gap between the second start bit and the third start bit. Code scramble value is altered on each transmission. Register code:.................... Sent as two blocks. Block 1 sends four start bits, the 8-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 second start bit and the third start bit. Code randomisation: ......... Alters the multiplier values, the increment value, the scramble value and the seed code at a 40s rate. Transmission range: .......... 40m minimum Receiver Power: .............................. 12VDC at 150mA. (If using an electric door strike up to 12VDC at 1A intermittent) Standby current: ................14mA (168mW) with all relays off. 150mA (1.8W) with all 3-relays and indicator LEDs lit Relay contact rating: ..........10A <at> 240VAC Momentary period: ............ When set to momentary operation, each output is adjustable from 0.26s to 2s in 0.26s steps, then in 1s steps to 10s and in 15s steps to 4.4 minutes. See Table 2. use with an electric door strike, the third output on the receiver can provide switched power directly rather than having to wire up through relay contacts and 12V power. Facility to setup for momentary or toggle action for the three outputs is provided with three pushbutton switches, a small rotary switch and three trimpots. Indicator LEDs are included for power indication, relay on or off and receive acknowledgement. The three pushbutton switches can also double up to function as local controls to switch the relays instead of using the UHF remote control. Security & registration Each keyfob transmitter must be allocated an identity number from 0 (zero) through to 15. This is set by coding links on the PC board. Then the initial rolling code needs to be randomised and the algorithm parameters set so that they are unique for each transmitter. Finally, each transmitter is registered and this involves sending a synchronising code to the receiver from the transmitter when the receiver is set in its registration mode. As we said before, this can be done for 16 transmitters and each 74  Silicon Chip will operate independently with the receiver. Also included is a facility to lock out a particular transmitter after it has been registered. This is useful if a transmitter has been lost and you do not wish it to be able to be used with the receiver. If the lost transmitter is found then it can be easily re-registered. When the identity of the lost transmitter is not known, then all transmitters can be locked out and ones that are in use can be re-registered. Another use for this lockout facility is where people hire a public hall for a function, are lent a keyfob transmitter to gain entry (via an electric lock) and turn off any alarm system. If the keyfob is not returned, it can be locked out to prevent future security breaches. Transmitter circuit Fig.1 shows the circuit for the 3-channel UHF Rolling Code Keyfob Transmitter. There is not a lot to the circuit with just a PIC16F88-I/P microcontroller (IC1), a 433MHz UHF transmitter module and 5V regulator (REG1) as the major parts. siliconchip.com.au The keyfob transmitter, shown above about life size, has three buttons, each of which control a relay in the receiver. At bottom left is a LED which briefly flashes when any button is pressed, telling you that the battery is still OK! At right is an oversize view of the completed transmitter inside the open keyfob case. The green PC board is the 433MHZ UHF transmitter itself. IC1 is normally kept in sleep mode with its internal oscillator stopped and most internal features switched off. In this state it draws a typical standby current of 0.6A from the 5V supply (which in turn is derived from a miniature 12V battery). Switches S1 to S3 and the jumper links LK1 and LK2 connect to the RB6, RB5, RB7, RB0 and RB4 inputs. Each input is normally held high by an internal pullup resistor to the 5V rail. A closed switch will bring the respective input low (0V). Similarly when LK1 is closed the RB0 input will be held low. RB4 is brought low only when LK2 is in and switch S3 is pressed. IC1 is programmed to wake up from its sleep condition when any one of the RB4 to RB7 inputs change in level or the RB0 input goes to 0V. When IC1 wakes up it starts running its program. If RB0 is low, the routine to randomise the parameters is run. If RB4 is low, the registration codes are transmitted and if RB5, RB6 or RB7 are low, as when one of the keyfob buttons is pressed, it sends the normal rolling code. The rolling code and registration codes are sent via the 433MHz transmitter module. This module is powered via the paralleled RA3 and RA4 outputs of IC1 which go high to provide a nominal 5V to the VCC input of the module. The code signal is applied to the data input of the module from the RA2 output of IC1. LED1 is driven via the RB3 output and is modulated at the code transmission rate of about 1kHz. The LED acts as a transmit indicator. Inputs RA1, RA0, RA7 and RA6 inputs can be tied to 0V or to the 5V supply rail via links on the PC board. These select the identity of the transmitter. With all inputs connected to 0V, its identity is ‘0’. When all inputs are tied to 5V, the identity is ‘15’. Various combinations of high and low connections for these inputs select the other identities from 1 to 14. When the selected software routine is completed, IC1 returns to sleep mode. Firstly, if UHF transmission was involved, supply to the siliconchip.com.au UHF transmitter module is removed by taking the RA3 and RA4 outputs and the data line at RA2 to 0V. LED1 is switched off with a low at RB3. So IC1 returns to the sleep mode, when the RB0 and RB4 to RB7 inputs are high, with open links and switch connections. Flea-power regulator Putting the micro to sleep for most of the time is useful in keeping battery drain to the minimum but that still leaves the quiescent current of the regulator, because it needs to continuously provide 5V supply for IC1. A standard low-power 78L05 regulator is out of the question as it typically draws 3mA quiescent current. Better still is the micropower LP2950 voltage regulator which has a 75A quiescent current (typical). But even with 75A quiescent current, the battery will be flat after only 733 hours or 30 days. The solution was to use Microchip Technology’s MCP1703T-5002E/CB 3-terminal regulator which draws a mere 2A. This regulator current, combined with the micro’s quiescent current when it is asleep has the whole circuit drawing about 2.6A. We measured the standby current draw of our prototype circuit and found that it consumed 2.5A of current from a fresh 12V battery. Measuring this current was easy. A 1k resistor was temporarily placed in series with the battery supply and the voltage drop across this resistor was measured. As we measured 2.5mV, the current is then calculated as 2.5mV/1k or 2.5A. During a transmission of a rolling code command, the current will briefly rise to about 3mA. If you hold one of the buttons down after the transmission is complete, the current will be about 220A. This is due to current flow in the switch pullup resistor that connects from the 5V supply to 0V via the closed switch. Battery life is expected to be more than 2.5 years, after which the 12V battery will have discharged down to 6V. The transmitter circuit will continue to operate even at August 2009  75 D1 1N4004 K A REG1 MCP1703T-5002 +5V OUT IN GND 12V BATTERY (A23) 1 F MMC 1k 1 F MMC 8 4 1N4004 A 4 IDENTITY CODING 17 MCP1703T-5002E/CB IN K GND 2 OUT 1 12 13 10 S2 S3 LK2 REGISTER LK1 RANDOMISE RA0 RA3 6 2 ANT 3 Vcc 433MHz UHF DATA TRANSMITTTER MODULE RA7 RA2 15 11 S1 RA1 RA4 16 ANTENNA Vdd MCLR 18 100nF MMC 14 RA6 1 DATA IC1 PIC16F88 -I/P RB6 GND RB3 9 RB5 A RB7 ACKNOWLEDGE  LED1 RB4 LED K RB0 Vss 1k 5 K A 433MHz Tx MODULE SC 2009 ANT Vcc DATA GND 3-CHANNEL UHF ROLLING CODE TRANSMITTER Fig.1: the transmitter is based on a PIC16FBB-I/P chip and a commercial 433MHz UHF data transmitter. Don’t substitute REG1 with a conventional 5V regulator – even the low-power devices will quickly flatten the battery. this low voltage – and this takes into account the nominal 600mV drop across the reverse polarity protection diode D1. In fact, the regulator can operate down to 5.150V at its input and still maintain a 5V output. The input and output of REG1 are decoupled with 1F monolithic ceramic capacitors. The regulator is designed to be stable with between 1F and 22F of capacitance on its output. The effective series resistance (ESR) of the capacitor can range from 0 to 2 and so ceramic, tantalum or electrolytic capacitors can be used. IC1’s supply is also decoupled with a 100nF monolithic ceramic capacitor. Receiver circuit The receiver also uses a PIC16F88-I/P microcontroller (IC1) (see Fig.2). The UHF receiver module has a substantial on-board coiled wire antenna input to provide very good reception range. When no signal is present, the receiver’s output signal is random noise that is caused by the module’s automatic gain control (AGC) being set at maximum. Upon reception of a 433MHz signal, the receiver gain is reduced for best reception without overload and the coded signal from the data output of the module is applied to the RA2 input of IC1. LED4 indicates whenever a valid signal is received. The RA4, RA6 & RA1 outputs of IC1 each drive a transistor and relay. When RA4 goes high, it turns on transistor Q1, which pulls in RELAY1 and LED1 lights up. Diode D1 clips spike voltages at the collector of Q1 when the relay switches off. The relay contacts are rated at 10A and 240VAC and can be used to control 230VAC lights if required. Relay operation can be either momentary or toggle. Tog76  Silicon Chip gle operation means that the relay switches on with one press of switch S1 on the transmitter keyfob and switches off when S1 is pressed again. Momentary operation has the relay switch on for a short preset period of time. For RELAY1, the momentary period is set using the trimpot VR1. The trimpot wiper can be adjusted from 0V through to 5V and this voltage is monitored at the AN3 input of IC1 to give the actual period which ranges from 0.26 seconds to 4 minutes 24 seconds. The other two relays operate in a similar manner with LED2 and LED3 indicating when they are on. Similarly, VR2 and VR3 set the momentary periods for RELAY2 and RELAY3. Note that transistor Q3, used to switch RELAY3 is a power Darlington. This allows it to drive an electric door strike (which may require 800mA or so) as well as the relay. Dual function switches Switches S1, S2 and S3 have different functions, depending on whether link LK1 is in or out of circuit. When LK1 is out of circuit, the RA5 input is held high via a 33k resistor to the 5V supply and switches S1, S2 and S3 then can be used to operate the relays directly. Hence, S1 operates RELAY1, S2 operates RELAY2 and so on. Whether each relay operates in toggle or momentary mode depends on how it has been previously set. When LK1 is placed in circuit, S1, S2 and S3 perform a different function. S1 does the lockout function, S2 sets toggle or momentary operation and S3 does keyfob registration. BCD rotary switch The on-board BCD rotary switch (S4) has 16 positions, siliconchip.com.au labelled 0-9 and A-F. This switch is only applicable to the lockout and momentary/toggle selections; it plays no part in the keyfob transmitter registration. The BCD switch has four outputs that connect to the RB3, RB1, RB2 and RB0 inputs of IC1. They are normally held high via internal pullup resistors in IC1 unless an input is held low via a closed contact in the switch. When the BCD switch is set at 0, all four inputs are held high. Position 1 on the switch has the ‘1’ output at RB3 pulled low. Position 15 (or F) sets all switch outputs at 0V. Also in the settings mode with LK1 in circuit, pressing S3 places the program in IC1 ready to accept the registration signal from a transmitter. S1 provides the lockout function. Pressing S1 will prevent the transmitter from operating the receiver. The transmitter to be locked out is identified by the number selected with BCD1. Similarly for the momentary/ toggle function the position of BCD1 determines the output that will be changed from momentary to toggle or toggle to momentary when S2 is pressed. BCD1 position 1 changes output 1, position 2 changes output 2 and position 3 changes output 3. Power The circuit is powered by a 12V DC plugpack. Reversepolarity protection is provided by diode D4 while the 7805 3-terminal 5V regulator, REG1, is protected against excessive input voltage by zener diode ZD1. A nominal 12V rail supplies the three 12V relays. It is labelled as 11.4V on the circuit diagram (12V – 0.6V drop across D4) but the actual voltage could be higher depending REG1 7805 +5V OUT POWER A LED5 100nF MMC  K TP5V 10 F D4 10 IN K GND ZD1 16V 1W 100 F A 1k +11.4V 1 DATA TPGND A Vdd RA2 VR1 LED1 33k MOMENTARY PERIOD1 GND RA5 AN3 4 MOMENTARY PERIOD2 VR2 Vcc DATA DATA GND ANT GND GND Vcc 8 9A 012 67 EF á S4 CONNECTIONS 34 5 2 C 8 MOMENTARY PERIOD3 VR3 S4 17 7 2 C 8 4 6 8 12 TPS1 11 TPS2 TPS3 S2 LK1 OUT S1 SC  2009 A AN0 10 RB3 LOCKOUT '2' MOMENTARY/TOGGLE S3 '3' REGISTER RELAY2 D2  NC A COM 3 1k 15 C B E 18 RB1 NO Q2 BC337 CON3 3.3k 1 RB2 RB0 RA7 A 16 LED3 A ACKNOWLEDGE RB6 K RB4 Vss RELAY3 K D3  K  LED4 RB5 1k A C B 1k 2 COM NO Q3 BD681 CON2 3 CONNECT ELECTRIC DOOR STRIKE TO CON3 PINS 1 & 2 E 5 D1-4: 1N4004 LK1 IN '1' RA4 NO Q1 BC337 K K RA1 S3 S2 LED2 RA6 9 1 S1 LK1 IC1 PIC16F88 -I/P COM 3.3k SELECT AN6 TP3 BCD SWITCH 0–15 (0–F) C B E TP2 4 C 1 BC D 13 NC A 1k 433MHz Rx MODULE TP12V CON1 D1  1k TP1 RELAY1 K K 2 CON4 3.3k 14 ANT 12V DC INPUT A 470 F 16V Vcc 433MHz RX MODULE K BC337 LEDS K A B E A K ZD1 C 3-CHANNEL UHF ROLLING CODE RECEIVER A BD681 7805 K B C GND IN E GND OUT Fig.2: the receiver is not dissimilar to the transmitter, again based on the same PIC. The main difference is in the coding arrangement (S4) and the relays which can be used to switch just about anything, mains (up to 10A) or low voltage. If used to control a door strike, relay 3 isn’t required – it can be switched directly via the Darlington (Q3). siliconchip.com.au August 2009  77 1 F 1 F 12V ALKALINE BATTERY – + D1 + + ANTENNA LINK 19080051 ANTENNA 433MHzGTx NILL OR MODULE XT ED O C ANT Vcc S2 IC1 PIC16F88-I/P 1k 1k K S3 LK2 15008091 LOCATING ROLLING HOLES CODE TX IDENTITY ENCODING LED1 COPPER SIDE COMPONENT SIDE Construction ANTENNA 10 D4 S3 TPS3 NC COM NO 1 P-TYPE NYLON CABLE CLAMPS E 3PTP3 T LED3 Q3 E C B 1k K 3.3k 100 F 10 F 470 F D3 RELAY3 RELAY2 NC TP12V CON3 OUT C D2 Q2 B A 1k E VR3 0V C D1 K 1k K 2TP2 PT +12V 012 EF ZD1 1k TPS2 LED2 A RELAY1 CON1 VR2 LED1 A 12V DC INPUT REG1 7805 T VR1 1PTP1 Q1 B 1k TPS1 GND CON4 LED4 DNG V 5 PT LED5 S2 1 C 4 3.3k 433MHz Rx MODULE LINK  S1 TPNGND D G PT TP5V 34 5 BC D REVIE CER ED O C G NILL OR F HU 8 C 2 8 9A 29080051 S4 33k 67 Vcc DATA DATA GND G NI H CTI WS CAV 0 3 2 78  Silicon Chip 1k IC1 PIC16F88-I/P OUT IN Identity coding On the underside of the PC board are the identity encoding linking selections. The default setting is set for identity 0 where the ‘8’, ‘4’, ‘2’ and ‘1’ connections are tied to the 0V track with narrow PC tracks. If you are building just one transmitter there is no need to change these settings; it is only when more than one transmitter is required to work with the receiver that each transmitter requires a different identity. To set a different identity, use table 1 as a guide to setting the linking. 100nF LK1 ANT GND GND Vcc D N G SK NIL 1S We’ll begin with the keyfob transmitter. It is built using a 34 x 56mm PC board coded 15008091. The assembled PC board is designed to fit into a Teco type-11 keyfob case with three buttons. The case is supplied with two battery contacts, a key ring loop, three switch caps and a case securing screw. Start by checking the PC board for correct sizing in the box. The edges of the PC board may need to be trimmed with a file if it has not been cut to the correct size. Note that the base of the case has a + and – polarity indicator for the battery terminals at its top end while the PC board should fit neatly into the lower end of this case. The case has two 1mm-diameter locating protrusions moulded into the base. These line up with the holes on the PC board when it is correctly fitted. Take care not to damage them – don’t apply excessive force or the pins will be bent or squashed. Check the holes are correct with 1.25mm holes drilled for the battery terminals. Check that the copper pattern is intact with no breaks in the copper tracks or hairline shorts between copper areas. Repair if necessary. For example, to set identity 1, the ‘1’ connection has to be tied to 5V with the ‘2’, ‘4’ and ‘8’ connections left tied to 0V. To connect the ‘1’ connection to the 5V rail, the narrow track connecting to the 0V rail has to be broken with a hobby knife or engraving tool and a solder bridge applied V 2 1 PT on the plugpack and power drawn from the plugpack. REG1 supplies IC1 and the UHF receiver module. A 100F capacitor decouples the supply to REG1 while a 10F capacitor bypasses the regulator output. LED5 indicates power is on. 3.3k A S1 REG1 0V LK1 100nF + 8 4 2 1 5V KEEPER POSITION DATA GND Fig.3 (left) shows the component side of the transmitter PC board. The UHF data module lies flat on the main PC boardwith its antenna, comprised of a short length of PC board track, a wire link and a wire coil. At right (Fig.4) is the underside of the PC board, showing the identity coding links and the two locating holes. REG1, an SMD device, is also mounted on the copper side (highlighted in red). V 0 WS V 2 1 NC COM COM NO NO 2 CON2 3 Fig.5: the receiver PC board. Everything is mounted on-board, with a similar coiled wire antenna at the top of the board. siliconchip.com.au between the terminal and the 5V rail track. Make sure the 0V and 5V supply are not shorted by connecting both these supply rails to the one connection. Identities available are from identity 0 to identity 15. Identities 10 to 15 are the letters A to F respectively. We mention the A to F values because the lockout switch on the receiver is labelled with these hexadecimal numbers instead of decimal – to lockout a transmitter identity on the receiver you must match the switch setting with the identity value. It is a good idea to write the actual identity of each transmitter on the rear of the keyfob case. This will make it easier to determine any lost transmitter identity so that it can be locked out. REG1 mounts on the copper side of the PC board. This is a surface-mount device but it only has three leads, so is quite easy to solder in place. Position the device over the copper lands as shown on the underside overlay diagram (Fig.4) and solder just one of the leads to the PC board. Check the device is still located correctly before soldering the remaining pins. If you need to realign the device, it is much easier when only one pin is soldered! Use solder wick to help remove it – don’t try prising it off while heating the Con1 and Con2 are actually two 4-way barrier terminals, with one mounting hole cut off each end and the two halves glued together, as you can see here. Hot-melt glue holds them together while soldering and bolting in place (which takes most of the strain anyway). Note that these are actually panel-mounting types which we made fit – the right ones, with PC pins instead of solder tags, were out of stock at the time. You should use the PC-mounting type. pins as it is easy to damage either the pins or the copper lands underneath. The topside of the PC board can now be assembled with the remaining components. Start with the wire link that acts as part of the UHF antenna. This is made from a 30mm length of 0.7mm tinned copper wire and is stretched as a straight wire between the two PC pads and soldered in position. We’ll look at the remainder of the antenna (the coil) shortly. Now insert the IC socket taking care to place the notched end toward S1 as shown. Make sure the socket is fully seated onto the PC board before soldering the pins. Don’t insert the IC just yet. Switches S1, S2 and S3 are mounted fully seated onto the PC board. When soldering, be sure the locator hole near to S3 is not soldered but is left clear of solder. Also install the two 1k resistors and diode D1 (which of course must be oriented correctly). Similarly, LED1 must go in the right way around – so that its anode, the round edge/longer lead, is oriented toward the lower edge of the PC board. The LED mounts right down on the PC board. The 2-way and 3-way pin headers can be mounted and soldered in place. The jumper plug can be installed in the keeper position. This position is just to store the jumper plug so that it is not lost. When placed in the keeper position, it does not make a connection for LK1. There are two 1F monolithic capacitors, mounted near REG1. These will be marked as 105 or 1 on their body. The 100nF capacitor just above S1 will be marked as 104 or 100n. Here’s a matching photo to help get everything where it should be! In the receiver, the UHF module mounts at right angles to the board . . . siliconchip.com.au . . . as shown in this close-up photo. Make sure it goes in the right way around! August 2009  79 Parts List – Deluxe Rolling-Code UHF Remote Control Transmitter 1 PC board coded 15008091, 34 x 56mm 1 keyfob case with 3-buttons (Teko type-11 No.11123.4) [supplied with battery contacts, key ring loop, 3-switch caps, LED diffuser and a securing screw] 1 433MHz UHF transmitter module (Jaycar ZW-3100 or equivalent) 1 12V alkaline remote control battery (Energizer A23 or equivalent) 1 DIP18 IC socket 3 SPST micro tactile switches vertical mount with 3.5mm actuator (S1-S3) (Jaycar SP-0602 or equivalent) 1 3-way 2.54mm spacing pin header 1 2-way 2.54mm spacing pin header 1 2.54mm jumper shunt 1 35mm length of 0.7mm tinned copper wire 1 138mm length of 0.63mm enamelled copper wire Semiconductors 1 PIC16F88-I/P microcontroller programmed with 1500809A (IC1) 1 MCP1703T-5002E/CB (SOT-3 package) 5V regulator (REG1) 1 3mm green LED (LED1) 1 1N4004 1A diode (D1) Capacitors 2 1F monolithic ceramic 1 100nF monolithic ceramic Resistors (0.25W 1%) 2 1k Receiver 1 PC board coded 15008092, 110 x 141mm 1 IP65 sealed polycarbonate box with clear lid 171 x 121 x 55mm 1 433MHz UHF receiver module (Jaycar ZW-3102 or equivalent) 1 0-F BCD rotary switch (BCD1) (Jaycar SR-1220, Altronics S 3000A or equivalent) 3 SPST micro tactile switches vertical mount with 6.0mm (or similar) actuator (S1-S3) (Jaycar SP-0603 or equivalent) The 433MHz transmitter module mounts parallel with the PC board by bending the mounting pins down at right angles. Make sure the pins are bent in the correct direction so when installed the module has the antenna pin toward the top edge of the PC board. The module sits about 3mm above the PC board. Battery clips are mounted with the dimples pointing inward to face each other. The larger dimpled clip is for the + end and this mates well with a dint in the battery + terminal. The antenna is made up using the straight wire link soldered in earlier and a spiral section, made using a 138mm length of 0.63mm enamelled copper wire. The insulation on each end is scraped clean for about 1mm to allow the ends 80  Silicon Chip 3 12V SPDT relays with 10A 240VAC contacts (RLY1-3) (Jaycar SY-4050, Altronics S 4170A or equivalent) 2 4-way PC mount terminal barriers with transparent cover and 9.5mm spacing (CON1) (Jaycar HM-3162 or equivalent) 1 3-way screw terminals with 5.08mm pin spacing (CON3) 1 3-way pin header with 2.54mm pin spacing 1 2.54mm jumper shunt 1 30mm length of 0.7mm tinned copper wire 1 157mm length of 1mm enamelled copper wire 3 P clamps for 5mm cable 3 Cable glands (3-6.5mm diameter cable) 1 18-pin DIL IC socket 1 mini heatsink 19 x 19 x 9.5mm 1 2.5mm PC mount DC socket (CON2) 10 PC stakes 2 M4 x 15mm screws 3 M4 x 10mm screws 5 M4 nuts 1 M3 x 10mm screw 4 M3 x 6mm screws 1 M3 nut 3 M4 washers 2 M3 washers Semiconductors 1 PIC16F88-I/P programmed with 1500809B (IC1) 1 7805 5V regulator (REG1) 2 BC337 NPN transistors (Q1,Q2) 1 BD681 NPN Darlington transistor (Q3) 3 red 3mm LEDs (LED1-LED3) 2 green 3mm LEDs (LED4,LED5) 4 1N4004 1A diodes (D1-D4) 1 16V 1W zener diode (ZD1) Capacitors 1 470F 16V PC electrolytic 1 100F 16VW PC electrolytic 1 10F 16VW PC electrolytic 1 100nF monolithic ceramic Resistors (0.25W 1%) 1 33k 3 3.3k 6 1k 1 10 3 10k horizontal trim pots (coded 103) (VR1-VR3) to be soldered in position. The wire is coiled by winding on about five turns on a 6.35mm (1/4”) former – a drill bit is ideal. The coil winding should look something like our prototype (as shown in the photograph). Before inserting the microcontroller, connect the battery and check that there is 5V between pins 5 and 14 on the IC1 socket. The voltage could range from 4.85V to 5.15V. Anything outside this means there is a problem. A 0V reading could mean the battery is in the wrong way or there is a short circuit across the 5V supply rail. If it is correct, remove the battery and insert IC1, the notch on the IC matching the notch on the socket. The quiescent current can be measured if a 1k resistor is placed in series with the battery to one of the clips. This siliconchip.com.au is done by temporarily soldering one end of the resistor to the PC board at the + terminal. Connect your multimeter leads across the resistor and set the meter for reading millivolts. Then connect the “-” end of the battery to the minus terminal on the PC board and hold the unsoldered end of the resistor to the plus battery terminal. The voltage should be around 2.5mV to 3mV, representing 2.5A to 3A. The voltage will rise when one of the switches is pressed to about 3V but fall back to the quiescent value after the LED has flashed and the switch is released. Receiver construction The receiver uses a PC board coded 15008092, measuring 110 x 141mm. It is housed in a 171 x 121 x 55mm IP65 sealed polycarbonate box with clear lid. As you did with the transmitter, check the PC board fits neatly into the box. The corner mounting holes should already be drilled out to accommodate M3 screws that are used to screw into the integral brass threads of the box. Holes for CON1 and CON2 are 2mm for the 4-way terminals and 4mm for the outside securing screws. The holes to secure the P-clamps are 4mm. Again, check the PC board for breaks in the copper tracks or for shorts between tracks and repair any faults, if necessary. Begin assembly by installing the wire link and the resistors. The table below shows the resistor colour codes for each value but it’s a good idea to also verify each value with a digital multimeter before soldering in position. PC stakes can go in next. Install the diodes D1-D4 and ZD1 taking care to orient correctly. The IC socket can be installed again making sure the notched end is correctly oriented. S1-S3 can be installed now as well as the 3-way pin header for LK1. Install BCD1 ensuring the switch is oriented correctly, along with trimpots VR1 – VR3. Transistors Q1 and Q2 are mounted with the orientation shown. Darlington transistor Q3 is not so immediately obvious: it is installed with its metal face towards LED3. Next install the four capacitors – the three electrolytic (polarised) types need to be oriented as shown. CON1, CON2, CON3 and CON4 can be installed. Because barrier terminal strips only come in four and six-way (and we need eight-way!) we made our own by carefully cutting off the mounting holes from one end of two four-way types and gluing them together. Because they are soldered to the PC board and there is also a mounting point at each end, this should be more than adequate. Before soldering in, the combined CON1 and CON2 block is secured to the PC board using two M4 x 15mm screws placed through the two outside holes and with two M4 nuts on the underside of the PC board. We ended up using only one of the clear protective coverings – it adequately covers the eight live terminals while leaving the two mounting screws uncovered. LEDs 1-5 are mounted about 15mm above the PC board. RESISTOR COLOUR CODES No. 1 3 8 1 Value 33k 3.3k 1k 10 siliconchip.com.au 4-Band Code (1%)   orange orange orange brown   orange orange red brown   brown black red brown   brown black black brown   Table 1: Transmitter Identity Coding IDENTITY   0   1   2   3   4   5   6   7   8   9 10 (or A) 11 (or B) 12 (or C) 13 (or D) 14 (or E) 15 (or F) ‘8’ 0V 0V 0V 0V 0V 0V 0V 0V 5V 5V 5V 5V 5V 5V 5V 5V ‘4’ 0V 0V 0V 0V 5V 5V 5V 5V 0V 0V 0V 0V 5V 5V 5V 5V ‘2’ 0V 0V 5V 5V 0V 0V 5V 5V 0V 0V 5V 5V 0V 0V 5V 5V ‘1’ 0V 5V 0V 5V 0V 5V 0V 5V 0V 5V 0V 5V 0V 5V 0V 5V The default setting is Identity 0 as set by narrow PC tracks that connect the ‘8, 4, 2 and 1’ inputs to 0V. Other Identities are set by breaking the appropriate track that connects an input to 0V and soldering a bridge from the input to the 5V rail. For example to set Identity 1, break the 0V connection to the ‘1’ terminal and solder to the 5V rail. For Identity 5, the ‘4’ input would need to be tied to 5V as well as the ‘1’ input. with red LEDs used for LEDs 1-3 while LEDs 4-5 are green. Be sure to orient each correctly. The UHF receiver module can be installed next; again take care to orient correctly. The pin connections for the module are printed adjacent to each pin. The three relays can be mounted now, followed by the 5V regulator. It mounts horizontal to the PC board on a small heatsink. The leads are bent down 90° to protrude through the holes in the PC board. Fasten the regulator and heatsink to the PC board (with an M3 x 10mm screw and nut) before soldering the leads in place underneath. The antenna is made using 157mm of 1mm enamelled copper wire. The ends are stripped of enamel insulation for about 1mm using a sharp hobby knife to scrape it clean. Again, the wire is wound into a coil over a 6.35mm (1/4”) former such as a drill bit. The coil is stretched out to reach the two connection points and soldered in position. That completes the construction of the boards themseleves. Next month, we’ll look at testing and setting them up to talk to each other and complete the project. We’ll also look at some Frequently Asked Questions about rolling code and code scrambling. Stay tuned! SC 5-Band Code (1%) orange orange black red brown orange orange black brown brown brown black black brown brown brown black black gold brown CAPACITOR CODES Value F value IEC Code EIA Code 1F 1F 105 1u0 100nF 0.1uF 104 100n August 2009  81