designing sensor system for detecting chicken movement and behavior
DESCRIPTION
DESIGNING SENSOR SYSTEM FOR DETECTING CHICKEN MOVEMENT AND BEHAVIORTRANSCRIPT
UNIVERSITI TEKNOLOGI MALAYSIA
NOTES : * If the thesis is CONFIDENTIAL or RESTRICTED, please attach with the letter from
the organisation with period and reasons for confidentiality or restriction.
DECLARATION OF THESIS / UNDERGRADUATE PROJECT PAPER AND COPYRIGHT
Author’s full name : MOHD FARID BIN ABD AZIZ
Date of birth : 15 JANUARY 1988
Title : DESIGNING SENSOR SYSTEM FOR DETECTING
CHICKEN MOVEMENT AND BEHAVIOR
Academic Session : 2011/2012
I declare that this thesis is classified as:
I acknowledged that Universiti Teknologi Malaysia reserves the right as follows:
1. The thesis is the property of Universiti Teknologi Malaysia.
2. The Library of Universiti Teknologi Malaysia has the right to make copies for the
purpose of research only.
3. The Library has the right to make copies of the thesis for academic exchange.
Certified by:
SIGNATURE SIGNATURE OF SUPERVISOR
880115-01-5279 DR MOHD FAUZI BIN OTHMAN (NEW IC NO. /PASSPORT NO.) NAME OF SUPERVISOR
Date : JUNE 2012 Date : JUNE 2012
Date: 25 APRIL 2010 Date : 25 APRIL 2010
Date: 7 MAY 2009 Date : 7 MAY
√
CONFIDENTIAL (Contains confidential information under the Official Secret
Act 1972)*
RESTRICTED (Contains restricted information as specified by the
organisation where research was done)*
OPEN ACCESS I agree that my thesis to be published as online open access
(full text)
“I acknowledge that I have studied this piece of work and in my opinion it is in
accordance with the scope requirement and quality for the purpose of awarding the
Bachelor of Engineering (Electrical – Control and Instrumentation)”
Signature :
Name of Supervisor : DR MOHD FAUZI BIN OTHMAN
Date : JUNE 2012
DESIGNING SENSOR SYSTEM FOR DETECTING CHICKEN
MOVEMENT AND BEHAVIOR
MOHD FARID BIN ABD AZIZ
A report submitted in partial fulfillment of the
requirements for the award of the degree of
Bachelor of Engineering (Electrical – Control and Instrumentation)
Faculty of Electrical Engineering
Universiti Teknologi Malaysia
JUNE 2012
ii
“I declare that this thesis entitled “Designing Sensor System for Detecting Chicken
Movement and Behavior” is the result of my own research except as cited in the
references. The thesis has not been accepted for any degree and is not concurrently
submitted in candidature of any other degree”
Signature : .............................................
Name : MOHD FARID BIN ABD AZIZ
Date : JUNE 2012
iii
To my beloved wife, family, family-in-laws, brothers and sisters. Thank you
for your prayer, love and encouragement. To all the lecturers who have guided me,
and to all my friends for your help and support, I thank you all.
iv
ACKNOWLEDGEMENT
‘In The Name of Allah, The Most Gracious and The most Merciful’
Alhamdulillah, with all praise and gratitude to Allah S.W.T for giving me the
intelligence, strength, fortune and health to finish my final year project throughout these
two semesters.
Firstly, I would like to express my deepest thanks to my supervisor, Dr. Mohd
Fauzi bin Othman for his valuable guidance, support and suggestion. Without his
support and interest, this project would not able to be presented here.
Also, the deepest appreciation goes to my family and family-in-laws, whose have
been most tolerant and support I’ve all these years. Thanks for the encouragement, love
and emotional support that all of you had given me
Lastly, I would like to thank to all of my friends for their endless support and
assistance at various occasions.
v
ABSTRACT
The development of this sensor system is to detect early sickness of chickens in a
real situation. Usually the healthiness of a chicken is related to its movement. An
unhealthy chicken rarely moves (inactive) and loses its appetite. Here, the movement of
a chicken is detected using an accelerometer sensor. The data obtained from the
accelerometer sensor is transmitted wirelessly from the chicken to the receiver or base
station (monitoring station). The wireless communication application is used because a
poultry farm covers a very wide area and it can transmit the data more efficiently
compared to using wire. The data received by the receiver or base station will be
processed and then shown on a gravity graph consisting of a three-axis of accelerometer
data. The data is then displayed using LabVIEW where it displays the real time data.
The processed data will also be saved for future analysis. The saved data can be used for
non-real time monitoring graph by using MATLAB.
vi
ABSTRAK
Pembangunan sistem sensor ini adalah untuk mengesan penyakit awal ayam
dalam situasi sebenar. Biasanya kesihatan ayam berkaitan dengan pergerakannya. Ayam
yang tidak sihat kebiasaannya jarang bergerak (tidak aktif) dan hilang selera makan.
Disini, pergerakan ayam dikesan menggunakan sensor accelerometer. Data yang
diperolehi daripada sensor accelerometer dihantar dengan komunikasi tanpa wayar dari
ayam kepada stesen penerima atau receiver (stesen pemantauan). Aplikasi komunikasi
tanpa wayar digunakan kerana ladang ayam meliputi kawasan yang sangat luas dan ia
boleh menghantar data lebih lancar berbandingkan dengan komunikasi menggunakan
wayar. Data yang diterima oleh stesen penerima atau receiver akan diproses dan
kemudian dipaparkan pada graf graviti yang terdiri daripada paksi tiga data pecutan.
Data kemudiannya dipaparkan menggunakan LabVIEW di mana ia memaparkan graf
data masa sebenar. Data yang diproses juga akan disimpan untuk analisis masa depan.
Data yang disimpan boleh digunakan untuk graf bukan masa-sebenar dengan
menggunakan MATLAB.
vii
TABLE OF CONTENTS
CHAPTER TITLE PAGE
DECLARATION ii
DEDICATION iii
ACKNOWLEDGEMENTS iv
ABSTRACT v
ABSTRAK vi
TABLE OF CONTENTS vii
LIST OF TABLES x
LIST OF FIGURES xi
LIST OF EQUATIONS xiii
LIST OF APPENDICES xiv
1 INTRODUCTION
1.1 Introduction 1
1.2 Project Background 1
1.3 Problem Statement 2
1.4 Objective 2
1.5 Scope 3
1.6 Summary of Work 4
2 LITERATURE REVIEW
2.1 Introduction 6
2.2 Chicken Sickness Symptoms 6
2.3 Accelerometer 7
2.3.1 Positioning Algorithm of Accelerometer 8
viii
2.3.2 Accelerometer application 9
2.4 X-Bee Wireless Protocol 10
2.4.1 Technology Overview 11
2.4.2 X-Bee wireless module application 12
2.5 Arduino Microcontroller Board 13
2.6 Programming Software 14
3 METHODOLOGY
3.1 Introduction 15
3.2 System Overview 15
3.2.1 The methodology flow 16
3.3 Hardware Implementation(Transmitter) 19
3.3.1 5V Voltage regulator 19
3.3.2 Interface ADXL335 with Arduino 20
3.3.3 Interface Arduino with X-Bee module 20
3.3.4 Transmitter circuit 21
3.4 Hardware Implementation(Receiver) 22
3.4.1 Interface X-Bee shield with Arduino 22
3.5 Communication between Two X-Bee 23
3.6 Software Implementation 25
4 SYSTEM DESIGN
4.1 Introduction 27
4.2 Full System Operation 27
5 RESULT AND DISCUSSION
5.1 Introduction 30
5.2 Transmitter Testing 30
5.3 Receiver Testing 31
5.4 Full System Testing 32
5.5 Discussion 37
ix
6 CONCLUSION AND RECOMMENDATION
6.1 Introduction 39
6.2 Conclusion 39
6.3 Recommendation 40
REFERENCES 41
APPENDICES 43
x
LIST OF TABLES
TABLE NO. TITLE PAGE
1.1 FYP1 5
1.2 FYP2 5
xi
LIST OF FIGURES
FIGURE NO. TITLE PAGE
2.1 Sample signal of accelerometer 9
2.2 Comparison between RF modules 11
2.3 Mesh topology 12
2.4 Mesh architecture reliability 13
3.1 Methodology flow 16
3.2 Voltage regulator circuit 19
3.3 Connection between Arduino and accelerometer 20
3.4 Connection between Arduino and X-Bee 21
3.5 Transmitter Circuit 22
3.6 Set up for receiver 23
3.7 Setting for transmitter 24
3.8 Setting for receiver 24
3.9 LabVIEW block diagram 26
3.10 LabVIEW front panel 26
4.1 Full system operation 29
4.2 Flow chart for system operation 30
5.1 Transmitter testing 31
5.2 Receiver testing 32
5.3 Transmitter is attached to the chicken’s body 33
5.4 Receiver in a standby mode 34
xii
5.5 Result from serial monitor 34
5.6 Result from LabVIEW 36
5.7 Chicken in static condition 37
5.8 Chicken in walking condition 37
5.9 Chicken in running condition 38
xiii
LIST OF EQUATIONS
EQUATION NO. TITLE PAGE
2.1 Formula for acceleration and velocity 8
xiv
LIST OF APPENDICES
APPENDICES TITLE PAGE
A Arduino Coding for Accelerometer Sensor 43
B Accelerometer Circuit Diagram 45
C Arduino UNO Datasheet 46
D Accelerometer Datasheet 55
E X-Bee Datasheet 59
F X-Bee shield Diagram 64
CHAPTER 1
INTRODUCTION
1.1 Introduction
This chapter will discuss the project background, problem statement, objective,
scope and summary of work. In addition, this chapter will lay out the trend of this
project in the market.
1.2 Project Background
Chicken meat is one of best sources of protein required by our society. The low
price compared to meat makes chicken a popular alternative and in demand by
customers. Furthermore, the cost for operating the chicken stock is cheaper compared to
beef cattle. Usually, the important factor in operating the poultry farm is the health
condition factor of the chickens. Usually, the health of the chicken is related to its
activeness. When a chicken is unhealthy, it will not move regularly compared to a
healthy chicken, where it will be very active.
2
Sometimes, farmers are not aware about the health of their chickens. The greater
the number of chickens in the poultry farm the harder for them to detect which chicken
is sick. The advancement in technology can overcome this problem where the sensor is
designed to detect sick chickens. In addition, the wireless system also provides the data
to be sent wirelessly from the chicken coop to the receiver for monitoring the chicken
movement behavior
1.3 Problem Statement
There are four problem statements for this project. Firstly, this project was
designed to detect the early sickness of chickens. Nowadays, many sicknesses and
viruses can attack poultry farm industries. The latest virus is the Avian Influenza (bird
flu). By designing this system, the early sickness chickens can be detected just by
looking at the chicken movement and analyzing its behavior.
The, data from the transmitter is then transmitted wirelessly. The wireless system
is more convenient when it comes to a large poultry area. This method is more
reasonable compared to the wired method.
1.4 Objective
The main objective of the project is to design the system for detecting chicken
movement. From the chicken movement, analysis is performed to understand the
3
behavior of the chicken. There are two categories of chicken behavior, either the chicken
is active or inactive. Usually an inactive chicken would be considered unhealthy.
The movements’ data from the sensor must be transmitted wirelessly from the
chicken to the receiver using X-Bee wireless module. Then, the receiver will process the
data and shown on a real time graph. Lastly, the storage system data will save the data
received for further analysis.
1.5 Scope
The scope of this project is to design a transmitter and receiver pair which can
cater the important features for data transmitting and receiving. X-Bee wireless
communication technology is implemented as a communication between this transmitter
and receiver. This project consists of two major parts, which are hardware and software
parts.
In the hardware part, the components for the transmitter consist of accelerometer
sensor, Arduino microcontroller board, X-Bee wireless module and voltage regulator.
The receiver consists of Arduino microcontroller board, X-Bee wireless module and X-
Bee shield.
In the software part, C language is used for the transmitter, in which the data
from the accelerometer sensor will be processed before transmission. For monitoring
signals from the sensor, the software used is Labview. The Labview will show the real
time graph, and the gravity value for data saving.
4
At the end of this project, one transmitter and one receiver are produced. The
range of communication between the transmitter and receiver can be up to 100 meters
without blocking and suitable to be applied for a poultry farm with an area of 300x300
meters square.
1.6 Summary of Work
Implementation and work of the project during the first and second semesters are
summarized into a Gantt chart as shown in the next page.
5
Table 1: Research schedule for FYP-1
Task
Week
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
FYP briefing
Literature review
Investigating of
simulation model
FYP-1 presentation
Writing a report
Submit the report
Table 2: Research schedule for FYP-2
Task
Week
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Hardware part
Software part
Running the system
FYP-2 seminar
Complete and
submit thesis
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
This chapter includes the study on related projects and the gathering of
information from related technical papers and published journals. In addition, there will
be a brief introduction on chicken sickness symptoms, the Arduino microcontroller
which uses the ATmega 328 microcontroller, the sensing method of accelerometer
sensor and the application of X-Bee wireless module.
2.2 Chicken Sickness Symptoms
A sick chicken works hard not to show any sign of weakness and sickness. This
is to avoid becoming prey any predator. When it is sick for a long period, it will not able
to hide its condition. Usually, it will reduce its movement activity and its appetite also
become poor.The poultry farmer will detect the sickness of the
7
chicken from poultry manure. Normally, the unhealthy chicken will produce thin and
light poultry manure. Then, the antidote will be given to all chicken in the coop,
included healthy chicken ones. [8]
These are the factors that contribute to the sickness chicken
Injury
Virus infection
Hypo or hyperthermia (too cool or too hot environment)
Old age
Malnutrition
Lack of sunshine or fresh air
Poisoned
2.3 Accelerometer
Accelerometer sensors measure the acceleration experienced by the sensor and
anything to which the sensor is directly attached [1]. For this project, tripe axis
accelerometer sensor will be used which consists x-axis, y-axis and z-axis.
Accelerometer has two types of detection which are static acceleration and dynamic
acceleration.
Static acceleration entangles only tilt sensing while dynamic acceleration
involves motion, shock and vibration sensing. For this chapter, only dynamic
acceleration will be discussed. Dynamic acceleration allows the changes of gravity
values when there are changes in position. This application is suitable for measuring and
8
detecting chicken’s motion. In addition, accelerometer will change gravity values when
there are changes in the axis position [6].
2.3.1 Positioning Algorithm of Accelerometer
To ensure that the accelerometer functions as a sensor, we must understand the
poisoning algorithm of accelerometer. Firstly, accelerometer can be defined as a sensor
that measures the acceleration experience and anything to which the sensor is directly
attached. It can also be defined as the rate of change of velocity of the object. Hence, the
rate of change of velocity can be defined as in Equation 2.1.
Equation 2.1: Formula for acceleration and velocity
However, if we want to find the position data of an object, we must do double
integration of acceleration. The double integration can be defined as the area below the
curve as shown in Figure 2.1. The integral is the sum of very a small areas where the
width value is almost zero [6].
9
Figure 2.1: Sample signal of accelerometer
However, there are losses in the sampling which affect the accuracy in the
obtained data in a real situation case. So, zero reference must be taken into account.
3.3.2 Accelerometer application
This accelerometer sensor can be used for various applications. One of the
applications is for measuring the physical activity in children. This application is
designed to measure the physical activity level of children. . The children’s activities
will be recorded and the data will be analyzed to determine whether the children are
active or not. Then, we can determine the potential reasons of why some children
become active [15].
For pet monitoring, the accelerometer is used for monitoring spontaneous
activity in dogs. In this project, four healthy dogs are chosen and five identical
accelerometers are attached to each dog to get the output. Then the dogs are placed at
10
different locations and the data from the dogs are recorded. The data then are analyzed
to determine which place is the most convenient to them [16].
For environment monitoring, the accelerometer is used for monitoring
earthquake and landslide. When a slight change in angle value occurs, the alarm will be
ON to alert the people around that area [17].
2.4 X-Bee Wireless Protocol
X-Bee is a set protocol that uses the 802.15.4 standard as a baseline and adds
additional routing and networking functionality. This module is an embedded solution
reserving wireless-end-point connectivity to a device. These modules use the IEEE
802.15.4 networking protocol for fast-to-multipoint or peer-to-peer networking. It is
designed to fulfill the low power and low cost wireless requirement [5].
The X-Bee Alliance developed the X-Bee protocol and it was a group of
companies working in cooperation. These groups of companies developed a network
protocol that can be used in a variety of commercial and industrial low data rate
applications. X-Bee is a LR-WPAN technology and is built up from the lower layers of
IEEE 802.15.4 LR-WPA standard. While the 802.15.4 standard defies the lower-level
Physical and MAC layers, the X-Bee standard defines the higher-level network and
application layers as well as the security services [7].
11
2.4.1 Technology Overview
The 802.15.4 is a standard for wireless communication approved by the Institute
of Electrical and Electronics Engineers (IEEE). The IEEE is a technical professional
association that has put out numerous standards to encourage growth and interoperability
of existing and latest technologies. The 802.15.4 standard also permits the
communication for point-to-point or point-to-multipoint configuration [7].
X-Bee has a capability for low power applications. It fits well into embedded
systems and those markets where reliability and versatility are important but not in high
bandwidth. There is a comparison of features with other wireless technologies and their
different applications are shown in Figure 2.3. The lower data rate of the X-Bee device
allows for better sensitivity and range, but offers fewer throughputs. The primary
advantage of X-Bee lies in its ability to provide low power consumption and extended
battery life.
Figure 2.2: Comparison between RF protocols
12
2.4.2 X-Bee wireless module application
By using X-Bee wireless module, many applications can be done. The most
popular application for environment monitoring is in agriculture. For a wide area, X-Bee
wireless module is a suitable and convenient method for data transmission. This method
will help the farmer to monitoring their farms. Usually, the farmer will install the
wireless sensor network around the farm. The sensor used will be for movement
detection like infrared sensor for detecting the presence of thieves. Commonly, the Mesh
topology method will be installed around the farm. Mesh topology is multi-hopping
system where the wireless systems nodes communicate with each other to hop the data
from the sensor node to the base station. Then, the wireless sensor can pass the
command to each other in a mesh network, avoiding the need to communicate with each
other through a base station [14]. If a sensor node fails, it will find the other nearest
sensor node to transmit the data. Figure 2.3 shows the mesh topology overview.
Figure 2.3: Mesh topology
13
Figure 2.4: Mesh architecture reliability
2.5 Arduino Microcontroller Board
Arduino microcontroller board is a popular open-source board microcontroller
that is used electronics in multidisciplinary electronic application. This hardware
provides a simple open hardware designed with an Atmel AVR processor and on-board
input and output support. The software of Arduino microcontroller board consists of a
standard program language compiler and the boot loader that runs on the board [9].
Arduino microcontroller board is programmed using a Wiring-based language,
similar to C++ with slight simplifications, modification and processing-based integrated
development environment. The Arduino UNO board is used for this thesis because it is
commonly used and is also cheaper compared to other boards.
14
2.6 Programming Software
The programming software used for this thesis is LabVIEW and MATLAB
software. LabVIEW is a graphical development environment software provided by the
National Instrument Company and provides Virtual Instrument (VI) tools, a test
sequencing and management environment. It is a powerful system design software for
tasks performed by engineers and scientists. A VI can either run as a program, with the
front panel serving as a user interface or when dropped as a node onto the block
diagram. The front panel defines the input and output for the given node through the
connector panel. The graphical approach also allows non-programmers to build
programs by dragging and dropping virtual representations of lab equipment with which
they are already familiar. For this thesis, the LabVIEW software will be used to show
real time graph of chicken movement. Then, the data logging and communication port
also provides the data for both current and future analysis [8].
MATLAB is a programming environment for algorithm development, data
analysis, visualization and numerical computation. By using MATLAB, the technical
computer problem can be solved faster than traditional programming language such as C
programming, C++ programming and Fortran [8]. In additional, MATLAB can be used
in a wide range of applications. It consists of signal and image, processing,
communications, control design, test and measurement, financial modeling and analysis
and computation biology. For this thesis, MATLAB application is used for modeling
and analysis of the data from the receiver.
CHAPTER 3
METHODOLOGY
3.1 Introduction
This chapter explains the system overview and flow of the final year thesis and
the function of the main component for mechanisms, electronics and software.
3.2 System Overview
This system consists of two major parts which are the transmitter and receiver.
For the transmitter, it consists of a power supply part and sensor system part. The power
supply system has to supply 5V to the Arduino microcontroller board. Lithium polymer
battery was used to supply the microcontroller board. Yet, the voltage must be regulated
first because the voltage requirement cannot exceed 5V. By using a voltage regulator,
the desired voltage can be obtained. For the sensor part, the main brain will be Arduino
microcontroller board which uses Atmel AVR processor. The accelerometer will detect
the movement sensor for the chicken.
16
The output will be the gravity value of the accelerometer sensor. The gravity
value will be sent wirelessly using X-Bee wireless module. Then, the receiver will
receive the output to be displayed at the computer. The output will display a real time
waveform. Figure 3.1 will show the design system flow for the whole thesis.
Figure 3.1: Methodology flow
3.2.1 The methodology flow
i. Literature review
Firstly, after obtaining the title of thesis, internet research was made relating to
chicken sickness symptoms and wireless accelerometer. From there we were able
to gather important information about chicken behavior such as when it became
sick and also information on wireless accelerometer. Regarding the wireless
Literature review. Study on the
technology required
Fabrication stage 1: Circuit Design
Fabrication stage 2: Select the suitable
component
Fabrication stage 3: Circuit constuction
Fabrication stage 4: Circuit testing
Fabrication stage 5: Circuit repairing
Fabrication stage 6: Transmitter-Receiver
connectivity checking
Fabrication stage 7: Programming
Analysis and test: Documentation
17
accelerometer sensor, the required components to fabricate the system is also
obtained.
Furthermore, information from previous thesis done by graduates from FKE
Digital Library are also referred.
ii. Fabrication stage 1: Circuit design
For this thesis, only the transmitter part that needed to be designed. Firstly, the
circuit was supplied with 5V to the Arduino microcontroller board. Then, the
Arduino microcontroller board would distribute power to the accelerometer
sensor and X-Bee wireless module.
iii. Fabrication stage 2: Select the suitable component
This process must be done carefully because the components were costly. After
successfully designing the circuit, the circuit construction was carried out.
iv. Fabrication stage 3: Circuit construction
The constructions of the transmitter require high degree of patience. It was
because all the components had to be soldered on the strip board. Some
components were also very sensitive.
v. Fabrication stage 4: Circuit testing
After finishing circuit the construction, the circuit must be tested to ensure that it
functioned properly. One LED indicator was placed on the circuit to indicate that
the circuit functions properly. Then, the measurement was done at the sensor by
18
placing a voltmeter at the accelerometer’s axis and grounding. Every changes of
axis would change the output voltage from the sensor.
vi. Fabrication stage 5: Circuit repairing
While the circuit construction was underway, there were some errors during the
installation. Usually, errors would occur when resistor values were wrongly
chosen and grounding wrongly system connected to the component.
vii. Fabrication stage 6: Transmitter-Receiver connectivity checking
Connectivity between transmitter and receiver can be checked by using X-CTU
software. When the source and destination addresses were matched between two
X-Bee wireless modules, the reading will occur by using this software.
viii. Fabrication stage 7: Programming
This stage involved writing the program which detected the movement of the
chicken. The language for the programming is the C language.
ix. Analysis and test: Documentation
The sensor and wireless transmission devices were tested again to ensure that the
system functions properly.
19
3.3 Hardware Implementation(Transmitter)
Transmitter is a very important part to ensure that this thesis was successfully
implemented. It can be proved because the accelerometer sensor is placed at the
transmitter to detect chicken movement. This section will discuss how the important
components merged into a single transmitter system.
3.3.1 5V Voltage regulator
Since Arduino microcontroller board can only operate with a supply of 5V,
voltage regulator circuit is needed. This circuit is implemented by using an LM7805
voltage regulator and a pair of coupling capacitor to reduce noise and stabilize the
voltage signal. In additional, a diode is used to protect the LM7805 and microcontroller
board from the opposite direction of the electric current. The opposite direction electric
current can damage the component on the board. The complete circuit is shown in
Figure 3.2.
Figure 3.2: Voltage regulator circuit
Capacitor
Switch
Voltage
Regulator
Diode
20
3.3.2 Interface ADXL335 with Arduino
ADXL335 is the accelerometer sensor model used for this thesis. It is a triple
axis accelerometer that is designed by Analog Device where the sensor comes with a
breakout board that simplifies the soldering work. The output of this sensor is analog
voltage relative to acceleration. By using Arduino microcontroller board, the output
from the accelerometer sensor will be sent to the TX pin for wireless data transmission.
Figure 3.3 shows the connection between Arduino microcontroller board and
accelerometer sensor.
Figure 3.3: Connection between Arduino and Accelerometer
3.3.3 Interface Arduino with X-Bee wireless module
X-Bee wireless module was engineered to meet IEEE 802.15.4 standard. It
supports the unique needs of low cost and low powered wireless sensor networks. For
this thesis, the X-Bee modules are used as a data transmission between transmitter and
receiver. The processed signal from the accelerometer sensor will be sent out by
21
transmitter (TX) pin at the Arduino microcontroller board. The connection between the
Arduino and X-Bee wireless module is shown in Figure 3.4.
Figure 3.4: Connection between Arduino and X-Bee
3.3.4 Transmitter circuit
Transmitter circuit is a combination between sensor breakout board and Arduino
microcontroller. Sensor breakout board consists of a soldered accelerometer sensor, the
X-Bee wireless module that be connected with the Arduino microcontroller board as
mentioned before. A 5V regulated circuit is used to supply power to the Arduino
microcontroller board. Figure 3.5 shows the combination between the Arduino
microcontroller board and sensor breakout circuit.
22
Figure 3.5: Transmitter circuit
3.4 Hardware Implementation(Receiver)
The receiver functions as a data recipient from the transmitter circuit. Then, the
data received will be sent to the computer for display and analysis.
3.4.1 Interface X-Bee shield with Arduino
To set up the receiver, there are a few steps that must be followed. Firstly, the
Atmel processor must be removed from the Arduino microcontroller board. Then,
moving to the X-Bee shield, two jumpers must connected to the pins labeled X-
Bee/USB. This situation determines that the X-bee’s serial communication be connected
to the serial communication between the controller and FTDI USB-to-serial chip in the
Arduino microcontroller board. With these jumpers, the DOUT pin of the X-Bee
wireless module is connected to RX pin of microcontroller and DIN is connected to TX.
After all steps have been made, the calibration between X-Bee shield and Arduino
23
microcontroller board can be made. Figure 3.6 shows all the steps taken to set up the
receiver.
Figure 3.6: Set up for receiver
3.5 Communication Between Two X-Bee
Before communication between two X-Bees can be done, there are a few steps
required to set the X-Bee wireless module as a transmitter and receiver. Firstly, the
source and destination addresses for both modules must match. The source address
(MY) prevents the for non-duplicate messages from being ignored as duplicate. Then, it
is also used to distinguish a radio from the next and to prevent duplicate data packets. To
get a data transfer between modules, the destination address (DL) of the transmitting
radio needs to match the MY of the receiving radio. The addresses of X-Bee wireless
module can be set by using an X-CTU software. Figures 3.7 and 3.8 will show how to
set the addresses for the transmitter and receiver.
24
Figure 3.7: Setting for transmitter
After the transmitter X-Bee module has been set up, replace the transmitter X-
Bee module with the receiver X-Bee module.
Figure 3.8: Setting for receiver
25
3.6 Software Implementation
This thesis needs two types of software. Firstly, the software for the transmitter
where the gravity value needs to be processed and sent to the TX and RX pins and the
software for the receiver where the gravity value will convert into a graph. For this
section, only the software for the receiver can be shown. For the transmitter, the C
language programming is already done. The programming will be attached to the
Appendix section.
For the real time graph, software from the LabView will be used. It is because
the software from LabVIEW is easier compared to the other softwares. Figure 3.9 will
showns the software implementation using LabVIEW.
26
Figure 3.9:LabVIEW block diagram
Figure 3.10: LabVIEWfront panel
CHAPTER 4
SYSTEM DESIGN
4.1 Introduction
This chapter will discuss how the software designs and hardware designs are
integrated to come out with the full system design.
4.2 Full System Operation
The main purpose of this thesis is to study the movement of chicken. In order to
detect sickness in them, from the movement detected, the data will be analyzed and the
condition of the chicken can be determined.
The system starts when the circuit is supplied with 7.4V from Lithium Polymer
battery. As mentioned before, the Arduino microcontroller board can be operated at 5V.
Therefore, the circuit will be regulated to 5V by a voltage regulated circuit. This 5V will
be supplied to the Arduino microcontroller board. The Arduino microcontroller board
will distribute of 3.3V supply to the accelerometer sensor, X-Bee wireless module and
28
LED indicator. The accelerometer sensor will then detect the chicken movement. Then,
the output from the accelerometer sensor will be sent to an Atmel processor on the
Arduino microcontroller board. After that, the Atmel processor will process the data in
the gravity value and the value will be sent to the TX and RX pins. From the TX and RX
pins, data transmission will be done by the X-Bee wireless module.
Wireless data transmission can be done by connecting Arduino RX pin to DOUT
X-Bee module and Arduino TX pin to DIN X-Bee module. After that, the data will be
transmitted to the receiver. From the receiver, the Arduino is connected directly to the
computer. By using a LabVIEW software, a real time graph and data logger will be
shown. The data logger will save the data for further analysis or the non-realtime graph
can be done by putting the data to the MATLAB software. Figure 4.1 shows the flow of
the system.
29
Figure 4.1: Full system operation
30
START
INITIALIZING
MOVEMENT
DETECTED?
PROCESSING
DATA
DATA
TRANSMISSION
DATA
RECEIVED?
SOFTWARE
DISPLAYING
DATA
DATA SAVING
NO
NO
YES
YES
Figure 4.2: Flow chart for system operation
CHAPTER 5
RESULT AND DISCUSSION
5.1 Introduction
This chapter discusses the result obtained for this thesis.
5.2 Transmitter Testing
Figure 5.1: Transmitter testing
LED indicator will turn
ON
Li-Po
Battery X-Bee
Sensor
32
Figure 5.1 shows the transmitter part consisting of an accelerometer sensor, X-
Bee wireless module and 5V voltage regulator. The LED indicator will turn ON if the
transmitter works well. If one of the components does not work, the LED indicator will
turn OFF and when the battery runs out of power, the LED indicator will blink.
5.2 Receiver Testing
Figure 5.2: Receiver testing
The receiver is easy to test because it gets direct power from the computer. This
is because the receiver is connected via USB cable from Arduino microcontroller board
to USB computer device. When the receiver is connected, LED indicator from X-Bee
shield blinks. It shows that the X-Bee is ready to receive data from the transmitter. The
X-Bee shield does not function if the LED indicator is not blinking.
LED indicator
will be blinking
33
5.3 Full System Testing
In this thesis, three types of software will be used to test its functionality. First is
the serial monitor application from the Arduino’s software. Here, the gravity values will
be shown but it does not provide a real time graph. Before that, the transmitter should be
attached to the chicken’s body and the receiver system in a standby mode. Figures 5.3
and 5.4 show the transmitter being attached to the chicken’s body and the receiver ready
to receive the data.
Figure 5.3: Transmitter is attached to the chicken’s body
34
Figure 5.4: Receiver in a standby mode
When the transmitter is ON, the transmitter will start sending data although the
chicken does not move. Figure 5.5 shows the data received from the transmitter by using
Arduino’s serial monitor software.
Figure 5.5: Result from serial monitor
Gravity
values
35
From the serial monitor, the results show three values received from the
transmitter. The values represent the tri-axis of the accelerometer sensor which are x-
axis, y-axis and z-axis. A real time graph and data logger can be shown by using the
LabVIEW software as demonstrated in Figure 5.7
From the result obtained, shows that real time graph consists of only one axis
graph. However, for the data logger, the result obtained consists of tri-axis gravity value.
The result from the data logger can be saved for future analysis. After that, the value can
also be copied and paste to MATLAB software for non-real time graph analysis. Figures
5.7, 5.8 and 5.9 will show the graphs using MATLAB. The results consist three
conditions which are during the chicken is static, walking and running.
36
Figure 5.6: Result from LabVIEW
Real-time graph Data logger
37
Figure 5.7: Chicken in static condition
Figure 5.8: Chicken in walking condition
(Z)
(x)
(y)
38
Figure 5.9: Chicken in running condition
5.4 Discussion
Accelerometer sensor is suitable for detecting movement. When there are
changes in the axis direction, it will change the gravity value. This is proven in the
results obtained as shown in Figures 5.7, 5.8 and 5.9. From the results obtained, it shows
that, when the chicken is static, the waveform of gravity values shows that the
accelerometer sensor does not change much. However, when the chicken is walking, the
changes of gravity values is more active compared to when the chicken is static. Then
when the chicken is running, the changes of waveform for the gravity values is very
active compared to when the chicken is in static and walking conditions. When the
chicken is active, the graph will show the changes for every movement. During this
situation, the chicken can be considered as healthy. If the output does not indicate any
significant changes, the chicken would be considered as unhealthy or sick.
CHAPTER 6
CONCLUSION AND RECOMMENDATION
6.1 Introduction
In this chapter, conclusion and recommendation for the thesis are discussed. For
the conclusion part, the objectives of the thesis are explained as either archived or not.
As for the recommendation, we give suggestion on how to improve the thesis quality in
the future.
6.2 Conclusion
From the obtained result, it can be concluded that this thesis was conducted
successfully. The objective of this thesis which is to design a sensor system to detecting
chicken movement and behavior was achieved. In addition, other objectives such as
wireless data transfer, real time monitoring and data logger were also accomplished.
This thesis successfully demonstrates the capability of the accelerometer sensor
and X-Bee wireless module. The accelerometer sensor was able to detect the chicken
movement and from the chicken movement, the behavior of the
40
chicken can be determined. Furthermore, this thesis can be used as a platform for future
development in using the accelerometer and fully utilizing the sensor’s capability. The
X- Bee wireless module was efficient in transmitting the data from the transmitter to the
receiver. Furthermore, the X-Bee wireless module can be used in a wide of range area
within a maximum of 100 meters in radius.
However, his thesis also has some weaknesses. One of the weaknesses of this
system is regarding data transmission. There is time delay between the gravity values
but that does not greatly affect the system. Also, since the size of the transmitter is quite
large it will be a burden to the chicken and causes it to become uncomfortable due to its
size.
6.3 Recommendation
To reduce the weaknesses of this thesis, some improvements should be made.
Firstly, more extensive research should be done in order to overcome the delay in time
of the transmission. To reduce large the size of the transmitter system, the design of the
system should include smaller components in the future.
41
REFERENCE
1. B. B. Graham, "Using an Accelerometer Sensor to Measure Human Hand
Motion, "Electrical Engineering and Computer Science, Massachusetts Institute
of Technology, May 11, 2000.
2. A. R. Jimenez, et al., "A comparison of Pedestrian Dead-Reckoning algorithms
using a low-cost MEMS IMU," in Intelligent Signal Processing, 2009. WISP
2009. IEEE International Symposium on, 2009, pp. 37-42.
3. R. Faludi, Building Wireless Sensor Network, 1 ed.: O'REILLY, 2010.
4. "Xbee/Xbee-PRO OEM RF Module," M. Inc, Ed., 1 ed. Lindon: MaxStream Inc,
2007.
5. F. K. b. A. Hamid, "Wireless Smoke Detector System," Faculty of Electrical
Engineering, Universiti Teknologi Malaysia, Skudai, 2011.
6. Y. K. Bee, "Portable Video Game Using PIC18F452 & Accelerometer," Faculty
of Electrical Engineering, Universiti Teknologi Malaysia, Skudai, 2011.
7. C. H. Chueng, "Wireless Home Security System," Faculty of Electrical
Engineering, Universiti Teknologi Malaysia, Skudai, 2009.
8. www.wikipedia.com
42
9. www.arduinoforums.com
10. Urbanext.illinois.edu/eggs/res08-whatis.html
11. http://phys.csuchico.edu/ayars/XBee/Software.html
12. http://iijean.blogspot.com/2011/09/realtime-visualization-for.html
13. http://forum.sparkfun.com/viewtopic.php?f=32&t=29295
14. H. D. Saim, "Wireless Mesh Routing for Telemedical System," Faculty of
Electrical Engineering, Universiti Teknologi Malaysia, Skudai, 2008.
15. http://www.theactigraph.com/article/research-database/validation/
accelerometers- for-measuring-physical-activity-behavior-in-children/
16. B. D. Hansen, "Evaluating of an Accelerometer for at-Home Monitoring of
Spontaneous Activity in Dogs," 2007.
17. J. F.Lawrence, "MEM Accelerometer and Distributed sensing forRapid
Earthquake Characterization," 2010.
43
APPENDICES
APPENDIX A
Arduino Coding for Accelerometer Sensor
const int groundpin = 18; // analog input pin 4 -- ground
const int powerpin = 19; // analog input pin 5 -- voltage
const int xpin = A3; // x-axis of the accelerometer
const int ypin = A2; // y-axis
const int zpin = A1; // z-axis (only on 3-axis models)
void setup()
{
// initialize the serial communications:
Serial.begin(9600);
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
44
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
}
void loop()
{
// print the sensor values:
Serial.print(analogRead(xpin));
// print a tab between values:
Serial.print("\t");
Serial.print(analogRead(ypin));
// print a tab between values:
Serial.print("\t");
Serial.print(analogRead(zpin));
Serial.println();
// delay before next reading:
delay(100);
}
45
APPENDIX B
Accelerometer connection diagram
46
APPENDIX C
Arduino UNO Datasheet
47
48
49
50
51
52
53
54
55
APPENDIX D
Accelerometer Datasheet
56
57
58
59
APPENDIC E
X-Bee Datasheet
60
61
62
63
64
APPENDIX F
X-Bee shield Diagram