SlideShare a Scribd company logo
1 of 94
Download to read offline
i | P a g e
University of Greenwich
School of Engineering
Declaration of Originality
I, the undersigned, declare that the work contained within this report is completely my
own. Any material that has not been originated by me has been clearly referred.
Name: .................................................................................................
Signature: .................................................................................................
Date: .................................................................................................
ii | P a g e
ABSTRACT
Wireless communication has revolutionized the concurrent communication industry. Its
applications range from satellite transmission, radio and television broadcasting to mobile
phone. This project is aimed to create wireless hubs by using digital radio transmitter and
receiver and these hubs should be capable of communicate wirelessly in-between them. It
also intended that these hubs or short range devices will have mesh interconnection
capability. To achieve these purposes a small system in a form of PCB (Printed Circuit
Board) was designed and implemented containing Radio Module (ER400TRS), USB
interface (MM232R) and Microcontroller (PIC18F1320). ER400TRS made it possible to
employ a license-free carrier frequency like pan-European 433.05-434.79 MHz band.
MM232R was used to provide the communication link between PC and node, PIC18F1320
was chosen for its better performance. To fulfil the requirements of output and digital
inputs, LEDs and Switches were implemented.
The important part of this project was the transfer of packets of messages from one node or
PCB to another node and when three nodes were used they were organised in a straight
line so that the two end nodes cannot communicate directly with each other. To determine
how close nodes would need to be the signal strength against distance apart was critically
investigated by using existing PCB with a USB link and ER400TRS. Next was the
development of the appropriate hardware and software, for each node. Once it was done a
number of simple test were done to check the inputs/outputs, MM232R communication
with the PC and bi-directional communication using ER400TRS. Each test required a
compiler to compile the C code into a PIC readable format and a PIC programmer to burn
the program into the PIC. More or less, the deliverables and objectives of this project were
achieved by implementing bi-directional communication of messages between three nodes
or hubs.
iii | P a g e
ACKNOWLEDGEMENT
I would like to thank number of personalities for their support and encouragement
throughout the duration of this project.
First of all I would like to thank my respected Supervisor Dr. R. C. Seals of School of
Engineering, University of Greenwich for initiating this project and for his continuous
help, support and patience. Special thanks to Mr. A. Feasy who always had the time and
motivation to help during the lab session.
I would also like to thank my family and friends for their support during this time, without
which it would have not been possible for me to achieve this goal.
Finally I dedicate this project to my family.
iv | P a g e
Table of Contents
Declaration of Originality.......................................................................................................i
ABSTRACT ..........................................................................................................................ii
ACKNOWLEDGEMENT................................................................................................... iii
CHAPTER 1.........................................................................................................................1
Introduction ...........................................................................................................................1
1.1 Introduction.............................................................................................................1
1.2 Aims and Objectives...............................................................................................2
1.3 Project Deliverables................................................................................................3
1.4 Project Constraints..................................................................................................3
CHAPTER 2.........................................................................................................................4
Literature Review ..................................................................................................................4
2.1 Communication System...............................................................................................4
2.2 Microcontroller System...............................................................................................7
2.3 Design of Printed Circuit Board ..................................................................................7
CHAPTER 3.........................................................................................................................8
Requirements Analysis......................................................................................................8
3.1 Components Requirements Analysis...........................................................................8
3.2 Design Requirements Analysis....................................................................................9
3.3 Construction Requirements Analysis ..........................................................................9
3.4 Programming Requirements Analysis.......................................................................10
3.5 Final to do list............................................................................................................10
3.6 Testing Schedule .......................................................................................................11
CHAPTER 4.......................................................................................................................12
Possible Solutions............................................................................................................12
4.1 Communication System Solutions ........................................................................12
4.1.1 Node to Node Communication.......................................................................12
4.1.2 Communication between Node to PC ............................................................14
4.2 Microcontroller Solutions......................................................................................15
4.2.1 Basic Stamp 2 (BS2) IC..................................................................................15
4.2.2 Programmable Logic Control.........................................................................15
v | P a g e
4.2.2 Atmel ..............................................................................................................15
4.2.3 Microchip .......................................................................................................16
4.2.4 Selected Microcontroller ................................................................................16
4.3 Programming Solutions.........................................................................................17
4.4 PCB construction solution.....................................................................................18
4.4.1 Types of circuit board.....................................................................................18
4.4.2 Schematic and PCB design software..............................................................18
4.4.3 Drilling Methods ............................................................................................19
4.4.4 Soldering Methods..........................................................................................19
CHAPTER 5.......................................................................................................................20
Problem Implementation .................................................................................................20
5.1 Hardware implementations....................................................................................20
5.1.1 Circuit design by ISIS ....................................................................................20
5.1.2 Layout design by ARES .................................................................................23
5.1.3 List of Components ........................................................................................25
5.1.4 Drilling and soldering components.................................................................26
5.1.5 Identifying Node Distance..............................................................................28
5.2 Software Implementation ......................................................................................29
5.2.1 Test Plan 1 ......................................................................................................30
5.2.2 Test Plan 2 ......................................................................................................32
5.2.3 Test Plan 3 ......................................................................................................34
5.2.4 Test Plan 4 (Final Code).................................................................................34
5.2.5 Settings for Communication Test...................................................................38
CHAPTER 6.......................................................................................................................39
Results .............................................................................................................................39
6.1 Test Plan 1 Results ................................................................................................39
6.2 Test Plan 2 Results ................................................................................................41
6.3 Test Plan 3 Results ................................................................................................43
6.4 Test Plan 4 (Final Code) Results...........................................................................44
6.4 Testing Schedule ...................................................................................................47
CHAPTER 7.......................................................................................................................48
Discussion........................................................................................................................48
7.1 Discussion of Results ............................................................................................48
vi | P a g e
7.2 Discussion of Gantt chart ......................................................................................49
CHAPTER 8.......................................................................................................................50
Conclusion.......................................................................................................................50
CHAPTER 9.......................................................................................................................51
Future Work.....................................................................................................................51
REFERENCES ..................................................................................................................52
BIBLIOGRAPHY..............................................................................................................55
APPENDIX 1 .....................................................................................................................56
Header file code...............................................................................................................56
APPENDIX 2 .....................................................................................................................58
Test Plan 1: LED testing code.........................................................................................58
APPENDIX 3 .....................................................................................................................60
Test Plan 1: SWITCH testing code..................................................................................60
APPENDIX 4 .....................................................................................................................62
Test Plan 2: MM232R Transmission test code................................................................62
APPENDIX 5 .....................................................................................................................64
Test Plan 2: MM232R Reception test code.....................................................................64
APPENDIX 6 .....................................................................................................................68
Test Plan 3: ER400TRS test code and flow chart ...........................................................68
APPENDIX 7 .....................................................................................................................73
Test Plan 4: Final Code ...................................................................................................73
APPENDIX 8 .....................................................................................................................83
Components Order From.................................................................................................83
APPENDIX 9 .....................................................................................................................84
Gantt Chart ......................................................................................................................84
APPENDIX 10 ...................................................................................................................85
More project images........................................................................................................85
1 | P a g e
CHAPTER 1
Introduction
1.1 Introduction
One of the fastest growing fields of engineering world was Wireless communications. This
is the modern shape of physical wire communication Medias. Advancement of this
wireless technology was at peak in this century. New inventions of wireless
communication devices are happening day by day [1]. Existing devices are also
performing well. Research and development on wireless devices are also at peak. In simple
words a revolution of wireless communication has started [13]. Wireless communication
was the core theme of this project.
Wireless communication can be via radio frequency or microwave or infrared (IR) short
range communication. This project was using radio frequency for wireless communication
within the short range. In this project communication was in between adjacent buildings on
the Medway campus using Easy-Radio style digital radio transmitter and receiver modules.
The Easy-Radio style provides high performance, simple to use radio module that can bi-
directionally transfer data over a range up to 250m Line of Sight (LOS) [4]. This project
contained specific primary components to make the system work properly. These are
broken down into four simple components like data signal (computer interface or USB),
radio transceiver, microprocessor and Antenna system. In addition to being able to
communicate, it must also have a mesh interconnection capability. Initially communication
will be by sending single ASCII characters and then using the file transfer protocol.
Mainly this system required to have some form of intelligence such as PIC microprocessor
system in order to fulfil the requirements of this project.
2 | P a g e
Figure 1.1: System block diagram.
1.2 Aims and Objectives
To design and develop a short range intelligent digital radio wireless hub was the main
goal of this project. This hub must be able communicate between adjacent buildings on the
Medway campus using digital transmitter and receiver modules (Easy-Radio). It also must
have some interfacing capability like four LEDs for output and four digital inputs, a local
USB interface and also mesh interconnection capability. For example, if one of the hubs
was placed into Hawke building and the other hub is on the Pembroke building of the
campus, messages could be passed from hub to hub to provide bi-directional
communication between them. To achieve the goal which is stated above the following
objectives have been set:
 To research and investigate about issues in wireless technology and radio
frequency communication using a microcontroller.
 To have a details idea about the digital radio transmitter and receiver modules, PIC
microprocessor systems and mesh topology.
 To make Tx and Rx.
 To familiarise with the present technology to create three wireless hubs using Easy-
Radio Transceiver.
 To integrate all the required knowledge to a single design and to build the printed
circuit boards for the three Hubs and to test it.
PC 1 PC 3PC 2
HOST (A) HOST (B) HOST (C)
Radio
Transceiver (A)
Radio
Transceiver (B)
Radio
Transceiver (C)
3 | P a g e
1.3 Project Deliverables
The main objective of this project was to build three circuits which would have radio
module, USB interface and a microcontroller. These are the core components for final
digital wireless hub. Key areas of this project are as follows:
 Design and implement more than two small systems containing a Transceiver
(Radio module), USB interface and a Microcontroller.
 Implement bi-directional communication of ASCII characters between two hubs.
 Implement bi-directional communication between more than two hubs arranged in
a straight line of maximum error free communication distances.
1.4 Project Constraints
The following two major constraints were taken into consideration for the project.
 Lack of manpower: It was the aim that the cost of each PCB (Printed Circuit
Board) for the system would be as low as possible as many of them would be
made. It was planned to construct three PCBs within the limited cost which helped
to prove mesh interconnection capability. It was impossible to attend three nodes at
a time while testing. But this constraint was overcome by the help from author‟s
colleagues.
 Time: There was a limitation of time for carrying out the practical lab based work.
Because the project labs were closed at the end of July‟11 for the summer vacation.
Weekly lab work and meeting with the supervisors helped in completing the lab
based tasks on time.
4 | P a g e
CHAPTER 2
Literature Review
Good amount of work has been carried out by a number of engineers and researchers in the
field of digital radio wireless communication over a short range. This literature review
summarized what has been understood about wireless communication, digital radio
communication, short-range communication and its applications, Mesh interconnection
topology, Microcontroller, USB interface (MM232R), different steps for designing the
PCB and synchronous/asynchronous serial communication through the study of books,
past research papers, journals, datasheets and website information. Thematic analysis was
done and three specific themes were decided. They are Communication System,
Microcontroller System and Design of Printed Circuit Board.
2.1 Communication System
Wireless communication is the fastest growing part of the current communication
industry because of its widespread deployment. It was first developed in the pre-industrial
age [12]. Those systems used to transmit information over line-of-sight distances using
smoke signals, flashing mirrors. Wireless networks, both as stand-alone systems and as
part of the larger networking infrastructure. There is a gap between current and emerging
systems and the vision for future wireless applications shows that much work needs to be
done to make this vision a reality [1].
Digital radio communication means the analogue signal is digitized into zeros and ones
and then compressed and transmitted using a digital modulation scheme [1].
Communication across a wireless network is like a two-way radio communication. The
signal is transmitted into the open air, using an antenna which radiates energy at some
carrier frequency [14]. A transmitter does this job and it consists of a source of electrical
energy, which produces alternating current of a desired frequency of oscillation. The
propagation of energy depends on the frequency and the antenna and it can be
unidirectional or Omni-directional fashion. A wireless hub or router on the other end
receives the transmitted signal and decodes it [14]. This process also works in reverse.
Radio frequencies range from a few tens of hertz to three hundred gigahertz. This similar
mechanism is also used for walkie-talkies, cell phones and other devices.
5 | P a g e
The term short-range typically means less 100 meter e.g. NFC (Near Field
Communication), Zigbee, Z-Wave, Wi-Fi and DECT (Digital Enhanced Cordless
Telecommunication) [4]. There are several technologies for different applications of short-
range wireless embedded devices like Bluetooth, Infrared Data Association, Home Radio
Frequency, Ultra-Wideband Radio and their applications in the workplace, home, public,
travel [24]. There are different design challenges for short-range wireless networks like
mesh topology issues, i.e. mesh networking and device issues, i.e. efficient and low-cost
issues and also their solution [23]. But sometimes devices cannot communicate wirelessly
within a short range like range less than 1 meter [28].
Mesh is one type of network topology where data is forwarded between the nodes until it
reaches the destination without the help of central node. Central node means hub or switch
or access point. This type of the communication depends on radio range of the nodes. An
example of such a network has given.
Figure 2.2: An example of mesh network.
Signal
Radio
transmitter
Modulated
Signal
Demodulated
Signal
Signal
Radio
Receiver
Transmission
Antenna
Reception
Antenna
Figure 2.1: Typical radio transmission and reception
6 | P a g e
Start
Bit
Data Bits
Parit
y Bit
Stop Bits
In this project serial communication was required to communicate between node with the
PC. Serial communication means sending and receiving bytes of information one bit at a
time. This type of communication is basically used for transmitting information or data
between a computer and a peripheral device like programmable instrument. The serial port
on a computer is full duplex. Full duplex means it has separate lines for transmitting and
receiving data. That means they can send and receive at the same time. Parallel
communication is much faster than the serial because it allows transmission of a byte at a
once [26]. Generally, engineers use serial communication to transmit ASCII data. Such a
communication is completed using three transmission lines – ground, transmit and receive.
Synchronous and asynchronous are two forms of serial transmission. In the case of
synchronous communication the sender and receiver share a clock with each other. It
allows much faster rate than asynchronous communications, because additional bits are not
required for each data. On the other hand asynchronous means no synchronization,
because it allows data to be transmitted without the sender having to send a clock signal to
the receiver end. Description of some important serial parameters has given below:
Baud rate is basically the speed measurement for communication. It indicates the number
of bit transfers per second like 9600 baud means 9600 bits per second.
The end of communication for a single frame is indicated by the stop bit. Typically they
can be 1, 1.5 and 2 bits.
They are the measurement of the actual data bits in a transmission. The amount of actual
data may not be a full 8 bits all the time. It can be 5, 7, and 8 bits for frames.
Parity is used for error checking in serial communication. There are four types of parity
and they are even, odd, marked and spaced. It helps to detect data corruption which might
occur during transmission.
Figure 2.3: Typical character frame.
Character Frame
7 | P a g e
2.2 Microcontroller System
Microcontroller is the nerve centre of this project. The wireless hub should have some
form of microcontroller based intelligence. Microcontrollers are not only used in home and
office appliances, instruments and machinery but also into everyone‟s daily life [11]. One
of the most important features of the microcontroller is to store and run a program. It can
be programmed to make decisions and perform functions [2]. Its ability to perform math
and logic function makes it extremely versatile. The microcontroller consists of a central
processing unit (CPU), random-access memory, read-only memory, electrically erasable
programmable read-only memory (EEPROM), input / output (110) lines, serial and parallel
ports, timers, and other built-in peripherals, such as analogue-to-digital and digital-to-
analogue converters [11]. BASIC STAMP 2 or PIC microprocessor system can be used
for this project. Microcontrollers were originally programmed using an assembly language,
but currently different types of high-level programming languages like C are using [11].
Writing program using an assembly language is hard and time consuming. But C is less
time consuming and also easier to modify and update. The next thing is actually
programming the information inside the microcontroller. It can be done using an
Assembler, which converts the program into a format that the PIC understands. Windows
based MPLAB is the best one currently. It includes an editor, simulator and assembler.
2.3 Design of Printed Circuit Board
The Printed Circuit Board (PCB) was an electronic circuit which allows electricity to move
across pathways created upon copper layer from the design. PCBs are used in every single
electronic device. They can be single sided, double sided or multilayer. A single sided
board has only one side for connection and the other side is for components [29]. This type
of board was used for this project. Creation of PCBs is skilful and lengthy task. It required
different steps like design, construction and testing. The very first step is the schematic
design. Schematic means a collection of electronic symbols connected together by using
virtual wires [29]. Then the final step was generating netlist. Fabricating of the PCB starts
when the generated netlist is fed into the circuit board layout tool. Main steps are
generating component footprints, placing those footprints and connecting those. Basically,
there is no right way to place and route a PCB, but there are plenty of ways. Good
placement of components always leads to good routing.
8 | P a g e
CHAPTER 3
Requirements Analysis
This chapter provided what are the inputs, outputs of the desired system and how the
inputs were converted into outputs. As the project title “Short Range Intelligent Digital
Radio Wireless Hub” indicated the crucial requirements. Like-
 Short Range suggested that the communication would be within the limited short
range (<100m). The final system should be capable of communicating between
buildings of Medway campus at University of Greenwich.
 The word Intelligent on the title indicated the final system should have some form
of intelligence like a microprocessor system which would be the working brain of
this project.
 Digital Radio meant communication system of the final system would be based on
the typical digital radio transmission and reception based.
 Finally Wireless Hub indicated the type of communication system would be used
