Design of Intelligent PKE Transponder Based on PIC16F639 MCU

Hands-free Passive Keyless Entry (PKE) is fast becoming the mainstream for remote keyless entry applications in cars and a common option for new vehicle models. The method eliminates the need to manually press the transmitter button to lock or open the doors, and allows easy entry and exit of the vehicle as long as there is an active transponder.

Hands-free Passive Keyless Entry (PKE) is fast becoming the mainstream for remote keyless entry applications in cars and a common option for new vehicle models. The method eliminates the need to manually press the transmitter button to lock or open the doors, and allows easy entry and exit of the vehicle as long as there is an active transponder.

Hands-free PKE applications require two-way communication between the base station and the transponder unit. The base unit in the vehicle issues a low frequency (LF) command to search for surrounding transponders. Once the owner’s transponder is found, the transponder will automatically respond to the base unit. The base unit opens the door after receiving a valid authentication response signal.

In a typical PKE application, the output power of the base unit is designed to be the power allowed by the electromagnetic radiation standards specified by the government agency. The achievable antenna voltage is about 300V peak-to-peak when operating from a 9V to 12V DC supply. Due to the non-propagating nature of low frequency signals (125kHz), the signal level received by a typical key fob transponder about two meters away from the transmitting base unit is only about a few mV peak-to-peak. In addition, due to the directional characteristics of the antenna, if the antenna is not facing the base station antenna, the input signal level of the transponder will be very weak.

If the PKE is not functioning properly, the likely cause is that the transponder input signal level is too weak. Therefore, for the hands-free PKE application to work reliably, the input signal should be strong enough (above the input sensitivity level) within any desired communication range. To make the PKE system reliable, the system design engineer must consider four important parameters, the output power of the base station command signal, the input sensitivity of the transponder, the directivity of the antenna, and the battery life of the transponder.

The PIC16F639 is an MCU with a three-channel analog front end (AFE) whose AFE features are controlled by the MCU firmware. Due to its ease of use, the device can be used in a variety of intelligent low frequency detection and two-way communication applications. This article discusses an example of a design circuit for implementing a smart PKE transponder using a PIC16F639 MCU, and gives an example of the MCU firmware in the circuit. Design engineers can easily modify these circuits and MCU firmware according to the user’s specific application.

Figure 1: Smart passive keyless entry (PKE) system with two-way communication.

PIC16F639 PKE Transponder

The PIC16F639 includes a digital MCU part (PIC16F639 core) and an analog front end (AFE) part, which can be used for a variety of low frequency detection and intelligent two-way communication applications. Figure 1 is an example of a typical PKE system. The base unit sends a 125kHz command signal to search for available transponders around. If the received command is valid, the PKE transponder will return a response signal.

The PIC16F639 device has high analog input sensitivity (up to 1mV peak-to-peak) and three antenna connection pins. By connecting three antennas pointing in the X, Y and Z directions, the transponder can receive signals from any direction at any time, thereby reducing the possibility of signal loss due to the directivity of the antennas. The input signals to the antenna pins are detected independently of each other and then summed. Each input channel can be individually enabled or disabled by programming the configuration registers. The fewer channels that are enabled, the less power the device consumes.

For hands-free operation, the transponder continuously waits and detects incoming signals, which reduces battery life. Therefore, in order to reduce the operating current, the digital MCU part can be in a low current mode (sleep mode) while the analog front end (AFE) searches for a valid input signal. Only when the AFE detects a valid input signal, the digital MCU part is woken up. This is achieved by using an output enable filter (wakeup filter). The PIC16F639 has nine output enable filter options. The filter can be programmed by the user using the configuration registers. Once the filter is programmed, the device passes the detected output to the digital section only when the input signal meets the filter requirements.

Figure 2: Configuration circuit diagram of a passive keyless entry (PKE) transponder.

Figure 2 shows a configuration example of a PKE transponder. This transponder includes a PIC16F639 device, external LC resonant circuit, push button, UHF transmitter, backup battery (optional) and a 3V lithium battery.

To save battery power, the digital part is usually in sleep mode while the AFE part detects the LF input signal. Although the output pad of the AFE is internally connected to the PORTC pin, since the PORTC pin is not an interrupt-on-change pin, the AFE output cannot wake up the digital section through an interrupt-on-change event. Therefore, it is recommended to connect the LFDATA and ALERT pins of the AFE to the PORTA pins externally, as shown in Figure 2.

The digital part is woken up when one of the following three conditions occurs: the LFDATA pin has an AFE output; the ALERT pin has an AFE output; a switch button event on PORTA is pressed.

Figure 3: Due to the directivity of the antenna, in practical applications, the detection distance is , when the two antennas are parallel, and the detection distance is short when they are orthogonal.

External LC resonant antenna

