Hands-free Passive Keyless Entry System Using PIC16F639

Publisher:科技革新者Latest update time:2011-05-15 Keywords:PIC16F639 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Hands-free passive keyless entry (PKE) is quickly becoming a mainstream application for automotive remote keyless entry and is becoming a common option for new models. This method eliminates the need to press a transmitter button to lock or unlock the car door, and allows easy access to the vehicle as long as you have a valid transponder.

Hands-free PKE applications require two-way communication between the base station and the transponder unit. The base station unit in the vehicle sends a low frequency (LF) command to search for transponders in the surrounding area. Once the owner's transponder is searched, the transponder automatically responds to the base station unit. The base station unit opens the door after receiving a valid verification response signal.

In a typical PKE application, the output power of the base unit is designed to be the maximum power allowed by the electromagnetic radiation standards set by government agencies. When operating under a 9V to 12V DC power supply, the maximum antenna voltage that can be achieved is about 300V peak-to-peak. Due to the non-propagation characteristics 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 antenna, the input signal level of the transponder will be very weak.

If PKE does not work properly, the most likely reason is that the transponder input signal level is too weak. Therefore, for hands-free PKE applications 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, system design engineers 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 analog front end features are controlled by the MCU firmware. Due to its ease of use, this device can be used in a variety of intelligent low-frequency detection and two-way communication applications. This article discusses the design circuit examples of using the PIC16F639 MCU to implement an intelligent PKE transponder and gives examples 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 using two-way communication.


PIC16F639 PKE transponder

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 shows an example of a typical PKE system. The base station unit sends a 125kHz command signal to search for valid 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 has 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 caused by the directivity of the antenna. The input signals of each antenna pin are detected independently and then added. Each input channel can be enabled or disabled individually by programming the configuration register. The fewer channels are enabled, the lower the power consumption of the device.

To achieve hands-free operation, the transponder continuously waits and detects input signals, which reduces battery life. Therefore, to reduce operating current, the digital MCU part can be in low current mode (sleep mode) while the analog front end (AFE) searches for valid input signals. The digital MCU part is awakened only when the AFE detects a valid input signal. This function can be achieved by using an output enable filter (wake-up filter). The PIC16F639 has 9 output enable filter options. The user can program the filter using the configuration register. Once the filter is programmed, the device will only transmit the detected output to the digital part when the input signal meets the filter requirements.


Figure 2: Passive keyless entry (PKE) transponder configuration circuit diagram.


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

The digital part has two I/O ports, PORTA and PORTC. Each PORTA pin can be individually configured as a level change interrupt pin, while each PORTC pin does not have the level change interrupt function. The AFE part shares the three I/O pins RC1, RC2 and RC3 of the digital part PORTC, which are internally connected to the CS, SCLK/ALERT and LFDATA/CCLK/RSSI/SDIO pads of the AFE. LFDATA/CCLK/RRSI and ALERT are AFE outputs. SDIO, SCLK and CS are used to program or read the AFE configuration register.

To save battery energy, the AFE part is usually in sleep mode while the digital part is detecting the LF input signal. Although the output pads of the AFE are connected to the PORTC pin internally, the AFE output cannot wake up the digital part through a level change interrupt event because the PORTC pin is not a level change interrupt pin. Therefore, it is recommended to connect the LFDATA and ALERT pins of the AFE to the PORTA pin externally, as shown in Figure 2. The digital part

is awakened when one of the following three conditions occurs: there is an AFE output on the LFDATA pin; there is an AFE output on the ALERT pin; an event of pressing the switch button on PORTA.


Figure 3: Due to the directivity of the antenna, in practical applications, the detection distance is maximum when the two antennas are parallel and the detection distance is shortest 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 an external LC resonant antenna circuit (for each LF input channel). The external circuit is connected to the antenna input pins 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 to 10 μF) between the LCCOM pin and ground to provide a stable operating state.

Although the PIC16F639 has three LC input pins to connect to three external antennas, users can use only one or two antennas instead of using all three antennas simultaneously, depending on the specific application. The operating current consumption is proportional to the number of channels enabled, and the fewer channels enabled, the 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, a tuned loop antenna is usually used. To maximize the antenna voltage, the loop antenna must be precisely tuned to the desired frequency. For PKE applications, the antenna should be tuned to the base station carrier frequency. The loop antenna consists of a coil (inductor) and several capacitors that form a parallel LC resonant circuit. The antenna voltage is maximized by increasing the loop surface area and the quality factor (Q) of the circuit. [page]

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


Among them, L is the loop inductance and C is the capacitance.

For a given LC resonant circuit, the received antenna voltage can be approximately expressed by Equation 2.


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

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 primarily determined by the inductance.


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

In typical transponder applications, the inductance value ranges 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 that is exposed to the incident magnetic field. When cosα is equal to 1, the effective surface area of ​​the antenna is maximum, and the antennas of the base station and the transponder unit are facing each other. In practical applications, the detection distance is maximum when the two antennas are parallel and minimum when they are orthogonal. Figure 3 graphically illustrates the antenna orientation problem in practical applications.