which is wireless. More than one hub was created to communicate between them
wirelessly within the short range.
3.1 Components Requirements Analysis
According to the first deliverable described on chapter 1 page 2, the final system should
contain ER400TRS as a radio module, MM232R as a USB interface and most importantly
a microcontroller. Other requirements were four LEDs for output and four digital inputs.
No external power supply would be used. Each node got the required power from the USB
connection (MM232R). Another important component requirement was the programming
connector even though it was not mentioned anywhere, which helped to burn the program
into the microcontroller. The ER400TRS radio module required a 50 ohm Antenna such as
a whip, helical or PCB loop. The University has a limitation on budget of £150 per project.
So throughout the project it was kept in mind that more than one PCB would be made.
Within that budget it was possible to build three PCBs of the same system. In case of
Power MM232R can supply no more than 100 mA from USB [5] and ER400TRS can
consume 23 mA while transmit, 12.5 mA while receiving [4]. Also the power consumption
of selected microcontroller as low as 0.1 uA in standby mode and 25 mA while active
mode. Each LED would take 5 mA (Approx.) and 10 mA for rest of the circuitry.
9 | P a g e
3.2 Design Requirements Analysis
Design was the most important phase for any project. This phase has decided how
convenient it was to construct the PCB like was it too complicated to drill and solder or it
was easier. Programming the microcontroller also depended on this phase because how the
inputs and outputs are connected with the different ports of the microcontroller. There was
no specific design requirements mentioned for this project. At the beginning schematic
design was the primary step and requirement of this project. According to the requirement
four LEDs were used as an output and switches as a digital input. It was necessary to
identify how to connect the ER400TRS, MM232R, LEDs, Switches and the
Microcontroller along with the programming connector. When the schematic would be
done the generated netlist would be transferred to PCB layout design tool. The PCB should
be single sided. Along with the other required components four rubber feet should be
included and especially the connectors needed to be placed near the edge of the PCB for
easy access. Finally, the size of the copper pads for the DIL components must be oval
which would help for proper soldering. Distance between the nodes would be
approximately 20 to 25 m.
3.3 Construction Requirements Analysis
The designed PCB had several hole sizes for drilling. It was suggested to drill the larger
holes first, as this reduced the chance of accidentally under-drilling a hole. Three types of
sizes were required. Most of them are 0.8mm. Holes for the switches were 1mm and for
the rubber feet 4mm were required. Another essential requirement for this was to be
careful drilling. Because if it is not properly drilled the PCB will not be able to solder and
also it will not work as expected in testing session.
Soldering was done on the solder side of the PCB. This required following safety rules
because the soldering rod is maintained at the temperature of 325 o
C. Good soldering is a
skill that is learnt by practise. Before starting soldering all the components should be
inserted properly. Then at the beginning the smallest components like resistors, LEDs,
Capacitors should be soldered first. The amount of solder must be accurate; if not there
will be chance of short circuit on the PCB. If excessive heating was done then the surface
of the PCB will be changed into a different colour which can cause problem later. Some of
the components are heat sensitive, so they should be soldered carefully. If any component
is soldered in the wrong place it must be removed immediately using unsoldering sucker.
10 | P a g e
3.4 Programming Requirements Analysis
According to the last two deliverables of this project the following requirements were
determined.
Firstly, important part of the project was the transfer of packets of message from one node
to another node and they should be organised in a straight line so that the two end nodes
cannot communicate directly with each other. The structure of the message has given
below:
Secondly, there should be an acknowledgement reply from each node. For example, if
node A sends information to the node B. When node B received it will display the received
information and the acknowledgement reply like "Info Transferred" should be displayed
on the node A serial terminal.
All these requirements absolutely depend on how the programming was done. The
intelligence of the microcontroller would be decided by the programming or coding. It
required good knowledge of high-level programming or assembly language and also a in-
circuit programmer like MPLAB ICD2 or ICD3 to burn the program into the
microcontroller.
3.5 Final to do list
After going through all the functional requirements the final list of requirements was set
out as follows.
I. Identifying the inputs and outputs.
II. Identifying what type of oscillator would be used.
III. USB powered supply using MM232R.
IV. Implementing MCLR on the PCB or Hub.
V. Connection between ER400TRS and MM232R.
VI. Implementing ICD connector on the Hub or PCB.
Message Type Sender ID Message Length MessageReceiver ID
11 | P a g e
3.6 Testing Schedule
Test
No.
Purpose Expected Outcome
1 To ensure that the voltage on pin
14 of PIC18F1320 socket is at 5 V
Voltmeter will show exactly the
same value of supplied voltage on
those pin
2 To ensure all the outputs (LED) are
working [Test Plan 1]
LEDs will glow sequentially
according to the program
3 To ensure the reset switch is
working
LEDs will start to glow from the
beginning of sequence
4 To ensure all the inputs (SWITCH)
are working [Test Plan 1]
Each switch will glow pre-
assigned LED according to the
program
5 To ensure the MM232R
transmission is working
After the programming “Test
String” will be displayed on the
HyperTerminal window
6 To ensure the MM232R reception
is working
When the pre-defined command
will be received it will return user
defined command using Docklight
7 To ensure ER400TRS is working
for each PCB or Node
Each PCB will display its unique
modemid along with
“#modemidHello*
8 To ensure bi-directional
communication between three PCB
with mesh interconnection
capability
Each node will be able to receive,
transmit and forward the packet of
messages according to the inputs.
Table 3.1: Prepared test schedule according to the requirements
12 | P a g e
CHAPTER 4
Possible Solutions
Depending on the requirements analysis described in the previous chapter, this chapter
went through the available problem solutions and look for the most suitable and best
solution and also the reasons behind it.
4.1 Communication System Solutions
4.1.1 Node to Node Communication
Communications are generally two types they are wired or wireless. But this
communication based project will be having wireless as the each node would be mobile
connected with the PC. Some of the options for the wireless communication have
explained below.
Bluetooth Communication
This was the new addition in the shot-range wireless communication. Bluetooth was
mostly heard for the cell phones it was one of the popular form of data transfer. It was used
for transferring pictures, contacts, videos, messages and many more. This technology was
not only used in mobile phones but also in computers and PDA (Personal Digital
Assistants) to GPS systems and heart monitoring devices. Bluetooth worked on 2.4GHz
unlicensed industrial, scientific and medical (ISM) band and it uses frequency-hopping
spread-spectrum (FHSS) Communication, that means to transmit data over different
frequencies at different time intervals which is called as hops, and there will be 1600 such
hops per second, one of the difference between the other wireless devices and Bluetooth is
that they communicate with each other automatically. That is whenever the two Bluetooth
devices come within the range they would communicate, it is known as paring.
Infrared Communication
This method of communication was mostly heard for television remote controls or air
conditioners and so on, it was also seen that IR communication is suitable for high speed
data transfer, the major reasons for the IR to be more used was its low cost and low power
consumption. Some of the major reasons for using IR in mobile environment are as
follows [1].
13 | P a g e
1- High-speed of transmission: The first generation of IR transmission was 115.2kb/s but
as the time moved on it increased and presently it can work on 1 to 4 Mb/s of speed.
2- IR was a short range wireless communication, but it cannot transfer data outside a room,
this gives minimum problems to the user.
3- IR has no regulations such as in RF; the range of IR media is outside the scope of laws
pertaining to RF.
Major disadvantages of such a communication was basically limited range of transmission
and reception (<3m) and it also has various types of interference like fluorescent light, sun
light and so on.
Wireless Radio Communication
It was one of the requirements for this project that the communication method between one
node to another node would be using wireless radio communication (Easy-Radio style).
For this project Easy-Radio transceiver ER400TRS was considered as one of the solution
for the communication. It provided a bi-directional high speed data transfer. Obeying the
boundaries of the ISM bands (E.g. Pan-European 433.06 – 434.79 MHz band it was
possible to employ a license free approved Short Range Device with an effective radiated
power not exceeding 10mW [6].
Figure 4.1: ER400TRS device with pin out
Some important features of this device are as follows:
1. It has a low operating voltage of about 3.6 Volts.
2. It has a high sensitivity receiver a typical value is 105dBm @ 19.2 Kbps
3. A crystal controlled synthesiser is used for frequency accuracy.
4. A transparent data transmission is used by serial input and output.
5. Has a minimum power consumption that is less that 23mA for transmitting mode
and 12.5mA for receive mode.
14 | P a g e
Some applications of this device are as follows:
1. It could be used for environmental sense and control
2. Has a high rate of remote data Acquisition
3. Electronic point of sale equipment
4.1.2 Communication between Node to PC
Node to PC communication played a vital role for this project. A serial UART interface
can accomplish this role. FTDI (Future Technology Devices International ltd.) produced
range of development modules for USB to Serial UART development interface like
UM232R, UM245R, MM232R and UB232R. MM232R was one of the core requirements
for this project. For that reason, it was used which provided a communication between the
PC and PCB.
MM232R was mini USB- serial UART interface integrated circuit module. It was also a
latest product form FTDI‟s. This device could be used as a microcontroller or external
logic by separating internal clock. It has been provided by more security feature that is
with the help of unique number that is burned into the device during manufacturing. Size
of the MM232R was also one of the factors as it is ultra-small 18.0mm x 21.5mm (0.7”x
0.8”) PCB. It has got 16 pins on it which are .1” pitched. This module supported RTS
(Ready to Send) or CTS (Clear to Send) hardware handshaking and is powered from the
USB port [5]. Some important features of it have given below.
 Integrated Clock Circuit – No crystal or ceramic resonator is required because of its
built in clock circuit.
 Integrated EEPROM - MM232R has an inbuilt EEPROM; a portion of the EEPROM
is also allocated for the user to store additional data. This EEPROM can be
programmed using the USB without the requirements of any external voltage source
 Less external components - Reduced the material cost for USB interface designs
compare to its predecessor
 Lower supply voltage – This module works at low ranges from 3.3 to 5.25V and so
the USB bus provided with a 3.3V that eliminates the requirement of the external
regulator.
MM232R was selected among other development modules because of its versatility and
simplicity. Specially, it can be configured as a USB self-powered [5]. Due to this
characteristic the final system did not require any external voltage regulator.
15 | P a g e
4.2 Microcontroller Solutions
There are various options to be considered for the selection of the optimum
microcontroller such as the BS2 IC from Parallax Inc, Programmable logic controller
(PLC), or a microcontroller such as PIC form Microchip, AVR from Atmal and so on.
Different programming languages were used for controlling these microcontrollers like
visual basic, C/C++ or assembly language [2]. For industrial uses PLC became famous for
its easy programming language, code execution time and reliability. The key to selecting
the appropriate microcontroller depended on the understanding of the jargon, and
establishing priorities [23].
4.2.1 Basic Stamp 2 (BS2) IC
Basic stamp 2 was well known as BS2 IC. This can act as a controlling device in an
electronic device. It can be integrated into keypads, sensor, motors, switches, relays, lights
and so on. It has its own Programming language called as PBASIC. The operating voltage
required is from 5.5 volts whereas this project required working on even less voltages.
There are various kits available that can help one to understand and get used to the Basic
stamp.
4.2.2 Programmable Logic Control
PLCs are majorly used in industries to control processes. One of the definitions of PLC is
Microcomputer embedded in or attached to a device to perform switching, timing, or
machine or process control task. The advantage of a PLC over a microcontroller is that it is
easy to program, similar to microcontroller the PLC also accepts the analogues as well as
digital signals, but it do not need to be configured such as in microcontroller, one of the
major advantage over a microcontroller would be the ability to operate with both low as
well as high level voltages, the programming and execution can be done simultaneously.
4.2.2 Atmel
Atmel was one of the leading companies that produce broad range of microcontrollers like
8051, 8052 and so on. It gave a high range of code density from 2K bytes to 128K bytes, a
wide range of microcontrollers ranging from 8-bit to MCS-51 are more powerful and used
for industry standard. ISP (In-system programming) of Atmel also made it more flexible
and user friendly.
16 | P a g e
4.2.3 Microchip
This company used to develop semiconductor devices since 1989 [20]. Microchip
engineers focused their aim to develop a controller that would be able to programmable,
with the ability of providing high output current and also the capabilities of having input
and output pins. The first PIC (Peripheral Interface Controller) Microcontroller was based
on RIDC (Reduced instruction set code) which could execute one instruction per clock
cycle at 20 MHz. Main advantages for using PIC are inexpensive, small instruction set to
learn, wide range of interface ability and RISC architecture [20]. Most importantly, this
microchip has design support like free MPLAB IDE (Integrated Development
Environment) and C compilers. PIC has different series like PIC10, PIC12, PIC16, PIC18,
PIC24 and PIC 32.
The following table showed the comparison among the microcontrollers.
Types Programming
language
Operating
voltage
Cost Development
Module
available?
Complexity
as a new
user?
BS2 PBASIC Built in 5 V
DC
Medium Yes Easy
PLC Ladder logic External
power supply
High Yes More
complex
Atmel FastAVR or C External 3.0V
to 3.6V DC
Low No Complex
PIC C External 5V
DC
Low No Complex
Table 4.1: Comparison of microcontrollers.
4.2.4 Selected Microcontroller
The decision of which microcontroller would be the best for this project was made based
on the number of input and output required and the amount of space required for the
program and also the simplicity. For those above reasons PIC18F1320 of Microchip
Technology Inc. was selected. This PIC18F1320 comes in 18, 20 and 28 pin packages
having similar features of PIC18F1220.
17 | P a g e
They are used for their liner addressing, high performance, with enhanced flash
microcontroller along with 10-bit A/D and Nano Watt Technology. They can have the
speeds of 0 Hz to 40 MHz. This PIC has the power management ability such as when idle
CPU will be off and Peripherals will be on which was important in this project. The
maximum current can be 300 mA and maximum power dissipation of 1 Watt. It has two
ports (Port A & Port B).
4.3 Programming Solutions
Programming a PIC meant storing the program onto a PIC. It can be done by using
Assembly language or High-level language like C. The executable code for the PIC was
represented as a sequence of hexadecimal numbers called a hex code. Both the assembly
language and C required software to process their compiling into executable code which is
known as Compiler. A compiler converts a high level language program to machine
instructions for the targeted PIC. Rather than Assembly language C programming
language was used for this project. The major reasons for this decision have given below.
1. It is easier and less time consuming to write a program in C than in assembly.
2. C is also easier to modify and update.
3. Codes available in the function library can be used.
4. Programs are developed much more rapidly in C.
5. Code efficiency of compiled C programs is typically 80% of well-written
assembler program.
6. Another language C++ was too complex for use with the present generation of
PICs.
There are various C compilers available that target Microchip PICs like Hi-Tech,
Microchip and CCS. Hi-Tech C compiler has a good range of build-in functions and also
comes with source code for all its libraries. But it is more expensive than any other
compilers and does not have a code-generation wizard like CCS C compiler. Microchip C
compilers like C18 come free with the MPLAB IDE.
But for this project CCS C compiler was used. MPLAB IDE supported the Custom
Computer Services (CCS) language tools. Main reasons for selecting this have given
below.
1. CCS C was much easier to use.
2. Lots of sample C code was provided which explained a range of techniques and
features.
3. Built-in function libraries and standard C operators are specific to PIC registers.
4. It has device specific include files for each PIC microcontroller.
18 | P a g e
Programs are edited and compiled to PIC microcontroller instructions on a computer. PIC
microcontroller instructions are uploaded from PC to PIC using ICD 3 debugger.
Figure 4.2: Process diagram of compiling and debugging.
Some features of MPLAB ICD3 have given below.
 MPLAB ICD3 is powered by USB that make it more portable.
 Improved performance for debugging and programming.
 This debugger is 15 times faster than its earlier version in terms of programming.
 It was designed for high speed processors that would help the embedded engineers
to debug the device in real-time.
4.4 PCB construction solution
4.4.1 Types of circuit board
Three types of boards are there. These are Breadboard, Stripboard and Printed Circuit
Board. Breadboard is the way of making temporary circuits for testing purposes. All the
components can be reused and no drilling or soldering is required. One side of the
stripboard is made of copper and the parallel strips of copper track are connected together.
It does not require drilling only soldering was required. Printed circuit boards need to be
designed first then it required drilling and soldering both to place the components and
make the connections. This was the best choice for this project to make a complete system
according to the requirement.
4.4.2 Schematic and PCB design software
Schematic and PCB design was the main section of the design phase of this project. Both
can be done using one package. This phase will decide how the circuit is going to work.
There are two ways to do this.
19 | P a g e
First way was using WinQcad 52.6. It was complete electronics design software. It was
compatible with all the operating systems. It included a schematic design editor, a PCB
design editor and a compatible autorouter.
Second way was using Proteus PCB Design software. It has fully featured schematic
capture and World class shape based autorouter. This package was much more user
friendly and versatile compare to the WinQcad and it has a unique integrated 3D viewer.
The design for this project was required to do that using this software package. The
University of Greenwich has this software on its laboratory. For these reasons Proteus has
been used.
4.4.3 Drilling Methods
Drilling is one of the important phases of construction of the PCB. It can be done in
several ways. Variodrill was a high speed machine which combined drilling accuracy with
an increased level of user comfort. It rests on an adjustable base which allows the work
table to be tilted towards the user, thus reducing user fatigue. This machine has been used
for drilling all the components of 0.8mm diameter. A built in magnifier helped to view the
target with more accuracy. The manual drilling machine has also been used for drilling
holes for the rubber foots of 4mm diameter. When drilling with this particular machine, it
was important to hold the PCB down firmly, as the drill bit can snatch the board upwards
as it breaks through.
This manual machine was at the laboratory for different sizes of hole starting from 0.8mm
to 5mm. This was not used for the 0.8mm hole for this project because the other one
(Figure 4.7) was much more accurate and easier to drill.
4.4.4 Soldering Methods
Soldering can be done manually or automatically. One of the automatic systems is DS-01
Automatic DIP Soldering Systems. It has motorised drive and 0-6 seconds movement time
of the PCB during automatic soldering. The whole process is controlled by the motorised
drive unit which makes it independent of operator training and skills. But this has not been
used for this project. Because university does not provide such a system and as a beginner
soldering has been done manually by using a 30 Watt soldering iron.
20 | P a g e
CHAPTER 5
Problem Implementation
The implementation for this project was divided into two parts hardware and software.
Hardware section consisted of designing the PCB, drilling, soldering and testing the power
and short circuit. Software section consisted of PIC18F1320 programming according to the
developed test plans.
5.1 Hardware implementations
5.1.1 Circuit design by ISIS
ISIS 7.7 was a part of the Proteus 7.7 circuit design and simulation software. The digital
radio wireless hub system for this project was designed by this software. First task was to
connect ER400TRS, PIC18F1320, MM232R and ICD connector together. There are
various points that were considered during the circuit design, the following are the points.
 The number of inputs and outputs required
 Whether the internal or external oscillator to be used
 The 5 volts power supply
 A switch would be required to MCLR in order to manually reset the program
 Three LEDs would be connected to indicate the operation as an output
 Four switches would be used as an input
 The connection to the ER400TRS and MM232R
 ICD connection to upload program on the PIC
A PIC microcontroller can control outputs and react to inputs. In PIC18F1320 port RA0 to
RA4 and RB0 to RB7 were bidirectional ports and they can be used as an input or output.
PIC18F1320 have overall 18pins including VDD (Pin no.14) and VSS (Pin no. 5). Three
LEDs were used as an output for the following purposes.
LED 1: Supply voltage
LED 2: Data Transfer-Transmit
LED 3: Data Transfer-Receive
LED1, LED2 and LED3 were connected respectively to the Pin no. 6, 2 and 1 of the PIC.
Four switches (SW) were used for general purposes as an input to the system. SW1, SW2,
SW3 and SW4 were connected accordingly to the Pin no. 15, 16, 17 and 18.
21 | P a g e
Figure 5.1: LEDs and Switches.
Another issue was to properly operate the microcontroller it must be reset correctly. To do
that a simple normally open push button, a resistor, a capacitor and a diode were used. The
RC time constant for the reset circuit should be between 10ms and 20ms [20]. The circuit
of the following figure has an RC time constant of 10K X 1.0uF or 10ms.
Figure 5.2: PIC18F1320 reset circuit.
External power supply was not in the requirements for this project. So, it was necessary to
find a way to power the circuit. That is why MM232R was used because it has option to be
used as a BUS powered configuration or USB powered for the PCB. To do this pin 15
(USBPWR) and pin 14 (VCC50) should be connected together. Also the schematic capture
for MM232R and ER400TRS were not available on the ISIS library so it was required to
create one according to its pin description. The schematic capture of both the components
has given on the following page.
22 | P a g e
Figure 5.3: MM232R and ER400TRS
Radio Module (ER400TRS) has 9 pins. Pin no. 2 (RF GND), 9 (GND) were connected to
the common ground line and pin no. 8 (VCC) was connected to the common power line.
Other pins were connected using following connection.
The schematic capture of the final circuit has given below.
Pin no.3 (RSSI)
Pin no. 4 (BUSY) Pin no. 11 (RB5)
Pin no. 7 (RA3)
Pin no.5 (DATA IN) Pin no. 9 (RB1)
Pin no.5 (DATA OUT) Pin no. 10 (RB5)
PIC18F1320
ER400TRS
Figure 5.4: Short range digital wireless hub circuit
23 | P a g e
Figure 5.6: 4 way Rocker switch
5.1.2 Layout design by ARES
ARES was one of the important feature of the Proteus 7.7 professional, it was used to
design the layout of the PCB board. Once the ISIS schematic diagram was completed the
components and the design could be directly linked with the ARES with the help of the
„Netlist Transfer to ARES‟ present on the left hand top corner of the window. The
following steps are taken after that.
 Step 1: The board edge of the PCB was drawn first and it was considered as 3.75x3.2
inch.
 Step 2: Couple of components (ER400TRS and MM232R) were not in the ARES
library. So before transferring the netlist from the ISIS both the packages of the
components were created and saved. While transferring from the ISIS those newly
created packages were selected. All the other components were found on the ARES
library.
Figure 5.5: PCB layout of ER400TRS and MM232R.
 Step 3: It was decided to use one DIP switch for digital input instead of using four
push buttons because it is easier to handle, cheap and also required less space on
the PCB.
24 | P a g e
 Step 4: Now all the components were placed using the Auto placer of ARES. As
per the requirement all the connectors like ICD connector and MM232R were
placed on the edge for easier convenience. According to the datasheet of the
ER400TRS, this radio module should be kept away from the circuitry that is why it
was moved towards the edge.
 Step 5: Then at the four corners of the PCB four round through-hole pad (4mm
diameter) were placed for the rubber pad.
 Step 6: After placing the components manual routing by using bottom copper was
done. There were few connections which could not be connected. But those were
indicated using Top Silk layer on ARES to use manual wire to connect them after
the construction.
The screendump of the completed PCB layout has given below.
Figure 5.7: Short range digital wireless hub PCB layout.
25 | P a g e
After completing the PCB design it was printed. Three of the same PCBs were printed.
The bottom view of the printed circuit board has given on the following page.
Figure 5.8: Bottom view of the PCB.
5.1.3 List of Components
Components for three of the PCBs were identified and ordered from different electronic
component stores. The following table shows the list of the components.
Name Description Quantity
ER400TRS Radio Module 433 MHz 3
MM232R USB Module 3
PIC18F1320 DIP 18 IC (8 Bit) 3
LED Red 9
Diode 1 A, 100V 3
Capacitor 100 nF 12
Switch Push Button 3
Socket IC 18 way, DIL, PIC holder 3
26 | P a g e
Rocker Switch DIL, 4 way 3
Capacitor 10 uF 3
Resistor 10 K Ohm, 5%(Tolerance) 15
Resistor 1 K Ohm, 1%(Tolerance) 12
Socket ICD connector, Vertical 3
Table 5.1: List of used components.
5.1.4 Drilling and soldering components
Drilling and soldering are the two important phase of constructing the PCB. Health and
safety requirements were maintained throughout the both the process.
The right drilling equipment, drill bits and techniques can make a big difference in the
quality of drilling. Drilling was done first when the PCB was printed. If the drill was not
perfect or smooth or holes were not in the required position it will create problems for
soldering. Safety precautions were taken to protect eyes from probable threats before
starting drilling. At the beginning all the holes of 0.8 mm were drilled with a good
alignment by using semi-automatic drilling machine at the laboratory. Then the drilling
machine of different sizes like 1mm for the push button and 3mm for the rubber feet was
drilled.
When drilling was completed it was time for inserting the components carefully.
PIC18F1320, LEDs and Diodes package has polarity. That is why they were inserted
according to their accurate direction. Because once the component is inserted and soldered
it is quite hard to pull that off. Proper soldering plays a vital role for the circuit to work
because if the soldering was not good enough there might be possibilities of miss
connections, short circuits and IC damage. Hand-soldering method was used for this
project. It involved applying heat and solder to the junction between a component lead and
its pad until the solder melts, forming the solder joint on the solder side of the PCB []. All
the small components like resistor, capacitor, diodes etc. were soldered first. Then the rest
of them were soldered.
27 | P a g e
Figure 5.9: A PCB after drilling and soldering components
Here is the image of the completed three PCBs.
Figure 5.10: Three constructed PCBs.
ICD
Connector
DIP switch
Reset Switch
PIC18F1320 base
MM232R
ER400TRS
28 | P a g e
After the construction of the three PCBs, then they were tested is there any short circuit or
not by using continuity option of multimeter. Then the power test was done to check
whether the PIC is getting the expected power (5 V) or not at the pin 14 of PIC18F1320.
Figure 5.11: PIC was getting 5.15 V
5.1.5 Identifying Node Distance
Before programming the PIC it was important to determine how close the nodes need to
be. Two existing PCBs were provided by the supervisor which has ER400TRS and
MM232R. Image of them has given on Appendix 10. They were used to obtain a graph of
signal strength against distance. Pin no. 3 of ER400TRS was for RSSI (Received Signal
Strength Indicator) and it provided an analogue output voltage. It ranges from 0 V to 1.2
V. The distance ranges from 1 M to 20 M. After this experiment it was decided to keep the
nodes around 10 to 15 M apart from each other. On the following page the final graph
along with the tables has given.
29 | P a g e
Figure 5.12: Signal Strength against Distance graph with the table.
Another parameter for the construction of the PCB was the Antenna. Radio required an
antenna. According to the datasheet the length of the antenna would be 16.4 cms for the
frequency of 434MHz. A simple piece of wire was used as an antenna for each node.
5.2 Software Implementation
MPLAB was used as an Integrated Development Environment. CCS C was used as a
compiler. It was a third party language tool in MPLAB IDE. The whole software
implementation was divided into four test plans for the sequential towards the final code.
 Test Plan 1: Input/output testing including LEDs and Switches.
 Test Plan 2: MM232R test (Very important step prior checking the ER400TRS)
 Test Plan 3: ER400TRS test (Transmit and Receive)
 Test Plan 4: Final code to communicate among three nodes
At the beginning a header file named “EasyRadio.h” was created for initializing the PIC
for peripheral configuration. They are the settings that configure the PIC for the external
environment like Oscillator Type, MCLR pin usage, Code Protection, Brown-Out and
30 | P a g e
Watchdog Timer usage, Low Voltage Programming etc. This header file was used for all
the programs by include it at the beginning. In this file the on board UART IO, LEDs IO,
DIP Switch IO were also defined. The full code with explanation has given on Appendix 1.
5.2.1 Test Plan 1
This test plan for input/output testing was divided into two parts. Firstly, LEDs were tested
then the Switches.
Expected outcome for the LEDs test was each LED will toggle sequentially after 500ms
delay. Here is the flowchart for it.
Figure 5.13: LED test flow diagram.
Here is the screendump of CCS C compiler while writing the code.
Figure 5.14: Screendump for the LED testing code (ER_LED.C)
The full program listing has given on Appendix 2.
START MCU
initialization
Toggle
LED1
500ms delay
Toggle
LED3
500ms delay
Toggle
LED2
5000ms delay
31 | P a g e
After this switches were tested. The mechanism for this program was firstly to identify
whether the Switch 4 (master switch) was on or not if it is on then Switch 1 will turn on
LED 1, Switch 2 will LED 2 and Switch 3 will LED 3 on. The full program listing with
description of this test has given on Appendix 3.
Start
MCU Initialization
Switch Test
If master switch/
switch4 ON?
LED1 Off
LED2 Off
LED3 Off
No
If switch1 On? LED1 Off
LED1 On
If switch2 On? LED2 Off
LED2 On
If switch3 On? LED3 Off
LED3 On
Yes
Yes
Yes
Yes
No
No
No
Figure 5.15: Flow chart for testing switches
32 | P a g e
5.2.2 Test Plan 2
HyperTerminal and Docklight (V 1.9) are two testing, analysis and simulation tool for
serial communication. They were used for this project to monitor the communications.
Both of them quite same but the only difference was only the Docklight have the facility to
toggle the RTS pin. This phase of testing was for testing the MM232R was working or not.
MM232R was a bridge or communication link between the PC and PCB. So, it was very
important to check prior to the ER400TRS testing and final code. Two codes were written
and compiled for MM232R testing. First code transmitted the data string “Test String”
using TX pin of the MM232R in an infinite loop (Appendix 4). Here is the flow chart for
the program.
Figure 5.16: MM232R Data Send Test Flow Chart.
Here is the screendump of CCS C compiler while writing the ER_MM232R_TX.C code.
START
MCU
initialization
Send “Test
String” out to
RS232
500ms delay
Figure 5.17: Screendump for the MM232R Transmit testing
33 | P a g e
The mechanism of the second code was that the main function waits for CTS (Clear To
Send) pin of MM232R to get high and then receives a string command on MM232R-
UART defined RX. If the received command is one of the predefined one it acknowledges
with “Command –n Received” otherwise it send “Undefined Command”. The full C
program along with the description has given in Appendix 5.Here is the flow chart of it.
Figure 5.18: MM232R test flow chart
START
MCU Initialization
Wait and input
receive string
through RS232 i.e.
MM232R RX
If received string is
command string-1 i.e.
“$CMD1”
Send in-valid command
received acknowledge
through RS232 i.e.
MM232R TX
Send valid command
received acknowledge
through RS232 i.e.
MM232R TX
If received string is
command string-1 i.e.
“$CMD2”
If received string is
command string-1 i.e.
“$CMD3”
34 | P a g e
5.2.3 Test Plan 3
ER400TRS was tested in this test plan. It required two of the PCBs connected with three
different computers. It was impossible to stay at three places at the same time to test. So,
the author took help from his colleagues to check the check the response from the other
two nodes. Mobile phone was used as a communication media between them.
The mechanisms used for this test depend on different combination of SWITCH1 and
SWITCH2. Combination would be different on both the end. Like if switch 1 and switch 2
are both on in Node A then it would assign “01” as modem id and this will display on the
Node B the id along with “#modemidHello*”. Again if switch 1 and switch 2 both are off
then modem id would be “04” and it would be displayed on other node. This flow chart
and the code with description for each line is given on the Appendix 6.
5.2.4 Test Plan 4 (Final Code)
Following are the details of how the final code was implemented and how it was supposed
to work i.e. expected results and actual results.
This code described three simple node designed to act as part of an experimental mesh
network in which every node has exactly same hardware and firmware. The goal of this
code to work in a manner where a message sent through a node to another can be received
and acknowledged. To achieve this, a simple routing scheme was implemented in the
firmware.
There were three nodes A, B and C. Every node is connected to PC‟s USB port using serial
to USB converter to send and receive serial data from PC using serial terminal software
like HyperTerminal of windows. Following command structure has been used to construct
a command.
[Message Type][Sender Id][Receiver Id][Message length][Message]
Example: 10310Hello
Here [Message Type] is 1
[Sender Id] is 0 (0 for PC)
[Receiver Id] is 3
[Message length] is 10 which was total length of the packet
[Message] is Hello
All data are in ASCII format which can be sent by typing on serial terminal.
35 | P a g e
On the reception of this Command message from PC,
1- Node parses the data and verifies if the data message length and receive data length
are same. If not then send a message to PC that data length is invalid.
2- Check if the receiver id is in valid range. If the Id is the receiver is same as node id,
then a message is sent back to PC that node cannot send message to itself. Or if the
receiver id exceeds the valid range of nodes, a message is sent to PC that the
receiver id is invalid.
3- If data length and receiver id are valid, a packet containing the following format
was transmitted through RF module ER400TRS.
$[Sequence No][Message Type][Sender Id][Receiver Id][Message
length][Message]*
Example: #00111315Hello*
Here # sign is start of packet
[Sequence No] is 001 which is three digit auto incremented numbers on each new
message sent.
[Message Type] is 1
[Sender Id] is 1 node id (1-4 valid range) 1 = A, 2 = B and 3 = C here
[Receiver Id] is 3 (1-4 valid range)
[Message length] is 15 which is total length of the packet including # and *
[Message] is Hello
* Sign is end of packet.
On reception of this data message wirelessly through ER400TRS, it is parsed and
1 - Its length is verified i.e. data length and actual length is same, if not message is
discarded and no response message is sent in this case.
2 – If the receiver Id „2‟ and node id „2‟ is same a response message with the same format
as received message is sent to the sender „1‟ by changing the receiver and sender
information with same sequence number. This message identified as valid response from
receiver for the message sent earlier through the same sequence number which is notified
to the used by sending message usefully sent message to pc.
2 – If the receiver Id „3‟ and node id „2‟ is not the same and it is in valid range then the
message is transmitted as it is again. The idea is to send this message again with same
sender „1‟ and receiver id „3‟ is that if the receiver node „3‟ was not in the range of
36 | P a g e
first node „1‟ and if the second node „2‟ is within range of both , the node 2 can
forward the message of „1‟ to „3‟ with same sequence number. The acknowledge
response from „3‟ is routed back to „1‟ following same path i.e. 3-2-1 with the same
sequence number generated at 1 on transmission.
The final code with proper description on each line has given on Appendix 7. As design
method two flow charts were created before programming. One was for command message
date reception and the other one was for data message reception as follows.
Figure 5.19: Command Message Data Reception flowchart
37 | P a g e
Figure 5.20: Data Message Reception Flow chart.
38 | P a g e
The following image shows where the three nodes were kept at Medway campus during
the code testing. The distance between Node A and B was approximate 20 m and between
B and C was approximate 25 m.
Figure 5.21: Placement of nodes obtained from Google Earth.
5.2.5 Settings for Communication Test
For the test plan 2, 3 and 4 it was required to configure the PORT settings for the
communication test for both the HyperTerminal and Docklight software, where Docklight
was a testing, analysis and simulation tool for serial communication protocols. The
following diagram shows how the port settings were done.
Figure 5.22: Configuration for the PORT settings.
HyperTerminal
Docklight
Node A
Node B
Node C
39 | P a g e
CHAPTER 6
Results
6.1 Test Plan 1 Results
Here is the screendump when the program for the LED test was downloaded into the
PIC18F1320 by using MPLAB IDE and ICD3.
Figure 6.1: LED glow program downloaded.
The following image shows when the LEDs were glowing sequentially with an interval of
500ms.
Figure 6.2: Glowing LEDs when programming was done.
40 | P a g e
The following screendump shows when the program for the Switch test was downloaded
into the PIC18F1320 where four of the DIP switches worked as an output.
Figure 6.3: Switch_try program downloaded.
The following image shows all the LEDs glowed when Master Switch (Swicth 4) was off
after the program was burnt into the PIC. More images are on Appendix 10.
Figure 6.4: Working PCB (Node A) after the program.
Master Switch
41 | P a g e
6.2 Test Plan 2 Results
As mentioned on the previous chapter this test was basically for testing the MM232R
connection with the PC. It required both the HyperTerminal and Docklight to get the
results. The following screendump were taken when the program to test MM232R
transmission was burnt into the PIC.
Figure 6.5: MM232R_TX was downloaded.
The following screendump shows when “Test String” was appearing with a delay of 500
ms on the Hyperterminal window.
Figure 6.6: HyperTerminal window.
42 | P a g e
The following screendump shows when the program to test the MM232R reception was
successfully programmed using MPLAB IDE.
Figure 6.7: MM232R_Test was downloaded.
As mentioned on the previous chapter to get the results in this case a HyperTerminal like
software Docklight was used because for this program to test it was required to toggle the
RTS pin before sending the command. Docklight has the facility to toggle the RTS pin.
Following is the screendump when the expected outcome obtained from the software.
Figure 6.8: Docklight window.
RTS pin
Response when wrong
command was typed
Response when pre-defined
command was typed
43 | P a g e
6.3 Test Plan 3 Results
This test was for the ER400TRS. It required two PCBs (Node A and Node B)
simultaneously connected together with two individual PCs. The following screendump of
MPLAB IDE were captured when the programming was completed.
Figure 6.9: Downloaded ER400TRS_Test into the Microcontroller.
According to the program as described on previous chapter when SWITCH 1 and 2 will be
on it will display “#01 Hello*” on the other PCB and when SWITCH 1 and 2 will be off it
display “#04 Hello*”. Two PCBs Node A and Node B were used for this. On Node A
Switch 1 and 2 were off and on node B both of them were on. The following screendumps
shows the results from both the node.
Figure 6.10: Output from Node A.
44 | P a g e
Figure 6.11: Output from Node B.
6.4 Test Plan 4 (Final Code) Results
The implementation for this final code has given on the previous chapter. This testing
required three of the PCBs (Nodes) to be connected with three different PCs at different
places but within the range. When the program was successfully build it was programmed
into three PCBs. The following screendump shows when the programming was done for
one PCB or node.
Figure 6.12: Downloaded EasyRadio.c into the PIC18F1320.
45 | P a g e
Individual pin configuration of DIP switches for individual PCB was assigned. Like on
Node A switch 1 and 2 was on, Node B switch 1 on and switch 2 off, Node C switch 1 and
2 was off. This fulfilled the requirement of digital input. For that reason the following
modemid was assigned for different pin configuration.
Node Modemid
A 04
B 02
C 01
Port bit configurations were as described on previous chapter. To test the bi-directional
communication Hyperterminal was used. To test the mechanism of the code some
conditions for input on the Hyperterminal window was decided. Here are the conditions.
Condition 1: „10210hello‟ from Node A
Condition 2: „10410samit‟ from Node B
Condition 3: „10410hello‟ from Node A [To test if the message is able to transfer in his
own node]
Condition 4: „10110samit‟ from Node A
Condition 5: „10210medway‟ from Node A [To test when an invalid length was typed]
Condition 6: „10110hello‟ from Node B
Condition 7: „10114howareyou‟ from Node A
Condition 8: „10112iamfine‟ from Node B
The following screendumps shows the responses from each node for each condition.
Response after condition 1
Response after condition 2
Response after condition 4
Response after condition 5
Response after condition 6
Response after condition 7
Response after condition 8
Response after condition 3
Figure 6.13: Node A screendump.
46 | P a g e
Figure 6.14: Node B screendump
Figure 6.15: Node C screendump
Response after condition 1
Response after condition 2
Response after condition 4
Response after condition 6
Response after condition 7
Response after condition 8
Response after condition 1
Response after condition 2
Response after condition 7
Response after condition 8
Response after condition 4
Response after condition 6
47 | P a g e
6.4 Testing Schedule
The following table of testing schedule summarises all the results.
Test
No.
Purpose Expected Outcome Pass or
Fail
1 To ensure that the voltage on pin
14 of PIC18F1320 socket is at 5 V
Voltmeter will show exactly the
same value of supplied voltage on
those pin
Pass
2 To ensure all the outputs (LED) are
working [Test Plan 1]
LEDs will glow sequentially
according to the program
Pass
3 To ensure the reset switch is
working
LEDs will start to glow from the
beginning of sequence
Pass
4 To ensure all the inputs (SWITCH)
are working [Test Plan 1]
Each switch will glow pre-
assigned LED according to the
program
Pass
5 To ensure the MM232R
transmission is working
After the programming “Test
String” will be displayed on the
HyperTerminal window
Pass
6 To ensure the MM232R reception
is working
When the pre-defined command
will be received it will return user
defined command using Docklight
Pass
7 To ensure ER400TRS is working
for each PCB or Node
Each PCB will display its unique
modemid along with
“#modemidHello*
Pass
8 To ensure bi-directional
communication between three PCB
with mesh interconnection
capability
Each node will be able to receive,
transmit and forward the packet of
messages according to the inputs.
Pass
Table 6.1: Testing Schedule with results.
48 | P a g e
CHAPTER 7
Discussion
7.1 Discussion of Results
The objective of this project in start was to develop a node/modem that can be a part of a
mesh network to communicate with other modems in network through wireless module
ER400TRS. At the beginning the schematic capture for the required circuit did not take
time. Simulation was not possible with that schematic capture. But the design of PCB
layout took some time although the constructed PCB was working as expected. During the
PCB layout design as it was aimed to produce a single sided board to reduce the cost of
printing and also according to the datasheet of the ER400TRS single sided PCB was
preferred. And it was quite difficult to make all the connections using bottom copper to
make handy and small PCB. There were few connections left which was indicated by
using top silk from J1 to J6. After completion of drilling and soldering of the components
it was then connected using a black manual wire on three of the PCBs. Another one issue
to be discussed is the oscillator for the PIC. Internal oscillator was used for this project
because it was much simpler and easier and also sometimes difficult to get the external
oscillator to work even though internal oscillator was slightly less stable.
Test plan 1, 2 and 3 were successfully tested and accomplished. Three of them have given
the expected and accurate results. In the final code (Test Plan 4) of this project the modem
detection was not dynamic and it was fixed at the moment. DIP switches were used to
assign the dedicated modem id through hardware which should be dynamically assigned
during initialization of node. Also there should be adhoc based dynamic routing
mechanism implemented with RF power monitoring to know the corresponding modems
in range. So that every node may aware of their possible in range neighbour node and can
add it into its route. That means the DIP switch worked as a digital input and LEDs were
as an output. In the final code LED 1 was glowing to indicate the supply voltage on the
PCB, LED 2 was for transmitting and LED 3 for receiving. But only LED 1 and 2 were
glowing [Appendix 10]. The mechanism used for LED 2 and 3 was not working as
expected. One of the issues encountered that RF level/power was not being monitored first
problem was to know which modem was in the range and which was not. Also expected
results are not same as actual results and data was lost some times.
49 | P a g e
Packet based messages were transferred in between the nodes. The only difference was the
Node C. This Node could not transmit any packet based messages it could only receive
and forward messages from other nodes. It might happen due to the RF conflict. At the
moment hit and trial based method was used to know the range and different improvement
in code and algorithm implemented to improve the routing mechanism to get the actual
results.
More testing and modification could make the condition better than present to found out
more possible errors, modification of physical structure, hardware and programmes.
7.2 Discussion of Gantt chart
Gantt chart was used to maintain a time schedule for completing an engineering project
like this within a fixed time range. This project consisted of four phases. They are
literature review, design, development and testing. First phase of literature has completed
on time. Design phase could not be completed on time that is why it was modified after the
initial version. This phase took longer time than it was planned and expected so this task
was not achieved on time. Schematic has also gone through couple of changes. Some
parallel tasks were required like while determining the signal strength designing and
implementing was also done at the same time. Three test plans along with the final code
were added this time in phase 4 of the Gantt chart. The updated and final version of the
Project Gantt chart, showing progress to date, is on the Appendix 9.
50 | P a g e
CHAPTER 8
Conclusion
Wireless communication has been the best choice among all the other „over-the-air‟
technologies like Infrared, Bluetooth, DECT and so on. Wireless transmission of
„information‟, which can be digital data or file. This project focused on the current issue of
wireless communication within the short range. This short range wireless technology has
huge future market potential for entertainment, logistics, healthcare and automotive.
Presented experimental wireless hub has been successfully deployed as hardware and
software design using Easy-Radio Transceiver and PIC18F1320. This paper presents
details on the implementation of the whole system, coding techniques for all the test and
routing technique for the final code. The findings of this project were gained through a
background research and literature survey with related and vital references for
understanding current conditions, investigating the minimum requirements to analyse any
given problem for making to do list, explored some sample projects which has helped to
identify the possible solutions for the practical work for an outcome in uneven
circumstances. Subject to the limitation of equipment cost three PCBs or Nodes were made
with the similar configuration of systems. These were successfully designed and
implemented around the fixed laboratory period. To achieve the main purpose of this
project some objectives were set like testing core components of the system. For that
reason, three codes in C were written using CCS C and compiled using MBLAB IDE to
test the inputs/outputs, MM232R and ER400TRS. These also provided expected results.
These tests were very important prior to the final code because it required a serial terminal
from PC to the PCB or node to send messages to the node, MM232R served that purpose
and ER400TRS served as transceiver to wirelessly communicate. First two deliverables of
this project were achieved. Third deliverable was to implement bi-directional
communication between more two hubs or nodes were nearly accomplished. Experimental
results proved limited usability of the system although regular data transmission between
nodes has been shown. The learning outcomes from this project are microcontroller
programming for interfacing MM232R interfacing to communicate with PC over interface
USB, interfacing wireless module ER400TRS, PCB design and development, RF
communication essentials and basic routing techniques for Mesh networking.
51 | P a g e
CHAPTER 9
Future Work
The future work comes into play in order to improve the present project. The aim of this
project was to build a wireless hub using Easy-Radio module, MM232R and PIC18F1320
that is capable of communicating wirelessly. Even though the project more or less had
achieved the goals, there are a large number of works need to be done and improved.
Such as currently on this project receiving characters for each node are displayed on the
HyperTerminal window. Currently, microcontroller devices are using LCD displays to
output visual information. Such a display can be implemented on the already constructed
PCB of this project. It will display the standard ASCII set of characters which will be
transmit or receive using their respective node. One of the other important improvements
that could be made on this project is to make it portable. Like instead of Thru-hole
components if SMT (Surface Mount Technology) components were used it will make the
PCB smaller in size and handy too. And also on this PCB instead of MM232R a female
USB connector can be implemented which will directly connect to the PC even though it
requires much more intelligence.
Currently a simple piece of wire was used as an antenna for each PCB or node. It can be
improved if Helical or Whip antennas and connectors were used instead of that. But due to
the limitation of costing it was not used. Such an antenna instead of a simple wire will
make the node more efficient. The distance between the nodes in this project was
approximate 20m which was not satisfactory. Implementing those antennas into the PCB
might improve the distance.
HyperTerminal was used to send the characters from one node to another with an
acknowledgement reply. In the future instead of sending characters File Transfer Protocols
like XModem could be used. XModem divides the data into a series of packets that are
sent to the receiver. In addition user interface can be implemented on this project. It will
allow users to interact with the nodes with images rather than text commands as now. GUI
(Graphic User Interface) can be created using Matlab or Text Interface using Microsoft
C/C++ or Visual C or Visual Basic.
52 | P a g e
REFERENCES
1. Goldsmith Andrea (2005), „Wireless Communications‟, Publisher: Cambridge
University Press, ISBN 0-521-83716-2
2. Iovine John (2004), „PIC Microcontroller Project Book‟, Second Edition, Publisher:
McGraw-Hill, ISBN 0-07-143704-5
3. Nick Hunn (2010), „Essentials of Short-range wireless‟, Publisher: Cambridge
University Press, ISBN 978-0-521-76069-0
4. Easy-Radio ER400TRS Transceiver (2003), LPRS Data Sheet, Available at:
http://www.robot-electronics.co.uk/datasheets/Easy-Radio%20ER400TRS%201-2.pdf,
[Date accessed: 12/04/2011]
5. MM232R USB-Serial UART development module datasheet version 1.1 (2010),
Available at:
http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_MM232R.pdf
[Date accessed: 11/04/2011]
6. D. Langwald, P. Groppe and B. vom Berg (2003), „Wireless RS232 link Using license-
exempt Short Range Devices (SRDs)‟, Elektor Electronics
7. A. Sikora (2004), „Design challenges for short-range wireless networks‟, IEE
Proceedings-Communications, Vol. 151, No. 5. ISSN-20040742.
8. O. Mirabella, Lo Bello, A. Raucea (2007), „Improving routing in long-distance wireless
mesh networks via a distributed embedded router‟, Journal of Parallel and Distributed
Computing, ISSN-0743-7315
9. Barnes, Stuart J. (2002), „Under the skin: short-range embedded wireless technology‟,
International Journal of Information Management 22(2002) 165-179, ISSN-0268-
4012/02.
10. Ian F. Akyildiz, Xudong Wang, Weilin Wang (2005), „Wireless mesh networks: a
survey‟, Computer Networks 47 (2005) 445–487, ISSN-1389-1286.
11. A.H.G. Al-Dhaher (2001), „Integrating hardware and software for the development
of microcontroller bases systems‟, Microprocessors and Microsystems 25(2001) 317-
328, ISSN-0141-9331/01.
12. James M. Conrad, Ivan Howitt (2006), „Introducing Student to Communications
Concepts Using Optical and Low-Power Wireless Devices‟, Turk J Elec Engin,
VOL.14, NO.1, ISSN-1401-2006.
13. David C. Chou, David C. Yen (2001), „Wireless communication: the next wave of
Internet Technology‟, Technology in Society 23(2001) 217-226, ISSN- 0160-791X/01.
53 | P a g e
14. Marshall Brain, Tracy V. Wilson, „How WiFi works?‟, Available at:
http://computer.howstuffworks.com/wireless-network1.htm [Date accessed 24th
April‟2011]
15. Electronic Projects (2010), Available at: http://www.electronic-
engineering.ch/microchip/ [Date accessed: 26th
April‟2011]
16. What‟s a microcontroller? Student Guide, Version 2.2, PARALLEX, ISBN 1-
928982-02-6,p1-5
17. K. Fazel, P. Robertson, O. Klank, F. Vanselow (1998). ‟ Concept of a wireless
indoor video communications system‟, Signal Processing: Image Communication 12
(1998) 193-208, ISSN- 0923-5965/98.
18. S. Salmons, G.T. Gunning, I. Taylor, S.R.W. Grainger, D.J. Hitchings, J.
Blackhurst, J.C. Jarvis (2001),‟ASIC or PIC? Implantable stimulators based on semi-
custom CMOS technology or low-power microcontroller architecture‟, Medical
Engineering & Physics 23 (2001) 37–43, ISSN- 1350-4533/01.
19. Behzad Razavi (1997),‟Recent Advances in RF Integrated Circuits‟, IEEE
Communications Magazine, ISSN- 0163-6804/97.
20. Barry B. Brey (2008),‟Applying PIC18 Microcontrollers‟, Publisher: Pearson
Prentice Hall, ISBN- 0-13-088546-0
21. Olin Lathrop, Embed Inc. (2009),‟ In-circuit Serial Programming
(ICSP)‟,Available at: http://www.embedinc.com/picprg/icsp.htm [Date accessed: 20th
June‟2011]
22. Remigiusz Olejnik (2010), „An Experimental Wireless Mesh Network Node Based
on AVR ATmega 16 Microcontroller and RFM12B Radio Module‟, Computer
Network: 17th Conference, ISSN-7796-105.
23. J.P. Carmo, J.H. Correia (2009), „Low-power/low-voltage RF microsystems for
wireless sensors networks‟, Microelectronics journal 40(2009), ISSN-0026-2692.
24. Mikko Sallinen, Esko Strömmer and Pirkka Tukeva (2009), „Short-Range
Communication in Ubiquitous Professional and Consumer Applications‟, Available at:
http://ercim-news.ercim.eu/en76/special/short-range-communication-in-ubiquitous-
professional-and-consumer-applications [Date accessed: 1st
October‟2011]
25. Srividya Iyer, „RSSI - Receive Signal Strength Indicator‟, Available at:
http://www.birds-eye.net/definition/r/rssi-receive_signal_strength_indicator.shtml [Date
accessed: 15th
October‟2011]
26. National Instruments (2004), „Serial Port Communication‟, Available at:
http://cnx.org/content/m12293/latest/ [Date accessed: 24th
August‟2011]
54 | P a g e
27. David G. Wright, Timothy J. Williams, Jefferey D. Wick (2005), „Method of
Programming USB Microcontrollers‟, United States Patent.
28. Raja Banerjea (2007), „Short-range Wireless Communication‟, United States Patent
Application Publication.
29. Jan Axelson (1993), ‟Making Printed Circuit Boards‟, Publisher: Janet Loise
Axelson, ISBN: 0-8306-3950-0
30. Harry J. R. Dutton (1998), „Understanding Optical Communications‟, International
Technical Support Organization.
55 | P a g e
BIBLIOGRAPHY
1. Muhammad Ali Mazidi, Rolin D. McKinlay, Danny Causey (2008),‟PIC
Microcontroller and Embedded Systems‟, Publisher: Pearson International Edition,
ISBN-0-13-600902-6.
2. Ibrahim, Dogan (2008),‟ Advanced PIC Microcontroller Projects in C: From USB
to RTOS with the PIC 18F Series‟, Publisher: Elsevier Science & Technology,
ISBN- 9780750686112.
3. Details of pic ICSP and how to use it for pic microcontrollers, Available at:
http://www.best-microcontroller-projects.com/pic-icsp.html [Dates accessed: 22nd
September‟2011]
4. RF and Communications Fundamentals, Available at:
http://zone.ni.com/devzone/cda/tut/p/id/3992#toc0. [Date accessed: 25th
September‟2011]
56 | P a g e
APPENDIX 1
Header file code
//****************************************************************
// Module EasyRadio.h by Samit
// Description: This module provides the peripherial configuration
for the used microcontroller in Easy Radio PCB module.
//****************************************************************
//****************************************************************
// Includes
//****************************************************************
*
#include <18F1320.h> // Microcontroller used
//****************************************************************
*
// Configuration of fues settings
//****************************************************************
*
#device ICD=TRUE // ICD enabled
#device adc=10 // 10-bit ADC setting
#FUSES NOWDT // No Watch Dog Timer
#FUSES WDT128 // Watch Dog Timer uses 1:128
Postscale
#FUSES INTRC_IO // Internal RC Osc, no CLKOUT
#FUSES NOFCMEN // Fail-safe clock monitor
disabled
#FUSES NOBROWNOUT // No brownout reset
#FUSES PUT // Power Up Timer
#FUSES NOCPD // No EE protection
#FUSES NOSTVREN // Stack full/underflow will not
cause reset
#FUSES DEBUG // Debug mode for use with ICD
#FUSES NOLVP // No low voltage prgming,
B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT // Program memory not write
protected
#FUSES NOWRTD // Data EEPROM not write
protected
#FUSES NOWRTC // Configuration not registers
write protected
#FUSES IESO // Internal External Switch Over
mode enabled
#FUSES NOEBTR // Memory not protected from
table reads
#FUSES NOEBTRB // Boot block not protected from
table reads
#FUSES MCLR // Master Clear pin enabled
#FUSES NOPROTECT // Code not protected from
reading
#FUSES NOCPB // No Boot Block code protection
#FUSES NOWRTB // Boot block not write protected
#use delay(clock=4000000) // (Dont Care)Internal RC
Oscilator used
// On board UART IO definations
#use rs232(baud=9600, xmit=PIN_B6,rcv=PIN_B7, STREAM = MM232R )
57 | P a g e
#use rs232(baud=19200,xmit=PIN_B1,rcv=PIN_B4,UART1,STREAM =
ER400)
// On board LEDs IO definations
#define LED1 PIN_A2 // First LED for supply voltage
#define LED2 PIN_A1 // Second LED for data transmit
#define LED3 PIN_A0 // Third LED for data receive
// On board Dip switch IO definations
#define SWITCH1 PIN_A6 // General purpose switch 1 input
#define SWITCH2 PIN_A7 // General purpose switch 2 input
#define SWITCH3 PIN_B2 // General purpose switch 3 input
#define SWITCH4 PIN_B3 // General purpose switch 4 input
// On board MM232R IO definations
#define CTS_MM232R PIN_B0
//****************************************************************
*
// End of file
//****************************************************************
*
58 | P a g e
APPENDIX 2
Test Plan 1: LED testing code
//****************************************************************
*
// Module ER_LED.c by Samit
// Description: This module provides the functionalities to test
// the LEDs on Easy Radio PCB
//****************************************************************
*
// Includes
//****************************************************************
*
#include "EasyRadio.h"
//****************************************************************
*
// Pragmas and Constant Defines
//****************************************************************
*
#define LED_STATE_DELAY 500 // Half second delay selected for
inter LED state
//****************************************************************
*
// Local Function Prototypes
//****************************************************************
*
void LEDTest(void);
//****************************************************************
*
// main(void)
// Main function defines the microcontroller's inbuilt peripherial
// settings and then enters into infinite loop of LED test routine
//****************************************************************
*
void main()
{
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
disable_interrupts(INT_RDA);
disable_interrupts(GLOBAL);
LEDTest();
}
//****************************************************************
*
// LEDTest(void)
// This function toggles the LEDs one by one in an infinite loop
with a pre-defined LED_STATE_DELAY delay
//****************************************************************
*
void LEDTest(void)
59 | P a g e
{
while(1)
{
output_toggle(LED1);
delay_ms(LED_STATE_DELAY);
output_toggle(LED2);
delay_ms(LED_STATE_DELAY);
output_toggle(LED3);
delay_ms(LED_STATE_DELAY);
}
}
//****************************************************************
*
// End of file
//****************************************************************
*
60 | P a g e
APPENDIX 3
Test Plan 1: SWITCH testing code
//****************************************************************
*
// Module ER_SWITCH.c by Samit
// Description: This module provides the functionalities to test
the Switches on Easy Radio PCB
//****************************************************************
*
//****************************************************************
*
// Includes
//****************************************************************
*
#include "EasyRadio.h"
//****************************************************************
*
// Pragmas and Constant Defines
//****************************************************************
*
#define MASTER_SWITCH SWITCH4 // This switch enables or disable
all switches
#define LED_STATE_DELAY 500 // Half second delay selected for
inter LED state
//****************************************************************
*
// Local Function Prototypes
//****************************************************************
*
void SwitchTest(void);
//****************************************************************
*
// main(void)
// Main function defines the microcontroller's inbuilt peripherial
// settings and then enters into infinite loop of Swtich test
routine
//****************************************************************
*
void main()
{
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
disable_interrupts(INT_RDA);
disable_interrupts(GLOBAL);
SwitchTest();
}
//****************************************************************
*
// SwtichTest(void)
61 | P a g e
// This function first check the master switch,if it is on then it
checks other switches and on/off LEDs accordingly
//****************************************************************
*
void SwitchTest(void)
{
while(1)
{
if(input(MASTER_SWITCH)) // If master switch is on,
check other switches
{
// Check if switch 1 is on, put LED1 on
if(input(SWITCH1))
{
output_high(LED1);
}
else
{
output_low(LED1);
}
// Check if switch 2 is on, put LED2 on
if(input(SWITCH2))
{
output_high(LED2);
}
else
{
output_low(LED2);
}
// Check if switch 3 is on, put LED3 on
if(input(SWITCH3))
{
output_high(LED3);
}
else
{
output_low(LED3);
}
}
else
{
// If master switch is off, Off all LEDs
output_low(LED1);
output_low(LED2);
output_low(LED3);
}
}
}
//****************************************************************
*
// End of file
//****************************************************************
*
62 | P a g e
APPENDIX 4
Test Plan 2: MM232R Transmission test code
//*****************************************************************
// Module MM232R.c by Samit
// Description: This module provides the functionalities to test the MM232R data transmission
from PIC
//*****************************************************************
//*****************************************************************
// Includes
//*****************************************************************
#include "EasyRadio.h"
#include "String.h"
//*****************************************************************
// Pragmas and Constant Defines
//****************************************************************
//*****************************************************************
// Local Function Prototypes
//*****************************************************************
void MM232R_TXTest(void);
//*****************************************************************
// main(void)
// Main function defines the microcontroller's inbuilt peripheral settings and then enters into
infinite loop of data send routine
//*****************************************************************
void main()
{
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
disable_interrupts(INT_RDA);
disable_interrupts(GLOBAL);
MM232R_TXTest();
}
//*****************************************************************
// MM232R_TXTest(void)
// This function transmit the data string "Test String" using TX pin of MM232R in an infinite loop
//*****************************************************************
void MM232R_TXTest(void)
{
unsigned char MMsg[] = {"Test Stringnr"};
while(1)
{
fputs(MMsg,MM232R);
delay_ms(500); // Half second delay
}
}
63 | P a g e
//*****************************************************************
// End of file
//*****************************************************************
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes
Wireless Mesh Network Nodes