The PIC16F639 device has three low frequency input channels. The LCX, LCY, and LCZ pins are used to connect the external LC resonant antenna circuit (of each LF input channel). The external circuit is connected to the antenna input pin and the LCCOM pin. LCCOM is a common pin for all external antenna circuits. When the internal detection circuit detects a strong input signal, it is recommended to connect a capacitor (1~10μF) between the LCCOM pin and the ground to provide a stable working state.

Although the PIC16F639 has three LC input pins for connection to three external antennas, depending on the application, the user can use only one or two antennas instead of all three at the same time. Operating current consumption is proportional to the number of channels enabled, with fewer channels enabled, less current is consumed, but it is strongly recommended to use all three antennas in hands-free PKE applications.

To detect low frequency magnetic fields, tuned loop antennas are usually used. For the antenna voltage to , the loop antenna must be tuned to the desired frequency. For PKE applications, the antenna should be tuned to the base station carrier frequency. A loop antenna consists of a coil (Inductor) and several capacitors that form a parallel LC resonant circuit. The antenna voltage is made by increasing the loop surface area and the quality factor (Q) of the circuit.

The resonant frequency of the LC resonant circuit is given by Equation 1:

Among them, fc = base station carrier frequency (Hz); △f = |fc-fo|; fo = LC circuit resonant frequency (Hz); N = number of turns of loop coil; S = loop surface area (m2); Q = LC circuit figure of merit; Bo = magnetic field strength (Weber/square meter); α = angle of arrival of the signal.

In Equation 2, the quality factor (Q) is a measure of the frequency selectivity of the tuned circuit. Assuming the capacitor is lossless at 125kHz, the Q of the LC circuit will be dominated by the inductance.

where fo is the tuning frequency, L is the inductance value, and r is the impedance of the inductance.

In typical transponder applications, inductance values ​​range from 1 to 9 mH. For air core inductors, the Q value of the LC circuit is greater than 20, and for ferrite core inductors, the Q value is about 40.

The term Scosα in Equation 2 represents the effective surface area of ​​the antenna, which is the area of ​​the loop in the incident magnetic field. When cosα is equal to 1, the effective surface area of ​​the antenna is , and the antennas of the base station and the transponder unit face each other. In practical applications, the detection distance is short when the two antennas are parallel, and the detection distance is short when they are orthogonal. Figure 3 graphically illustrates the antenna orientation problem in a practical application.

Figure 4: Recommended transponder board antenna layout.

If the three antennas are positioned orthogonal to each other on the same printed circuit board, antenna orientation problems can be greatly reduced. In practice, this design will increase the probability that at least one transponder antenna will be facing the base station antenna at any time. Figure 4 is an illustration of the arrangement of three antennas on the transponder circuit board. LCZ uses one large air core coil, LCX and LCY use two ferrite core coils. Some companies specialize in the production of ferrite coils for 125 kHz RFID and low frequency detection applications.

As shown in Equations 2 and 3, when the LC circuit is accurately tuned to the frequency of the incident carrier, the induced voltage on the coil is . However, in practical applications, the LC resonance frequency of each transponder is also different due to the different tolerances of the LC components. To compensate for errors due to component tolerances, each channel of the PIC16F639 has an internal tuning capacitor bank. Capacitance values ​​can be programmed to 63pF in 1pF steps, and the capacitance value increases monotonically with increasing configuration register bits.

Capacitors can be effectively tuned by monitoring the RSSI current output. The RSSI output is proportional to the input signal strength, so the closer the LC circuit is tuned to the carrier frequency, the higher the monitored RSSI output. The total capacitance value increases as the configuration register bits are raised, and the resulting internal capacitance is added to the capacitance of the LC circuit. As the internal resonant capacitance increases, the LC resonant frequency will decrease.

Figure 5: Each resonant antenna of the transponder circuit must be tuned to the carrier frequency of the base unit to achieve signal reception.

Battery Backup and No Battery Mode

In practice it is possible for the battery to accidentally be temporarily disconnected from the circuit, for example when the transponder is dropped on a hard surface. If this happens, the data stored in the MCU may not be restored correctly. To avoid accidental separation of the battery, the user may consider using a backup battery circuit. The battery backup circuit can temporarily supply the VDD voltage to the transponder. This circuit is recommended for use in precision transponders, but not required for all applications. In Figure 2, D4 and C1 form the battery backup circuit. When the battery is connected, C1 is fully charged, and when the battery is briefly disconnected, C1 provides the VDD voltage.

When the transponder is in batteryless operation it is called batteryless mode. In Figure 2, diodes D1, D2, D3 and C1 form the power supply circuit in batteryless mode. When the transponder coil generates voltage, coil current flows through diodes D1 and D2 to charge C1, which provides the VDD voltage to the transponder. This power supply circuit is useful when the PIC16F639 is used in anti-collision transponder applications that require battery-free operation. Depending on the application, the C1 capacitor value in batteryless mode can vary from a few microfarads to a few farads.

