Friday 12 April 2013

Wireless Technology


Wireless Technology

Electronic devices traditionally communicate through physical wired connections. Alternatively, in some situation where physical connection is not possible due to environmental restraints, there are several cordless methods to transfer information. The most common method to transfer data wirelessly is using various radio frequencies. In practical designs, the radio frequency range is determined by the application. For example, application that requiresa faster transfer rate and long distances would usea higher frequency range such as Wi-Fi technology, which operates at 2.4 or 5 GHz. In short range applications, a low frequency range device would be more preferable due to less energy consumption, such as television remotes and remote controlled gadgets.

Application

A wireless communication device is used to provide the connection from the measurement unit to the data collection system. A microprocessoris required to control the data flow of the measurement unit. Prior to transmission, the microprocessor is responsible for calculating andencoding of any data obtained from the peripheral attached to it. When the encoded message is ready to be transfer, it will be passed on to the transmitter. The digital signal will be delivered to a receiver on the data collection system. Subsequently, a second microprocessor will be needed to decode the signal retrieved and the processed data will be ready for use after decoding.



  Component Selection


There are wide varieties of wireless devices available in the market today, such as Wi-Fi, Bluetooth, Infrared, Cellular and Radio frequency. A several factors should be considered for determining appropriate wireless module.Majority of wireless devicestransmission range are dependent on the amount of input power available. However, energy consumption is a major concern for this project.Hence, seeking a low power usage wireless chip that could also maintain necessary performance would increase the operation time of the measurement system.


Several example mention above regarding feasible wireless options available, but the most suitable technology found fit for this project is the radio frequency (RF). Precisely, the low frequency RF devicescan be found in many forms and sizes. Since this project only requires transmitting information over a short distance, using the XBee series 1 chip would be sufficient. The XBee RF module is composed of both transmitter and receiver, also known as transceiver. It hastransmission ranges up to 30 meters with obstacles within path or up to 100meters with direct line of sight.

This typical specification for XBee chip is 3.3V at 45mA for transmission, which is about 148.5mW per transmission. For estimation purposes, the data transmission from the measurement system to the data collection unit is set to every 5 seconds. It would consume about1.78W per minute. In comparison,the approximate duration of hypocycloid pattern amusement rides is about 2.5 minutes, which is about 4.46W per ride duration.This consumption rate is estimated base on rated specifications. When implementing, the transmission may be adjusted to fit the project needs and the actual energy consumption may be less. Since the energy usage is dependent on the data transmission rate, adjusting the amount of transfer relative to battery level would be a solution to lower energy consumption.

Hardware Operations

The XBee RF module is a Universal Asynchronous Receiver/Transmitter (UART), which translatelogic level asynchronous serial signal into readable data.The signal transmitted in 8 data bits and a stop bit by alternating signal voltage levels to compose zeros and ones. The figure 5.4.1 shows an example of UART data packet transmission of a decimal number “31”. The signal remains high during idle, transmission of one bits and stop bit. On the other hand, the signal becomes zero when initializing the start bit and transmission of zero bits.



The serial transmission of data is limited to 8 bits and receiver/transmitter buffer size.Hence,hardware flow control can be implemented to prevent loss of data due to memory overflow. The figure 5.4.2 shows the internal data flow diagram of an XBee module.



When flow control is enabled, the incoming data from the microcontroller will remain in the data in (DI) buffer until it can be processed. The CTS outputs a low signal notifying the host, it is clear to send; otherwise a high signalwould initiate a stop when DI buffer has less than 34 bytes of memory. Similar approach is used for the data out (DO) buffer to control data flow with RTS (request to send).

To simplify programming schemes, some designers prefer to eliminate the use of flow control. This technique is possible if the sending message is smaller than the DI buffer size (about 202 bytes) and interface at a lower baud rate. More details on for buffer overflow prevention can be found in page 12 of the XBee product manual.



XBee Configuration


The XBee RF module can be configured using X-CTU program, which is only available on windows operating systems. In this project, the prototype only demonstrates communication from a single measurement unit to the data collection unit. Therefore, the XBee device can be setup as a peer to peer. The XBee can be connected to the PC using an XBee explorer USB and X-CTU program can configure it through serial USB port.

Connect the XBee module with the XBee explorer into the USB port of the PC. Select the “PC setting” tab and choose the corresponding COM port. By Clicking on test/query button, the program will verify the connection between the PC and XBee. However, in order to establish the connection, the correct baud rate for the XBee device must be selected (note: default XBee baud rate is at 9600).


The next step is to choose the XBee communication settings, under the “modem configuration” adjust the settings for receiver and transmitter XBee as follows. There is also an option using application-programming interface (API), but in this prototype the XBee are configured to operate in transparent mode.


XBee #1
XBee #1
Channel
13
Channel
13
PAN ID
8788
PAN ID
8788
DH
0
DH
0
DL
10
DL
11
MY
11
MY
10
Baud (BD)
9600
Baud (BD)
9600
            

Implementation

The measurement unit and data collection unit both require a microcontroller to act as the host to process the data prior to transmission or receiving. The microcontroller used in the measurement unit is the PIC24FJ128GA010 chip and the data collection unit is the Arduino Mega.

PIC24 Microcontroller



The asynchronous serial communication requires an accurate calculation of the baud rate for the data to be transferred and decrypted on the receiver. The baud rate of the serial communication is dependent on the clock frequency and the number of bit period. The UART module inside the PIC24 includes a dedicated baud rate generator, which calculates the baud rate by the following equation.

UART baud rate with BRGH = 0 (16 clock per bit period)





UART baud rate with BRGH = 1 (4 clock per bit period)



Both equation based on FCY = FOSC/2; Doze mode and PLL are disabled. More details on baud rate calculation can be found in the PIC24FJ128GA010 family data sheets.

Since the baud rate is very depended on the oscillation frequency of this chip, the serial communication requires a steady oscillator to operate properly. Although, this chip has an internal oscillation, the oscillator is affected by temperature. For this reason, an external oscillator is more preferable as it can provide a much more reliable clock frequency. There are several types external clock available in the market, such as external clock, external oscillator, ceramic resonators and external oscillator with RC circuit.

0 comments:

Post a Comment