Rf module


Published on

Published in: Education
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Rf module

  1. 1. As explained earlier (refer RFID interfacing with 8051 & with AVR), an RFID moduleconsists of an RFID Reader, a line converter (usually MAX232) and a COM port. Theline converter of this module converts the TTL logic voltage of RFID Reader to RS232logic. Therefore, to convert the voltage level from such an RFID module, anotherMAX232 is used to interface it with a microcontroller.One can also use an RFID Reader directly to interface with the controller, thus avoidingthe need of voltage level converters. Here both the MAX232s have been eliminatedfrom the circuit and RFID reader is directly connected with the PIC microcontroller.The following table explains the pin diagram of the RFID Reader module.Pin No. Name Description1 Vcc Supply Voltage; 5V2 GND Ground (0V)3 BEEP Beep or LED drive4 ANT No Use5 ANT No Use
  2. 2. 6 SEL High is RS232, Low is Weigand7 RS232 TTL output data8 D1 Weigand Data 19 D0 Weigand Data 0Another part of the RFID system is RFID tag, which contains 12 bytes of unique data.As the tag comes in the range of the Reader Module, it gets activated and transmits thisunique code. (For more detail on working of RFID system, refer the article on RFID) Theobjective here is to receive this 12 byte unique code and display on a 16x2 LCD usingPIC18F4550.With the RFID interfacing, this article also explains the USART interrupt which is aninternal interrupt. (For external interrupts, refer PIC Hardware interrupts) The internalinterrupts, unlike hardware interrupts, are associated with internal peripherals of thecontroller. To use the USART interrupt, following registers have to be configuredaccordingly.1. INTCON (Interrupt Control Register)Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIFPEIE/GIEL: This bit is used to enable/disable all the peripheral interrupts (Internalinterrupts) of the controller. But GIE/GIEH bit must be set to high first. 1 = Enables all Peripheral Interrupts 0 = Disables all Peripheral Interrupts
  3. 3. GIE/GIEH: This is Global Interrupt Enable bit. This bit is set to high to enable allinterrupts of the PIC18F4550. 1 = Enables interrupts 0 = Disables all interrupts2. PIR1 (Peripheral Interrupt Request 1)Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0SPPIF ADIF RCIF TXIF SSPIF CCP1IF TMR2IF TMR1IFTXIF: This is Transmission interrupt flag which is set to high when TXREG* is empty.RCIF: This is Reception interrupt flag which is set to low when reception is complete.*TXREG : EUSART Transmit Register (The data to be transmitted is stored in thisregister)3. PIE1 (Peripheral Interrupt Enable 1)Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0SPPIE ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IETXIE: This bit is used to enable/disable the Transmission (Tx) interrupt.RCIE: This bit is used to enable/disable the Reception (Rx) interrupt.Refer PIC EUSART registers for more details.The connections of RFID reader module and LCD with the microcontroller are shown inthe circuit diagram tab.
  4. 4. Programming Steps:1. Set the baud rate of PIC’s USART of to 9600 bps.2. Set the SPEN and CREN bits to ‘1’ (RCSTA Register).3. Set the GIE and PEIE to ‘1’ (INTCON Register).4. Store the 12 byte data into an array when Reception Interrupt is generated.5. Print the all stored data on the LCD. Refer displaying text on LCD using PIC.Image:Learn Analog System Design with Texas Instruments!
  5. 5. The RF module, as the name suggests, operates at Radio Frequency. Thecorresponding frequency range varies between 30 kHz & 300 GHz. In this RF system,the digital data is represented as variations in the amplitude of carrier wave. This kind ofmodulation is known as Amplitude Shift Keying (ASK).Transmission through RF is better than IR (infrared) because of many reasons. Firstly,signals through RF can travel through larger distances making it suitable for long rangeapplications. Also, while IR mostly operates in line-of-sight mode, RF signals can traveleven when there is an obstruction between transmitter & receiver. Next, RFtransmission is more strong and reliable than IR transmission. RF communication usesa specific frequency unlike IR signals which are affected by other IR emitting sources.This RF module comprises of an RF Transmitter and an RF Receiver. Thetransmitter/receiver (Tx/Rx) pair operates at a frequency of 434 MHz. An RF transmitterreceives serial data and transmits it wirelessly through RF through its antennaconnected at pin4. The transmission occurs at the rate of 1Kbps - 10Kbps.Thetransmitted data is received by an RF receiver operating at the same frequency as thatof the transmitter.The RF module is often used alongwith a pair of encoder/decoder. The encoder is usedfor encoding parallel data for transmission feed while reception is decoded by adecoder. HT12E-HT12D, HT640-HT648, etc. are some commonly usedencoder/decoder pair ICs.
  6. 6. Pin Diagram:Pin Description: RF TransmitterPin No Function Name 1 Ground (0V) Ground 2 Serial data input pin Data 3 Supply voltage; 5V Vcc 4 Antenna output pin ANT RF ReceiverPin No Function Name 1 Ground (0V) Ground 2 Serial data output pin Data 3 Linear output pin; not connected NC 4 Supply voltage; 5V Vcc
  7. 7. 5 Supply voltage; 5V Vcc6 Ground (0V) Ground7 Ground (0V) Ground8 Antenna input pin ANT