You are on page 1of 30



Methods of Optical Communication for Embedded Systems

Filip Roth

Brno, spring 2008

Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source.

Advisor: prof. Ing. V´ clav Pˇ enosil, CSc a r ii

I would like to thank Microchip Technology for providing free samples of the MCP2120 IrDA encoder/decoder, Gatema s.r.o. for a generous discount on printed circuit board manufacturing and Soltech s.r.o. for quick assembly of the prototype modules. I would like to thank my advisor, prof. Ing. V´ clav Pˇ enosil, CSc, for helpfulness and a r guidance during writing of this thesis. Last, but not least, I would like to thank my parents for their support during my studies.


theoretical and practical.Abstract This thesis deals with current-day wireless optical data transfer technologies used within embedded systems. iv . Thesis is divided into two parts. The basic test results of the designed module and a comparison with radio frequency devices are also provided. followed by a practical example of an embedded system using these technologies. Theoretical part covers signalling standards and communication protocols used in through-the-air optical communications.

wireless communication.Keywords IrDA. optical communication. embedded system v . remote control. microcontroller.

. . 2. . . .2. . . B Contents of the enclosed CD . . . . . . .Contents 1 Introduction . .3. . . . . . . . . . . . .2 Data integrity test . . . . . . . . . . . . . . . . . . . . .5 Infrared receiver . . . . . . . . . . . . . . . 2. . . . . . . . . . . . . . . . . . . . . . . . . 3. . . . . . . . . . . . . 2 Optical communication standards . . . . . . . . . . . . . . . . . 5 Comparison of optical and radio frequency technologies 6 Conclusion . .2 USB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3. . . . . .2 Application walkthrough . . . . . . . . . . . . . . . . . . . . . . .1 Basic IrDA PHY compatibility test . . . . . . . . . . . . . . . . . . . . . . . .3 Link Management Protocol . . . . . . . . . . . . . .2 Data encoding . . . . . Bibliography . . . . . . . . . . . . . . . . . . . . . A Test device schematic . . . . . . . . . . . . . . . . .2 Link Access Protocol . . . . . . . . . . . . . . . .1. . . . .2. . . . . . 2. . . . . . . . . . . . . . . . . . . . . . . 3. . . .6 ISM radio frequency module . . .2 Carrier-based communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3. . . . . . . . . . . . . 3 Simple test device . . . . . . . . . . . 2. . . . . . . . . 3. . 4. . . . . . . . .1 Main features . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3. . . . . . . . 4. 3. .2. . . .2 Hardware description . . . . . . . . . 3. . . . . . . . . . . . .1 Infrared Data Association (IrDA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Software description . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . 2. . . . . . . . . . . . 2. . . . . . . . . . . . 4 Verification of functionality . . . . . . . . . . . . .1 Microcontroller block . . . . . . . . . 3. . . . . . . . . . . . . . . . . . . . . 2. . . 2. . . . . . . . . . . . . . . . . . . . .1 Physical layer . . . . . . . . . . . . . . . .1. . . . .2. . . . . . . . . . . . . . . . . . . . . . 3. . . . . . .4 Infrared transmitter . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Physical layer . . . . . . . . . . . . . . 3. . . . . . . . . . .3 IrDA interface . . . .1 Design requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Optional layers . . . . . . . . .1. . . . . . . . . . . . . . . . . . .2. . . . 2 3 3 3 4 5 5 5 6 6 7 7 7 8 9 10 11 12 12 13 13 14 17 17 17 19 21 23 24 25 1 . . . . . .

Optical communicaton as we know it today was made possible with the development of light emitting diodes.Chapter 1 Introduction Nowadays. which feature very low switching times and therefore provide a way for hi-speed data transfer. The major optical communication standard IrDA and the principles of carrier-based optical communication are described in Chapter 2. 2 . Optical communication uses LEDs to transmit a specific pattern of data which is then received and decoded by an appropriate receiver. many of these systems are required to employ some form of communication interface for data exchange with the environment or with each other. some applications may benefit from using an optical data link. Chapter 4 provides test results of the system and Chapter 5 provides an comparison of optical and radio frequency wireless technologies. presumably due to their simplicity of use. Although dominated by radio frequency devices. In recent years. Chapter 3 covers the development of an embedded system using optical communication. as various embedded systems are being incorporated into a growing range of devices. The wavelengths of light sources used are usually located around 900nm and the receivers have appropriate matching spectral sensitivity peaks. such as wireless networking or Bluetooth. wireless technologies have grown in popularity.

the IrDA underwent several extensions and improvements. IrDA rev.Chapter 2 Optical communication standards In this chapter. For handheld electronic devices.1 Infrared Data Association (IrDA) The Infrared Data Association[1] is an industry-wide group. transmission of data frames when requested by IrLAP and also for changing communi3 . The IrDA set of standards was originally developed to allow for short-range data exchange without the need of interconnecting cables. because an UART is a standard periphery in most microcontrollers. IrDA rev. Each bit is encoded as a pulse present for logic zero and pulse absent for logic one. The standard quickly spread into many electronic devices. This makes IrDA SIR transmission very easy to use in embedded systems.1). The names of the founding organization (Infrared Data Association) and the physical port are commonly interchangeable. A framer may be considered a part of the physical layer.1 Physical layer The IrDA specification defines four different physical layer implementations. The framer is responsible for the reception of data frames and its presentation to the higher protocol layer (IrLAP). 1. In this work. the need for cables severely limited devices’ usability. IrDA rev. one start. For more detailed description of IrDA standards MIR and above.1) and VFIR (Very Fast InfraRed. only SIR specification is covered. founded to create an unified optical communication standard.1.g. no parity and one stop bit data frame. established in 1993. 1. TV remotes). such as PDAs. MIR (Medium InfraRed. The protocol set was also extended (while maintaining backwards compatibility with older devices). 2. 2. 1. please see the related sources in the References section[3]. FIR (Fast InfraRed. in the future a maximal speed of 100Mbps may be possible. Infrared Data Association (IrDA) specification and a carrier-based communication used in small control systems (e.4). These are SIR (Serial InfraRed. most recent additions are the IrSimple and IrSimpleShot protocols for digital images transfer between handheld devices and printers.0). The SIR physical layer uses return-to-zero bit encoding for the transmission and reception of infrared data. The maximal communication speed was increased from 115200bps in the original specification to a current maximum of 16Mbps. The frame format for one byte of data is a standard UART 8 databits. The pulse length is 3/16 of the selected baudrate with a minimum of 1. 1. Throughout its history. two major optical communication standards are described.63uS. IrPHY rev. most notably personal computers. portable digital assistants (PDAs) and cellphones.

2. The Normal Response Mode ends when the connected devices disconnect or the link has been broken for a sufficiently long time. The IrLAP protocol is a mandatory part of an IrDA compliant device. no communication between two Primary devices such as PDAs would be possible). Both the physical layer and the framer are mandatory layers of the IrDA specification. The Primary station is responsible for connection initiation and setup. embedded systems). 4 . O PTICAL COMMUNICATION STANDARDS Figure 2. idle (Normal Disconnect Mode or NDM in IrDA terminology) and connected (Normal Response Mode or NRM).1: IrDA SIR physical layer frame format cation speed based on IrLAP requests. required for overall IrDA connections management. The framer is the last IrDA layer dependent on hardware.2. such as personal computers or PDAs.g. However. the device monitors the IR media and upon detection of another device it negotiates the communication parameters and switches to NRM. Primary stations are usually devices with relatively large computing resources. higher IrDA layers are able to initiate data transmission regardless of being a Primary or a Secondary device. The Secondary station only responds to master commands.2 Link Access Protocol The Link Access Protocol (IrLAP) provides reliable data transfer for the upper layers and manages initial connection procedures such as device discovery and best possible communication speed negotiation. data flow management and link error recovery. the IrDA compliant device behaves either as a Primary (master) or a Secondary (slave) station.1. The distinction between Primary and Secondary stations ends at this layer. The IrLAP layer has two connection states. When in NDM. all Primary devices are required to be able to function as a Secondary device (otherwise. Secondary stations are usualy devices with limited resources (e. When communicating.

the Link Management Information Access Service (LM-IAS) and the Link Management Multiplexer (LM-MUX).3 Link Management Protocol The IrLMP layer of the IrDA specification consists of two parts. 2. an object exchange protocol · IrSimple. The LM-IAS provides a way for service discovery of the connected device. a protocol for wireless image transfer used in mobile phones Of particular concern for use in embedded systems is the IrCOMM protocol. single-chip solutions exist. Additionaly. an improvement of the original protocol set achieving higher transfer speeds · IrSimpleShot. 2. handling all of the IrDA communication on-chip and providing standard serial port interface (for example.2 Carrier-based communications Complementary to IrDA baseband communication (i. there exists a range of devices using some carrier frequency to optically transfer data. O PTICAL COMMUNICATION STANDARDS 2. a flow control mechanism for use above the IrLMP · IrCOMM. The LM-MUX is responsible for creating logical channels to each requested LM-IAS service over a single IrLAP connection.e. For each service a separate access point (Link Service Access Point. a cellphone would have some modem capability). MCP2150 from Microchip Technology). a legacy serial/parallel port emulation protocol · IrLAN. This optional IrDA layer allows for emulation of an standard RS232 serial port. Because the IrDA specifications are no longer public and are only available for purchase. most notably the television remote controls. the optional layers are covered only briefly. It is being widely used in systems not requiring high transmission speeds and focusing more on the transmission range. which is easily interfaceable to any modern microcontroller.4 Optional layers Above the mandatory layers. For more detailed description. this solution may be suitable for many simple data transfer applications. please see the related sources[3].1. a variety of extensions exist. which are accessible upon request by the connecting party. The extensions are: · TinyTP. wireless network attachment over IrDA · IrOBEX. The IrLMP is a mandatory part of an IrDA enabled device. The list of services has always at least one entry with device properties and IrDA device name.2. Each IrDA device has a list of supported services (for example. without carrier signal). 5 . LSAP) is created for use by higher protocol layers. Although not usable for time-critical tasks.1.

addressing information and command identification number. However.2 Data encoding There exist several data encoding schemes for carrier-based remote controls. A single data frame consists of a preamble. Figure 2. describing a one-way data transmission consisting of individual data frames. a standard RS232 frame timing may be used as well.2: Example of an carrier-based communication channel transmission The return-to-zero encoding is necessary due to the fact that the receiver usually contains an automatic gain control (AGC) circuit to atapt itself to changing ambient illumination levels.2. the transmitted signal would be “invisible”to the receiver after some time because the AGC circuit would consider it a part of the ambient illumination. 8-databit UART frame complies with the TSOP7000 requirements on pulse and separation lengths and therefore provides an easy to implement wireless optical communication. The carrier signal frequency ranges from tens of kilohertz to several hundred kilohertz. The information is represented by an return-to-zero PCM encoded signal. usually transmitted when a button is pressed or held for some time. With non-return-to-zero encoding. 2. inserting a single logical zero bit in the middle of a standard 19200bps. The speifications were originally developed for remote control of home appliances such as televisions and VCRs. a bit stuffing should be used to fulfill these requirements. O PTICAL COMMUNICATION STANDARDS 2. Most common are the Phillips RC5 and Sony RECS80. Being much easier to implement. For example. these encoding protocols are not necessary to use for wireless communication. Because the receivers usually have some requirements on burst duration and burst separation times.2.2.1 Physical layer The physical layer of an carrier based communication channel consists of a carrier signal modulated by a data signal. 6 . when using the TSOP7000[13] infrared receiver.

The individual blocks are described below. The board was designed to fit into the Hammond 1455C801 enclosure[15]. Because of the relative board complexity. 3. Surface-mount technology (SMT) was used where possible to minimize overall module dimensions. so some form of wired serial communication interface should be provided · the module should be small 3. the in-built autorouter did not perform very well and the board had to be routed manually.1 Design requirements The following requirements were followed during the design of the module: · the module must be easy to use · the module must use the USB communication interface for personal computer connection · the module must provide an IrDA compatible communication interface · the module should provide some form of an carrier-based interface · the module must provide a programming connector · the module should be usable without the USB-provided power supply · the module should be usable with a development board. 7 .Chapter 3 Simple test device To fulfill the thesis assignment. each performing some function of the module. a simple device was designed to demonstrate the technologies described above. The electronic components of each module are positioned on the board as close as possible to minimize track lengths and decrease the resulting electromagnetic interference. The possibility of the device being used in Digital Systems Architecture and Construction Laboratory was kept in mind during the development process. The device consists of several blocks.2 Hardware description The hardware was designed using EAGLE Layout Editor[19].

This microcontroller features 32kB of Flash memory. The microcontroller was connected in accordance with Atmel application note describing AVR hardware design considerations[6].1 Microcontroller block The module is based on an Atmel AVR RISC microcontroller. 8 . S IMPLE TEST DEVICE Figure 3.2. The device selected is ATMega324P[7]. 32 kilobyte device was selected to enable future firmware extensions.1: Render of the module (some components not shown) 3.3. 1kB of configuration memory and 2kB of SRAM. The periphery usage is as follows: · USART0 is available on the three pin connector · USART1 is connected to the IrDA transceiver · SPI is used for communication with the RFM12B radio module · INT2 triggers on incoming USB data · PCI1 triggers on SETUP button press · PCI2 triggers on incoming radio data · PCI3 triggers on incoming modulated carrier data · PORTA is used for USB communication · Timer1 output compare A is used for modulated carrier frequency generation · Timer0 is used for modulated carrier data signal generation and reception The microcontroller block also features three status LEDs and an Atmel ISP programming connector not shown in the schematic diagram. Although the Flash memory usage is not very high with the current firmware. The AVR family was selected for its C-optimized instrucion set and a relatively high computing power.

Using parallel interface. This is important to meet Universal Serial Bus power requirements in Suspended mode. a single-chip solution was preffered. it has some disadvantages over FT245R.4. After some research into each devices’ properties[9]. Although FT232R can be used with lower microcontroller I/O usage compared to the parallel interface. From the software point of view. therefore an USB interface was selected to connect the device to personal computer. where the maximal power consumption is limited to 500uA. The FT245R[8] is connected in default bus powered configuration with external logic power switching. Linux kernels 2. the FT245R device driver creates a virtual COM port. the FT232R requires the user application to implement a flow control algorithm to prevent data loss. the flow control is handled by proper usage of the RXF and TXF status flags.2: Microcontroller block schematic 3. FT245R was selected. FTDI also provides an MPROG utility to properly 9 .2 USB interface Most modern computers do not contain a RS232 serial port. Both the VBUS and GND signals are filtered with noise suppression filters to reduce electromagnetic interference coming out of the device through the USB connector. With the FT245R. S IMPLE TEST DEVICE Figure 3. In the end. Firstly. In addition to data connection.20 and above natively support the device.2. To comply with Universal Serial Bus specification. The Microsoft Windows drivers are royalty free and certified by Microsoft. two devices were considered for use: FT232R and FT245R from FTDI. therefore allowing a wide range of applications to connect to the device. the virtual COM driver baud rate settings are ignored and the device successfully operates irrespective of baud rate settings. the USB also provides power supply lines and so there is no need for an external power supply to power the device. although not mandatory. Secondly.3. the device must be correctly configured with a matching baud rate. to successfully establish a connection with the MCU.

Both MCP2120 and TFDU4100 are connected in accordance with the respective recommended application circuits.2.3: USB interface schematic 3.3 IrDA interface To allow for a simple way of transmitting and receiving IrDA physical layer data. such as manufacturer and product description strings and maximal power consumption. This device integrates a transmit LED diode and a receive PIN photodiode together with pulse shaping. The IC also features an internal baud rate generator using the external crystal.3. The MCP2120 from Microchip Technology is an IrDA encoder/decoder with standard UART interface and the option to select baud rate by software. so the need for an x16 UART clock signal is avoided. The MCP2120 is subsequently connected to TFDU4100 IrDA transceiver from Vishay. The SC(Sensitivity Control) pin selects between shorter range with higher immunity against ambient interference sources and longer range with worse noise suppression parameters. Figure 3. The sensitivity control is accessible through the experimental devices’ setup utility along with IrDA baud rate setting. For more information see devices’ datasheets. a dedicated integrated circuit was used. S IMPLE TEST DEVICE configure the FT245R parameters. 10 .

an average current of 100mA is obtained). Figure 3. output frequency of 454.4 Infrared transmitter The main part of this modulated carrier transmitter is the IRF7304 dual P-channel MOSFET transistor.54kHz can be generated.5: Modulated carrier transmitter schematic 11 . the current is limited to about 200mA(using MC CARRIER duty cycle of 50%. For the 455kHz TSOP7000 receiver. the device functions as a two-input AND gate (with both inputs inverted). Stopping waveform generation and setting both signals to high disables the transmitter.3. The LEDs used are TSHA5202.2. effectively creating a simple hardware AM modulator. The capacitors are used to provide supply current for the LEDs during transitions from OFF to ON and therefore to reduce EM interference.4: IrDA interface schematic 3. In this configuration. using no prescaling and Timer 1 overflow value of 22. S IMPLE TEST DEVICE Figure 3. The MC CARRIER signal is generated using MCUs’ Timer1 in waveform generation mode. The MC TX signal is the data signal for the transmitter.

The transceiver features programmable frequency and low turnaround times (from transmit to receive mode and vice versa) so as to allow for frequency hopping applications.6: Modulated carrier receiver schematic 3.2kbps. The antenna output impedance is 50Ω. 12 .2. similar to the TSOP17xx family of remote control receivers. Scientific & Medical) band.6 ISM radio frequency module Although the experimental device is primarily aimed at providing infrared communication interfaces. The module requires a 3. The electrical design is simple. the device may be replaced.2. where an dedicated interrupt vector on pin change is used to trigger sampling of the incoming asynchronous data. should the need for different carrier frequency arise. The module operates in the 868MHz ISM (Industrial. an low-cost radio transceiver was incorporated into the design. However. to create a more flexible platform and increase the utilization of the microcontroller. Figure 3.3V power supply voltage which is provided by an LE33 lowdrop voltage stabilizer. The RFM12B[11] from Hope Microelectronics is a low-cost 10mW radio transceiver with SPI interface and data rates up to 115. S IMPLE TEST DEVICE 3. Because the TSOP7000 is pin compatible with standard remote control receivers from Vishay. being operated at 455kHz. the capacitors together with R3 are used to improve power supply stability and R6 is used to reduce output signal rise time.3. the device allows for significantly higher data rates (20kbps compared to 2400bps when using receivers with carrier frequencies around 40kHz) with similar ranges. The RF output is routed to an SMA connector for an external antenna connection. The output of the TSOP7000 is directly connected to the AVR MCU port D.5 Infrared receiver The TSOP7000 device is a 455kHz infrared receiver from Vishay Semiconductors.

two 256 byte fixed size buffers were implemented. two circular buffer structures were used to buffer the data streams. The ASIX Presto[18] USB programmer was used to upload the firmware into the AVR microcontroller. The setup utility is an terminal-accessible part of the firmware.3 Software description The firmware of the module was programmed using ATMEL AVRStudio[16] software development kit with WinAVR[17] compiler plugin installed.3. Firstly. the read and write operations on 13 . S IMPLE TEST DEVICE Figure 3. To ensure correct operation of the buffer. Because the interfaces may have different speed settings. configure interface hardware parameters. the buffer must not be read when empty and thirdly.3. The main function of the module is to transfer data between two currently binded interfaces. responsible for user configuration of the module. Due to the limited SRAM resources of the AVR microcontroller. The configuration utility may be executed by pressing the SETUP button located on the printed circuit board next to the USB connector. 3. some form of data buffering was required. It was assumed that only two interfaces at a time will be used. The circular buffer is an memory structure used for buffering of data between two communicating processes. ISM radio and RS232 (operating with TTL-compatible logic levels). save settings and reboot the system to resume normal operation. IrDA.1 Main features The module offers a total of five communication interfaces. three conditions must be met. This utility allows the user to select which interfaces to bind. These are USB. The circular buffer may have fixed size or may be resized when necessary. After some research. The interfaces to bind may be selected via the setup utility.7: Radio interface schematic 3. secondly. the buffer must not be written when full. MC (modulated carrier).

S IMPLE TEST DEVICE Figure 3. Following is an application walkthrough describing the main parts of the firmware. Data transmission is realized in the main program loop. 14 .3. buffer write operations are performed in interrupt handlers.8: Circular buffer principle the buffer must be atomic. 3. usb_buffer_dest_ptr = buffer_2. usb_buffer_src_start_ptr = &buffer_1_start.3. When the application is aware of what interfaces are requested by the user. And enables the requested interfaces. usb_buffer_dest_fcnt_ptr = &buffer_2_fillcount. usb_rx_active_buffer_full = 0. the module configuration is loaded from the microcontroller EEPROM memory. The first and second conditions are checked by an dedicated fill count variable and the third one by simply disabling and then reenabling interrupts when performing buffer read/write operations. sizeof(configuration)). 0. usb_buffer_dest_end_ptr = &buffer_2_end. EIMSK = (1 << INT2). The program performs basic I/O ports configuration to ensure correct pin input/output settings. EICRA = 0. DDRB = (1 << PORTB3)|(1 << PORTB4)|(1 << PORTB5)|(1 << PORTB7). it configures the circular buffer pointers for each interface. Then. PORTB = (1 << PORTB0)|(1 << PORTB3)|(1 << PORTB5). usb_buffer_src_ptr = buffer_1.2 Application walkthrough The main application starts when the device is powered up. eeprom_read_block(&configuration. Because the data on each interface is received asynchronously. usb_buffer_src_fcnt_ptr = &buffer_1_fillcount.

case 2: if_uart_transmit().(1 << PORTB3). case 5: if_radio_transmit(). break. PORTC |= (1 << PORTC3). PORTB &= 255 . S IMPLE TEST DEVICE Buffer variables are initiated. setup(). break. } } if (enter_setup == 1) { cli(). buffer_1_start = 0. case 3: if_irda_transmit(). break. *usb_buffer_dest_fcnt_ptr = *usb_buffer_dest_fcnt_ptr + 1. And the program jumps into the main loop. break. break. buffer_1_end = 0. usb_buffer_dest_ptr[*usb_buffer_dest_end_ptr] = temp. } } When data arrives on an interface. Interrupts are enabled. break. case 4: if_mc_transmit(). sei(). case 4: if_mc_transmit(). buffer_2_start = 0. EIMSK = 0. it is processed by an interrupt handler and stored into the respective interface buffer. 15 . if (*usb_buffer_dest_fcnt_ptr == 256) { usb_rx_active_buffer_full = 1. case 5: if_radio_transmit(). break. case 3: if_irda_transmit(). asm volatile ("NOP"). } } if (buffer_2_fillcount > 0) { switch (configuration. break.interface2) { case 1: if_usb_transmit(). PORTB |= (1 << PORTB3). temp = PINA.3. ISR(INT2_vect) { uint8_t temp. *usb_buffer_dest_end_ptr = (*usb_buffer_dest_end_ptr + 1) & 255. break. buffer_2_fillcount = 0. while (1) { if (buffer_1_fillcount > 0) { switch (configuration. case 2: if_uart_transmit(). buffer_2_end = 0. buffer_1_fillcount = 0. the main loop is aware that there is some data in the buffer. break. } } After the return from the interrupt handler.interface1) { case 1: if_usb_transmit(). asm volatile ("NOP").

setup()..interface2) { case 1: if_usb_transmit(). while (1 == 1). cli(). . *irda_buffer_src_start_ptr = (*irda_buffer_src_start_ptr + 1) & 255.1. case 4: if_mc_transmit(). S IMPLE TEST DEVICE if (buffer_2_fillcount > 0) { switch (configuration. . case 2: if_uart_transmit(). case 3: if_irda_transmit(). the system is reset using the watchdog timer. PORTC &= 255 . break. if (usb_rx_active_buffer_full == 1) { usb_rx_active_buffer_full = 0.. } } And so the data is transmitted by the appropriate interface transmit function. the interrupts are disabled and the setup utility is entered. UDR1 = irda_buffer_src_ptr[*irda_buffer_src_start_ptr]. case 5: if_radio_transmit(). 16 . wdt_enable(WDTO_1S). while (!(UCSR1A & (1<<UDRE1))) {}.. *irda_buffer_src_fcnt_ptr = *irda_buffer_src_fcnt_ptr .\n").. cli(). printf("\nRebooting . printf("\n\n"). The application does not return from the setup utility back to the main loop. break.. Instead. printf("=======================\n\n"). Optionally. printf("Communicator setup menu\n"). EIMSK = (1 << INT2).3. break. } sei().(1 << PORTC3). break.. break.

Among the binary data of the query. The test setup for each experiment and obtained results are described below. Two devices were tested with the module. This suggests that the module is indeed compatible with standard IrDA enabled devices. both the cellphone (“SIEMENS S65”) and notebook (“HEX”) IrDA names were correctly received. IrLAP discovery queries were received by the Hyperterminal application. each connected to a separate PC using the USB interface. 17 .2 Data integrity test This test checked the correct data transfer through the module. The only difference was that the transmitting Hyperterminal was configured to append Carriage Return (CR) symbols after Line Feed (LF). two modules were used. A As a source of data was used the L TEX source code of this thesis having at that time 26210 bytes. The tests checked whether the device is compatible with standard IrDA physical layer and if the module transfers data correctly even when overloaded.1 Basic IrDA PHY compatibility test The Infrared Data Association physical layer compatibility was checked by listening to device discovery requests by standard IrDA devices. an Siemens S65 cellphone and an Fujitsu Siemens C1020 notebook. Both modules were configured with the same parameters as above. To check for full match. an MD5 hash utility was run on both files.Chapter 4 Verification of functionality Simple tests were performed to test the functionality of the designed module. When the respective IrDA ports were enabled and placed in close proximity of the IrDA receiver on the module. The module was configured to bind USB and IrDA interfaces and the IrDA speed was set to 9600bps. After the transmission from one module and the reception of data by the other one. 4. 4. The modules were placed about one centimeter apart with the IrDA transceivers properly aligned so as to prevent range limits and receiver noise from affecting the test results. A standard Microsoft Windows Hyperterminal utility was used to connect to the COM port. both source and received file had same sizes. This time. producing same hash results. This was done because Hyperterminal defaults to discarding CR symbols from the input stream. the Hyperterminal applications likewise. The virtual COM port created by the FT245R drivers was configured to 921600bps with hardware flow control. This is the speed at which the IrLAP device discovery takes place.

this fact being confirmed by the red status LED (buffer full condition) on the device. Therefore correct hardware flow control was demonstrated (the buffer full condition successfully propagated through the USB interface and virtual COM port drivers to Hyperterminal). The file size was large enough to fill the USB incoming data buffer of the module (parallel USB interface operates significantly faster than IrDA at 9600bps).4. this test had shown that the data buffering functions are correct. It may be concluded from this test that the data transmission control and data buffering are reliable. 18 . V ERIFICATION OF FUNCTIONALITY Most importantly.

However. speed. radio frequency devices usually provide higher ranges than optical interfaces. For this transmission range. only the transmission distance is an issue. For the optical wavelengths. both IrDA and carrier-based optical interfaces may be considered a short-range communication.Chapter 5 Comparison of optical and radio frequency technologies Although the field of wireless communications is dominated by radio frequency devices. For example. whereas the RFM12B radio module is capable of communicating over hundreds of meters in the open air[11]. ZigBee[22] and a collection of custom RF modules. Where transmission security is of particular concern. because for electromagnetic radiation with frequencies in the RF band most non-metallic objects are semitransparent. electric motors. there exists a variety of RF alternatives. because the devices must be correctly positioned to communicate. Both technologies are prone to interference from sources emitting electromagnetic noise on wavelengths similar to the frequency ranges used. optical communication is more suitable than radio frequency technology. Considering usable transmission distance. obstacle surpassing. care must be taken when designing the system to ensure visibility (or sufficient reflection from surroundings) between the communicating parties. offering speeds up to 16Mbps[21]. Obstacle surpassing is much better in devices utilizing RF technology. Radio frequency devices are more susceptible to noise from power grids. This also limits the use of optical technology in handheld devices. parameters such as transmission distance. security. computers and other simi19 . Let’s take a look at some of the advantages and disadvantages of both technologies. With RF based design. interference immunity or price may be considered. The following paragraphs compare these parameters of both technologies (only commonly available devices are used for comparison). Both technologies allow for range extension with external optics/antennas (e.g. Most infrared transmitters are strongly directional and therefore make eavesdropping on an optical channel much harder than on almost omnidirectional radio link. the TSOP7000 device integrated in the module allows for transmission distance of several tens of meters[13]. Assuming no external optics added to the transceivers. Speed ranges of both technologies are approximately the same. infrared optical communication may be used with the same or better resulting parameters compared to RF-based solution. RONJA[20]). in some applications. This parameter is difficult to compare because both technologies are continuously being upgraded. For example. Most low-power radio modules feature speeds up to several megabits per second [23] and IrDA FIR physical layer offers the same range[1]. such as Bluetooth[23]. IrDA VFIR transceivers are currently available for sampling from Vishay. Both optical and radio frequency devices have a set of parameters affecting the choice of optimal design solution.

For low speed wireless communication. an oneway optical data link may be designed for as low as CZK 24 (using L-53F3BT infrared LED and TSOP4838 receiver. C OMPARISON OF OPTICAL AND RADIO FREQUENCY TECHNOLOGIES lar sources. but not least is the price factor. Therefore the operating conditions must be taken into account when selecting the optimal technology. whereas optical communication may be disrupted by fluorescent tubes. price source same as above). prices for single quantities from TME[24] at the time of writing this thesis). from the Sun). this link operates at much higher speeds. however.g. HID lamps or by simply too much light saturating the receiver (e.5. Last. 20 . The cheapest radio link may be created for CZK 158 (RFM01 and RFM02.

Some of the interfaces provided by the module have not yet fully finished software implementations. the crystal reference of the MCP2120 encoder/decoder may be replaced to allow for communication speeds up to 312. The IrDA overview research was somewhat difficult due to the fact that the official specifications are no longer freely available and are only provided for a fee. Should the need arsise. A comparison of optical and radio frequency technologies was performed. This could be more optimal solution considering that the majority of the provided interfaces is only half duplex and the incorporated radio module has frequency hopping support. The test device was designed to provide a simple platform for infrared communications development. the firmware can be modified. Both technologies are present on the test device for possible future wireless communications development. Of course. 21 . However. all of the interfaces share the same data transmission algorithm verified by the testing and therefore it may be reasonably expected the implementations will have the same correct behavior. If higher IrDA interface speeds are required. The application may be rewritten to use packet communication instead of simple data forwarding. However.Chapter 6 Conclusion This work provided an overview of current optical communication methods together with an embedded system example design utilizing these technologies as requested by the official assignment. The device was extended with the radio communication module.5kbps. the development continues. the IR signal timing would not meet IrDA requirements for minimal pulse duration. with this modification. The onboard microcontroller has enough memory capacity to make the implementation of (some layers of) IrDA protocol stack possible. Basic transmission parameters were tested and correct operation verified. Therefore best effort was made to cross-reference other available sources.

vishay. part 1 [online].edu/charlatans/References/Overview. [cited 2008-05-21]. URL: http://ww1.W. URL: http://www.. Infrared Data Association. [cited 2008-05-21].mse.pdf.pdf.ftdichip. [cited 2008-05-21].. Megowan.pdf. [11] Hope RF: RFM12B device datasheet [online].Bibliography [1] Infrared Data Association official website [online]. [7] Atmel Corporation: ATMega324P MCU device datasheet [online].D.J. URL: http://www. part 2 [online]. Documents/AppNotes/AN232-04. [9] Future Technology Devices International Ltd.pdf. URL: http://www.microchip. [10] Microchip Technology Suwak. [8] Future Technology Devices International Ltd. [cited 2008-05-21].: MCP2120 device datasheet [online]. Hope RF.pdf. [cited 2008-05-21].com/docs/82504/protocol. Ch.pdf. Future Technology Devices International Ltd. (FTDI): FT245R device datasheet [online]. (FTDI): FT8U232/FT8U245 Devices Latency and Data Throughput Application Note [online]. com/dyn/resources/prod_documents/doc2521. Atmel documents/ SES Technology R&D group.pdf.atmel.vishay. URL: http://www. Microchip Technology Inc.atmel. [3] SES Technology: Introduction to the IrDA Protocol [online].com/downloads/ en/DeviceDoc/21618b.ftdichip. URL: http://www. Vishay Electronic [4] Vishay Electronic GmbH: Infrared Data Communication According to IrDA Standard. Future Technology Devices International Ltd. Knutson: IrDA Infrared Communications: An Overview [online]. [cited 2008-05-21]. Atmel Corporation. [5] Vishay Electronic GmbH: Infrared Data Communication According to IrDA Standard. Counterpoint Systems Foundry. [cited 2008-05-21].irda. URL: http: //www. 22 . Vishay Electronic GmBH. [cited 2008-05-21].org.. URL: http: //www.hoperf.pdf. [cited 2008-05-21]. [cited 2008-05-21]. [2] P. URL: http: //www.palantirisystems. URL: http://www. URL: http: //dogbert.pdf. [6] Atmel Corporation: AVR042 application note: AVR Hardware Design Considerations [online]. [cited 2008-05-21].com/ publications/IntroductiontoIrDA.

C ONCLUSION [12] Vishay Electronic GmbH: TFDU4100 IrDA transceiver device datasheet [online]. [23] Bluetooth SIG official website [online].irf..cadsoft. [cited 2008-05-21]. ASIX URL: http://www. [cited 2008-05-21].o.: EAGLE.asp?tool_id= 2725. [19] CadSoft Computer. [18] ASIX s. [cited 2008-05-21]. URL: http://www.atmel.zigbee.vishay. Hammond Manufacturing Co. Inc. [14] International Rectifier: IRF7304 device datasheet [online]. [17] WinAVR. 23 . Products and/or technologies referenced in this work may be registered trademarks of their respective tsop7000. Atmel Corporation.r.farnell. [cited 2008-05-21]. URL: http: //winavr. URL: http://www.r. Inc. [cited 2008-05-21].6. Vishay Electronic GmBH. com/docs/82147/ tfdu8108. [cited 2008-05-21].bluetooth.sourceforge. Inc.tme. URL: http://www. Zigbee [cited 2008-05-21]. [cited 2008-05-21]. URL: http://www.. cited [cited 2008-05-22]. freeware PCB design tool. [cited 2008-05-21].com/ datasheets/71889.: 1455C801 enclosure datasheet [online]. URL: http://www. [cited 2008-05-21]. Vishay Electronic GmBH.: ASIX Presto USB programmer. URL: [21] Vishay Electronic GmbH: TFDU8108 VFIR device datasheet [online]. [15] Hammond Manufacturing Co. URL: http://www.htm. [16] Atmel Corporation: Atmel AVR Studio. CadSoft Computer. International Rectifier. [13] Vishay Electronic GmbH: TSOP7000 receiver device datasheet [online]. URL: [24] Transfer Multisort Elektronik (TME) e-shop [online].vishay. URL: http://www.o.. open source software development tools. [cited 2008-05-21].pdf. URL: http://www. data/ Karel Kulhavy et al. [cited 2008-05-21]. [22] ZigBee Alliance official website [online]. Vishay Electronic Bluetooth SIG. URL: http://www.pdf. [20] Karel Kulhavy et al: Reasonable Optical Near Joint Access (RONJA) TME Czech Republic s..

Appendix A Test device schematic 24 .

Appendix B Contents of the enclosed CD · PDF version of this thesis · hardware project files.12 SP4/WinAVR · datasheets of components used · ftdi device drivers 25 . AVR Studio 4.16r2 Light · firmware source code. EAGLE 4.