Figure 6: In the base station circuit, the current driver U1 amplifies the power of the 125 kHz square wave pulse from the MCU. The square wave pulse output of U1 becomes a sine wave after passing through the LC series resonant circuit composed of L1, C2, C3 and C4.

Transponder circuit

The transponder circuit has three external LC resonant circuits, five push button switches, a 433.92MHz resonator for UHF data transmission and several elements for battery backup mode.

Each LC resonant circuit is connected to the LC input and the LCCOM pin. The air core antenna is connected to the LCX input, and the two ferrite bar inductors are connected to the LCY and LCZ pins. The LCCOM pin is the common pin for the three antenna connections, and is grounded through C11 and R9. Each resonant antenna must be tuned to the base unit’s carrier frequency for signal reception (Figure 5). The antenna can be tuned to the state using the internal capacitance of each channel.

When the device is initially powered up, the digital section uses the SPI (CS, SCLK/ALERT, and SDIO) to program the AFE configuration registers. Due to the high input sensitivity of the AFE (about 3mV peak-to-peak), the AFE is very sensitive to ambient noise, so measures must be taken to avoid excessive AC noise along the PCB traces. Use capacitors C6 and C12 on the VDD and VDDT pins to filter noise, respectively.

Diodes D1 and D2 and capacitor C5 are used in battery backup mode, and diodes D2, D3 and D7 and capacitor C5 are used in batteryless mode. For stable operation in battery-free mode, a larger value of C5 is required. Capacitor C5 holds the charge from the battery and coil voltage through diodes D3 and D7. The charge stored in C5 maintains power to the PIC16F639 device when the battery is temporarily disconnected. Diodes D3 and D7 are connected to each other through the air-core coil, creating a strong coil voltage in the three external LC resonant antennas.

Once a valid input signal is detected, the digital MCU part wakes up and issues a response if the command signal is valid.

The transponder can respond using an internal modulator (LF intercom) or an external UHF transmitter. Each analog input channel has an internal modulator (transistor) between the input and the LCCOM pin. If the AFE receives a command to clamp or open the clamp from the digital MCU section, the internal modulator is turned on and off, respectively. The antenna voltage is clamped and unclamped according to the clamp or unclamp command respectively, which is called LF talkback. LF intercom is only used in close range applications. The base station can detect changes in the transponder antenna voltage and reconstruct the modulated data.

In long-range applications, the transponders employ UHF transmitters. UHF (433.92 MHz) resonator U2 and power amplifier Q1 constitute a UHF transmitter that can be switched on and off with a button. Capacitors C2 and C3 are both in the range of about 20pF, depending on the wiring layout. L1, which is generally formed by the metal traces of the printed circuit board, is a UHF antenna, and the efficiency will be significantly improved by increasing its loop area.

When the MCU I/O pin outputs a logic high level, the UHF transmitter part is turned on, otherwise it is turned off. The output of RC5 is the modulated data of the UHF signal, which can be reconstructed by the UHF receiver of the base station.

base station circuit

The base unit includes an MCU, 125kHz transmitter/receiver and a UHF receiver module. The base station sends out low frequency command signals at 125kHz and receives responses from transponders via UHF and LF. After issuing the LF command, the base station checks for a response via the LF or UHF link.

The 125kHz transmitter generates a carrier signal that is output by an MCU-based Pulse Width Modulator (PWM). The current driver U1 amplifies the power of the 125kHz square wave pulse from the MCU. The square wave pulse output of U1 becomes a sine wave after passing through the LC series resonant circuit composed of L1, C2, C3 and C4. L1 is the air core inductor for the 125kHz LF antenna (Figure 6).

When the LC series resonant circuit is tuned to the frequency of the PWM signal, the antenna radiation is strong. At the resonant frequency, the LC circuit impedance , which makes L1 load current , which creates a strong electromagnetic field. The user can tune the LC circuit by monitoring the coil voltage on L1. Each element after diode D1 is used to receive the LF intercom signal from the transponder. When the transponder responds with LF intercom, the coil voltage on L1 changes due to the magnetic field generated by the transponder coil voltage. Since the transponder coil voltage is initially generated by the base station antenna (L1), the response voltage is 180o out of phase with the initial voltage. Therefore, under given conditions, the voltage on L1 will vary with the coil voltage of the transponder.

Changes in the coil voltage on L1 can be detected by an envelope detector and a low-pass filter formed by D1 and C5. The detected envelope signal passes through active gain filters U2A and U2B. The demodulated analog output is fed to the MCU’s comparator input pins for pulse shaping. The comparator output is available on TP6 and decoded by the MCU.

The Links:   LC150X01-SL02 LTM04C380K