More Related Content

Similar to Wireless Mesh Network Nodes

ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...
ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...
ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...Valerie Felton
 
PROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEMPROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEMNandasaba Wilson
 
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docx
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docxPROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docx
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docxIreneCarbonilla2
 
BE1268_Dissertation_Clarke_Ricky_W13032289
BE1268_Dissertation_Clarke_Ricky_W13032289BE1268_Dissertation_Clarke_Ricky_W13032289
BE1268_Dissertation_Clarke_Ricky_W13032289Ricky Clarke
 
ANSYS Fluent - CFD Final year thesis
ANSYS Fluent - CFD Final year thesisANSYS Fluent - CFD Final year thesis
ANSYS Fluent - CFD Final year thesisDibyajyoti Laha
 
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEW
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEWCAPACITY BUILDING IN THE PRINTING INDUSRTY NEW
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEWRichard Odei-Nkansah
 
Brar.Randhir 2Nov14.pdf
Brar.Randhir 2Nov14.pdfBrar.Randhir 2Nov14.pdf
Brar.Randhir 2Nov14.pdfMuradAlam12
 
Industry_Project_Report
Industry_Project_ReportIndustry_Project_Report
Industry_Project_ReportEanna Hegerty
 
Final Capstone Report A14-159 Frans Georges
Final Capstone Report A14-159 Frans GeorgesFinal Capstone Report A14-159 Frans Georges
Final Capstone Report A14-159 Frans GeorgesFrans Georges
 
