Home
        Full Report in PDF format - ECE
         Contents
1.      from       Transfer     Then  Hyper Terminal should be disconnected     Data analysis                   If matlabcommand m is not yet available  copy it from the Appendix E above   Save result txt and mathlabcommand m on the same directory    Run the matlabcommand m in Matlab and change the Matlab working directory  1f necessary    A figure with the X axis s  Y axis s and Z axis s data is shown    Five image files called xaxis jpg  yaxis jpg  zaxis jpg  result jpg and  scalarguan jpg are automatically saved into the same directory of the two other    files     45    Appendix H  Picture    Remote end   s hardware      4  gom  OF su  gt         drav   e    et DODGE Er Ce          CC MU  OES OE EF   3 g    r OGC  O OG O00  00  y DOOODE  DODO EF  6 0 6 0               NG    OO000000000000000000000    1  U  U  U  H          46    Base station   s hardware       47    System Overview        48    Appendix I  Bibliography      Mega32 datasheet  http   www atmel com dyn resources prod_documents doc2503 pdf         Radiometrix SP2 433 16 radio packet controller    http   Www radiometrix co uk dsheets sp2 pdf         Radiometrix SP2 433 16 radio packet controller evaluation kit    http   Www radiometrix co uk dsheets sp2ek pdf         Mega32 prototype board    http   homepage sunrise ch mysunrise pfleury avr starterkit html         Max233 driver receiver  http   pdfserv maxim ic com en ds MAX220 MAX249 pdf         Analog Device ADXL311    2g dual axis accelerometer  http   www ana
2.    s outputs are neglected and    the practical values are derived           Ing X axis Y axis Z axis  2 OxA5  1 0x95  0 0x85   1 0x75   2 0x65                         Radio Packet Controller  Radiometrix SP2 433 16 radio packet controller is chosen for the project  SP2 is   a highly intelligent transceiver module at 160kbps half duplex  It is operational at 5V and  is direct interface to 5V CMOS logic  It has a reliable 50m in door and 200m outdoor  range  SP2 includes two modules internally  One is UHF module which is responsible to  transmit and receive data  The other is space port controller which is responsible to  control data and to interface with external microcontroller  Operational method inside  SP2 is user transparent  SP2 works either in transmitter mode or receiver mode and it  uses a handshaking mechanism to prevent data loss during transmission  In the remote  end   s hardware  four LEDs are used to indicate states of the SP2    e Green LED transmitter enabled  Pin5     TXSelect          Red LED   receiver enabled  Pin4     RXSelect       e Orange LED   valid preamble detected  Pin10     Signal       e Yellow LED valid packet received  Pin13     RXR        Preamble allows data slicer in receiver to establish a correcting slicing point  After the  receiver has settled  the SP2 identify and phase lock onto the incoming data  A  4    whip  wave whip of 433MHz is mounted onto the prototype board to boost its signal strength  and it does give a much longer range a
3.   10   SP2 reset 1    SP2 ready    if  time0  100   begin  time0 0    reset timer      X axis  if  ADC doneconversion  1             ADC_doneconversion 0   ADC X read ADC  ADC Xsel        Y axis  if  ADC doneconversion  1        ADC doneconversion 0   ADC Y read ADC  ADC Ysel        Z axis  if  ADC doneconversion  1           ADC_doneconversion 0   ADC Z read ADC  ADC Zsel               Task2  ADC_X ADC_Y    TX_byte_count 0    rx byte pos 0    MCU to SP2 buffer 0  TX control byte   TX byte count      while  TX byte count  lt  4             testing  hardcode sequence of data                  MCU to SP2 buffer TX byte count  0x55     if  TX byte count  1    CU to SP2 buffer TX byte count  0x70     else if  TX byte count  2    CU to SP2 buffer TX byte count  0x75     else if  TX byte count  3    CU to SP2 buffer TX byte count  0x78   if  TX byte count  1    CU to SP2 buffer TX byte count  ADC X   else if  TX byte count  2    CU to SP2 buffer TX byte count  ADC Y   else if  TX byte count  3    CU to SP2 buffer TX byte count  ADC Z                                      3l      Show Y axis on remote end s hardware  PORTB  ADC_Y     TX byte count            assert TXR low to initiate transfer to SP2       amp  make sure RXA is high    TXR 0   MCUCR 0x0A    falling edge for request accept    end    end    32    Appendix D  Base station microcontroller   s Code      k k k kok k kok k k K K k K K K Kk K KOK K K KOK Ck kck ck kck ck KKK KKK KOK k kk    Project   Complete Receiver  Versio
4.  2EVIIKLU    GND GND    PC   SCL  PC1 SDA          PC2  TCK  PC3 TMS       PC4 TDO  PCS TDI  PC6 TOSC1  PC  TOSC2 FF  PD   RXD        PD1 TXD  PD2 INT    PD3 INT1  PD4 0C1B  PD570C1A  PD6 1CP  PD7 0C2       11  31    Radiometrix SP2 433 16    22 GND  81 Yeo  28 D3   19 D2   18 DL   17 Da   16 Reset     15 TXR       14 TXA       13 RXR     12 RXA                          uo   ano    ul  S  KWBZKT           8 1 microfarad 158 ohms  Cornell University MEng Project  ECE     2  picofarad 100 kilo ohms       Base station hardware      Rev 1 0  Mong  Kim Fung    127472083 Page 171             24    Appendix C  Remote end microcontroller   s Code     KOK KK kok k kok k k K k I k K K K K K KOK K KOK K KOK KOK KOK KOK OK KOK k k K    Project   Complete Transmitter  Version   1 2   Date   12 05 2003   Author   Wong  Kim Fung    Company   Cornell University  Ithaca  NY  USA       Comments  Program is complete and functions   Chip type   ATmega32   Program type   Application   Clock frequency   16 000000 MHz   Memory model   Small   External SRAM size   0   Data Stack size 24512        KKKKKK KKK KKK KKK Ck K K Ck KKK k kc K KKK KKK KKK KKK KKK KKK        LEDs indicator     Green  transmitter enabled    Red  receiver enabled    Orange  preamble detected    Yellow  valid packet received  include  lt Mega32 h gt    include  lt string h gt   include  lt stdio h gt   include  lt stdlib h gt                          define begin     define end       Accelerometer parameters  define ADC_VREF_TY
5.  Axis labels and titles are shown on each graph and each axis has a  unique color representing itself  Since this project is designed to be simple and user   friendly  A color images of the graphs are saved automatically as xaxis jpg  yaxis jpg     zaxis jpg  result jpg  scalarguan jpg in the same folder of the Matlab command file     17    5  Test Results    Demonstration has been given to Dr  Land at a teaching lab in Corson Hall  The  system functions well and data collected are good  The design has been proved to be  successful  During demonstration  the system was tested with a range of 20 plus meters  and the base station can receive data without any difficulty  The specification of radio  packet controller claims to be 50 meters range in building  Because of this impressive  range  the project can be greatly applied into future application or design    The accelerometers are suitable for the designed application  From various tests   a person can hardly reach an acceleration of 2g although a 2g motion is possible with  vigorous movements  Z axis of the system is positive pointing upward and negative  pointing downward  Gravitational force on earth is  1g and the tested value of Z axis  while being idle is proved to be consistent with this theoretical value  Notice that both X    and Y axes have value of Og when they are idle but Z axis has value of  1g when it is idle     Two samples of test results are documented in this report  The first test result is  shown below a
6.  INTO  void ext int0  void   begin   unsigned char temp TX data       PORTB  0xF0    debugging    switch  TX state            case  TXA regaccept lsb    begin    PORTB  0x10    debugging      set data lines to output  amp  place data on the data lines  DDRC DDRC   Ox0F   PORTC  PORTC amp 0xFO     MCU to SP2 buffer TX byte pos   amp  Ox0F      TXR 1    tell SP2 that data is present   MCUCR 0x03    rising edge for data read  TX state TXA dataread lab    Next state   end   break           28    case  TXA dataread 1sb    begin    PORTB  0x20    debugging     wait for SP2 to set TXA to high to tell    MCU that data has been read  TXR 0     transfer request by MCU  MCUCR 0x02    falling edge for request accept  TX state TXA regaccept msb           end  break     case  TXA regaccept msb     begin    PORTB  0x40    debugging     shift the MS nibble to LS and send to data lines  temp TX data  MCU to SP2 buffer TX byte pos   amp 0xF0  gt  gt 4   PORTC  PORTC  amp  OxF0   temp TX data   TX byte pos      increment transmit buffer position       TXR 1    data present  MCUCR 0x03    rising edge for data read  TX state TXA dataread msb    end   break        case  TXA dataread msb    begin    PORTB  0x80    debugging   if  TX byte pos    TX byte count     TXR 0   transfer request  MCUCR 0x02    falling edge for request accept    else    DDRC 0xF0    done TX  set data lines to input  MCUCR 0x0A    enable EXT INT1 on falling edge                TX state TXA reqaccept lsb        end  break     
7.  byte  0  amp  amp   RX byte count  0      RX  enable  data are valid  sent to USART      QxA2    0x62          0x9D   Ox5D           0xA5    0x65    e and dump data to PC    reguest    accept    Appendix E  Matlab Code     Version       Date  December 1 2003    This matlab file is used to display the data collected   by the acceleration reading device    data percent   load  result txt     data g   data percent  2 100     row size col size    size data percent    X data g l end 1    put 1st column of data g in X  Y data_g 1 end 2    put 2nd column of data gin Y  Z data_g 1 end 3    put 3rd column of data g in Z     calculating total scalar quantity of 3 axes  for i   l row  size   scalar quan 1    sqrt X 1   2   Y i   2   Z i   2   end    t  l row_size     subplot 2 2 1     plot t X  bo       grid on    title  Acceleration   Xaxis     xlabel  samples  10Hz      ylabel  acceleration  g        Automatically save the figure into the current   work directory as xaxis jpg with best resuoltion  print  djpeg100 xaxis jpg    figure     subplot 2 2 2     plot t  Y  gp      grid on    utle  Acceleration   Yaxis    xlabel  samples  10Hz     ylabel  acceleration  g     print  djpeg100 yaxis jpg    figure     subplot 2 2 3    plot t Z  r       grid on    utle  Acceleration   Zaxis    xlabel  samples  10Hz       38    ylabel  acceleration  g     print  djpeg100 zaxis jpg    figure     subplot 2 2 4     plot data g    legend  X axis   Y axis   Z axis    title  Acceleration measurement   3a
8.  changed  throughout the development  revisions on the design were constantly made  In the    following  four major components of the system are introduced     3 1 Microcontroller   Atmel AVR microcontroller is chosen for this project because I am relatively  familiar with it  It has been used in ECE476 Microcontroller class which I had taken  during spring semester and general technical support is available from Dr  Land or  various websites  It is a good fit for the project as it includes eight built in analog to   digital conversion channels  built in USART  two external interrupts  and four bi     directional ports which are just enough for project development and debugging purpose     3 2 Wireless Connection   Initial design was to apply Bluetooth technology instead of using radio packet  controller  SP2   After much research had been done  the cost of a pair of Bluetooth  module was from  300 to  400  The worse fact is that most modules can only support  point to point  It will be a while before the next generation point to multipoint OEM  modules are available  After discussing this with Dr  Land  we omitted the choice of  Bluetooth technology and chose to use radio packet controller    At a cost of  198  the SP2 does give some advantages over Bluetooth modules  that are available  First and most important  multiple SP2 can form a small personal  network and each packet can include the source and destination address ID  Second  SP2  includes handshake mechanism to prev
9.  hile   ADCSR  amp  0x10   0     DCSR  0x10    DC_doneconversion 1    return ADCH           27            Testing  show one axis working alone                void Taskl  unsigned char ADC value    begin  if  ADC value lt  0xA2  amp  amp  ADC value gt  0x92  PORTB  0x0f   else if  ADC value lt 0x92  amp  amp  ADC value gt 0x82  PORTB  0x55   else if  ADC value  0x82  PORTB  0x00   else if  ADC value lt 0x82  amp  amp  ADC value gt 0x72  PORTB  0xaa   else if  ADC value lt  0x72  amp  amp  ADC value gt  0x62  PORTB  0xf0   else PORTB  0xff    end   ar      Testing  show two axes working together  void Task2  unsigned char ADC vl  unsigned char ADC v2   begin                                                                                  unsigned char LED  LED_X  LED_Y   if  ADC_v1 lt  0xA2  amp  amp  ADC_v1 gt  0x92  JED X 0b11000000   else if  ADC v1  0x92  amp  amp  ADC v1 gt 0x82  ED X 0b10000000   else if  ADC v1 lt 0x82  amp  amp  ADC v1 gt 0x72  ED X 0b01000000   else if  ADC vl lt  0x72  amp  amp  ADC vl gt  0x62  JED X 0b00000000   else if  ADC v1  0x82  ED X 0b11000001   if  ADC v2 lt  0x9D  amp  amp  ADC v2 gt  0x8D  ED Y 0b00110000   else if  ADC v2 lt 0x8D  amp  amp  ADC v2 gt 0x7D  ED Y 0b00100000   else if  ADC v2 lt 0x7D  amp  amp  ADC v2 gt 0x6D  ED Y 0b00010000   else if  ADC v2 lt  0x6D  amp  amp  ADC v2 gt  0x5D  ED Y 0b00000000   else if  ADC v2  0x7D  ED Y 0b00110010   LED LED X LED Y   PORTB  LED    end      detect TXA  MCU to SP2 transfer  interrupt  EXT
10.  signals from accelerometers  converting signals into digital count by  built in ADC  arranging data into packet  and sending the packet to the base station   s  hardware  Base station   s hardware is responsible in receiving packet  rearranging the  received data in percentage  and transmitting the rearranged data to a computer via    USART  Finally  data is analyzed in some graphs     2 2 System Requirements  A simple to use and maintenance free system is the priority of this design  A  nearly plug and play system is designed with minimum user s operational steps  After    discussing with Dr  Land  system requirements are as following     e Fora given tight budget  cost needs to be kept low    e The device should be fairly compact since it would be carried on a human   s body   e Range of the radio frequency connection should be highly stable up 20m    e The system should be expandable with multiple clients if necessary    e Acceleration readings should be constantly updated at 10Hz    e A graphical interpretation should be available on the received readings     e No radio interference is allowed on other instruments     3  Range of solutions   The initial project proposal is slightly different from what the deliverable is at the  end of implementation  Various components of the initial design have been replaced   This could be a reason of better fit or just happened that the wanted components were  unavailable at the time of implementation  As some of the hardware had been
11.  time0        end         Repacketize received data into percentrage of 2g    and then print the new buffer in    to PC  void Repack Sendmsg  void   begin  int temp value     RS head 0   RS tail 4     PORTB  0x70       reorganized the SP2 packet into another buffer    this is for user readability on the hyperterminal             RS buffer RS head    SP2 to MCU buffer 0    while  RS head  lt  RS tail     if  RS head  1   temp value    int SP2 to MCU buffer RS head    130  100   else if  RS head  2   temp value     int SP2 to MCU buffer RS head    125  100   else if  RS head  3   temp value    int SP2 to MCU buffer RS head    133  100        RS buffer RS head  temp value   32     printf    S4d  RS_buffer RS_head     prrintf        RS_head        printf  NnNEet    RS_head 0   end    35      detect RXR  SP2 to MCU transfer  interrupt  EXT_INT1  void ext intl  void     begin       unsigned char temp_RX_data     switch  RX_state          case  RXR tranreq lsb     begin     PORTB  0x01    RXA 0     Step2 MCU pulls RX accept low   CUCR 0x0C    rising edge for data present   RX state RXR datapresent lsb    Next state       end  break     case  RXR datapresent lsb    begin    PORTB  0x02     SP2 turns on bus drivers  places LS nibble    onto data lines and set RX reguest to high  SP2_to_MCU_buffer RX_byte_pos  PINC  amp  Ox0F        RXA 1     data read  MCUCR 0x08   falling edge for transfer request  RX state RXR tranreg msb    end   break     case  RXR tranreg msb    begin     PORTB  
12. 0 140 160    samples  10Hz     A figure including the X  Y and Z axes is shown     43    Acceleration measurement   scalar quantity of 3axes       1 8 T T T T T          C    o  o  T    acceleration  g        T                0 2r             T          d                    0 l l l l l  0 20 40 60 80 100    samples  10Hz     Scalar quantity of X  Y  and Z axes is shown     44    120    140    160    180    Appendix G  User   s Manual    System set up               Plug in a serial cable with base station   s DB9 connector and a computer    Make sure coml is available for Hyper Terminal  If not  go to Device Manager of  Windows OS to change the com port    Open up a Hyper Terminal with 9600 baud rate    stop bits  no parity and no flow  control  Connection s name is up to user s preference    Go to    File    on menu and    Properties    and select    Settings     Click    ASCII  setup        choose    Append line feeds to incoming line ends    from    ASCII  Receiving       Put 9V batteries into the base station   s and remote end   s battery holders  Make    sure the polarities are correct     Data collecting           Make connection to the Hyper Terminal and go to    Transfer    and    Capture  Text     on menu  Open the file named result txt and make sure it is empty   Press    start    on the    Capture Text  window to start collecting data    When data is being collected  it is shown in three columns    When enough data are collected  click    stop    from Capture Text 
13. 0x04    RXA 0    request accept by MCU  MCUCR 0x0C     rising edge for data read  RX state RXR datapresent msb    end   break     case  RXR datapresent msb    begin     PORTB  0x08     shift the MS nibble to lower  read data lines  temp RX data   PINC   SP2 to MCU buffer RX byte pos    temp RX data lt  lt 4     SP2 to MCU buffer RX byte pos      RX byte post t      if  Getting control byte             get to know how many bytes the packet ar  Getting_control_byte 0   RX_control_byte SP2_to_MCU_buffer 0      zero the bit6 7 to get the exact count  RX byte count SP2 to MCU buffer 0   amp  Ox3F      else if  RX byte count  gt  0  RX byte count       36      done receiving a packet   if      Getting  control  byte 1   done    if statements make sure the            otherwise  data wouldn t be  if    SP2 to MCU buffer 1   lt     amp  amp   SP2 to MCU buffer 1        amp  amp   SP2 to MCU buffer 2   lt     amp  amp   SP2 to MCU buffer 2        amp  amp   SP2 to MCU buffer 3       amp  amp   SP2 to MCU buffer 3   gt      repacketiz  Repack Sendmsg     PORTB  SP2 to MCU buffer 2              MCUCR 0x08   falling edge for transfer    RXA 1    RX state RXR tranreg lsb   end  break     end   void main void    begin  initialize       while          1     if  time0  10  SP2_reset 1    if  time0  500    begin   time0 0    reset timer   RX byte count 0    RX byte pos 0    UCSRB 0x08    transmitter enable       CUCR 0x08     end    end    37      falling edge for request       Getting control
14. AN ACCELERATION MEASURING SYSTEM VIA  RADIO FREQUENCY COMMUNICATION    A Design Project Report  Presented to the Engineering Division of the Graduate School  Of Cornell University  In Partial Fulfillment of the Requirements for the Degree of    Master of Engineering  Electrical     by  Wong  Kim Fung  Project Advisor  Dr  Bruce Land    Degree Date  January 2004    Abstract    Master of Electrical Engineering Program  Cornell University    Design Project Report    Project Title  An Acceleration Measuring System via Radio Frequency Communication    Author  Wong  Kim Fung    Abstract  This project is designed to explore the possibility of building a compact  acceleration measuring device and applying it in a typical middle high school science  class  Such an interesting interactive device could to be used to improve the traditional  classroom environment  Students can carry the device on their bodies and see how fast  they move  and ideally  it is hoped to help them become more interested in learning  simple physics  The project   s design is based on a pair of microcontrollers   Accelerometer   s sensors are used and data are transmitted through radio frequency and  serial communication  RS232   Readings of the accelerometer   s outputs are updated ten  times a second and data will be shown in graphical interpretation after measurement is  taken  The designed goal of this project is to provide a simple to use and reliable device    that can record the acceleration with good tim
15. PE 0x00  define ADC_Xsel 0x00   define ADC_Ysel 0x01   define ADC_Zsel 0x02     define ADC pos2g 0xA0     define ADC_poslg 0x90     define ADC Og 0x80     define ADC neglg 0x70     define ADC neg2g 0x60  define Accelerometer range 2    SP2 reset   define SP2 reset PORTD 7    MCU SP2 transfer signals  define TXR PORTC 6   TXA PIND 2  define RXA PORTC 5   RXR PIND 3    SP2 states  define TXA regaccept lsb  define TXA dataread Lab  define RXR tranreg Lab  define RXR datapresent lsb  define TXA regaccept msb  define TXA dataread msb  define RXR tranreq msb  define RXR datapresent msb                                                       CO Jo DG O ha LES    2      Global variables    Accelerometer variables  unsigned char ADC_X    unsigned char ADC_Y    unsigned char ADC_Z    unsigned char ADC_doneconversion         Control byte for SP2 transmitter  nsigned char TX_control_byte    Counter for transmitting bytes  nsigned char TX_byte_count    Position for transmitting bytes  nsigned char TX_byte_pos    Buffer for data packet    nsigned char MCU_to_SP2_buffer 10         Cui SSG TRE PS S I      Control byte for SP2 receiver  unsigned char RX_control_byte     Counter for receiving bytes  unsigned char RX byte count     Position for receiving bytes    unsigned char RX byte pos     Buffer for data packet   junk  unsigned char SP2 to MCU buffer 2      flag for getting Control byte  bit Getting control byte                 unsigned char TX state   unsigned char RX state       interrupt v
16. acceleration on three axes   it could also keep track on how the device has moved  Also  a smaller board could be  built specially for the remote end   s hardware  Although the final remote end   s hardware  is not bulky  the device would fit into more applicable place if it was smaller  It could  truly be used in a grade school   s science class if hardware is properly placed into an    enclosure     20    7  Acknowledgements    This project would not be done without Dr  Bruce Land   s support and guidance   I would like to thank him for soldering the tiny accelerometers on to the prototype boards     And I owe him an apology for hurting his finger when drilling a hole on the board     I also would like to thank my family and girlfriend for supporting me  I have  gained a lot of encouragement from them during my studies  They have been well  supporting and respecting my decision on the Mastering of Engineering studies at Cornell    University     21    Appendix A  Cost                Item   Item description Quantity Company Price       1 Radiometrix SP2 433 160 Lemos International 198  radio packet controller    2  3 Solderable perf board 0 1    grid 4  5 Pushbuttons 4 1       7 4 55V Voltage detector  TL7757  1 44  17 2    ADSL311     2g accelerometer We Analog Devices Sample    18 MAX233 media driver 1 Maxim IC Sample          Total  252 63    Note  Miscellaneous parts such as Mega32  16MHz crystals  resistor  capacitors  and    wires  etc are negligible as they are acquir
17. ariables  unsigned char reload   unsigned int time0     void initialize void   begin    ADC input X Y Z axes     PAO X  PAl Y  PA2 Z  DDRA 0xF8          testing  DDRB 0xFF   PORTB 0xFF          MCU to SP2 interface    Bit6 TXR Bit5 RXA  DDRC 0xF0    PORTC 0xF0       Bit2 TXA Bit3 RXR  Bit7 SP2 reset  DDRD 0xF3           Timer Counter 0 initialization     Clock source  System Clock  time0 0    reload 256 250    TCCR0 0x03    clk 64       26    end    TCNTO reload     Timer Counter0 Overflow Interrupt Enable  TIMSK 0x01             ADC initialization  ADMUX ADC_VREF_TYPE 0x20   Left adjust result  ADCSR 0x87    ADC doneconversion 1                SP2 initialization  SP2 reset 0    TXR 1    PORTC 6 out  RXA 1     PORTC 5 out  TX control byte 0x04           RX byte count 0     RX byte pos 0   Getting control byte 1     TX state 1   RX state 3        GICR 0xC0     External interrupts 0 1 enabled  MCUCR 0x0A    Falling edge generates interrupt          Global enable interrupts  fasm  sei            Timer 0 overflow interrupt service routine  interrupt  TIMO OVF  void timer0 overflow void   begin    end      reload to force lms overflow  TCNTO reload     time0           Read the AD conversion result  unsigned char read ADC  unsigned char ADC input     begin    end       ADMUX ADC VREF TYPE   0x20   ADMUX  ADC input      Start the ADC conversion     ADSC bit6  returns to zero after conversion  ADCSR  0x40    ADCSR 0xc7     W  A  A              Wait for the ADC conversion to complete 
18. collision avoidance mechanism to prevent data loss during transmission  It can also be  customized to include source and designation address in the packet  However  the cost  would need to be lowered for production use    The planning and implementation of this project have gone well and smoothly   Planning was carefully thought through from the beginning of design and it was worth  the time since a careful plan saves a lot development time  The final deliverable is fairly  compact and solid  Data transmission between the pair of radio packet controllers is  robust  Accuracy of accelerometers is acceptable  Overall  the system functions well and    works as desired     il    Table of Contents    An Acceleration Measuring System via Radio Frequency Communication    PRS URAC EE i  Executive SUMMARY cis ba Oe CON TEMO e BEP oo Ee ii  T    Introductioh   ee s ertet erba e Reto dd eie Rc vus ERR  1  2  Design Problem and System Reouirementz YY Y Y Y Y enn  2  Dee EE 2   2 2 System Ree 2   3  Range of solutions    occorre ty DL YL NW YA GYW y 3  3 1  Microcontrollers SANS 3   3 2 Wireless Connection  i ae ea O y CR A GY dn 3   3 3 ACCElErOMeter uyu ua uu deco Sadek yy LY EN VP c ssa PD Se Vaden es ia tes 4  STEE 4   4  Design and Implementaton  000000000 5  4 1 Remote end    hardware z sess ds nes A XY Ye ERR RA yeas AA Leo ey wn FERA ERR Nee 5   AD Base station harde ss 11   4 3 r  d mud y e Opt Node edk pea RNK kasy ma 13   AA E 3 1656002 ccs Ne 17   5   DESC Results kN 18  6  Co
19. connected  with pin 2 of Max233  RXD of microcontroller is not necessary in this project since the    data always goes into one direction to computer   There was a problem encountered when soldering the DB9 connector onto the    prototype board  Its pin would not fit in either 0 1    grid board or the 2mm grid board     However  with help from Dr  Land  it is fitted onto the board by drilling bigger holes     12    4 3 Embedded program   There are two embedded application in the system  The program at the remote  end   s microcontroller is responsible to collect data from accelerometers and to send the  data in packet through a radio packet controller  The program at the base station   s  microcontroller is responsible to receive data through radio packet controller and to  process packet into a meaningful data format  Then  reorganized packet is sent through a    USART to a computer for graphical analysis     Here  the remote end   s program is explained in detail    e interrupt  TIMO OVF  void timer0_overflow void   Since the system is required to collect data in 10Hz  an interrupt service routine   ISR  serves the best by providing an accurate time interval for operation   Timer Counter 0 is chosen and ISR occurs every 100 millisecond  A 100  millisecond interval is chosen so that people normally would not notice  significant data delay  Moreover  a 50ms interval had been tested on the system    and it worked     e unsigned char read ADC unsigned char ADC input   This func
20. e resolution     Report Approved by  Project Advisor  Date        Executive Summary    This Master of Electrical and Computer Engineering project is designed to  measure acceleration through a simple microcontroller based system  It explores the  possibility of performing a simple interactive experiment in a science class to help  students in learning basic physics  This system should be easy to use by any grade  teacher with a simple user manual    Two dual axis accelerometers are arranged to form a tri axis accelerometer and  outputs are sent to an Atmel Mega32 microcontroller  MCU   The accelerometer   s  outputs are analog  They are converted into digital counts by the built in MCU analog   to digital converters  The radio connection is established by a pair of radio packet  controllers  SP2  from Radiometrix  For both remote end   s hardware and base station   s  hardware  radio packet controllers are connected to MCUs  Acceleration readings are  sent from the remote end   s radio packet controller to the base station   s radio packet  controller  After performing some mathematics on the receiving data  the acceleration  readings in digital count are converted into percentage and they are sent through a serial  communication to a computer  Then Matlab is used to display the data into a graphical  interpretation    This system functions as a point to point system  but the SP2s are capable of  being applied as a point to multipoint system  The SP2 has the handshaking and  
21. ed from the lab     22          Appendix B  Schematics    A 5v    s 8 Vdd  STL Ka  18 a    BIAS A U  ADXL311    R2 cnn 3 Paa anca   PAL ADC1  4 NC PA2 ADC2  PA3 ADC3  PA47ADC4       PC  SCL  PC1 SDA  A 5v PC2 TCK   TA PAS ADCS M    Ci 18 vdd Pe anc PC4 TDO  PCS TDI  PC6 TOSC1  PC7 TOSC2  PDA RXD  PD1 TXD  PD2  INTO  PD3  INTL  PD4 0C1B  PD5 0C1A  PD6 1CP  PD7 0C2    ST 1  IL Pa7 ADC7  BIAS a PBa Ta  ADXL 311 PBL TL  R2 onn 3 PB2 AING  PB3 AINL  PB4 SS  PB5 MOSI  PB6 MISO  PB7 SCK   RESET  XTALI  XTaL2  AREF  AVCC    cEUD3WLU                   GND GND  11  31          433MHz antenna       RF GND 1  Antenna 2  RF GND 3  RX Select  4  TX Select    5    2 Green  K   E GND 6 Radiometrix SP2 433 16  i TXD AF  7       oran e NC 8                NC 9       2       Yellow Signal    18       8 1 microfarad 150 ohms    Cornell University MEng Project  ECE     2  picofarad 200 kilo ohms    188 kilo ohms Remote end hardware    Wong  Kim Fung Rev 1 0 Page 1 1  187472003                23    2  R1       Green  VV E GND 6     gt      u   lt     fa  NP  m     d  a         w  GA    2  o  To       ES        PA   ADC    PALZADC1  PA27ADC2  PA3 ADC3  PA4 ADC4  PAS ADCS  PA67ADC6  PA7 ADC7  PB   T     PB1 T1   PB27A NG    w   Ro M M lw       z  ble jp jo  KO  00  N  os Jo        o       433MHz antenna    RF GND 1  Antenna 2  RF GND 3  RX Select  4  TX Select  5      TXD AF            i    PB3 AINI  PB4 SS  PBS MOSI  PB6 MISO  PB  SCK  RESET  XTALI  xTAL2  AREF  AVCC          w          w          
22. ences between the two are the  USART and accelerometers  There is no accelerometer connected with base station   s  hardware since its purpose is used to receive and process data  For the USART  PD 1 is  used to transmit data serially to the serial communication hardware  Please refer to    section 4 1 for detail on microcontroller     Radio Packet Controller  The connection of SP2 in both the base station   s hardware and the remote end   s    hardware are identical  Please refer to section 4 1 for detail on SP2     Serial Communication   Serial communication  RS232  transmits data from microcontroller to computer s  Hyper Terminal  The USART of base station has baud rate of 9600bps  one stop bits  no  parity bit and data frame is 8 bit     The RS232 is negative logic which means that a    1    is negative voltage and a    0     is positive voltage  A converter is needed for TXD and RXD and Max233 is chosen  because of its internal capacitors  Max232 is a popular choice but four external    capacitors seem too much for the design and Max233 functions just as well as it     11    A female DB9 connector is soldered with Max233 media driver  Pin 5  T1Out  of  Max233 is connected with pin 2  Receive data  of DB9  Pin 5  Signal ground  of DB9  connector is connected with ground bus of prototype board  Then  a serial cable is  connected with both DB9 connector and computer together  Since USART protocol is  used for the serial communication  PD1 of microcontroller which is TXD is 
23. end      detect RXR  SP2 to MCU transfer  interrupt  EXT INT1  void ext intl  void   begin   Switch  RX state            case  RXR tranreg lsb    begin    PORTB  0x01    debugging   RXA 0    Step2 MCU pulls RX accept low    29    MCUCR 0x0C    rising edge for data present  RX_state RXR_datapresent_lsb    Next state  end  break     case  RXR datapresent lsb     begin    PORTB  0x02    debugging     SP2 turns on bus drivers  places LS nibble    onto data lines and set RX request to high  SP2 to MCU buffer 0  PINC  amp  Ox0F        RXA 1    data read  MCUCR 0x08   falling edge for transfer request  RX state RXR tranreg msb    end   break     case  RXR tranreg msb     begin    PORTB  0x04    debugging   RXA 0    request accept by MCU  MCUCR 0x0C    rising edge for data read  RX state RXR datapresent msb    end   break     case  RXR datapresent msb    begin    PORTB  0x08    debugging     shift the MS nibble to lower  read data lines  SP2 to MCU buffer 0   PINC lt  lt 4   SP2 to MCU buffer 0    MCUCR 0x08     falling edge for transfer request  if  Getting_control_byte           Getting_control_byte 0    RX_control_byte SP2_to_MCU_buffer 0     RX byte count SP2 to MCU buffer 0   amp  Ox3F      else if  RX byte count  gt  0  RX byte count          if   Getting control byte  0  amp  amp   RX_byte_count  0         Getting control byte 1    MCUCR MCUCR   0x02        RXA 1    RX state RXR tranreg Lab   end  break     30    void main void   begin  initialize       while  1      if  time0
24. ent packet loss  Packet framing and error  checking is user transparent  Third  it has a reliable range of 50m in building and 200m    outdoor     3 3 Accelerometer   An initial design included an accelerometer of    10g with analog output  It was  hoped to fit the system into various application with a lager range  In addition to this  the  project is designed to measure all X axis  Y axis  and Z axis  It is difficult to find a tri   axis accelerometer with a suitable range since most accelerometers are designed for  industrial purpose  While most accelerometers are used in industries  the cost is not low   As a result  only a dual axis accelerometer of    2g with analog output is available to be  sampled from Analog Devices  During implementation  two dual axis accelerometers are  arranged in a way that all three axes are perpendicular to each other  There is one axis of    an accelerometer is left disconnected from microcontroller     3 4 Data Processing   Data are collected and processed in three stages and each stage can process the  information in different ways  It is entirely up to the developer on what data he wants to  have at each stage    1  Accelerometer   s outputs are analog and they are processed by  microcontroller   s ADC and then transmitted out    11  Data received in base station   s hardware are manipulated to convert to  percentage  After some mathematical manipulation  the data before  transmitting through serial communication to a computer are in perc
25. entage of     2g    ili  At the hyper terminal  data are arranged into a matrix with three columns   After collecting the necessary data  a file is saved by capturing the matrix   Then  a Matlab program is opened and the data is once again processed by the  program  At this final processing  data in percentage are converted into data    in unit g and this translation shows the real accelerations that have recorded     This scheme of handling collected data in the above way eased the programming    effort and it will be elaborated later in this report     4  Design and Implementation   The acceleration measuring system includes two major hardware and two major  software programs  The hardware is the remote end   s hardware and the base station   s  hardware  The software programs are the embedded application and Matlab program     A block diagram of the system is shown below     Remote end    digital           Huper Terminal  Matlab        4 1 Remote end hardware   Remote end s hardware is the device that will be carried by a user  Lots of efforts  have been spent to make it compact  light and reliable  Overall  the device consists of  three major parts and they are microcontroller  accelerometer  and radio packet controller     All of the major components are elaborated in the following sections     There is a color scheme used in this project and they are   Red     9V   Yellow     5V   Black     ground   White     data signals between MCU and SP2 or X axis  Blue     transmis
26. fferent period of time  One axis was    tested along its positive and negative axis while the other two axes were kept still  X axis    was tested from 8  second to 10  second  Z axis was tested from 10  second to 12     second  Finally Y axis was tested from 14  second to 16  second  Figures of X axis  Y     axis  Z axis  combined axes and scalar quantity of combined axes are shown in Appendix    F     19    6  Conclusion    This project has fulfilled my desire to build a system based on microcontroller  I  have been able to apply my electrical and computer engineering background to finish the  task  The project was based on heavy research and planning  Any alternative solutions  had been considered carefully  The system is kept compact throughout the  implementation and layout of prototype board was carefully designed  During the project   I did not encounter any major problems and developing the system went well  Overall  I  enjoyed working on this project  I have trained myself to be good at soldering parts even  with surface mount capacitors  I have learned to be patient when debugging hardware  and software  Most important is that I know how to make decision when there are    alternative solutions pointing into same or different directions     There are many additions which could be made to the basic system I built  If  there were more manpower  this project could be expanded greatly and more interesting  features could be added into the system  Instead of just getting 
27. fter being connected  Signal lines such as TXR      TXA     RXR     RXA    and Reset    are Active Low which means they are activated  enabled   when low is passed into the signal line  Datasheets found on various Radiometrix   s  websites are inconsistent and may mislead developers    When implementing the SP2  it gave me one difficulty that is worth to mention  here  The SP2 is manufactured by Radiometrix Limited which bases on England  The  size of the module is fairly compact and when I was trying to solder the SP2 into a  prototype board  problem happened  The SP2 would not fit into a standard 0 1    spacing  board  The spacing of the pins is 2mm  in that case  a 2mm grid prototype board is  needed  After so much effort had spent on the web in searching for the right board  a  relatively expensive board was found from Digikey but there was no luck to find a socket  that would fit the SP2  And that is why the expensive SP2s are soldered onto the board    directly     10    4 2 Base station hardware   Base station is responsible for receiving collected data  manipulating received  data into percentage format and sending to a computer through a serial communication   RS232  for a graphical analysis  It consists three major parts which are microcontroller     radio packet controller and serial communication hardware     Microcontroller   The connection of microcontrollers in both the base station   s hardware and  remote end   s hardware are nearly identical  The only differ
28. h to acknowledge  that data has been read   Then  the steps are done again for the higher 4 bit  Process will repeat until the entire  packet is read  Notice that data lines should be set as input before initiate a transfer  request  They will only be set as output during a transmitting operation   External interrupt 1 is used as RXR     MCU needs to detect a falling or rising  edge of RXR    and it works by setting register MCUCR 3 2  to 10 or 11 respectively     Also  GICR 7 must be set to enable the external interrupt 1 requested     16    4 4 Matlab application   Matlab is chosen to analysis data in graphical interpretation because of its  powerful mathematical and graphical tools  Through the serial communication  a matrix  with three columns is displayed on Hyper Terminal  Data received on Hyper Terminal is  saved into a text file on a directory    The matrix   s column is separated with a space and Matlab can easily load the text  file into workspace  Once data loaded  a matrix variable called data_percent is created   Then  data_percent is processed and converted into a new matrix with unit g  The new  matrix is saved into variable named data_g  The range of data_g should be from  2g to    2g    Each column of data_g is saved into a new variable representing its specific axis   Five graphs are plotted and first three graphs show X axis  Y axis and Z axis data  respectively  Fourth graph shows all three axes and fifth graph shows the scalar quantity  of all three axes 
29. han just some abstract fancy programming  In addition to this  I was  able to apply both hardware knowledge and software programming skill into the project    Using radio packet controller for the wireless connection in this design gives  advantages such as longer reliable range  lower cost  and most importantly  the possibility  of extending the project   s goal into a small personal network with multiple client systems   The accelerometers can be easily replaced with any desired acceleration range and only a  little modification is needed to be done on the embedded programs    One of the main goals of this project is simplicity  The system should be reliable  and a friendly  easy to understand result should be available to user  Hence  the final data  is in a matrix form so that it will be easy to import into software  such as Excel or Matlab   A user manual is provided in Appendix G to show how to get a graphical interpretation of    collected data in Matlab     2  Design Problem and System Requirements  2 1 Design Problem   The goal of this project is to design a low cost  compact and reliable acceleration  measuring device  It should also be expandable into multiple clients system with few  code modifications  A simple graphical interpretation should be available to analysis the  collected data    The system is composed with two major hardware and they are remote end   s  hardware and base station   s hardware  Remote end   s hardware is responsible in  collecting analog
30. irst  a 10 bit resolution is used for the AD conversion in which means 1023 is  the maximum digital count  Then the ADC data register is left shifted and the higher 8   bit which is register ADCH is chosen  The measured analog signals from the  accelerometers are referenced with 5V supply voltage and the equation of getting digital    count of the analog signals is  X   1023    Accelerometer   s signal level   5V     A list of the equivalent values of accelerometer   s output in different forms is    shown below           Ing   In voltage   Higher 8 bit digital count  2 10100000   0xA0  1 10010000   0x90  0 10000000   0x80   1 01110000   0x70   2 01100000   0x60                         Since two dual axis accelerometers are used  they are arranged in a way that all  three axes are perpendicular to each other  A strong Wire is used to hold them as close as  possible at 90 degree  X axis and Y axis of first accelerometer are read as X axis and Y   axis of the system  X axis of second accelerometer is read as Z axis of the system and Y   axis of second accelerometer is left disconnected from microcontroller  Example of an    accelerometer orientation is shown below     Y axis   ve     ADXL311  0309    X axis   ve  X axis   ve        Y axis   ve     After carefully aligning and connecting them together  they are tested individually  since each accelerometer may differ from another on electrical characteristics  As a  result of this testing  the theoretical values of accelerometer
31. log com UploadedFiles Data Sheets 39398238692761ADXL311 a pdf         National Instrument 5V voltage regulator  LM78M05   http   www national com ds LM LM341 pdf         CodeVision AVR evaluation download    http   www hpinfotech ro html download htm       49    
32. n   1 2   Date   12 06 2003  Author   Wong  Kim Fung    Company   Cornell University          Comments  Program is complete and functions   Chip type   ATmega32   Program type   Application   Clock frequency   16 000000 MHz   emory model   Small   Internal SRAM size   2048   External SRAM size   0   Data Stack size i 512       KOKCKCKCKCKCKCk I Ck K K Ck KKK KKK kck ck KKK KKK KKK KKK ke e x kx f         LEDs indicator         Green  transmitter enabled         Red  receiver enabled    Orange  preamble detect    d         Yellow  valid packet received    include   Mega32 h    include  lt string h gt   include  lt stdio h gt   include  lt stdlib h gt              define begin    define end      define ADC_diff 0x20    SP2 reset  define SP2 reset PORTD 7    define TXR PORTC 6   TXA  define RXA PORTC 5   RXR    SP2 states  define TXA regaccept lsb  define TXA dataread Lab  define RXR tranreg Lab             define TXA regaccept msb    define TXA dataread msb  define RXR tranreg msb                     Global variables       define RXR datapresent lsb    define RXR datapresent msb      difference of 2g  amp  Og in digital count      MCU SP2 transfer signals    PIND 2  PIND 3    1  2  3  4  5  6  7  8      Control byte for SP2 receiver  unsigned char RX control byte     Counter for receiving bytes  unsigned char RX byte count     Position for receiving bytes  unsigned char RX byte pos     23      Buffer for data packet   unsigned char SP2_to_MCU_buffer 4      flag for getting Cont
33. nclusion  aysa re Ea e e bo d   OPER EEE 20  7  Acknowledgements                                                                        21  Appendix A  Cosas 22  Appendix B  Schematics                                                                      23  Appendix C  Remote end microcontroller s Code                     eee rn 25  Appendix D  Base station microcontroller s Code                                      33  Appendix E  Matlab Code                                                                   38  Appendix F  Matlab result                                                                   40  Appendix G  User s Manual    45  Appendix H  Pictures  cj  eu YR E teria ex dane savage cue a CA day xa x dE Rara Yeu d ge 46    Appendix I  Bibliography                                                                    49    1  Introduction    Traditional learning method in classroom environment is not always enjoyable   While some children do fine in learning fundamental physics with traditional way  there  are always others who prefer interactive learning  This project explores the possibility of  building a compact and reliable acceleration measuring device with cost effective  solution  Its goal is to provide students a tool to enhance their learning experience in  classroom    In fulfilling the Master of Engineering project requirement  I chose to design a  system based on microcontroller  This gives me a chance to build a tangible and practical  deliverable rather t
34. nd the Matlab code is modified a little to combine four graphs into a figure   This is because a more understandable illustration can be done in a combine figure   Second test result is shown in Appendix F and five graphs including scalar quantity are  shown    Test 1    At the first test  the accelerometer device was moved in a circular motion along  XY plane  Sine waves were generated on X axis and Y axis  Z axis was supposed to be  constant at a value of  1g  However  this test was done by a human being and the interval  between each circular motion varied  It is very difficult to finish each circle with same  period of time and same speed  As a result  irregular sine waves were generated on X   axis and Y axis and Z axis also had values varying around  1g  A figure of the test is    shown on next page     18    o       D    S  N    acceleration  g     acceleration  g   1 1    o             1     N    1     o   o    Test 2        ker   o      Acceleration   Xaxis                                                                                  50 100 150 200  samples  10Hz     Acceleration   Zaxis             Du           S             50 100 150  samples  10Hz     200    acceleration  g     acceleration  g          Cn e Cn    1       1   s  Cn   o    Acceleration   Yaxis                   50 100 150 200    samples  10Hz     Acceleration measurement   3axes       luy ee                      50 100 150 200    samples  10Hz     At this test  all three axes were tested at a di
35. onous and there are  couple procedures that should be handled before transmitting  First  if there is a valid  packet in SP2 waiting to be uploaded into MCU  data must be uploaded before  transmitting  Second  data lines must not be set to output until step 3  After the SP2 has  accepted the transfer request  data lines could stay as output until the entire packet is sent  out  Then  steps for transmitting data are as follow    1  MCU is ready to transfer data  It asserts TXR    from high to low to initiate a  transfer request   MCU waits for SP2 to pull TXA    low which means request is accepted   MCU set data lines to output and place the lower 4 bit on the data lines   MCU set TXR    back to high to tell SP2 that data is present   MCU waits for SP2 to set TXA    back to high to acknowledge that data has been    Ur des ke    read   Then  the steps are done again for the higher 4 bit  Process will repeat until the entire  packet is read   External interrupt 0 is used as TXA   MCU needs to detect a falling or rising edge of  TXA  and it works by setting register MCUCR 1 0  to 10 or 11 respectively  Also     GICR 6 must be set to enable the external interrupt 0 requested     14    Here  the base station   s program is explained in detail     interrupt  TIMO_OVF  void timer0_overflow void     This has the same purpose of the timer counter 0 interrupt that is explained above     void Repack_Sendmsg void    This function serves two purposes  First  packet received by the base sta
36. rol byte  bit Getting_control_byte       unsigned char TX_state   unsigned char RX_state       for TXC interrupt   unsigned char RS_head   unsigned char RS_tail      i        buffer for reorganized packet to PC  nt RS_buffer 6        interrupt variables  unsigned char reload   unsigned int time0        void initialize void    begin    testing  DDRB OxFF   PORTB 0xFF          MCU to SP2 interface    Bit6 TXR Bit5 RXA  DDRC 0xF0    PORTC 0xF0          BitO RXD Bitl TXD      Bit2 TXA Bit3 RXR  Bit7 SP2 reset    DDRD 0xF3    try bit0 as output           Timer Counter 0 initialization  time0 0    reload 256 250    TCCR0 0x03    clk 64   TCNTO reload      Timer Counter0 Overflow Interrupt  TIMSK 0x01                USART initialization  UCSRA 0x00    UCSRB 0x08    transmitter enable  UCSRC 0x86    8bit data  UBRRL 0x67    9600 baud rate  UBRRH 0x00          SP2 initialization  SP2 reset 0    TXR 1    PORTC 6 out  RXA 1    PORTC 5 out    TX control byte 0x04     TX byte count 0      TX byte pos 0    RX control byte 0           34       Enable    RX_byte_count 0   RX_byte_pos 0   Getting_control_byte 1     BX done flag 0       TX_state 1   RX_state 3     RS head 0   RS tail 4     GICR 0xC0     External interrupts 0 1 enabled  CUCR 0x0A    Falling edge generates interrupt                   Global enable interrupts  fasm  sei    end       Timer 0 overflow interrupt service routine  interrupt  TIMO OVF  void timer0 overflow void   begin     reload to force lms overflow  TCNTO reload    
37. sion related signals   Green     receiving related signals or Y axis   Purple     Z axis value    Orange     interconnection signals or reset    Microcontroller    Atmel AVR Mega32 is chosen for the project because of its availability  familiar    by the developer  and its great features such as built in analog to digital converters     external interrupts  and USART transmission     Port A has eight channels of ADC  ADCO is connected with X axis of first  accelerometer  ADC is connected with Y axis of first accelerometer  ADC2 is  connected with X axis of second accelerometer that is held upright  As a result     ADC2 is reading Z axis value of the device     Port B is connected with LEDs for testing and debugging purpose  These LEDs  help to debug the embedded program during development  It is almost impossible  to have program worked the first time without debugging and that is why it is  necessary to have these LEDs  They can be used to show the data transmitted  or    which state the microcontroller is at     Port C is used to interface with a radio packet controller  SP2   PC6 is an output  signal connected with TXR    of SP2  PCS is an output signal connected with  RXA   PC3  PC2  PC1  and PCO are bi directional signals connected with D3  D2   D1  DO of SP2 respectively     e Port D is also used to interface with SP2  PD2 is external interrupt zero and it is  an input signal connected with TXA    from SP2  PD3 is external interrupt one and  it is an input signal connec
38. ted with RXR    from SP2  PD7 is an output signal    connected with Reset    of SP2     A table with the list of signals connected with the microcontroller is shown below           Pin Port Direction Signal    40 PAO X axis  39 PAI Y axis  38 PA2 Z axis  8 1 Red LEDs  28 PC6 TXR     27 PC5 RXA     25 22 D3 D2 D1 D0  21 PD7 Reset        gt   gt    gt     olo    16 PDO Input TXA                         Beside the Port signals  basic connections on microcontroller are worth noticing   The microcontroller is running at 16MHz with an external crystal  A reset button is  available on microcontroller and the MCU   s reset is activated on low    A 9V alkaline battery is used to power up this remote end   s hardware  Of course  there is a SV voltage regulator connected with the battery  The voltage regulator is  LM78M05 of TO 220 package from National Instrument  A 0 1uF capacitor is  connected between Vcc and ground to stabilize the source  The prototype board that is    used is 0 1 inch spacing and it is the most popular standard for most components     Accelerometer   Analog Devices ADXL311     2g dual axis accelerometer is selected for this  project  It is operational from 2 7V to 5 25V  Its typical sensitivity is 312mv g at 5V and  Og is about 2 5V  Notice that the typical sensitivity changes with different input voltage  and each accelerometer has different electrical characteristic    Accelerometer   s output is in analog which is desired since the MCU has the built   in ADC  F
39. tion is called by passing a value to read the accelerometer s signals  The  value passed is a channel number such as ADCO  ADCI  or ADC2  The function  allows one ADC reading at a time  Although multiple ADC readings are allowed  with Mega32  it is safer and more accurate to read one channel at a time  This is  done by a flag called ADC doneconversion which indicates if an ADC channel is    being read       void Taskl unsigned char ADC value   This function is for debugging purpose  It tests whether the accelerometer s  signals are correct and it is done by reading a converted value of one of the three  channels  The value read must be within a range from 0x60 to Ox AO  explained in    section 4 1 Accelerometer   One channel at a time is tested     13      void Task2 unsigned char ADC vl  unsigned char ADC_v2   This function is for debugging purpose  It is very similar to the Task  function  above  However  instead of testing one channel s value at a time  two channel s  values are compared with the range from 0x60 and OxAO  This function is used to    prove that microcontroller is reading multiple channels properly     e interrupt  EXT INTO  void ext intO void   detect TXA  MCU to SP2 transfer  The function is processed by an external interrupt 0 and it is used for the  microcontroller to acknowledge that SP2 is ready for the data transfer  Detail on    how it operates is explained below     MCU to SP2  Transmission    Doing a byte transfer from the MCU to the SP2 is asynchr
40. tion s  microcontroller is in digital count  Here  the packet is converted into percentage  of the acceleration and the range is from  100  to  100   This conversion could  actually be done by the remote end s microcontroller  However  in order to  minimize the amount of data transmission through the radio packet controllers     the conversion is done at the base station to maintain data integrity     Second  the function calls built in function printf to send data through USART   Using printf function saves a lot of time on writing codes for the USART   Although the compiler generates a significant amount of assembler codes by  handling printf  it only generates a few codes after calling it the first time  So   considering the pros and cons of using printf  I chose to implement it to ease the    programming effort     interrupt  EXT_INT1  void ext intl void    detect RXR  SP2 to MCU transfer  The function is processed by an external interrupt 1 and it is used for the  microcontroller to know that SP2 is ready for data upload  Detail on how it    operates is explained below     15    SP2 to MCU  Receiving   Doing a byte transfer from the SP2 to the MCU is asynchronous and steps are  shown below   1  SP2 asserts RXR    low to initiate a transfer request   2  MCU pulls RXA  low to tell SP2 that request is accepted   3  SP2 places data on the data lines and sets RXR    back to high to tell MCU that  data is present   4  MCU reads the data from data lines and set RXA  back to hig
41. xes    xlabel  samples  10Hz     ylabel  acceleration  g      print  djpeg 100 result jpg    figure    plot vector_guan    title  Acceleration measurement   scalar quantity of 3axes    xlabel  samples  10Hz      ylabel  acceleration  g      print  djpeg100 scalarguan jpg    39      Matlab result    Appendix F                L     p  E m      R    Ra a       Lane e E     ec 7       _ s             a E A n 4  2 NN  ES B Y Y FN  223 SE i     dem LE um        6  uopeiejeooe    40 60 80 100 120 140 160 180  samples  10Hz     20    A movement on X axis was performed along positive and negative direction     40    Acceleration   Yaxis  12   I     I l         0 8    o o  T D    o  N    acceleration  g                     0 6   i i i i i i i  0 20 40 60 80 100 120 140 160 180  samples  10Hz     A movement on Y axis was performed along positive and negative direction     41    Acceleration   Zaxis  0 2 T T I T T T T T       S  o  T    acceleration  g   o  co  T  l             20 40 60 80 100 120 140 160 180  samples  10Hz     A movement on Z axis was performed along positive and negative direction     42    Acceleration measurement   3axes                                                                                                                                        180    1 5 T T T T T T T I      X axis      Y axis         Z axis  ab a  05r   4  I l m I  2 or 4  6     N prem    L        ay  8  8 05   DOE 4   1 TN  d  FK    ka J U   1 5 a   2   l l l l l l l  0 20 40 60 80 100 12
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
Fax order form for SimaPro 7 professional - KBS  LG LFD850 User's Manual  [バイク・ヘルメットチェックシート](PDF  Corel Premium Suite X5, EDU, 1-4u  委託契約書(案)  Indesit PBAA 33 V X fridge-freezer  Demarreurs pannes Synthèse H&O  簡単取替システムキッチン  POSTER PRINTER ST-1  Whitmor 6024-575 Instructions / Assembly    Copyright © All rights reserved. 
   Failed to retrieve file