[page]
Figure 4: Recommended transponder circuit board antenna layout.

If the three antennas are positioned orthogonally on the same printed circuit board, the antenna orientation problem can be greatly reduced. In practical applications, this design will increase the probability that at least one transponder antenna is facing the base station antenna at any time. Figure 4 shows the layout of the three antennas on the transponder circuit board. LCZ uses a large air core coil, and LCX and LCY use two ferrite core coils. Some companies specialize in producing ferrite coils for 125 kHz RFID and low-frequency detection applications.

As shown in Equation 2 and Equation 3, when the LC circuit is accurately tuned to the frequency of the incident carrier, the induced voltage on the coil is the largest. However, in actual applications, due to the different tolerances of the LC components, the LC resonant frequencies of each transponder are also different. To compensate for the errors caused by component tolerances, each channel of the PIC16F639 has an internal tuning capacitor group. The capacitance value can be programmed to a maximum of 63pF in steps of 1pF, and the capacitance value increases monotonically with the increase of the configuration register bit.

The capacitance 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 increase, 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 base unit’s carrier frequency for optimal signal reception.


Battery backup and no-battery mode

In actual applications, it is possible that the battery may accidentally be disconnected from the circuit temporarily, such as when the transponder falls on a hard surface. If this happens, the data stored in the MCU may not be correctly restored. To avoid accidental battery disconnection, users can consider using a backup battery circuit. The backup battery circuit can temporarily provide VDD voltage to the transponder. This circuit is recommended for precision transponders, but it is not necessary for all applications. In Figure 2, D4 and C1 form a battery backup circuit. When the battery is connected, C1 is fully charged, and when the battery is temporarily disconnected, C1 provides VDD voltage.

When the transponder is in battery-free operation, it is called battery-free mode. In Figure 2, diodes D1, D2, D3, and C1 form the power supply circuit for battery-free mode. When the transponder coil generates voltage, the coil current flows through diodes D1 and D2 to charge C1, which can provide VDD voltage for 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 capacitance value of C1 in battery-free mode varies from a few microfarads to a few farads.


Figure 6: In the base station circuit, current driver U1 amplifies the power of the 125 kHz square wave pulses from the MCU. The square wave pulse output of U1 is converted into 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 components for battery backup mode.

Each LC resonant circuit is connected to the LC input and LCCOM pins. The air core antenna is connected to the LCX input and the two ferrite rod 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 carrier frequency of the base station unit to achieve the best signal reception (Figure 5). The internal capacitors of each channel can be used to tune the antenna to the best state.

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

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 no-battery mode. A larger capacitance of C5 is required for stable operation in no-battery mode. Capacitor C5 stores the charge from the battery and coil voltage through diodes D3 and D7. When the battery is temporarily disconnected, the charge stored in C5 can maintain the power supply of the PIC16F639 device. Diodes D3 and D7 are connected to each other through the air-core coil, generating a strong coil voltage in the three external LC resonant antennas.

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

The transponder can respond using an internal modulator (LF talkback) or an external UHF transmitter. Each analog input channel has an internal modulator (transistor) between the input and LCCOM pins. If the AFE receives a clamp or unclamp command from the digital MCU part, 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 talkback is only used in short-range applications. The base station can detect the change in the transponder antenna voltage and reconstruct the modulated data.

In long-distance applications, the transponder uses a UHF transmitter. The UHF (433.92 MHz) resonator U2 and the power amplifier Q1 form a UHF transmitter that is turned on and off with a key. The capacitance of capacitors C2 and C3 is in the range of about 20pF, depending on the circuit 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 is partially turned on, otherwise it is turned off. The RC5 output 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 station unit consists of an MCU, a 125kHz transmitter/receiver and a UHF receiver module. The base station sends out a 125kHz low frequency command signal and receives responses from the transponder via UHF and LF. After sending out the LF command, the base station checks for a response via the LF or UHF link.

The 125kHz transmitter generates a carrier signal based on the pulse width modulator (PWM) output of the MCU. Current driver U1 amplifies the power of the 125kHz square wave pulse from the MCU. The square wave pulse output of U1 is converted into a sine wave after passing through the LC series resonant circuit composed of L1, C2, C3, and C4. L1 is an air-core inductor for the 125kHz LF antenna (Figure 6).

The antenna radiates strongest when the LC series resonant circuit is tuned to the frequency of the PWM signal. At the resonant frequency, the LC circuit impedance is minimum, which maximizes the L1 load current, generating a strong electromagnetic field. The user can tune the LC circuit by monitoring the coil voltage on L1. The components after diode D1 are used to receive the LF intercom signal from the transponder. When the transponder responds with the 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 change with the transponder coil voltage.

The change in 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 comparator input pin of the MCU for pulse shaping. The comparator output is available on TP6 and decoded by the MCU.

Keywords:PIC16F639 Reference address:Hands-free Passive Keyless Entry System Using PIC16F639

Previous article:Realization of reactive power compensation algorithm for three-phase mismatch of load based on PIC16C72
Next article:Design of adjustable countdown reminder based on PIC16F627 microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号