@author Jane Programmer @cwid 123 45 678 @class
   @author Jane Programmer  @cwid   123 45 678  @class   @author Jane Programmer  @cwid   123 45 678  @class
@author Jane Programmer @cwid 123 45 678 @classtroutmanboris
 
@author Jane Programmer @cwid 123 45 678 @class.docx
   @author Jane Programmer  @cwid   123 45 678  @class.docx   @author Jane Programmer  @cwid   123 45 678  @class.docx
@author Jane Programmer @cwid 123 45 678 @class.docxShiraPrater50
 
Complete Thesis-Final
Complete Thesis-FinalComplete Thesis-Final
Complete Thesis-FinalHao SHEN
 

Similar to Wireless Mesh Network Nodes (20)

ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...
ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...
ARTIFICIALLY INTELLIGENT FACE DETECTION AND INVESTIGATION SYSTEM BASED ON OPE...
 
ABSTRACT
ABSTRACTABSTRACT
ABSTRACT
 
Encouraging Green Mobility
Encouraging Green MobilityEncouraging Green Mobility
Encouraging Green Mobility
 
PROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEMPROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEM
 
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docx
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docxPROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docx
PROPOSED NEW BRIDGE IN NAPUYAN ASENIERO DAPITAN CIT1.docx
 
BE1268_Dissertation_Clarke_Ricky_W13032289
BE1268_Dissertation_Clarke_Ricky_W13032289BE1268_Dissertation_Clarke_Ricky_W13032289
BE1268_Dissertation_Clarke_Ricky_W13032289
 
