مشروع RF[1]

download مشروع RF[1]

of 16

description

ء

Transcript of مشروع RF[1]

  • 1

    Graphical Remote ControlWith RF Transceiver

    EE650 Technical Report

    Report by: Alex MartinClass: 3EN16

    Dec. 08, 2000

  • 2

    Index1.0 Introduction2.0 Background3.0 Desired User Interface

    3.1 Background3.2 User Interface Requirements3.3 User Interface Overview

    4.0 Hardware Overview4.1 System Block Diagram4.2 Brief Description

    5.0 Component Selection/Requisition5.1 Transceiver

    5.1.1 Transceiver Requirements5.1.2 Transceiver Selection5.1.3 Transceiver Requisition

    5.2 LCD Display5.2.1 Display Requirements5.2.2 Display Selection5.2.3 Display Requisition

    5.3 Microcontroller5.3.1 Microcontroller Requirements5.3.2 Microcontroller Selection5.3.3 Microcontroller Requisition

    5.4 Other Components5.4.1 Component Selection5.4.2 Component Requisition

    6.0 Hardware Description6.1 System Schematic6.2 Microcontroller

    6.2.1 Microcontroller Overview6.2.2 Microcontroller Port Designations6.2.3 External Serial EEPROM

    6.3 Transceiver6.3.1 Transceiver Overview6.3.2 Transceiver Interface

    6.4 LCD Display6.4.1 LCD Overview6.4.2 LCD Interface/Control

    6.5 LCD Bias Circuit6.6 LCD Backlight Circuit6.7 LCD Power Control

  • 3

    Index (contd)7.0 Hardware Construction

    7.1 PCB Design7.2 Circuit Assembly

    8.0 Firmware Description8.1 Memory Usage

    8.1.1 Program Flash8.1.2 Data RAM8.1.3 Internal EEPROM8.1.4 External EEPROM

    8.1 Display Data Format8.2 Transceiver Protocol8.3 Flowchart/Description

    9.0 Programming9.1 Development Tools9.2 Programming the Serial EEPROM

    10.0 Appendices10.1 PCB Layout10.2 Program Assembly Code10.3 EEPROM Modifier Assembly Code10.4 Display Data Listing10.5 Invoices10.6 Data Sheets

    1.0 Introduction

  • 4

    The present report pertains to a remote control system, incorporating a graphical LCDdisplay, and a digital RF transceiver. The implemented system consists of a remote unit, and a basestation unit. The system is intended to act as a sub-system, providing control of a larger appliance, thedesign of which is beyond the scope of this project. Due to time restrictions the digital RF transceiversection of the system remained unimplemented. However, to avoid wasting the great deal ofcontemplation and time which was spent on this section of the circuit, it is still described herein.

    2.0 Background

    To implement a wireless remote control system, a communication medium is required. Themost popular medium for remote communication is infrared light, such as used in the commontelevision remote. Despite its popularity, this communication medium has two main limitations.

    The first such limitation is that of range. A direct line of sight must exist between the remotedevice, and the controlled device. While this is an acceptable condition for appliances such astelevisions, this restriction is inconvenient when controlling other devices, such as stereos.

    Another limitation inherent to the infrared remote control, is that communication is onlysimplex. This, again, is an acceptable condition when controlling a television, since the monitordisplays graphical feedback to the user, indicating the result of the control attempt. If, however, anappliance such as a stereo, is to be controlled from a different room, simplex communication does notsuffice.

    In order to implement a more convenient means of remote control, a radio frequency(RF)medium may be used for data communication. This is the communication medium selected for thisdesign project.

    3.0 Desired User Interface

    3.1 Background

    This section is intended as an overview of the desired user interface for the device, so that thereader may more easily interpret the ensuing description of system design. The user interface, alongwith feasibility, were the first things contemplated when considering the project, and defined theprocess of design.

    3.2 User Interface Requirements

    The following list describes conceived requirements of the user interface. Quick Visual Feedback Flexible/Adaptive Simple/Low profile

    3.2 User Interface Overview

  • 5

    To accommodate these requirements, a menu driven system was implemented. This providedan interface which can be adapted to almost any application, while minimizing the number of requireduser controls. Means of user control are provided using push-buttons, the functions of which aredisplayed on an adjacent display device. By this method, a menu driven system can be efficientlyrealized by changing the displayed push-button functions.

    This menu driven platform, combined with full duplex communication, is capable ofsupporting an unlimited number of applications. Moreover, the reduced number of push-buttonsresults in a low profile user interface, which is simple to understand.

    4.0 Hardware Overview

    4.1 System Block Diagram

    The block diagram of Figure 4.1 describes the main circuit blocks used to realize the remote,and base station components of a complete system. These two components of the complete system, areof similar design, the only difference being that the remote device does not require external memory,because all display information can be stored at the base station.

    LCD DISPLAY

    PIC16F877MICROCONTROLLER

    USERCONTROLS

    8Kx8 SERIALEEPROM

    RFTRANSCEIVER

    EXTERNAL CONTROLINTERFACE

    Figure 4.1

    4.2 Brief Description

    The relationship of the main system components becomes apparent by examination of theblock diagram(Fig. 4.1). The microcontroller acts as a mediator, and interface between system

  • 6

    components. The executed program controls and regulates all system functions. Because the amountof data required for storage of display data exceeds that of the common microcontroller, an externalmemory device is also required. Implementation of radio frequency communication requires the use ofan RF transceiver circuit.

    The main purpose of the system, of course, is to control one or more larger appliance. Thislarger system is beyond the scope of this project, and, as such, an external control port must beprovided to allow for future expansion.

    5.0 Component Selection/Requisition

    5.1 Transceiver Circuit

    5.1.1 Transceiver Requirements To establish feasibility of the project, the first component to be considered was the RF

    transceiver. The device, of course, had to be digital, and provide duplex communication. The data rateof the device should accommodate the magnitude of serial data to be communicated, such that theremote device can be updated within a couple of seconds. Other considerations were range andfrequency, which determine the usable distance of the remote, and the physical size of the antenna,respectively.

    5.1.2 Transceiver SelectionSeveral options were explored when searching for a suitable transceiver device. The initial

    conception was to use a transceiver module. A couple of these were found, and considered, but thisseemed to much like cheating. In order to realize a system comprised entirely of discrete components,transceiver ICs were then considered. Most of these devices are very complex, and require largenetworks of external components. This is also true of the new Bluetooth technology, which existsmainly at the baseband level.

    A suitable RF transceiver device was finally found from a Norway company called Chipcon.This company produces both ASICs and standard products, two of which are RF transceiver ICs.The simpler of the two ICs, the CC400, was selected, due to its lower operating frequency of430MHZ, and its minimized number of external components. The device operating voltage is 3V,which was ideal for operations from two AA batteries. The data rate was a suitable 10Kb/s.

    5.1.3 Transceiver RequisitionObtaining the transceiver ICs proved to be much simpler than anticipated. These components

    had to be imported from Norway, which of course could have been a huge task if things went roughly.However, a purchase order was simply faxed to Chipcon, and they abruptly replied, and shipped fiveof the devices. The only reservation was that it cost $75 for customs brokerage, which almost doubledthe price of the components.

    5.2 LCD Display

  • 7

    5.2.1 Display RequirementsThe display device had to be capable of displaying all user feedback and menu information,

    to realize the desired user interface. For this reason, a graphical display was desirable. Liquid crystalseemed the efficient choice, based on popularity, and power consumption. Many products, from manycompanies were reviewed, one of the main criterion being a 3V power supply.

    5.2.2 Display Selection The initial graphical display selected, was unobtainable, due to large order quantities. None

    the less, the same company, Densitron, was able to provide prototype quantities of a similar (but morecomplex) device, the LM4736. Products form twelve other companies were consider, but Densitronwas the most attractive. Moreover, the device was capable of 3V operation.

    5.2.3 Display RequisitionTwo LCD displays were initially purchased. I, used a false company name, to obtain the

    devices from prototype stock. These devices cost approximately $150 each, and, again, a customsbrokerage fee was required.

    5.3 Microcontroller

    5.3.1 Microcontroller RequirementsAfter selecting the other main components, the requirements of the microcontroller were well

    established. It, of course, had to be capable of 3V operation, be of sufficient speed to interface to othersystem components. A maximum number of ports, and maximum on chip memory were desirable. Thedevice had to be reprogrammable, to allow for ease of development. Another of the main criterion wasa good development package, because it is not desirable to spend a lot of time fiddling with nuisances.

    5.3.2 Microcontroller SelectionApproximately 50 microcontroller companies were reviewed for suitable devices. After

    screening for functionality, development tools were reviewed. Based upon this factor, the mostattractive manufacturers were ST, Temic, Atmel, and Microchip. Microchip won out because itprovided the most descriptive literature, which was invaluable in ensuring suitability of themicrocontroller. The PIC16F877 was selected.

    5.3.3 Microcontroller Requisition

    The selected Microcontroller was readily available through Digi-Key.

    5.4 Other Components

    5.4.1 Component SelectionAll other components were selected to support the main components. These included all

    discrete components, as well as a memory device, op-amp, and switch-mode regulator.

  • 8

    5.4.2 Component RequisitionAll other components, with the exception of the switch-mode regulator, were obtained from

    Digi-Key. The switch-mode regulator(required for LCD bias), was obtained through Maxim sampledistribution. This was the only component which was not purchased at full price. It was necessary tosample this component because no distributor stocked them.

    6.0 Hardware Description

    6.1 System Schematic

    Figure 6.1.1 is a more descriptive block diagram of the system, indicating some of the extrasupport devices required. Of these additional circuits, included is a switch-mode power supply, andLCD backlight control. A full schematic is represented in figure 6.1.2, describing exact connection ofthe circuitry. These figures, and the attached data sheets should be referred to while reading thisreport. To reduce the size of this report, only the first six pages of each data sheet are included. Fulldata sheets are available from the manufacturer web sites.

    LCD DISPLAY LCD BIAS STEP-UPREGULATOR

    PIC16F877MICROCONTROLLER

    POWER CONTROL

    USERCONTROLS

    8Kx8 SERIALEEPROM

    RFTRANSCEIVER

    BACKLIGHT CONTROL

    EXTERNAL CONTROLINTERFACE

    Figure 6.1.1

    6.2 Microcontroller

    6.2.1 Microcontroller OverviewThe data sheet of the PIC16F877 may be referred to for full details on this microcontroller.

    The device contains 8K words of 14 bit flash program memory, 365 bytes of RAM, and 256 bytes ofEEPROM. There is actually 512 bytes of internal RAM, but several locations are used as controlregisters.

  • 9

    The PIC16F877 has many internal functions, some of which were unnecessary. One of theinternal timers was repeatedly used to generate timing for functions such as encoding the data fortransmission. Because the device has no dedicated address or control busses, these functions had to beimplemented in software, along with the ascociated timing.

    The device has 32 I/O lines, arranged as 5 ports. Each of these I/O lines can be independentlyassigned as inputs or outputs. Most of these pins have multiplexed functions, and the implementedfunctions are programmable using the control registers. These lines are used to interface to theperipheral devices.

    6.2.2 Microcontroller Port DesignationsThe following I/O designations describe port usage. Several of the busses were split,

    to allow multiple functions, or because of the multiplexed pin functions.

    Port A Port BRA0 Transceiver Interface STROBE RB0 - -RA1 Transceiver Interface PDATA RB1 Serial SPI Interface /CSRA2 Transceiver Interface CLOCK RB2 Serial SPI Interface /CSRA3 Transceiver Interface D I/O RB3 User Controls PB1RA4 - - RB4 User Controls PB2RA5 - - RB5 User Controls PB3

    RB6 User Controls PB4Port C RB7 User Controls PB5

    RC0 Display Control Bus /RDRC1 Display Control Bus /WR Port DRC2 Display Control Bus A0 RD0 Display Data Bus D0RC3 Serial SPI Interface SCK RD1 Display Data Bus D1RC4 Serial SPI Interface SDI RD2 Display Data Bus D2RC5 Serial SPI Interface SDO RD3 Display Data Bus D3RC6 Display Control Bus /RST RD4 Display Data Bus D4RC7 Display Control Bus /CS RD5 Display Data Bus D5

    RD6 Display Data Bus D6Port E RD7 Display Data Bus D7

    RE0 Piezo Transducer Out -RE1 Display Power Enable -RE2 High Voltage Enable -

    6.2.3 External Serial EEPROMThe Microcontroller did not have sufficient internal memory to store all of the required

    display data. For this reason an external memory was required. A serial SPI EEPROM, the 25LC640from Microchip, was selected for display data storage. This memory device proved to be an efficientsolution, and despite the overhead required, could be accesses using a repetitive read loop.

  • 10

    6.3 Transceiver

    6.3.1 Transceiver OverviewThe transceiver portion of the circuit was not implemented due to time restrictions. No

    problems with this circuit are anticipated, and it will be developed when time allows. To avoidwasting all of the time and contemplation which was spent on this section of the circuit, a briefdescription follows.

    The selected transceiver IC was the CC400 form Chipcon Components. This device iscapable of a 10Kb/s data rate, and uses an FSK modulation scheme. The carrier frequency is firmwareprogrammable in increments of 5KHz, from 300-500MHz. However the connected componentsnetwork values were calculated to support a 420-450MHz carrier frequency. The device utilizes ahalf-duplex operating scheme. A /4 wavelength SMA antenna implemented in the system.

    Other programmable functions include, frequency deviation, transmit power, sensitivity,transmit/receive, and power down mode. Component values for supporting circuitry, were calculatedusing Chipcons SmartRF Studio software. All parameters are entered into the software, andcomponent values are conveniently calculated.

    6.3.2 Transceiver InterfaceThe transceiver requires 16 configuration bytes to be programmed via a 3-wire interface, to

    initialize the device. These configuration bytes program the aforementioned functions. The threeprogramming lines are a clock, strobe, and data. Timing for these lines are generated in software.

    Transmitted data must be Manchester encoded to maintain a constant DC signal level.Although the data link was not completed, the transmitter is provided with the Manchester encodeddisplay data. Data input and output form the transceiver share a common signal pin. Thetransmit/Receive function of the device is programmable through the configuration bytes.

    6.4 LCD Display

    6.4.1 LCD OverviewThe selected LCD display device is the LM4736 from Densitron Corporation. This display

    module provides an on board controller, memory, and display drivers. It has many powerful(andcomplex) features, such as three layers of graphical memory, each of which can be independentlyscrolled. The controller is interfaced to 32K of on-board RAM, for data storage. The layers of data canbe stored anywhere within the addressing space of this RAM, thus increasing the complexity of thedevice.

    The LCD controller also has an on-chip character generator ROM. This is efficient inreducing the number of display write commands necessary to display text. It, however, does not assistwith the large amount of data required to display graphics to the display.

    A 20 volt power supply is necessary for LCD bias. This is accomplished using a switch-moderegulator, as is described in a following section.

    6.4.2 LCD Interface/ControlAddress, data, and control for the LCD display module share a common 8-bit bus. Each byte

    written to the bus is designated as a control of data byte, by a separate control line. While this may

  • 11

    seem efficient, it requires that sequential data for the display must be stored as 9-bit words. This isaccomplished by segmenting the data into packets, as will be described in the firmware section of thisreport.

    The display requires four other control line including read, write, chip select, and reset. Allcontrol signal timing is generated in software, as the microcontroller does not have a dedicated controlbus. The display is intended to interface to an 8080 type microcontroller. The reset signal to thedisplay was initially generated by a TCM809 reset controller from Telcom. It was found that the150ms delay generated by this device was much longer than the required 1ms, and so the device wasreplaced by a microcontroller control signal.

    6.5 LCD Bias Circuit

    Bias for the LCD display was provided by a 20V switch-mode power regulator. It was foundthat switch-mode regulators capable of generating 20V from 3V, are few and far between. A suitabledevice was eventually found in the Maxim MAX629, switch-mode regulator. The related circuitry isdisplayed in the schematic of figure 6.1.2. The display data sheet called for a 24V supply, but theregulator was noisy at this level. It was found that a 20V supply sufficed. This input voltage is also fedto a potentiometer, for contrast control.

    6.6 LCD Backlight Circuit

    Because the device is to be used as a battery operated remote control, power consumption is aprime issue. One way of reducing power consumption while the remote is active, is to control thebacklight. For this purpose a backlight control circuit was designed. This circuit is comprised of asimple comparator, and Cds photoresistor, controlling an LED driver transistor. This circuit worksbeautifully, switching the LED backlight on when surrounding light levels are to low. A Cdsphotoresistor was used as opposed to a photodiode or phototransistor, because its responsivity moreclosely matches that of the human eye.

    6.7 LCD Power Control

    The microcontroller, memory and transceiver each have programmable standby states, inwhich power consumption is minimal. The LCD display, and related circuitry, however, dont. Forthis reason a Hexfet is used to control power to this part of the circuit. This is necessary in order for afull standby state to be realized, and for battery power consumption to be minimized. InternationalRectifiers IRF7402 Hexfet was used for this purpose.

    7.0 Hardware Construction

    7.1 PCB Design

  • 12

    Appendix 10.1 contains Images of the PCB layout. The layout was created inAutocad, as no proper deign software was available. It is believed that Autocad provides adegree of freedom that most dedicated PCB design software doesnt. However, it does nointegrate many of the convenient functions commonly found in PCB design softwarepackages.

    7.2 Circuit Assembly

    The PCB was completely fabricated by myself. The process required a lot of trialand error, and it took a full week to get right. The pin pitch on the transceiver chip wasonly 0.62mm A photoetching process was used. All components were hand soldered, andassembled. Figures 7.2.1, and 7.2.2 describe the assembled PCB construction.

  • 13

    8.0 Firmware Description

    8.1 Memory Usage

    8.1.1 Program FlashThe PIC16F877 contains 8Kwords of 14-bit program flash. Accordingly, all program data is

    stored in this area.

    8.1.2 Data RAMThe Microcontroller also contains 365 bytes of data RAM. Several of these locations were

    used as loop counters, and as general purpose registers.

    8.1.3 Internal EEPROMThe 256 bytes of internal EEPROM were used only when programming the external

    EEPROM. Bootstrap firmware was designed for this purpose, and is described under theProgramming section of this report.

  • 14

    8.1.4 External EEPROMThe external serial EEPROM was used to store all display data. Due to the large amount of

    data required for both test and graphics, an external memory was required.

    8.2 Display Data Format

    The display data is stored in the sequential format with which it is written to the display. Thisincludes all commands, addressing, and data information. Because each byte required a control/datadesignation, the data was segmented into 10 byte packets. The format of these packets is described infigure 8.2.1. The first two bytes of each packet comprise a header, and the following 8 bytes are data.

    Packet Header

    Figure 8.2.1

    VALID DATA

    DATA/CONTROL

    2

    1

    0

    3

    4

    5

    6

    7

    m

    m

    m

    m

    m

    m

    m

    m

    n

    n

    n

    n

    n

    n

    n

    n

    Each bit in the first header byte is aligned with a respective data byte, and designates weatherthe byte is valid. This is used by the display write loop, to determine the end of the sequential readoperation. When the loop encounters a 0 value for a respective byte, the write sequence isterminated. In this way, write sequences of variable length can be realized.

    The second byte of the header is likewise aligned with its respective data byte, anddesignates weather the byte is control or data. The display control signals are energized accordingly.

    A full display write is made up of a long sequence of packets. These sequences are stored inthe external EEPROM, and separated into pages. Because each graphical background uses a hugeamount of memory, all text foregrounds share only two backgrounds. Each foreground or backgroundis allotted one or more 256 byte memory block. Appendix 10.4 lists the contents of the externalEEPROM. From this it can be seen that each background takes up about 6 blocks (or 1.5K) ofmemory. Each text foreground takes up only 1 block.

    In order to establish the functions of each pushbutton, for each foreground, a link table isincluded at the beginning of the block. This link table holds the link address of next display for eachmenu. Also, so that the correct background may be displayed for each foreground, the address of therespective background is also stored in the link table.

    8.3 Transceiver Protocol

    Although the transceiver section of the circuit was not fully implemented, the display dataformat is ideal as a transceiver protocol. The base station device contains all display data, and theremote device acts as a slave, sending control signals, and waiting for display data. Display data istransmitted form the base station device, in the same 10 byte packet format. In this way, the displaydata can be altered at the base station only, and the remote device will adapt accordingly.

    8.4 Flowchart/Description

  • 15

    The flowchart of figure 8.4.1 describes basic operation of the application firmware. Theflowchart represents only the most basic functions of the program, as all red/write loops, timing,delays, and addressing have been omitted. The flowchart should however provide enough backgroundto interpret the well annotated assembly code included in appendix 10.2.

    A large portion of the program is simply initialization. This is due to the large number ofports and devices which need to be configured. The display itself requires that about 50 bytes bewritten to it to initialize everything from scrolling, to memory addressing space. The display reset andpower up must follow a specific sequence to avoid display damage. The high voltage LCD bias mustnot be applied until the display has had a chance to write to its LCD drivers.

    The basic flow of the actual main program is apparent, upon examination of the flowchart.Keep in mind that each process block on the flow chart could represent up to 100 lines of complexloops, and counters.

    Upon reset, the peripherals are initialized, an the display is written with data for the firstscreen. This process includes copying the foregrounds link table to a more convenient location inRAM. This allows for each user pushbutton depression to link to the successive display image.

    The data each display write is simultaneously Manchester encoded, and sent to thetransceiver. Complex timing had to be implemented, in order to maintain a 8Kb/s data rate whileprocessing interior and exterior memory read loops, which were different in length.

    At the end of each write sequence, a pushbutton depression is waited for. Once this occurs,the respective address is looked up from the current link table, and the display write process restarts.

    9.0 Programming

    9.1 Development Tools

    One of the attractive characteristics of the PIC16F877, is the full set of development toolsprovided by Microchip. A programming/debugging tool was purchased as part of this package, at aprice of $240. This tool allowed program breakpoints, single stepping, halting, and registermonitoring. All of these features proved very useful.

    The Microchip software package, likewise, was very efficient. It allowed assembly codeediting, compiling, and debugging. Programming was provided by the programming/debuggingmodule, through Microchips proprietary In Circuit Serial Programming protocol.

    9.2 Programming the Serial EEPROM

    Through the development package, all internal memory of the microcontroller could bemonitored and modified. The external serial EEPROM, however, could not be modified through thedevelopment tools. It was, however, required that all display data be programmed to this memory.

    To complete this task, a full scale application was created. This firmware reads a block of theexternal EEPROM to internal EEPROM, where it can be modified using the development tools, andthen written back. This is a tedious process, and required modification of the data in 256 byte blocks,due to the size of the internal EEPROM.

    A full assembly code listing for the EEPROM modifier Program is included in appendix 10.3.Also, to give an idea of the amount of display data programmed, a full hexadecimal listing of allEEPROM memory blocks is provided in appendix 10.4.

    10.0 Appendices

  • 16

    10.1 PCB Layout

    10.2 Program Assembly Code

    10.3 EEPROM Modifier Assembly Code

    10.4 Display Data Listing.

    10.5 Invoices

    10.6 Data Sheets