1227201 Report
1227201 Report1227201 Report
1227201 Report
 
ANSYS Fluent - CFD Final year thesis
ANSYS Fluent - CFD Final year thesisANSYS Fluent - CFD Final year thesis
ANSYS Fluent - CFD Final year thesis
 
ourintern.docx
ourintern.docxourintern.docx
ourintern.docx
 
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEW
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEWCAPACITY BUILDING IN THE PRINTING INDUSRTY NEW
CAPACITY BUILDING IN THE PRINTING INDUSRTY NEW
 
Report_FAT1_Final
Report_FAT1_FinalReport_FAT1_Final
Report_FAT1_Final
 
Brar.Randhir 2Nov14.pdf
Brar.Randhir 2Nov14.pdfBrar.Randhir 2Nov14.pdf
Brar.Randhir 2Nov14.pdf
 
INCEST AND IMPACT(sociological study)
INCEST AND IMPACT(sociological study)INCEST AND IMPACT(sociological study)
INCEST AND IMPACT(sociological study)
 
FYP_Thesis
FYP_ThesisFYP_Thesis
FYP_Thesis
 
Industry_Project_Report
Industry_Project_ReportIndustry_Project_Report
Industry_Project_Report
 
Final Capstone Report A14-159 Frans Georges
Final Capstone Report A14-159 Frans GeorgesFinal Capstone Report A14-159 Frans Georges
Final Capstone Report A14-159 Frans Georges
 
@author Jane Programmer @cwid 123 45 678 @class
   @author Jane Programmer  @cwid   123 45 678  @class   @author Jane Programmer  @cwid   123 45 678  @class
@author Jane Programmer @cwid 123 45 678 @class
 
@author Jane Programmer @cwid 123 45 678 @class.docx
   @author Jane Programmer  @cwid   123 45 678  @class.docx   @author Jane Programmer  @cwid   123 45 678  @class.docx
@author Jane Programmer @cwid 123 45 678 @class.docx
 
Complete Thesis-Final
Complete Thesis-FinalComplete Thesis-Final
Complete Thesis-Final
 
Puvan Dissertation 2
Puvan Dissertation 2Puvan Dissertation 2
Puvan Dissertation 2
 

Recently uploaded

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Recently uploaded (20)

A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

Wireless Mesh Network Nodes

  • 1. i | P a g e University of Greenwich School of Engineering Declaration of Originality I, the undersigned, declare that the work contained within this report is completely my own. Any material that has not been originated by me has been clearly referred. Name: ................................................................................................. Signature: ................................................................................................. Date: .................................................................................................
  • 2. ii | P a g e ABSTRACT Wireless communication has revolutionized the concurrent communication industry. Its applications range from satellite transmission, radio and television broadcasting to mobile phone. This project is aimed to create wireless hubs by using digital radio transmitter and receiver and these hubs should be capable of communicate wirelessly in-between them. It also intended that these hubs or short range devices will have mesh interconnection capability. To achieve these purposes a small system in a form of PCB (Printed Circuit Board) was designed and implemented containing Radio Module (ER400TRS), USB interface (MM232R) and Microcontroller (PIC18F1320). ER400TRS made it possible to employ a license-free carrier frequency like pan-European 433.05-434.79 MHz band. MM232R was used to provide the communication link between PC and node, PIC18F1320 was chosen for its better performance. To fulfil the requirements of output and digital inputs, LEDs and Switches were implemented. The important part of this project was the transfer of packets of messages from one node or PCB to another node and when three nodes were used they were organised in a straight line so that the two end nodes cannot communicate directly with each other. To determine how close nodes would need to be the signal strength against distance apart was critically investigated by using existing PCB with a USB link and ER400TRS. Next was the development of the appropriate hardware and software, for each node. Once it was done a number of simple test were done to check the inputs/outputs, MM232R communication with the PC and bi-directional communication using ER400TRS. Each test required a compiler to compile the C code into a PIC readable format and a PIC programmer to burn the program into the PIC. More or less, the deliverables and objectives of this project were achieved by implementing bi-directional communication of messages between three nodes or hubs.
  • 3. iii | P a g e ACKNOWLEDGEMENT I would like to thank number of personalities for their support and encouragement throughout the duration of this project. First of all I would like to thank my respected Supervisor Dr. R. C. Seals of School of Engineering, University of Greenwich for initiating this project and for his continuous help, support and patience. Special thanks to Mr. A. Feasy who always had the time and motivation to help during the lab session. I would also like to thank my family and friends for their support during this time, without which it would have not been possible for me to achieve this goal. Finally I dedicate this project to my family.
  • 4. iv | P a g e Table of Contents Declaration of Originality.......................................................................................................i ABSTRACT ..........................................................................................................................ii ACKNOWLEDGEMENT................................................................................................... iii CHAPTER 1.........................................................................................................................1 Introduction ...........................................................................................................................1 1.1 Introduction.............................................................................................................1 1.2 Aims and Objectives...............................................................................................2 1.3 Project Deliverables................................................................................................3 1.4 Project Constraints..................................................................................................3 CHAPTER 2.........................................................................................................................4 Literature Review ..................................................................................................................4 2.1 Communication System...............................................................................................4 2.2 Microcontroller System...............................................................................................7 2.3 Design of Printed Circuit Board ..................................................................................7 CHAPTER 3.........................................................................................................................8 Requirements Analysis......................................................................................................8 3.1 Components Requirements Analysis...........................................................................8 3.2 Design Requirements Analysis....................................................................................9 3.3 Construction Requirements Analysis ..........................................................................9 3.4 Programming Requirements Analysis.......................................................................10 3.5 Final to do list............................................................................................................10 3.6 Testing Schedule .......................................................................................................11 CHAPTER 4.......................................................................................................................12 Possible Solutions............................................................................................................12 4.1 Communication System Solutions ........................................................................12 4.1.1 Node to Node Communication.......................................................................12 4.1.2 Communication between Node to PC ............................................................14 4.2 Microcontroller Solutions......................................................................................15 4.2.1 Basic Stamp 2 (BS2) IC..................................................................................15 4.2.2 Programmable Logic Control.........................................................................15
  • 5. v | P a g e 4.2.2 Atmel ..............................................................................................................15 4.2.3 Microchip .......................................................................................................16 4.2.4 Selected Microcontroller ................................................................................16 4.3 Programming Solutions.........................................................................................17 4.4 PCB construction solution.....................................................................................18 4.4.1 Types of circuit board.....................................................................................18 4.4.2 Schematic and PCB design software..............................................................18 4.4.3 Drilling Methods ............................................................................................19 4.4.4 Soldering Methods..........................................................................................19 CHAPTER 5.......................................................................................................................20 Problem Implementation .................................................................................................20 5.1 Hardware implementations....................................................................................20 5.1.1 Circuit design by ISIS ....................................................................................20 5.1.2 Layout design by ARES .................................................................................23 5.1.3 List of Components ........................................................................................25 5.1.4 Drilling and soldering components.................................................................26 5.1.5 Identifying Node Distance..............................................................................28 5.2 Software Implementation ......................................................................................29 5.2.1 Test Plan 1 ......................................................................................................30 5.2.2 Test Plan 2 ......................................................................................................32 5.2.3 Test Plan 3 ......................................................................................................34 5.2.4 Test Plan 4 (Final Code).................................................................................34 5.2.5 Settings for Communication Test...................................................................38 CHAPTER 6.......................................................................................................................39 Results .............................................................................................................................39 6.1 Test Plan 1 Results ................................................................................................39 6.2 Test Plan 2 Results ................................................................................................41 6.3 Test Plan 3 Results ................................................................................................43 6.4 Test Plan 4 (Final Code) Results...........................................................................44 6.4 Testing Schedule ...................................................................................................47 CHAPTER 7.......................................................................................................................48 Discussion........................................................................................................................48 7.1 Discussion of Results ............................................................................................48
  • 6. vi | P a g e 7.2 Discussion of Gantt chart ......................................................................................49 CHAPTER 8.......................................................................................................................50 Conclusion.......................................................................................................................50 CHAPTER 9.......................................................................................................................51 Future Work.....................................................................................................................51 REFERENCES ..................................................................................................................52 BIBLIOGRAPHY..............................................................................................................55 APPENDIX 1 .....................................................................................................................56 Header file code...............................................................................................................56 APPENDIX 2 .....................................................................................................................58 Test Plan 1: LED testing code.........................................................................................58 APPENDIX 3 .....................................................................................................................60 Test Plan 1: SWITCH testing code..................................................................................60 APPENDIX 4 .....................................................................................................................62 Test Plan 2: MM232R Transmission test code................................................................62 APPENDIX 5 .....................................................................................................................64 Test Plan 2: MM232R Reception test code.....................................................................64 APPENDIX 6 .....................................................................................................................68 Test Plan 3: ER400TRS test code and flow chart ...........................................................68 APPENDIX 7 .....................................................................................................................73 Test Plan 4: Final Code ...................................................................................................73 APPENDIX 8 .....................................................................................................................83 Components Order From.................................................................................................83 APPENDIX 9 .....................................................................................................................84 Gantt Chart ......................................................................................................................84 APPENDIX 10 ...................................................................................................................85 More project images........................................................................................................85
  • 7. 1 | P a g e CHAPTER 1 Introduction 1.1 Introduction One of the fastest growing fields of engineering world was Wireless communications. This is the modern shape of physical wire communication Medias. Advancement of this wireless technology was at peak in this century. New inventions of wireless communication devices are happening day by day [1]. Existing devices are also performing well. Research and development on wireless devices are also at peak. In simple words a revolution of wireless communication has started [13]. Wireless communication was the core theme of this project. Wireless communication can be via radio frequency or microwave or infrared (IR) short range communication. This project was using radio frequency for wireless communication within the short range. In this project communication was in between adjacent buildings on the Medway campus using Easy-Radio style digital radio transmitter and receiver modules. The Easy-Radio style provides high performance, simple to use radio module that can bi- directionally transfer data over a range up to 250m Line of Sight (LOS) [4]. This project contained specific primary components to make the system work properly. These are broken down into four simple components like data signal (computer interface or USB), radio transceiver, microprocessor and Antenna system. In addition to being able to communicate, it must also have a mesh interconnection capability. Initially communication will be by sending single ASCII characters and then using the file transfer protocol. Mainly this system required to have some form of intelligence such as PIC microprocessor system in order to fulfil the requirements of this project.
  • 8. 2 | P a g e Figure 1.1: System block diagram. 1.2 Aims and Objectives To design and develop a short range intelligent digital radio wireless hub was the main goal of this project. This hub must be able communicate between adjacent buildings on the Medway campus using digital transmitter and receiver modules (Easy-Radio). It also must have some interfacing capability like four LEDs for output and four digital inputs, a local USB interface and also mesh interconnection capability. For example, if one of the hubs was placed into Hawke building and the other hub is on the Pembroke building of the campus, messages could be passed from hub to hub to provide bi-directional communication between them. To achieve the goal which is stated above the following objectives have been set:  To research and investigate about issues in wireless technology and radio frequency communication using a microcontroller.  To have a details idea about the digital radio transmitter and receiver modules, PIC microprocessor systems and mesh topology.  To make Tx and Rx.  To familiarise with the present technology to create three wireless hubs using Easy- Radio Transceiver.  To integrate all the required knowledge to a single design and to build the printed circuit boards for the three Hubs and to test it. PC 1 PC 3PC 2 HOST (A) HOST (B) HOST (C) Radio Transceiver (A) Radio Transceiver (B) Radio Transceiver (C)
  • 9. 3 | P a g e 1.3 Project Deliverables The main objective of this project was to build three circuits which would have radio module, USB interface and a microcontroller. These are the core components for final digital wireless hub. Key areas of this project are as follows:  Design and implement more than two small systems containing a Transceiver (Radio module), USB interface and a Microcontroller.  Implement bi-directional communication of ASCII characters between two hubs.  Implement bi-directional communication between more than two hubs arranged in a straight line of maximum error free communication distances. 1.4 Project Constraints The following two major constraints were taken into consideration for the project.  Lack of manpower: It was the aim that the cost of each PCB (Printed Circuit Board) for the system would be as low as possible as many of them would be made. It was planned to construct three PCBs within the limited cost which helped to prove mesh interconnection capability. It was impossible to attend three nodes at a time while testing. But this constraint was overcome by the help from author‟s colleagues.  Time: There was a limitation of time for carrying out the practical lab based work. Because the project labs were closed at the end of July‟11 for the summer vacation. Weekly lab work and meeting with the supervisors helped in completing the lab based tasks on time.
  • 10. 4 | P a g e CHAPTER 2 Literature Review Good amount of work has been carried out by a number of engineers and researchers in the field of digital radio wireless communication over a short range. This literature review summarized what has been understood about wireless communication, digital radio communication, short-range communication and its applications, Mesh interconnection topology, Microcontroller, USB interface (MM232R), different steps for designing the PCB and synchronous/asynchronous serial communication through the study of books, past research papers, journals, datasheets and website information. Thematic analysis was done and three specific themes were decided. They are Communication System, Microcontroller System and Design of Printed Circuit Board. 2.1 Communication System Wireless communication is the fastest growing part of the current communication industry because of its widespread deployment. It was first developed in the pre-industrial age [12]. Those systems used to transmit information over line-of-sight distances using smoke signals, flashing mirrors. Wireless networks, both as stand-alone systems and as part of the larger networking infrastructure. There is a gap between current and emerging systems and the vision for future wireless applications shows that much work needs to be done to make this vision a reality [1]. Digital radio communication means the analogue signal is digitized into zeros and ones and then compressed and transmitted using a digital modulation scheme [1]. Communication across a wireless network is like a two-way radio communication. The signal is transmitted into the open air, using an antenna which radiates energy at some carrier frequency [14]. A transmitter does this job and it consists of a source of electrical energy, which produces alternating current of a desired frequency of oscillation. The propagation of energy depends on the frequency and the antenna and it can be unidirectional or Omni-directional fashion. A wireless hub or router on the other end receives the transmitted signal and decodes it [14]. This process also works in reverse. Radio frequencies range from a few tens of hertz to three hundred gigahertz. This similar mechanism is also used for walkie-talkies, cell phones and other devices.
  • 11. 5 | P a g e The term short-range typically means less 100 meter e.g. NFC (Near Field Communication), Zigbee, Z-Wave, Wi-Fi and DECT (Digital Enhanced Cordless Telecommunication) [4]. There are several technologies for different applications of short- range wireless embedded devices like Bluetooth, Infrared Data Association, Home Radio Frequency, Ultra-Wideband Radio and their applications in the workplace, home, public, travel [24]. There are different design challenges for short-range wireless networks like mesh topology issues, i.e. mesh networking and device issues, i.e. efficient and low-cost issues and also their solution [23]. But sometimes devices cannot communicate wirelessly within a short range like range less than 1 meter [28]. Mesh is one type of network topology where data is forwarded between the nodes until it reaches the destination without the help of central node. Central node means hub or switch or access point. This type of the communication depends on radio range of the nodes. An example of such a network has given. Figure 2.2: An example of mesh network. Signal Radio transmitter Modulated Signal Demodulated Signal Signal Radio Receiver Transmission Antenna Reception Antenna Figure 2.1: Typical radio transmission and reception
  • 12. 6 | P a g e Start Bit Data Bits Parit y Bit Stop Bits In this project serial communication was required to communicate between node with the PC. Serial communication means sending and receiving bytes of information one bit at a time. This type of communication is basically used for transmitting information or data between a computer and a peripheral device like programmable instrument. The serial port on a computer is full duplex. Full duplex means it has separate lines for transmitting and receiving data. That means they can send and receive at the same time. Parallel communication is much faster than the serial because it allows transmission of a byte at a once [26]. Generally, engineers use serial communication to transmit ASCII data. Such a communication is completed using three transmission lines – ground, transmit and receive. Synchronous and asynchronous are two forms of serial transmission. In the case of synchronous communication the sender and receiver share a clock with each other. It allows much faster rate than asynchronous communications, because additional bits are not required for each data. On the other hand asynchronous means no synchronization, because it allows data to be transmitted without the sender having to send a clock signal to the receiver end. Description of some important serial parameters has given below: Baud rate is basically the speed measurement for communication. It indicates the number of bit transfers per second like 9600 baud means 9600 bits per second. The end of communication for a single frame is indicated by the stop bit. Typically they can be 1, 1.5 and 2 bits. They are the measurement of the actual data bits in a transmission. The amount of actual data may not be a full 8 bits all the time. It can be 5, 7, and 8 bits for frames. Parity is used for error checking in serial communication. There are four types of parity and they are even, odd, marked and spaced. It helps to detect data corruption which might occur during transmission. Figure 2.3: Typical character frame. Character Frame
  • 13. 7 | P a g e 2.2 Microcontroller System Microcontroller is the nerve centre of this project. The wireless hub should have some form of microcontroller based intelligence. Microcontrollers are not only used in home and office appliances, instruments and machinery but also into everyone‟s daily life [11]. One of the most important features of the microcontroller is to store and run a program. It can be programmed to make decisions and perform functions [2]. Its ability to perform math and logic function makes it extremely versatile. The microcontroller consists of a central processing unit (CPU), random-access memory, read-only memory, electrically erasable programmable read-only memory (EEPROM), input / output (110) lines, serial and parallel ports, timers, and other built-in peripherals, such as analogue-to-digital and digital-to- analogue converters [11]. BASIC STAMP 2 or PIC microprocessor system can be used for this project. Microcontrollers were originally programmed using an assembly language, but currently different types of high-level programming languages like C are using [11]. Writing program using an assembly language is hard and time consuming. But C is less time consuming and also easier to modify and update. The next thing is actually programming the information inside the microcontroller. It can be done using an Assembler, which converts the program into a format that the PIC understands. Windows based MPLAB is the best one currently. It includes an editor, simulator and assembler. 2.3 Design of Printed Circuit Board The Printed Circuit Board (PCB) was an electronic circuit which allows electricity to move across pathways created upon copper layer from the design. PCBs are used in every single electronic device. They can be single sided, double sided or multilayer. A single sided board has only one side for connection and the other side is for components [29]. This type of board was used for this project. Creation of PCBs is skilful and lengthy task. It required different steps like design, construction and testing. The very first step is the schematic design. Schematic means a collection of electronic symbols connected together by using virtual wires [29]. Then the final step was generating netlist. Fabricating of the PCB starts when the generated netlist is fed into the circuit board layout tool. Main steps are generating component footprints, placing those footprints and connecting those. Basically, there is no right way to place and route a PCB, but there are plenty of ways. Good placement of components always leads to good routing.
  • 14. 8 | P a g e CHAPTER 3 Requirements Analysis This chapter provided what are the inputs, outputs of the desired system and how the inputs were converted into outputs. As the project title “Short Range Intelligent Digital Radio Wireless Hub” indicated the crucial requirements. Like-  Short Range suggested that the communication would be within the limited short range (<100m). The final system should be capable of communicating between buildings of Medway campus at University of Greenwich.  The word Intelligent on the title indicated the final system should have some form of intelligence like a microprocessor system which would be the working brain of this project.  Digital Radio meant communication system of the final system would be based on the typical digital radio transmission and reception based.  Finally Wireless Hub indicated the type of communication system would be used which is wireless. More than one hub was created to communicate between them wirelessly within the short range. 3.1 Components Requirements Analysis According to the first deliverable described on chapter 1 page 2, the final system should contain ER400TRS as a radio module, MM232R as a USB interface and most importantly a microcontroller. Other requirements were four LEDs for output and four digital inputs. No external power supply would be used. Each node got the required power from the USB connection (MM232R). Another important component requirement was the programming connector even though it was not mentioned anywhere, which helped to burn the program into the microcontroller. The ER400TRS radio module required a 50 ohm Antenna such as a whip, helical or PCB loop. The University has a limitation on budget of £150 per project. So throughout the project it was kept in mind that more than one PCB would be made. Within that budget it was possible to build three PCBs of the same system. In case of Power MM232R can supply no more than 100 mA from USB [5] and ER400TRS can consume 23 mA while transmit, 12.5 mA while receiving [4]. Also the power consumption of selected microcontroller as low as 0.1 uA in standby mode and 25 mA while active mode. Each LED would take 5 mA (Approx.) and 10 mA for rest of the circuitry.
  • 15. 9 | P a g e 3.2 Design Requirements Analysis Design was the most important phase for any project. This phase has decided how convenient it was to construct the PCB like was it too complicated to drill and solder or it was easier. Programming the microcontroller also depended on this phase because how the inputs and outputs are connected with the different ports of the microcontroller. There was no specific design requirements mentioned for this project. At the beginning schematic design was the primary step and requirement of this project. According to the requirement four LEDs were used as an output and switches as a digital input. It was necessary to identify how to connect the ER400TRS, MM232R, LEDs, Switches and the Microcontroller along with the programming connector. When the schematic would be done the generated netlist would be transferred to PCB layout design tool. The PCB should be single sided. Along with the other required components four rubber feet should be included and especially the connectors needed to be placed near the edge of the PCB for easy access. Finally, the size of the copper pads for the DIL components must be oval which would help for proper soldering. Distance between the nodes would be approximately 20 to 25 m. 3.3 Construction Requirements Analysis The designed PCB had several hole sizes for drilling. It was suggested to drill the larger holes first, as this reduced the chance of accidentally under-drilling a hole. Three types of sizes were required. Most of them are 0.8mm. Holes for the switches were 1mm and for the rubber feet 4mm were required. Another essential requirement for this was to be careful drilling. Because if it is not properly drilled the PCB will not be able to solder and also it will not work as expected in testing session. Soldering was done on the solder side of the PCB. This required following safety rules because the soldering rod is maintained at the temperature of 325 o C. Good soldering is a skill that is learnt by practise. Before starting soldering all the components should be inserted properly. Then at the beginning the smallest components like resistors, LEDs, Capacitors should be soldered first. The amount of solder must be accurate; if not there will be chance of short circuit on the PCB. If excessive heating was done then the surface of the PCB will be changed into a different colour which can cause problem later. Some of the components are heat sensitive, so they should be soldered carefully. If any component is soldered in the wrong place it must be removed immediately using unsoldering sucker.
  • 16. 10 | P a g e 3.4 Programming Requirements Analysis According to the last two deliverables of this project the following requirements were determined. Firstly, important part of the project was the transfer of packets of message from one node to another node and they should be organised in a straight line so that the two end nodes cannot communicate directly with each other. The structure of the message has given below: Secondly, there should be an acknowledgement reply from each node. For example, if node A sends information to the node B. When node B received it will display the received information and the acknowledgement reply like "Info Transferred" should be displayed on the node A serial terminal. All these requirements absolutely depend on how the programming was done. The intelligence of the microcontroller would be decided by the programming or coding. It required good knowledge of high-level programming or assembly language and also a in- circuit programmer like MPLAB ICD2 or ICD3 to burn the program into the microcontroller. 3.5 Final to do list After going through all the functional requirements the final list of requirements was set out as follows. I. Identifying the inputs and outputs. II. Identifying what type of oscillator would be used. III. USB powered supply using MM232R. IV. Implementing MCLR on the PCB or Hub. V. Connection between ER400TRS and MM232R. VI. Implementing ICD connector on the Hub or PCB. Message Type Sender ID Message Length MessageReceiver ID
  • 17. 11 | P a g e 3.6 Testing Schedule Test No. Purpose Expected Outcome 1 To ensure that the voltage on pin 14 of PIC18F1320 socket is at 5 V Voltmeter will show exactly the same value of supplied voltage on those pin 2 To ensure all the outputs (LED) are working [Test Plan 1] LEDs will glow sequentially according to the program 3 To ensure the reset switch is working LEDs will start to glow from the beginning of sequence 4 To ensure all the inputs (SWITCH) are working [Test Plan 1] Each switch will glow pre- assigned LED according to the program 5 To ensure the MM232R transmission is working After the programming “Test String” will be displayed on the HyperTerminal window 6 To ensure the MM232R reception is working When the pre-defined command will be received it will return user defined command using Docklight 7 To ensure ER400TRS is working for each PCB or Node Each PCB will display its unique modemid along with “#modemidHello* 8 To ensure bi-directional communication between three PCB with mesh interconnection capability Each node will be able to receive, transmit and forward the packet of messages according to the inputs. Table 3.1: Prepared test schedule according to the requirements
  • 18. 12 | P a g e CHAPTER 4 Possible Solutions Depending on the requirements analysis described in the previous chapter, this chapter went through the available problem solutions and look for the most suitable and best solution and also the reasons behind it. 4.1 Communication System Solutions 4.1.1 Node to Node Communication Communications are generally two types they are wired or wireless. But this communication based project will be having wireless as the each node would be mobile connected with the PC. Some of the options for the wireless communication have explained below. Bluetooth Communication This was the new addition in the shot-range wireless communication. Bluetooth was mostly heard for the cell phones it was one of the popular form of data transfer. It was used for transferring pictures, contacts, videos, messages and many more. This technology was not only used in mobile phones but also in computers and PDA (Personal Digital Assistants) to GPS systems and heart monitoring devices. Bluetooth worked on 2.4GHz unlicensed industrial, scientific and medical (ISM) band and it uses frequency-hopping spread-spectrum (FHSS) Communication, that means to transmit data over different frequencies at different time intervals which is called as hops, and there will be 1600 such hops per second, one of the difference between the other wireless devices and Bluetooth is that they communicate with each other automatically. That is whenever the two Bluetooth devices come within the range they would communicate, it is known as paring. Infrared Communication This method of communication was mostly heard for television remote controls or air conditioners and so on, it was also seen that IR communication is suitable for high speed data transfer, the major reasons for the IR to be more used was its low cost and low power consumption. Some of the major reasons for using IR in mobile environment are as follows [1].
  • 19. 13 | P a g e 1- High-speed of transmission: The first generation of IR transmission was 115.2kb/s but as the time moved on it increased and presently it can work on 1 to 4 Mb/s of speed. 2- IR was a short range wireless communication, but it cannot transfer data outside a room, this gives minimum problems to the user. 3- IR has no regulations such as in RF; the range of IR media is outside the scope of laws pertaining to RF. Major disadvantages of such a communication was basically limited range of transmission and reception (<3m) and it also has various types of interference like fluorescent light, sun light and so on. Wireless Radio Communication It was one of the requirements for this project that the communication method between one node to another node would be using wireless radio communication (Easy-Radio style). For this project Easy-Radio transceiver ER400TRS was considered as one of the solution for the communication. It provided a bi-directional high speed data transfer. Obeying the boundaries of the ISM bands (E.g. Pan-European 433.06 – 434.79 MHz band it was possible to employ a license free approved Short Range Device with an effective radiated power not exceeding 10mW [6]. Figure 4.1: ER400TRS device with pin out Some important features of this device are as follows: 1. It has a low operating voltage of about 3.6 Volts. 2. It has a high sensitivity receiver a typical value is 105dBm @ 19.2 Kbps 3. A crystal controlled synthesiser is used for frequency accuracy. 4. A transparent data transmission is used by serial input and output. 5. Has a minimum power consumption that is less that 23mA for transmitting mode and 12.5mA for receive mode.
  • 20. 14 | P a g e Some applications of this device are as follows: 1. It could be used for environmental sense and control 2. Has a high rate of remote data Acquisition 3. Electronic point of sale equipment 4.1.2 Communication between Node to PC Node to PC communication played a vital role for this project. A serial UART interface can accomplish this role. FTDI (Future Technology Devices International ltd.) produced range of development modules for USB to Serial UART development interface like UM232R, UM245R, MM232R and UB232R. MM232R was one of the core requirements for this project. For that reason, it was used which provided a communication between the PC and PCB. MM232R was mini USB- serial UART interface integrated circuit module. It was also a latest product form FTDI‟s. This device could be used as a microcontroller or external logic by separating internal clock. It has been provided by more security feature that is with the help of unique number that is burned into the device during manufacturing. Size of the MM232R was also one of the factors as it is ultra-small 18.0mm x 21.5mm (0.7”x 0.8”) PCB. It has got 16 pins on it which are .1” pitched. This module supported RTS (Ready to Send) or CTS (Clear to Send) hardware handshaking and is powered from the USB port [5]. Some important features of it have given below.  Integrated Clock Circuit – No crystal or ceramic resonator is required because of its built in clock circuit.  Integrated EEPROM - MM232R has an inbuilt EEPROM; a portion of the EEPROM is also allocated for the user to store additional data. This EEPROM can be programmed using the USB without the requirements of any external voltage source  Less external components - Reduced the material cost for USB interface designs compare to its predecessor  Lower supply voltage – This module works at low ranges from 3.3 to 5.25V and so the USB bus provided with a 3.3V that eliminates the requirement of the external regulator. MM232R was selected among other development modules because of its versatility and simplicity. Specially, it can be configured as a USB self-powered [5]. Due to this characteristic the final system did not require any external voltage regulator.
  • 21. 15 | P a g e 4.2 Microcontroller Solutions There are various options to be considered for the selection of the optimum microcontroller such as the BS2 IC from Parallax Inc, Programmable logic controller (PLC), or a microcontroller such as PIC form Microchip, AVR from Atmal and so on. Different programming languages were used for controlling these microcontrollers like visual basic, C/C++ or assembly language [2]. For industrial uses PLC became famous for its easy programming language, code execution time and reliability. The key to selecting the appropriate microcontroller depended on the understanding of the jargon, and establishing priorities [23]. 4.2.1 Basic Stamp 2 (BS2) IC Basic stamp 2 was well known as BS2 IC. This can act as a controlling device in an electronic device. It can be integrated into keypads, sensor, motors, switches, relays, lights and so on. It has its own Programming language called as PBASIC. The operating voltage required is from 5.5 volts whereas this project required working on even less voltages. There are various kits available that can help one to understand and get used to the Basic stamp. 4.2.2 Programmable Logic Control PLCs are majorly used in industries to control processes. One of the definitions of PLC is Microcomputer embedded in or attached to a device to perform switching, timing, or machine or process control task. The advantage of a PLC over a microcontroller is that it is easy to program, similar to microcontroller the PLC also accepts the analogues as well as digital signals, but it do not need to be configured such as in microcontroller, one of the major advantage over a microcontroller would be the ability to operate with both low as well as high level voltages, the programming and execution can be done simultaneously. 4.2.2 Atmel Atmel was one of the leading companies that produce broad range of microcontrollers like 8051, 8052 and so on. It gave a high range of code density from 2K bytes to 128K bytes, a wide range of microcontrollers ranging from 8-bit to MCS-51 are more powerful and used for industry standard. ISP (In-system programming) of Atmel also made it more flexible and user friendly.
  • 22. 16 | P a g e 4.2.3 Microchip This company used to develop semiconductor devices since 1989 [20]. Microchip engineers focused their aim to develop a controller that would be able to programmable, with the ability of providing high output current and also the capabilities of having input and output pins. The first PIC (Peripheral Interface Controller) Microcontroller was based on RIDC (Reduced instruction set code) which could execute one instruction per clock cycle at 20 MHz. Main advantages for using PIC are inexpensive, small instruction set to learn, wide range of interface ability and RISC architecture [20]. Most importantly, this microchip has design support like free MPLAB IDE (Integrated Development Environment) and C compilers. PIC has different series like PIC10, PIC12, PIC16, PIC18, PIC24 and PIC 32. The following table showed the comparison among the microcontrollers. Types Programming language Operating voltage Cost Development Module available? Complexity as a new user? BS2 PBASIC Built in 5 V DC Medium Yes Easy PLC Ladder logic External power supply High Yes More complex Atmel FastAVR or C External 3.0V to 3.6V DC Low No Complex PIC C External 5V DC Low No Complex Table 4.1: Comparison of microcontrollers. 4.2.4 Selected Microcontroller The decision of which microcontroller would be the best for this project was made based on the number of input and output required and the amount of space required for the program and also the simplicity. For those above reasons PIC18F1320 of Microchip Technology Inc. was selected. This PIC18F1320 comes in 18, 20 and 28 pin packages having similar features of PIC18F1220.
  • 23. 17 | P a g e They are used for their liner addressing, high performance, with enhanced flash microcontroller along with 10-bit A/D and Nano Watt Technology. They can have the speeds of 0 Hz to 40 MHz. This PIC has the power management ability such as when idle CPU will be off and Peripherals will be on which was important in this project. The maximum current can be 300 mA and maximum power dissipation of 1 Watt. It has two ports (Port A & Port B). 4.3 Programming Solutions Programming a PIC meant storing the program onto a PIC. It can be done by using Assembly language or High-level language like C. The executable code for the PIC was represented as a sequence of hexadecimal numbers called a hex code. Both the assembly language and C required software to process their compiling into executable code which is known as Compiler. A compiler converts a high level language program to machine instructions for the targeted PIC. Rather than Assembly language C programming language was used for this project. The major reasons for this decision have given below. 1. It is easier and less time consuming to write a program in C than in assembly. 2. C is also easier to modify and update. 3. Codes available in the function library can be used. 4. Programs are developed much more rapidly in C. 5. Code efficiency of compiled C programs is typically 80% of well-written assembler program. 6. Another language C++ was too complex for use with the present generation of PICs. There are various C compilers available that target Microchip PICs like Hi-Tech, Microchip and CCS. Hi-Tech C compiler has a good range of build-in functions and also comes with source code for all its libraries. But it is more expensive than any other compilers and does not have a code-generation wizard like CCS C compiler. Microchip C compilers like C18 come free with the MPLAB IDE. But for this project CCS C compiler was used. MPLAB IDE supported the Custom Computer Services (CCS) language tools. Main reasons for selecting this have given below. 1. CCS C was much easier to use. 2. Lots of sample C code was provided which explained a range of techniques and features. 3. Built-in function libraries and standard C operators are specific to PIC registers. 4. It has device specific include files for each PIC microcontroller.
  • 24. 18 | P a g e Programs are edited and compiled to PIC microcontroller instructions on a computer. PIC microcontroller instructions are uploaded from PC to PIC using ICD 3 debugger. Figure 4.2: Process diagram of compiling and debugging. Some features of MPLAB ICD3 have given below.  MPLAB ICD3 is powered by USB that make it more portable.  Improved performance for debugging and programming.  This debugger is 15 times faster than its earlier version in terms of programming.  It was designed for high speed processors that would help the embedded engineers to debug the device in real-time. 4.4 PCB construction solution 4.4.1 Types of circuit board Three types of boards are there. These are Breadboard, Stripboard and Printed Circuit Board. Breadboard is the way of making temporary circuits for testing purposes. All the components can be reused and no drilling or soldering is required. One side of the stripboard is made of copper and the parallel strips of copper track are connected together. It does not require drilling only soldering was required. Printed circuit boards need to be designed first then it required drilling and soldering both to place the components and make the connections. This was the best choice for this project to make a complete system according to the requirement. 4.4.2 Schematic and PCB design software Schematic and PCB design was the main section of the design phase of this project. Both can be done using one package. This phase will decide how the circuit is going to work. There are two ways to do this.
  • 25. 19 | P a g e First way was using WinQcad 52.6. It was complete electronics design software. It was compatible with all the operating systems. It included a schematic design editor, a PCB design editor and a compatible autorouter. Second way was using Proteus PCB Design software. It has fully featured schematic capture and World class shape based autorouter. This package was much more user friendly and versatile compare to the WinQcad and it has a unique integrated 3D viewer. The design for this project was required to do that using this software package. The University of Greenwich has this software on its laboratory. For these reasons Proteus has been used. 4.4.3 Drilling Methods Drilling is one of the important phases of construction of the PCB. It can be done in several ways. Variodrill was a high speed machine which combined drilling accuracy with an increased level of user comfort. It rests on an adjustable base which allows the work table to be tilted towards the user, thus reducing user fatigue. This machine has been used for drilling all the components of 0.8mm diameter. A built in magnifier helped to view the target with more accuracy. The manual drilling machine has also been used for drilling holes for the rubber foots of 4mm diameter. When drilling with this particular machine, it was important to hold the PCB down firmly, as the drill bit can snatch the board upwards as it breaks through. This manual machine was at the laboratory for different sizes of hole starting from 0.8mm to 5mm. This was not used for the 0.8mm hole for this project because the other one (Figure 4.7) was much more accurate and easier to drill. 4.4.4 Soldering Methods Soldering can be done manually or automatically. One of the automatic systems is DS-01 Automatic DIP Soldering Systems. It has motorised drive and 0-6 seconds movement time of the PCB during automatic soldering. The whole process is controlled by the motorised drive unit which makes it independent of operator training and skills. But this has not been used for this project. Because university does not provide such a system and as a beginner soldering has been done manually by using a 30 Watt soldering iron.
  • 26. 20 | P a g e CHAPTER 5 Problem Implementation The implementation for this project was divided into two parts hardware and software. Hardware section consisted of designing the PCB, drilling, soldering and testing the power and short circuit. Software section consisted of PIC18F1320 programming according to the developed test plans. 5.1 Hardware implementations 5.1.1 Circuit design by ISIS ISIS 7.7 was a part of the Proteus 7.7 circuit design and simulation software. The digital radio wireless hub system for this project was designed by this software. First task was to connect ER400TRS, PIC18F1320, MM232R and ICD connector together. There are various points that were considered during the circuit design, the following are the points.  The number of inputs and outputs required  Whether the internal or external oscillator to be used  The 5 volts power supply  A switch would be required to MCLR in order to manually reset the program  Three LEDs would be connected to indicate the operation as an output  Four switches would be used as an input  The connection to the ER400TRS and MM232R  ICD connection to upload program on the PIC A PIC microcontroller can control outputs and react to inputs. In PIC18F1320 port RA0 to RA4 and RB0 to RB7 were bidirectional ports and they can be used as an input or output. PIC18F1320 have overall 18pins including VDD (Pin no.14) and VSS (Pin no. 5). Three LEDs were used as an output for the following purposes. LED 1: Supply voltage LED 2: Data Transfer-Transmit LED 3: Data Transfer-Receive LED1, LED2 and LED3 were connected respectively to the Pin no. 6, 2 and 1 of the PIC. Four switches (SW) were used for general purposes as an input to the system. SW1, SW2, SW3 and SW4 were connected accordingly to the Pin no. 15, 16, 17 and 18.
  • 27. 21 | P a g e Figure 5.1: LEDs and Switches. Another issue was to properly operate the microcontroller it must be reset correctly. To do that a simple normally open push button, a resistor, a capacitor and a diode were used. The RC time constant for the reset circuit should be between 10ms and 20ms [20]. The circuit of the following figure has an RC time constant of 10K X 1.0uF or 10ms. Figure 5.2: PIC18F1320 reset circuit. External power supply was not in the requirements for this project. So, it was necessary to find a way to power the circuit. That is why MM232R was used because it has option to be used as a BUS powered configuration or USB powered for the PCB. To do this pin 15 (USBPWR) and pin 14 (VCC50) should be connected together. Also the schematic capture for MM232R and ER400TRS were not available on the ISIS library so it was required to create one according to its pin description. The schematic capture of both the components has given on the following page.
  • 28. 22 | P a g e Figure 5.3: MM232R and ER400TRS Radio Module (ER400TRS) has 9 pins. Pin no. 2 (RF GND), 9 (GND) were connected to the common ground line and pin no. 8 (VCC) was connected to the common power line. Other pins were connected using following connection. The schematic capture of the final circuit has given below. Pin no.3 (RSSI) Pin no. 4 (BUSY) Pin no. 11 (RB5) Pin no. 7 (RA3) Pin no.5 (DATA IN) Pin no. 9 (RB1) Pin no.5 (DATA OUT) Pin no. 10 (RB5) PIC18F1320 ER400TRS Figure 5.4: Short range digital wireless hub circuit
  • 29. 23 | P a g e Figure 5.6: 4 way Rocker switch 5.1.2 Layout design by ARES ARES was one of the important feature of the Proteus 7.7 professional, it was used to design the layout of the PCB board. Once the ISIS schematic diagram was completed the components and the design could be directly linked with the ARES with the help of the „Netlist Transfer to ARES‟ present on the left hand top corner of the window. The following steps are taken after that.  Step 1: The board edge of the PCB was drawn first and it was considered as 3.75x3.2 inch.  Step 2: Couple of components (ER400TRS and MM232R) were not in the ARES library. So before transferring the netlist from the ISIS both the packages of the components were created and saved. While transferring from the ISIS those newly created packages were selected. All the other components were found on the ARES library. Figure 5.5: PCB layout of ER400TRS and MM232R.  Step 3: It was decided to use one DIP switch for digital input instead of using four push buttons because it is easier to handle, cheap and also required less space on the PCB.
  • 30. 24 | P a g e  Step 4: Now all the components were placed using the Auto placer of ARES. As per the requirement all the connectors like ICD connector and MM232R were placed on the edge for easier convenience. According to the datasheet of the ER400TRS, this radio module should be kept away from the circuitry that is why it was moved towards the edge.  Step 5: Then at the four corners of the PCB four round through-hole pad (4mm diameter) were placed for the rubber pad.  Step 6: After placing the components manual routing by using bottom copper was done. There were few connections which could not be connected. But those were indicated using Top Silk layer on ARES to use manual wire to connect them after the construction. The screendump of the completed PCB layout has given below. Figure 5.7: Short range digital wireless hub PCB layout.
  • 31. 25 | P a g e After completing the PCB design it was printed. Three of the same PCBs were printed. The bottom view of the printed circuit board has given on the following page. Figure 5.8: Bottom view of the PCB. 5.1.3 List of Components Components for three of the PCBs were identified and ordered from different electronic component stores. The following table shows the list of the components. Name Description Quantity ER400TRS Radio Module 433 MHz 3 MM232R USB Module 3 PIC18F1320 DIP 18 IC (8 Bit) 3 LED Red 9 Diode 1 A, 100V 3 Capacitor 100 nF 12 Switch Push Button 3 Socket IC 18 way, DIL, PIC holder 3
  • 32. 26 | P a g e Rocker Switch DIL, 4 way 3 Capacitor 10 uF 3 Resistor 10 K Ohm, 5%(Tolerance) 15 Resistor 1 K Ohm, 1%(Tolerance) 12 Socket ICD connector, Vertical 3 Table 5.1: List of used components. 5.1.4 Drilling and soldering components Drilling and soldering are the two important phase of constructing the PCB. Health and safety requirements were maintained throughout the both the process. The right drilling equipment, drill bits and techniques can make a big difference in the quality of drilling. Drilling was done first when the PCB was printed. If the drill was not perfect or smooth or holes were not in the required position it will create problems for soldering. Safety precautions were taken to protect eyes from probable threats before starting drilling. At the beginning all the holes of 0.8 mm were drilled with a good alignment by using semi-automatic drilling machine at the laboratory. Then the drilling machine of different sizes like 1mm for the push button and 3mm for the rubber feet was drilled. When drilling was completed it was time for inserting the components carefully. PIC18F1320, LEDs and Diodes package has polarity. That is why they were inserted according to their accurate direction. Because once the component is inserted and soldered it is quite hard to pull that off. Proper soldering plays a vital role for the circuit to work because if the soldering was not good enough there might be possibilities of miss connections, short circuits and IC damage. Hand-soldering method was used for this project. It involved applying heat and solder to the junction between a component lead and its pad until the solder melts, forming the solder joint on the solder side of the PCB []. All the small components like resistor, capacitor, diodes etc. were soldered first. Then the rest of them were soldered.
  • 33. 27 | P a g e Figure 5.9: A PCB after drilling and soldering components Here is the image of the completed three PCBs. Figure 5.10: Three constructed PCBs. ICD Connector DIP switch Reset Switch PIC18F1320 base MM232R ER400TRS
  • 34. 28 | P a g e After the construction of the three PCBs, then they were tested is there any short circuit or not by using continuity option of multimeter. Then the power test was done to check whether the PIC is getting the expected power (5 V) or not at the pin 14 of PIC18F1320. Figure 5.11: PIC was getting 5.15 V 5.1.5 Identifying Node Distance Before programming the PIC it was important to determine how close the nodes need to be. Two existing PCBs were provided by the supervisor which has ER400TRS and MM232R. Image of them has given on Appendix 10. They were used to obtain a graph of signal strength against distance. Pin no. 3 of ER400TRS was for RSSI (Received Signal Strength Indicator) and it provided an analogue output voltage. It ranges from 0 V to 1.2 V. The distance ranges from 1 M to 20 M. After this experiment it was decided to keep the nodes around 10 to 15 M apart from each other. On the following page the final graph along with the tables has given.
  • 35. 29 | P a g e Figure 5.12: Signal Strength against Distance graph with the table. Another parameter for the construction of the PCB was the Antenna. Radio required an antenna. According to the datasheet the length of the antenna would be 16.4 cms for the frequency of 434MHz. A simple piece of wire was used as an antenna for each node. 5.2 Software Implementation MPLAB was used as an Integrated Development Environment. CCS C was used as a compiler. It was a third party language tool in MPLAB IDE. The whole software implementation was divided into four test plans for the sequential towards the final code.  Test Plan 1: Input/output testing including LEDs and Switches.  Test Plan 2: MM232R test (Very important step prior checking the ER400TRS)  Test Plan 3: ER400TRS test (Transmit and Receive)  Test Plan 4: Final code to communicate among three nodes At the beginning a header file named “EasyRadio.h” was created for initializing the PIC for peripheral configuration. They are the settings that configure the PIC for the external environment like Oscillator Type, MCLR pin usage, Code Protection, Brown-Out and
  • 36. 30 | P a g e Watchdog Timer usage, Low Voltage Programming etc. This header file was used for all the programs by include it at the beginning. In this file the on board UART IO, LEDs IO, DIP Switch IO were also defined. The full code with explanation has given on Appendix 1. 5.2.1 Test Plan 1 This test plan for input/output testing was divided into two parts. Firstly, LEDs were tested then the Switches. Expected outcome for the LEDs test was each LED will toggle sequentially after 500ms delay. Here is the flowchart for it. Figure 5.13: LED test flow diagram. Here is the screendump of CCS C compiler while writing the code. Figure 5.14: Screendump for the LED testing code (ER_LED.C) The full program listing has given on Appendix 2. START MCU initialization Toggle LED1 500ms delay Toggle LED3 500ms delay Toggle LED2 5000ms delay
  • 37. 31 | P a g e After this switches were tested. The mechanism for this program was firstly to identify whether the Switch 4 (master switch) was on or not if it is on then Switch 1 will turn on LED 1, Switch 2 will LED 2 and Switch 3 will LED 3 on. The full program listing with description of this test has given on Appendix 3. Start MCU Initialization Switch Test If master switch/ switch4 ON? LED1 Off LED2 Off LED3 Off No If switch1 On? LED1 Off LED1 On If switch2 On? LED2 Off LED2 On If switch3 On? LED3 Off LED3 On Yes Yes Yes Yes No No No Figure 5.15: Flow chart for testing switches
  • 38. 32 | P a g e 5.2.2 Test Plan 2 HyperTerminal and Docklight (V 1.9) are two testing, analysis and simulation tool for serial communication. They were used for this project to monitor the communications. Both of them quite same but the only difference was only the Docklight have the facility to toggle the RTS pin. This phase of testing was for testing the MM232R was working or not. MM232R was a bridge or communication link between the PC and PCB. So, it was very important to check prior to the ER400TRS testing and final code. Two codes were written and compiled for MM232R testing. First code transmitted the data string “Test String” using TX pin of the MM232R in an infinite loop (Appendix 4). Here is the flow chart for the program. Figure 5.16: MM232R Data Send Test Flow Chart. Here is the screendump of CCS C compiler while writing the ER_MM232R_TX.C code. START MCU initialization Send “Test String” out to RS232 500ms delay Figure 5.17: Screendump for the MM232R Transmit testing
  • 39. 33 | P a g e The mechanism of the second code was that the main function waits for CTS (Clear To Send) pin of MM232R to get high and then receives a string command on MM232R- UART defined RX. If the received command is one of the predefined one it acknowledges with “Command –n Received” otherwise it send “Undefined Command”. The full C program along with the description has given in Appendix 5.Here is the flow chart of it. Figure 5.18: MM232R test flow chart START MCU Initialization Wait and input receive string through RS232 i.e. MM232R RX If received string is command string-1 i.e. “$CMD1” Send in-valid command received acknowledge through RS232 i.e. MM232R TX Send valid command received acknowledge through RS232 i.e. MM232R TX If received string is command string-1 i.e. “$CMD2” If received string is command string-1 i.e. “$CMD3”
  • 40. 34 | P a g e 5.2.3 Test Plan 3 ER400TRS was tested in this test plan. It required two of the PCBs connected with three different computers. It was impossible to stay at three places at the same time to test. So, the author took help from his colleagues to check the check the response from the other two nodes. Mobile phone was used as a communication media between them. The mechanisms used for this test depend on different combination of SWITCH1 and SWITCH2. Combination would be different on both the end. Like if switch 1 and switch 2 are both on in Node A then it would assign “01” as modem id and this will display on the Node B the id along with “#modemidHello*”. Again if switch 1 and switch 2 both are off then modem id would be “04” and it would be displayed on other node. This flow chart and the code with description for each line is given on the Appendix 6. 5.2.4 Test Plan 4 (Final Code) Following are the details of how the final code was implemented and how it was supposed to work i.e. expected results and actual results. This code described three simple node designed to act as part of an experimental mesh network in which every node has exactly same hardware and firmware. The goal of this code to work in a manner where a message sent through a node to another can be received and acknowledged. To achieve this, a simple routing scheme was implemented in the firmware. There were three nodes A, B and C. Every node is connected to PC‟s USB port using serial to USB converter to send and receive serial data from PC using serial terminal software like HyperTerminal of windows. Following command structure has been used to construct a command. [Message Type][Sender Id][Receiver Id][Message length][Message] Example: 10310Hello Here [Message Type] is 1 [Sender Id] is 0 (0 for PC) [Receiver Id] is 3 [Message length] is 10 which was total length of the packet [Message] is Hello All data are in ASCII format which can be sent by typing on serial terminal.
  • 41. 35 | P a g e On the reception of this Command message from PC, 1- Node parses the data and verifies if the data message length and receive data length are same. If not then send a message to PC that data length is invalid. 2- Check if the receiver id is in valid range. If the Id is the receiver is same as node id, then a message is sent back to PC that node cannot send message to itself. Or if the receiver id exceeds the valid range of nodes, a message is sent to PC that the receiver id is invalid. 3- If data length and receiver id are valid, a packet containing the following format was transmitted through RF module ER400TRS. $[Sequence No][Message Type][Sender Id][Receiver Id][Message length][Message]* Example: #00111315Hello* Here # sign is start of packet [Sequence No] is 001 which is three digit auto incremented numbers on each new message sent. [Message Type] is 1 [Sender Id] is 1 node id (1-4 valid range) 1 = A, 2 = B and 3 = C here [Receiver Id] is 3 (1-4 valid range) [Message length] is 15 which is total length of the packet including # and * [Message] is Hello * Sign is end of packet. On reception of this data message wirelessly through ER400TRS, it is parsed and 1 - Its length is verified i.e. data length and actual length is same, if not message is discarded and no response message is sent in this case. 2 – If the receiver Id „2‟ and node id „2‟ is same a response message with the same format as received message is sent to the sender „1‟ by changing the receiver and sender information with same sequence number. This message identified as valid response from receiver for the message sent earlier through the same sequence number which is notified to the used by sending message usefully sent message to pc. 2 – If the receiver Id „3‟ and node id „2‟ is not the same and it is in valid range then the message is transmitted as it is again. The idea is to send this message again with same sender „1‟ and receiver id „3‟ is that if the receiver node „3‟ was not in the range of
  • 42. 36 | P a g e first node „1‟ and if the second node „2‟ is within range of both , the node 2 can forward the message of „1‟ to „3‟ with same sequence number. The acknowledge response from „3‟ is routed back to „1‟ following same path i.e. 3-2-1 with the same sequence number generated at 1 on transmission. The final code with proper description on each line has given on Appendix 7. As design method two flow charts were created before programming. One was for command message date reception and the other one was for data message reception as follows. Figure 5.19: Command Message Data Reception flowchart
  • 43. 37 | P a g e Figure 5.20: Data Message Reception Flow chart.
  • 44. 38 | P a g e The following image shows where the three nodes were kept at Medway campus during the code testing. The distance between Node A and B was approximate 20 m and between B and C was approximate 25 m. Figure 5.21: Placement of nodes obtained from Google Earth. 5.2.5 Settings for Communication Test For the test plan 2, 3 and 4 it was required to configure the PORT settings for the communication test for both the HyperTerminal and Docklight software, where Docklight was a testing, analysis and simulation tool for serial communication protocols. The following diagram shows how the port settings were done. Figure 5.22: Configuration for the PORT settings. HyperTerminal Docklight Node A Node B Node C
  • 45. 39 | P a g e CHAPTER 6 Results 6.1 Test Plan 1 Results Here is the screendump when the program for the LED test was downloaded into the PIC18F1320 by using MPLAB IDE and ICD3. Figure 6.1: LED glow program downloaded. The following image shows when the LEDs were glowing sequentially with an interval of 500ms. Figure 6.2: Glowing LEDs when programming was done.
  • 46. 40 | P a g e The following screendump shows when the program for the Switch test was downloaded into the PIC18F1320 where four of the DIP switches worked as an output. Figure 6.3: Switch_try program downloaded. The following image shows all the LEDs glowed when Master Switch (Swicth 4) was off after the program was burnt into the PIC. More images are on Appendix 10. Figure 6.4: Working PCB (Node A) after the program. Master Switch
  • 47. 41 | P a g e 6.2 Test Plan 2 Results As mentioned on the previous chapter this test was basically for testing the MM232R connection with the PC. It required both the HyperTerminal and Docklight to get the results. The following screendump were taken when the program to test MM232R transmission was burnt into the PIC. Figure 6.5: MM232R_TX was downloaded. The following screendump shows when “Test String” was appearing with a delay of 500 ms on the Hyperterminal window. Figure 6.6: HyperTerminal window.
  • 48. 42 | P a g e The following screendump shows when the program to test the MM232R reception was successfully programmed using MPLAB IDE. Figure 6.7: MM232R_Test was downloaded. As mentioned on the previous chapter to get the results in this case a HyperTerminal like software Docklight was used because for this program to test it was required to toggle the RTS pin before sending the command. Docklight has the facility to toggle the RTS pin. Following is the screendump when the expected outcome obtained from the software. Figure 6.8: Docklight window. RTS pin Response when wrong command was typed Response when pre-defined command was typed
  • 49. 43 | P a g e 6.3 Test Plan 3 Results This test was for the ER400TRS. It required two PCBs (Node A and Node B) simultaneously connected together with two individual PCs. The following screendump of MPLAB IDE were captured when the programming was completed. Figure 6.9: Downloaded ER400TRS_Test into the Microcontroller. According to the program as described on previous chapter when SWITCH 1 and 2 will be on it will display “#01 Hello*” on the other PCB and when SWITCH 1 and 2 will be off it display “#04 Hello*”. Two PCBs Node A and Node B were used for this. On Node A Switch 1 and 2 were off and on node B both of them were on. The following screendumps shows the results from both the node. Figure 6.10: Output from Node A.
  • 50. 44 | P a g e Figure 6.11: Output from Node B. 6.4 Test Plan 4 (Final Code) Results The implementation for this final code has given on the previous chapter. This testing required three of the PCBs (Nodes) to be connected with three different PCs at different places but within the range. When the program was successfully build it was programmed into three PCBs. The following screendump shows when the programming was done for one PCB or node. Figure 6.12: Downloaded EasyRadio.c into the PIC18F1320.
  • 51. 45 | P a g e Individual pin configuration of DIP switches for individual PCB was assigned. Like on Node A switch 1 and 2 was on, Node B switch 1 on and switch 2 off, Node C switch 1 and 2 was off. This fulfilled the requirement of digital input. For that reason the following modemid was assigned for different pin configuration. Node Modemid A 04 B 02 C 01 Port bit configurations were as described on previous chapter. To test the bi-directional communication Hyperterminal was used. To test the mechanism of the code some conditions for input on the Hyperterminal window was decided. Here are the conditions. Condition 1: „10210hello‟ from Node A Condition 2: „10410samit‟ from Node B Condition 3: „10410hello‟ from Node A [To test if the message is able to transfer in his own node] Condition 4: „10110samit‟ from Node A Condition 5: „10210medway‟ from Node A [To test when an invalid length was typed] Condition 6: „10110hello‟ from Node B Condition 7: „10114howareyou‟ from Node A Condition 8: „10112iamfine‟ from Node B The following screendumps shows the responses from each node for each condition. Response after condition 1 Response after condition 2 Response after condition 4 Response after condition 5 Response after condition 6 Response after condition 7 Response after condition 8 Response after condition 3 Figure 6.13: Node A screendump.
  • 52. 46 | P a g e Figure 6.14: Node B screendump Figure 6.15: Node C screendump Response after condition 1 Response after condition 2 Response after condition 4 Response after condition 6 Response after condition 7 Response after condition 8 Response after condition 1 Response after condition 2 Response after condition 7 Response after condition 8 Response after condition 4 Response after condition 6
  • 53. 47 | P a g e 6.4 Testing Schedule The following table of testing schedule summarises all the results. Test No. Purpose Expected Outcome Pass or Fail 1 To ensure that the voltage on pin 14 of PIC18F1320 socket is at 5 V Voltmeter will show exactly the same value of supplied voltage on those pin Pass 2 To ensure all the outputs (LED) are working [Test Plan 1] LEDs will glow sequentially according to the program Pass 3 To ensure the reset switch is working LEDs will start to glow from the beginning of sequence Pass 4 To ensure all the inputs (SWITCH) are working [Test Plan 1] Each switch will glow pre- assigned LED according to the program Pass 5 To ensure the MM232R transmission is working After the programming “Test String” will be displayed on the HyperTerminal window Pass 6 To ensure the MM232R reception is working When the pre-defined command will be received it will return user defined command using Docklight Pass 7 To ensure ER400TRS is working for each PCB or Node Each PCB will display its unique modemid along with “#modemidHello* Pass 8 To ensure bi-directional communication between three PCB with mesh interconnection capability Each node will be able to receive, transmit and forward the packet of messages according to the inputs. Pass Table 6.1: Testing Schedule with results.
  • 54. 48 | P a g e CHAPTER 7 Discussion 7.1 Discussion of Results The objective of this project in start was to develop a node/modem that can be a part of a mesh network to communicate with other modems in network through wireless module ER400TRS. At the beginning the schematic capture for the required circuit did not take time. Simulation was not possible with that schematic capture. But the design of PCB layout took some time although the constructed PCB was working as expected. During the PCB layout design as it was aimed to produce a single sided board to reduce the cost of printing and also according to the datasheet of the ER400TRS single sided PCB was preferred. And it was quite difficult to make all the connections using bottom copper to make handy and small PCB. There were few connections left which was indicated by using top silk from J1 to J6. After completion of drilling and soldering of the components it was then connected using a black manual wire on three of the PCBs. Another one issue to be discussed is the oscillator for the PIC. Internal oscillator was used for this project because it was much simpler and easier and also sometimes difficult to get the external oscillator to work even though internal oscillator was slightly less stable. Test plan 1, 2 and 3 were successfully tested and accomplished. Three of them have given the expected and accurate results. In the final code (Test Plan 4) of this project the modem detection was not dynamic and it was fixed at the moment. DIP switches were used to assign the dedicated modem id through hardware which should be dynamically assigned during initialization of node. Also there should be adhoc based dynamic routing mechanism implemented with RF power monitoring to know the corresponding modems in range. So that every node may aware of their possible in range neighbour node and can add it into its route. That means the DIP switch worked as a digital input and LEDs were as an output. In the final code LED 1 was glowing to indicate the supply voltage on the PCB, LED 2 was for transmitting and LED 3 for receiving. But only LED 1 and 2 were glowing [Appendix 10]. The mechanism used for LED 2 and 3 was not working as expected. One of the issues encountered that RF level/power was not being monitored first problem was to know which modem was in the range and which was not. Also expected results are not same as actual results and data was lost some times.
  • 55. 49 | P a g e Packet based messages were transferred in between the nodes. The only difference was the Node C. This Node could not transmit any packet based messages it could only receive and forward messages from other nodes. It might happen due to the RF conflict. At the moment hit and trial based method was used to know the range and different improvement in code and algorithm implemented to improve the routing mechanism to get the actual results. More testing and modification could make the condition better than present to found out more possible errors, modification of physical structure, hardware and programmes. 7.2 Discussion of Gantt chart Gantt chart was used to maintain a time schedule for completing an engineering project like this within a fixed time range. This project consisted of four phases. They are literature review, design, development and testing. First phase of literature has completed on time. Design phase could not be completed on time that is why it was modified after the initial version. This phase took longer time than it was planned and expected so this task was not achieved on time. Schematic has also gone through couple of changes. Some parallel tasks were required like while determining the signal strength designing and implementing was also done at the same time. Three test plans along with the final code were added this time in phase 4 of the Gantt chart. The updated and final version of the Project Gantt chart, showing progress to date, is on the Appendix 9.
  • 56. 50 | P a g e CHAPTER 8 Conclusion Wireless communication has been the best choice among all the other „over-the-air‟ technologies like Infrared, Bluetooth, DECT and so on. Wireless transmission of „information‟, which can be digital data or file. This project focused on the current issue of wireless communication within the short range. This short range wireless technology has huge future market potential for entertainment, logistics, healthcare and automotive. Presented experimental wireless hub has been successfully deployed as hardware and software design using Easy-Radio Transceiver and PIC18F1320. This paper presents details on the implementation of the whole system, coding techniques for all the test and routing technique for the final code. The findings of this project were gained through a background research and literature survey with related and vital references for understanding current conditions, investigating the minimum requirements to analyse any given problem for making to do list, explored some sample projects which has helped to identify the possible solutions for the practical work for an outcome in uneven circumstances. Subject to the limitation of equipment cost three PCBs or Nodes were made with the similar configuration of systems. These were successfully designed and implemented around the fixed laboratory period. To achieve the main purpose of this project some objectives were set like testing core components of the system. For that reason, three codes in C were written using CCS C and compiled using MBLAB IDE to test the inputs/outputs, MM232R and ER400TRS. These also provided expected results. These tests were very important prior to the final code because it required a serial terminal from PC to the PCB or node to send messages to the node, MM232R served that purpose and ER400TRS served as transceiver to wirelessly communicate. First two deliverables of this project were achieved. Third deliverable was to implement bi-directional communication between more two hubs or nodes were nearly accomplished. Experimental results proved limited usability of the system although regular data transmission between nodes has been shown. The learning outcomes from this project are microcontroller programming for interfacing MM232R interfacing to communicate with PC over interface USB, interfacing wireless module ER400TRS, PCB design and development, RF communication essentials and basic routing techniques for Mesh networking.
  • 57. 51 | P a g e CHAPTER 9 Future Work The future work comes into play in order to improve the present project. The aim of this project was to build a wireless hub using Easy-Radio module, MM232R and PIC18F1320 that is capable of communicating wirelessly. Even though the project more or less had achieved the goals, there are a large number of works need to be done and improved. Such as currently on this project receiving characters for each node are displayed on the HyperTerminal window. Currently, microcontroller devices are using LCD displays to output visual information. Such a display can be implemented on the already constructed PCB of this project. It will display the standard ASCII set of characters which will be transmit or receive using their respective node. One of the other important improvements that could be made on this project is to make it portable. Like instead of Thru-hole components if SMT (Surface Mount Technology) components were used it will make the PCB smaller in size and handy too. And also on this PCB instead of MM232R a female USB connector can be implemented which will directly connect to the PC even though it requires much more intelligence. Currently a simple piece of wire was used as an antenna for each PCB or node. It can be improved if Helical or Whip antennas and connectors were used instead of that. But due to the limitation of costing it was not used. Such an antenna instead of a simple wire will make the node more efficient. The distance between the nodes in this project was approximate 20m which was not satisfactory. Implementing those antennas into the PCB might improve the distance. HyperTerminal was used to send the characters from one node to another with an acknowledgement reply. In the future instead of sending characters File Transfer Protocols like XModem could be used. XModem divides the data into a series of packets that are sent to the receiver. In addition user interface can be implemented on this project. It will allow users to interact with the nodes with images rather than text commands as now. GUI (Graphic User Interface) can be created using Matlab or Text Interface using Microsoft C/C++ or Visual C or Visual Basic.
  • 58. 52 | P a g e REFERENCES 1. Goldsmith Andrea (2005), „Wireless Communications‟, Publisher: Cambridge University Press, ISBN 0-521-83716-2 2. Iovine John (2004), „PIC Microcontroller Project Book‟, Second Edition, Publisher: McGraw-Hill, ISBN 0-07-143704-5 3. Nick Hunn (2010), „Essentials of Short-range wireless‟, Publisher: Cambridge University Press, ISBN 978-0-521-76069-0 4. Easy-Radio ER400TRS Transceiver (2003), LPRS Data Sheet, Available at: http://www.robot-electronics.co.uk/datasheets/Easy-Radio%20ER400TRS%201-2.pdf, [Date accessed: 12/04/2011] 5. MM232R USB-Serial UART development module datasheet version 1.1 (2010), Available at: http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_MM232R.pdf [Date accessed: 11/04/2011] 6. D. Langwald, P. Groppe and B. vom Berg (2003), „Wireless RS232 link Using license- exempt Short Range Devices (SRDs)‟, Elektor Electronics 7. A. Sikora (2004), „Design challenges for short-range wireless networks‟, IEE Proceedings-Communications, Vol. 151, No. 5. ISSN-20040742. 8. O. Mirabella, Lo Bello, A. Raucea (2007), „Improving routing in long-distance wireless mesh networks via a distributed embedded router‟, Journal of Parallel and Distributed Computing, ISSN-0743-7315 9. Barnes, Stuart J. (2002), „Under the skin: short-range embedded wireless technology‟, International Journal of Information Management 22(2002) 165-179, ISSN-0268- 4012/02. 10. Ian F. Akyildiz, Xudong Wang, Weilin Wang (2005), „Wireless mesh networks: a survey‟, Computer Networks 47 (2005) 445–487, ISSN-1389-1286. 11. A.H.G. Al-Dhaher (2001), „Integrating hardware and software for the development of microcontroller bases systems‟, Microprocessors and Microsystems 25(2001) 317- 328, ISSN-0141-9331/01. 12. James M. Conrad, Ivan Howitt (2006), „Introducing Student to Communications Concepts Using Optical and Low-Power Wireless Devices‟, Turk J Elec Engin, VOL.14, NO.1, ISSN-1401-2006. 13. David C. Chou, David C. Yen (2001), „Wireless communication: the next wave of Internet Technology‟, Technology in Society 23(2001) 217-226, ISSN- 0160-791X/01.
  • 59. 53 | P a g e 14. Marshall Brain, Tracy V. Wilson, „How WiFi works?‟, Available at: http://computer.howstuffworks.com/wireless-network1.htm [Date accessed 24th April‟2011] 15. Electronic Projects (2010), Available at: http://www.electronic- engineering.ch/microchip/ [Date accessed: 26th April‟2011] 16. What‟s a microcontroller? Student Guide, Version 2.2, PARALLEX, ISBN 1- 928982-02-6,p1-5 17. K. Fazel, P. Robertson, O. Klank, F. Vanselow (1998). ‟ Concept of a wireless indoor video communications system‟, Signal Processing: Image Communication 12 (1998) 193-208, ISSN- 0923-5965/98. 18. S. Salmons, G.T. Gunning, I. Taylor, S.R.W. Grainger, D.J. Hitchings, J. Blackhurst, J.C. Jarvis (2001),‟ASIC or PIC? Implantable stimulators based on semi- custom CMOS technology or low-power microcontroller architecture‟, Medical Engineering & Physics 23 (2001) 37–43, ISSN- 1350-4533/01. 19. Behzad Razavi (1997),‟Recent Advances in RF Integrated Circuits‟, IEEE Communications Magazine, ISSN- 0163-6804/97. 20. Barry B. Brey (2008),‟Applying PIC18 Microcontrollers‟, Publisher: Pearson Prentice Hall, ISBN- 0-13-088546-0 21. Olin Lathrop, Embed Inc. (2009),‟ In-circuit Serial Programming (ICSP)‟,Available at: http://www.embedinc.com/picprg/icsp.htm [Date accessed: 20th June‟2011] 22. Remigiusz Olejnik (2010), „An Experimental Wireless Mesh Network Node Based on AVR ATmega 16 Microcontroller and RFM12B Radio Module‟, Computer Network: 17th Conference, ISSN-7796-105. 23. J.P. Carmo, J.H. Correia (2009), „Low-power/low-voltage RF microsystems for wireless sensors networks‟, Microelectronics journal 40(2009), ISSN-0026-2692. 24. Mikko Sallinen, Esko Strömmer and Pirkka Tukeva (2009), „Short-Range Communication in Ubiquitous Professional and Consumer Applications‟, Available at: http://ercim-news.ercim.eu/en76/special/short-range-communication-in-ubiquitous- professional-and-consumer-applications [Date accessed: 1st October‟2011] 25. Srividya Iyer, „RSSI - Receive Signal Strength Indicator‟, Available at: http://www.birds-eye.net/definition/r/rssi-receive_signal_strength_indicator.shtml [Date accessed: 15th October‟2011] 26. National Instruments (2004), „Serial Port Communication‟, Available at: http://cnx.org/content/m12293/latest/ [Date accessed: 24th August‟2011]
  • 60. 54 | P a g e 27. David G. Wright, Timothy J. Williams, Jefferey D. Wick (2005), „Method of Programming USB Microcontrollers‟, United States Patent. 28. Raja Banerjea (2007), „Short-range Wireless Communication‟, United States Patent Application Publication. 29. Jan Axelson (1993), ‟Making Printed Circuit Boards‟, Publisher: Janet Loise Axelson, ISBN: 0-8306-3950-0 30. Harry J. R. Dutton (1998), „Understanding Optical Communications‟, International Technical Support Organization.
  • 61. 55 | P a g e BIBLIOGRAPHY 1. Muhammad Ali Mazidi, Rolin D. McKinlay, Danny Causey (2008),‟PIC Microcontroller and Embedded Systems‟, Publisher: Pearson International Edition, ISBN-0-13-600902-6. 2. Ibrahim, Dogan (2008),‟ Advanced PIC Microcontroller Projects in C: From USB to RTOS with the PIC 18F Series‟, Publisher: Elsevier Science & Technology, ISBN- 9780750686112. 3. Details of pic ICSP and how to use it for pic microcontrollers, Available at: http://www.best-microcontroller-projects.com/pic-icsp.html [Dates accessed: 22nd September‟2011] 4. RF and Communications Fundamentals, Available at: http://zone.ni.com/devzone/cda/tut/p/id/3992#toc0. [Date accessed: 25th September‟2011]
  • 62. 56 | P a g e APPENDIX 1 Header file code //**************************************************************** // Module EasyRadio.h by Samit // Description: This module provides the peripherial configuration for the used microcontroller in Easy Radio PCB module. //**************************************************************** //**************************************************************** // Includes //**************************************************************** * #include <18F1320.h> // Microcontroller used //**************************************************************** * // Configuration of fues settings //**************************************************************** * #device ICD=TRUE // ICD enabled #device adc=10 // 10-bit ADC setting #FUSES NOWDT // No Watch Dog Timer #FUSES WDT128 // Watch Dog Timer uses 1:128 Postscale #FUSES INTRC_IO // Internal RC Osc, no CLKOUT #FUSES NOFCMEN // Fail-safe clock monitor disabled #FUSES NOBROWNOUT // No brownout reset #FUSES PUT // Power Up Timer #FUSES NOCPD // No EE protection #FUSES NOSTVREN // Stack full/underflow will not cause reset #FUSES DEBUG // Debug mode for use with ICD #FUSES NOLVP // No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O #FUSES NOWRT // Program memory not write protected #FUSES NOWRTD // Data EEPROM not write protected #FUSES NOWRTC // Configuration not registers write protected #FUSES IESO // Internal External Switch Over mode enabled #FUSES NOEBTR // Memory not protected from table reads #FUSES NOEBTRB // Boot block not protected from table reads #FUSES MCLR // Master Clear pin enabled #FUSES NOPROTECT // Code not protected from reading #FUSES NOCPB // No Boot Block code protection #FUSES NOWRTB // Boot block not write protected #use delay(clock=4000000) // (Dont Care)Internal RC Oscilator used // On board UART IO definations #use rs232(baud=9600, xmit=PIN_B6,rcv=PIN_B7, STREAM = MM232R )
  • 63. 57 | P a g e #use rs232(baud=19200,xmit=PIN_B1,rcv=PIN_B4,UART1,STREAM = ER400) // On board LEDs IO definations #define LED1 PIN_A2 // First LED for supply voltage #define LED2 PIN_A1 // Second LED for data transmit #define LED3 PIN_A0 // Third LED for data receive // On board Dip switch IO definations #define SWITCH1 PIN_A6 // General purpose switch 1 input #define SWITCH2 PIN_A7 // General purpose switch 2 input #define SWITCH3 PIN_B2 // General purpose switch 3 input #define SWITCH4 PIN_B3 // General purpose switch 4 input // On board MM232R IO definations #define CTS_MM232R PIN_B0 //**************************************************************** * // End of file //**************************************************************** *
  • 64. 58 | P a g e APPENDIX 2 Test Plan 1: LED testing code //**************************************************************** * // Module ER_LED.c by Samit // Description: This module provides the functionalities to test // the LEDs on Easy Radio PCB //**************************************************************** * // Includes //**************************************************************** * #include "EasyRadio.h" //**************************************************************** * // Pragmas and Constant Defines //**************************************************************** * #define LED_STATE_DELAY 500 // Half second delay selected for inter LED state //**************************************************************** * // Local Function Prototypes //**************************************************************** * void LEDTest(void); //**************************************************************** * // main(void) // Main function defines the microcontroller's inbuilt peripherial // settings and then enters into infinite loop of LED test routine //**************************************************************** * void main() { setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); disable_interrupts(INT_RDA); disable_interrupts(GLOBAL); LEDTest(); } //**************************************************************** * // LEDTest(void) // This function toggles the LEDs one by one in an infinite loop with a pre-defined LED_STATE_DELAY delay //**************************************************************** * void LEDTest(void)
  • 65. 59 | P a g e { while(1) { output_toggle(LED1); delay_ms(LED_STATE_DELAY); output_toggle(LED2); delay_ms(LED_STATE_DELAY); output_toggle(LED3); delay_ms(LED_STATE_DELAY); } } //**************************************************************** * // End of file //**************************************************************** *
  • 66. 60 | P a g e APPENDIX 3 Test Plan 1: SWITCH testing code //**************************************************************** * // Module ER_SWITCH.c by Samit // Description: This module provides the functionalities to test the Switches on Easy Radio PCB //**************************************************************** * //**************************************************************** * // Includes //**************************************************************** * #include "EasyRadio.h" //**************************************************************** * // Pragmas and Constant Defines //**************************************************************** * #define MASTER_SWITCH SWITCH4 // This switch enables or disable all switches #define LED_STATE_DELAY 500 // Half second delay selected for inter LED state //**************************************************************** * // Local Function Prototypes //**************************************************************** * void SwitchTest(void); //**************************************************************** * // main(void) // Main function defines the microcontroller's inbuilt peripherial // settings and then enters into infinite loop of Swtich test routine //**************************************************************** * void main() { setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); disable_interrupts(INT_RDA); disable_interrupts(GLOBAL); SwitchTest(); } //**************************************************************** * // SwtichTest(void)
  • 67. 61 | P a g e // This function first check the master switch,if it is on then it checks other switches and on/off LEDs accordingly //**************************************************************** * void SwitchTest(void) { while(1) { if(input(MASTER_SWITCH)) // If master switch is on, check other switches { // Check if switch 1 is on, put LED1 on if(input(SWITCH1)) { output_high(LED1); } else { output_low(LED1); } // Check if switch 2 is on, put LED2 on if(input(SWITCH2)) { output_high(LED2); } else { output_low(LED2); } // Check if switch 3 is on, put LED3 on if(input(SWITCH3)) { output_high(LED3); } else { output_low(LED3); } } else { // If master switch is off, Off all LEDs output_low(LED1); output_low(LED2); output_low(LED3); } } } //**************************************************************** * // End of file //**************************************************************** *
  • 68. 62 | P a g e APPENDIX 4 Test Plan 2: MM232R Transmission test code //***************************************************************** // Module MM232R.c by Samit // Description: This module provides the functionalities to test the MM232R data transmission from PIC //***************************************************************** //***************************************************************** // Includes //***************************************************************** #include "EasyRadio.h" #include "String.h" //***************************************************************** // Pragmas and Constant Defines //**************************************************************** //***************************************************************** // Local Function Prototypes //***************************************************************** void MM232R_TXTest(void); //***************************************************************** // main(void) // Main function defines the microcontroller's inbuilt peripheral settings and then enters into infinite loop of data send routine //***************************************************************** void main() { setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); disable_interrupts(INT_RDA); disable_interrupts(GLOBAL); MM232R_TXTest(); } //***************************************************************** // MM232R_TXTest(void) // This function transmit the data string "Test String" using TX pin of MM232R in an infinite loop //***************************************************************** void MM232R_TXTest(void) { unsigned char MMsg[] = {"Test Stringnr"}; while(1) { fputs(MMsg,MM232R); delay_ms(500); // Half second delay } }
  • 69. 63 | P a g e //***************************************************************** // End of file //*****************************************************************