Professional Documents
Culture Documents
net/publication/315794059
CITATIONS READS
0 2,814
1 author:
Ahmedul Haque
Karlsruhe Institute of Technology
5 PUBLICATIONS 1 CITATION
SEE PROFILE
All content following this page was uploaded by Ahmedul Haque on 06 April 2017.
Master Thesis of
Ahmedul Haque
KIT – University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association www.kit.edu
Abstract
Due to the recent advances in technology, low-cost, low-power, multifunctional sensor nodes
equipped with data processing, sensing and communicating abilities have been developed.
These sensor units are used to observe and monitor a variety of phenomena (such as
temperature and height measurement) in real physical world. Some applications need a
network of sensor units, where each node is connected to each other and their measurements
must be considered as a whole. In those cases, a time synchronization between all sensor
units is needed to guarantee a correct analysis of the data.
This thesis reviews the most representative clock synchronization algorithms for Wire-
less Sensor Networks (WSN) and evaluates their suitability to Overhead Line Monitor-
ing Systems (OLMS). The thesis describes also the development and implementation of
an innovative time synchronization algorithm for providing optimum time synchroniza-
tion performance to a set of remotely located sensor units installed on overhead power
lines. This algorithm ensures a reliable way to effectively handle and understand the data
tramsmitted from sensor units to a central station, where the data is processed. This
algorithm was programmed and run on a STM microcontroller with a Cortex M4 proces-
sor at 168 MHz. The performance of this algorithm is tested with two microcontrollrs of
STM32 family namely, STM32F407VGMCU Discovery Kit and STM32F4329ZI DISCO
Evaluation Board. This new algorithm and the proposed system architecture are designed
in an optimum way to enhance fault tolerance, scalability, enegy efficiency and accuracy
of the whole sensor network. Moreover, some suggestions are made to further improve the
performance of the developed system.
iii
I declare that I have developed and written the enclosed thesis completely by myself, and
have not used sources or means without declaration in the text.
Karlsruhe, March 2017
.........................................
(Ahmedul Haque)
Acknowledgments
First and foremost, I would like to thank my thesis supervisor, Ms.Gabriela Molinar. Her
support, advice, experiences and guidance were instrumental in the completion of this
work. Regular discussion with her was effectively helpful and insightful. I am deeply
grateful to her for her wise suggestion on several challenges while performing the time
synchronization task among sensor units. I am also indebted to her for her sincere effort
to teach me the art of doing research works as an individual. Her guideline will surely help
me to a significant extent in my future life.
I would also like to extend my gratitude to Prof. Dr. rer. nat Wilhelm Stork for is
continuous support during the development of this thesis and giving me the opportunity
to do the thesis within the Institute for Information Processing Technologies (ITIV).
I also want to thank all people that worked in the ITIV institute. With their patience and
openness, they created an enjoyable working environment. I would like to appreciate their
inspiration and cooperation during the entire work.
vii
Contents
Abstract iii
Acknowledgments vii
1. Introduction 1
1.1. An overview of Wireless Sensor Networks (WSN) . . . . . . . . . . . . . . . 2
1.2. Time synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3. Overhead power line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4. Overhead Line Monitoring Systems (OLMS) . . . . . . . . . . . . . . . . . . 4
1.4.1. Components of a monitoring system . . . . . . . . . . . . . . . . . . 4
1.5. Use of sensors in OLMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7. Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.8. Requirements on time synchronization protocols for Wireless Sensor Networks 7
2. Theoretical background 9
2.1. Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1. Definition of clock and general clock model [RN10] . . . . . . . . . . 9
2.1.2. Sources of errors in time synchronization . . . . . . . . . . . . . . . 11
2.2. Classification of time synchronization protocols . . . . . . . . . . . . . . . . 12
2.2.1. Synchronization issues . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1.1. Master-slave versus peer-to-peer synchronization . . . . . . 12
2.2.1.2. Internal synchronization versus external synchronization . 13
2.2.1.3. Probabilistic versus deterministic synchronization . . . . . 13
2.2.1.4. Sender-to-receiver versus receiver-to-receiver versus receiver-
only synchronization . . . . . . . . . . . . . . . . . . . . . . 13
2.2.1.5. Clock correction vs untethered clocks . . . . . . . . . . . . 14
2.2.1.6. Pairwise Synchronization versus network-wide synchroniza-
tion [RLK+ 09] . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.2. Application-dependent features . . . . . . . . . . . . . . . . . . . . . 15
2.2.2.1. Single-hop versus multi-hop networks . . . . . . . . . . . . 15
2.2.2.2. Stationary networks versus mobile networks . . . . . . . . 15
2.2.2.3. MAC-layer-based approach versus standard approach . . . 15
2.3. Discusssion of time synchronization protocols . . . . . . . . . . . . . . . . . 16
2.3.1. Flooding Time Synchronization Protocol (FTSP) . . . . . . . . . . . 16
2.3.2. Reference Broadcast Synchronization(RBS) . . . . . . . . . . . . . . 16
2.3.3. Romer’s Synchronization Protocol . . . . . . . . . . . . . . . . . . . 17
2.3.4. Continuous clock synchronization is wireless real-time applications
(Mock et al.’s Protocol) . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3.5. Timing-Sync Protocol for Sensor Networks (TPSN) . . . . . . . . . 19
2.3.6. Delay Measurement Time Synchronization (DMTS) Protocol . . . . 19
2.3.7. Probabilistic Clock Synchronization service in wireless sensor networks 21
ix
x Contents
3. System description 45
3.1. Reasons behind choosing GPS receiver as time source . . . . . . . . . . . . 46
3.2. An innovative time synchronization algorithm . . . . . . . . . . . . . . . . . 47
3.2.1. Reasons behind choosing this algorithm . . . . . . . . . . . . . . . . 47
3.2.2. Implementation of the time synchronization algorithm . . . . . . . . 49
3.2.2.1. NMEA Messages Overview . . . . . . . . . . . . . . . . . . 51
4. Results 53
4.1. Test Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2. Test Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.1. Time needed to reset counter/timer . . . . . . . . . . . . . . . . . . 54
4.2.2. Processing time needed to update GPS and set RTC seperately . . . 55
4.2.3. Total processing time needed to update GPS and set RTC . . . . . . 56
4.2.4. Clock Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
x
Contents xi
Bibliography 65
Appendix 67
A. List of Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
B. Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
C. Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
xi
List of Figures
xiii
List of Tables
xv
1. Introduction
It is hardly possible to imagine a modern society without electrical power. Most of the
devices of the daily life works with electric power. Electricity has become one of the
fundamental needs for the modern society.
After being generated, electric power needs to be transmitted to the place of consumption.
Sometimes, this distance could be quite long. Electric network is used to transport elec-
tricity from generators to consumers. The transmission system between power generation
and consumption has to be reliable. This medium must be risk free and employed in an
efficient way for monetary reasons. In order to ensure that, these lines need to be moni-
tored by transmission system operators (TSO). The capacity of the existing network could
be enhanced by using sensors and optimal regulation. Doing that, the need to construct
new lines will be reduced [MB11].
The high voltage transmission lines or overhead power lines, depending on system load,
can carry high current. This high current and weather conditions can cause a rise in
temperature, finally leading to the elongation in length of these lines. There could be two
problems created by this:
2. These elongated lines become bent and could touch any object below since the dis-
tance between these lines and ground is reduced. At high temperature there will
be risk electric sparks and short circuits with objects that are below these lines (for
example, highways, trees, buildings,cars etc.) thus causing lots of damages in terms
of human lives as well.
Hence, it is of vital importance to regularly monitor the lines. Sensors are used for this
purpose. They will measure the temperature and height of the lines from the ground and
then send the measured data to the TSO where further processing and analysis will take
place.
Sensors are used to monitor the conductor behavior and to control the power that can
be transmitted in real-time. Time synchronization between all sensor units is needed to
guarantee a correct analysis of the data. Those sensors must be time synchronized, i.e.
each measurement must have a time stamp common to all sensor units, to allow an efficient
data understanding and control of the system.
1
2 1. Introduction
Domain Applications
Health Recognition of pre defined symptoms by tele-monitoring physio-
logical data
Logistics Tracking of Cargo
Civilian Highway traffic monitoring
Military Enemy attack prevention, chemical and nuclear attack monitoring
Environment Flood and Earthquake detection
Home and K-12 educa- Smart kindergarten, intelligent home
tion
Agriculture Soil moisture and water resource monitoring
Space Exploration Exploration of cosmic radiation and inter-planets
Ocean Deep undersea exploration
Industry Toxic gas emission detection
2
1.3. Overhead power line 3
costs associated with cables are high. Morever, long relocation time makes it unsuitable
in many real time applications. Overhead line overcomes the problems associated with
cables and hence (Figure 1.1) is preferred in transmission of energy along large distances.
It is comprised of one or more conductors, suspended by poles or towers [MPJ08].
The advantages of overhead power line compared to cables for power transmission are as
follows [MPJ08]:
3
4 1. Introduction
• They use bare conductors which can break and cause damage.
The basic components of a monitoring system are [MPJ08] (see Figure 1.2 ):
2. A receiving unit with data processing, storage and graphical user interface for the
operator.
4
1.5. Use of sensors in OLMS 5
The transmission of energy is monitored in transmission lines via deploying sensors in all
the components of OLMS. There are many poles supporting a long overhead transmission
line (Figure 1.3). Usually sensors are placed on locations close to the poles on each span.
Data generated by sensors have to be delivered to the substation [MPJ08].
1.6. Environment
The structure of the sensor network developed for monitoring remotely located sensors of
OLMS is according to Figure 1.4. There are sensor units located in the overhead power
lines, which are wirelessly connected a central station. Each of the sensor units consists of
an arbitrary number of sensors and a processing unit as shown in Figure 1.5.
The sensor units on OLMS could have different kind of sensors, as for example [MPJ08]:
• Image sensor.
This thesis focuses on the design and implementation of the time synchronization algo-
rithm which will timestamp incoming data from sensors. This algorithm runs in a mi-
crocontroller (which is used as processing unit in this thesis) and is bound to assure an
effective synchronization of time inside the system.
5
6 1. Introduction
Figure 1.4.: Structure of the sensor network for the OLMS considered in this thesis. CS stands for
central station, SU for sensor unit. An arbitrary number of sensor units are wirelessly
connected to a central station.
Figure 1.5.: Structure of a typical wireless sensor unit. It has an arbitrary N number of sensors
(denoted as S1,S2 up to SN) connected to a processing unit (denoted as PU) which
ensures the wireless transmission of timestamped information to the central station.
1.7. Tasks
The measured data from each sensor will be processed by the corresponding processing
unit and then will be sent to a central station for making further analysis. The central
station will get measured data from all the sensor units available in the system. In order
to properly manage and efficiently understand the time when each measured data is taken,
the central station should receive data with proper time information (that means when
the measured data is taken). A common notion of time is thus needed among sensors in a
sensor unit.
6
1.8. Requirements on time synchronization protocols for Wireless Sensor Networks 7
The central station is responsible for managing the information generated by the sensors
in each sesnor unit. That means, all measurement data have to be properly time-stamped
on the sensor unit. This also implies that the processing unit itself needs to be time
synchronized. One possible way to do it is to connect a global source of time such as a
GPS receiver to the processing unit.
This thesis is focused in synchronization of time among sensors in individual sensor units.
• Accuracy:
Accuracy indicates the maximum offsets or average errors between the local clock
values of any two nodes. The need for accuracy varies for different protocols depend-
ing on applications and purpose of synchronizations. It shows how well the time is
maintained in WSN with respect to the standard time.
• Energy Efficiency:
It is the most important factor for WSN as every network node has a limited energy
resource. Some define energy efficiency based on awake and sleep time of nodes.
Others define it as the amount of energy consumed for one round of synchronization.
• Robustness:
If WSN is employed in harsh and hostile environments, network nodes might die or
go out of network. It affects the level of synchronization errors at least for some time
until the failed node is replaced. During this time, nodes waste both energy and
time.
• Lifetime:
The synchronized time may be instantaneous or throughout the entire duration of
the network.
• Scalability:
A large number of sensor nodes are deployed in wireless sensor networks. Time
synchronization protocols should work well with arbitrary number of nodes.
• Complexity:
Highly complex synchronization protocols are not applicable to many applications
due to energy constraint and hardware limitations.
• Scope:
A time synchronization protocol may provide a common time scale for all sensor
nodes in the network or for only some closely spaced nodes.
7
8 1. Introduction
• Immediacy/Delay:
Many applications, such as forest fire detection, may require instant response without
any significant delay. This is called immediacy requirement and might prevent the
designer of the protocol from depending on excessive processing after such an event
of interest occurs which in turn requires that all nodes to be pre-synchronized at all
times.
8
2. Theoretical background
For a perfect clock, equation 2.1 is fulfilled which means that clock value is equal to real
time.
∂C
=1 (2.1)
∂t
In reality, due to a series of fluctuations, such as vibration, temperature, humidity etc. the
angular frequency of a clock changes over time and clocks drift.
For some node i, the local clock value Ci (t) can be related to real time t by equation 2.2.
Here, ai is the clock drift and bi is the clock offset of node i. Drift denotes the rate or
frequency of the clock and offset denotes the difference between the clock value and real
time t.
Equation 2.2 can be used to compare the local clock values of two nodes (see equation
2.3).
9
10 2. Theoretical background
Where, a12 is the relative drift and b12 is the relative offset between the clocks of nodes 1
and 2.
If two clocks are perfectly synchronized, then the relative drift is equal to 1 and the relative
offset is equal to zero as shown in equations 2.4, 2.5.
a12 = 1 (2.4)
b12 = 0 (2.5)
∂ 2 C1 (t) ∂ 2 C2 (t)
Drif t, λ = − (2.8)
∂t2 ∂t2
Offset is the difference in local clock values between two clocks. Skew is the difference in
rate of change of local values between two clocks. In other words, skew is the difference
in frequency of two clocks. Drift is defined to be the difference in rate of change of skew
between two clocks [RLK+ 09].
The clock skew can fluctuate over time due to different atmospheric conditions, such as
temperature and humidity. But assuming that the clock skew stays bounded, equation 2.9
is reached.
clockskew ≤ (1 + ρ) (2.9)
10
2.1. Related work 11
Figure 2.2.: Delays involved during delivery of a message over a wireless link [BM10]
1. Send Time:
This is the time needed to build the message at the application layer and then transfer
it to the network interface. This time varies with operating systems.
2. Access Time:
Probably the most significant componenet that leads to packet delay. This is the
waiting time needed to access the channel after reaching the MAC (Medium Access
Control) layer. It is highly dependent of the sensor network employed MAC protocol.
3. Transmission Time:
During this time the packet is transmitted bit by bit at physical layer. Estimation
of the packet time depends on the radio speed and packet size.
4. Propagation Time:
During this time the message travels from network interface of the sender to the
network interface of the receiver through air.
5. Reception Time:
Similar to transmission time, reception time is the time taken in receiving a message
bit by bit at the physical layer.
6. Receive Time:
Highly dependent on the operating system in use. This is the time spent in receiving
the message, transforming the bits into a packet and then tranferring the packet to
the application layer where the receiver decodes it.
11
12 2. Theoretical background
• Synchronization issues
• Application-dependent features
• Master-slave:
One node will be selected as master, the other nodes will be slaves. The local
clock reading of the master will be regarded as reference time by the slaves. Slaves
will try to get synchronized with the master node. The master node needs CPU
resources proportional to the number of slaves. Usually, master nodes have powerful
processors.
• Peer-peer:
Any node can communicate directly with all the other nodes in the network. So the
risk of master node failure is eliminated in this method. This protocol offers more
flexibility but can also be more difficult to handle.
12
2.2. Classification of time synchronization protocols 13
• Internal synchronization:
A global time base, called real time is unavailable and that is why the main target
of this method is to minimize the maximunm difference between local clock readings
of the sensor nodes.
• External synchronization:
A standard source of time, such as UTC(Universal Time Controller) is available.
UTC can be used as reference time by the sensor nodes. This method has high
energy requirement due to the use of an external time source.
Internal synchronization is applicale to both master-slave and peer-peer fashion
whereas, external synchronization is suited for master-slave fashion only. External
synchronization needs master node which maintains communication with a stan-
dard time service (such as GPS) in order to synchronize the slaves and itself to the
reference time.
• Probabilistic synchronization:
A probabilistic guarantee on the maximum clock offset with a failure probability that
can be bonded or determined is ensured in this method. Protocols following deter-
ministic approach exchange more messages and need extra processing. So propabilis-
tic approach is preferred over deterministic one some times. However, propabilistic
method is not suitable for wireless environment.
• Deterministic synchronization:
An upper bound on the clock offset is guaranteed with certainty. Most algorithms
follow deterministic approach.
13
14 2. Theoretical background
• Clock correction:
In order to keep the entire network synchronized, the local clock values of the par-
ticipating nodes are corrected either instantly or continously. The correction is done
with respect to a global time-scale or an atomic clock.
• Untethered clocks:
In order to have a common notion of time among the sensor nodes, a considerable
amount of energy is dissipated. It can be avoided if the local clock value of each
node is exchanged with others. The local values are maintained and compared in
a tabular format. When sensor nodes exchange the timestamps, those timestamps
are transferred to the local clock values of the receiving node. The round-trip delay
between two nodes is taken into consideration.
• Pairwise Synchronization:
Synchronization is done in between two nodes. However synchronization among a
set of nodes is also possible.
• Network-wide synchronization:
A large number of nodes are synchronized using this method.
Table 2.1 shows the classification of different time synchronization protocols based on
synchronization issues [SBK05].
Synchronization issues
Protocol Master- Internal vs. Probabilistic Sender-to- Clock
slave versus external vs. deter- receiver vs correction
peer-to- ministic receiver-to-
peer receiver
RBS Peer-peer Both Deterministic Receiver- No
to-receiver
Romer Peer-peer Internal Deterministic Sender-to- No
receiver
Mock et al. Master/slave Internal Deterministic Receiver- Yes
to-receiver
TPSN Master/slave Both Deterministic Sender-to- Yes
receiver
DMTS Master/slave Both Deterministic Sender-to- Yes
receiver
Probabilistic Peer-peer Both Probabilistic Receiver- No
to-receiver
Tini-sync Peer-peer Internal Deterministic Sender-to- Yes
receiver
Time- Peer-peer Internal Deterministic Receiver- Yes
diffusion to-receiver
Asynchronous Peer-peer Internal Deterministic Sender-to- Yes
diffusion receiver
14
2.2. Classification of time synchronization protocols 15
15
16 2. Theoretical background
Application-dependent features
Protocol Single-hop MAC layer Geared to
versus vs standard mobility
multi-hop
RBS Both Standard No
Romer Single-hop Standard Yes
Mock et al. Both MAC layer No
TPSN Both MAC layer Yes
DMTS Both Standard No
Probabilistic Both Standard No
Tini-sync Both MAC layer No
Time- Both Standard Yes
diffusion
Asynchronous Both Standard Yes
diffusion
• More robust against failure of links between nodes and dynamic topology changes.
• Each node can communicate despite the lack of reliability.
16
2.3. Discusssion of time synchronization protocols 17
Figure 2.3.: Time-critical path for traditional protocols (left) and RBS protocol (right) [SBK05].
17
18 2. Theoretical background
• With the increase of the number of hops along the path of message containing the
timestamp, the synchronization error increases.
• In sparse networks, where the number of hops is usually high, this protocol is not
applicable.
• Synchronization achieved in this protocol is localized and short lived.
• Round trip estimation is required, which can increase synchronization error.
18
2.3. Discusssion of time synchronization protocols 19
19
20 2. Theoretical background
2. Local clocks are synchronized over the whole network to create a network time.
3. Global time source synchronization is possible by connecting the synchroniza-
tion leader to a global time source such as GPS receiver.
The five delays involved along a time transfer path [RLK+ 09] are presented in the
figure 2.4.
1. The processing time and MAC delay of the sender can be eliminated by taking
a timestamp when a clear channel is detected.
2. Transmit time is divided into two parts: time to send preamble and start sym-
bols and then time to send the data.
3. The processing time of the receiver is measured using local timestamps of the
receiver: If a time packet is time stamped at its arrival time and then time
stamped again before adjusting the local clock of the receiver then, processing
delay of receiver is the difference between the two timestamps.
Figure 2.4 shows the time line of transferring a message from one node to
the other. In Mica platform, the sender synchronizes with the receiver at the
end of start symbol. If the receiver takes a local timestamp at this instant
(denoted by t1 ) and then take another timestamp when processing the time
message (denoted by t2 ) then, total time delay (denoted by td ) can be measured
[RLK+ 09] according to equation 2.10.
td = te + t2 − t1 (2.10)
whereas, te is the estimated time to send the preamble and start symbols.
In DMTS protocol, the leader sends a time synchronization message with its
timestamp t, which is added after MAC delay and detection of a clear chan-
nel. The receiver calculates the path delay and sets its local clock time to tr :
The receiver is then synchronized with the leader. The lower bound is the
synchronization precision and the upper bound is the local clock accuracy.
• Multi-hop DMTS algorithm:
Two scenarios are possible [RLK+ 09].
20
2.3. Discusssion of time synchronization protocols 21
1. If a node is aware of its children nodes, then it will broadcast a time signal
after adjusting its own time. By using single hop communication with a known
leader, the node then synchronizes with its children.
2. If a node has no knowledge about the children, then multi-hop DMTS algorithm
is used .Using leader selection algorithm a time master is selected. In order to
identify the distance from master to another node. A master is of source level
0. If a node is synchronized with master, it will be level 1 time source. The root
node periodically broadcasts is time and so do the synchronized nodes. When
receiving a time signal, a node will check the level of the tie source. If it is from
a source of lower level than itself, then it accepts the time. Otherwise it silently
rejects the signal. DMTS guarantees shortest path to time master, since a node
always selects the node that is closest to the time leader as its parent.
DMTS has some advantages as follows [RLK+ 09]:
• DMTS is energy efficient because only one time signal transfer is required to syn-
chronize all nodes in a single hop.
• To monitor a wireless sensor network at run-time, a user application interface is
provided.
• DMTS is lightweight since there is no complex operation involved. So computational
complexity is low.
• From point of view of receivers, the leader’s time signal is a common-view timestamp.
That is why it is convenient for receivers to get synchronized with each other better
than they can synchronize with the sender.
• DMTS supports multi-hop synchronization.
• This algorithm guarantees that root time will be propagated to all network nodes
with a limited number of broadcasts.
However, DMTS has the following disadvantages [RLK+ 09]:
• The synchronization accuracy is low compared to RBS.
• This method is applicable only to a relatively low resolution, low frequency external
clock.
• There is a trade-off between synchronization accuracy and computational complexity
and/or energy efficiency.
21
22 2. Theoretical background
22
2.3. Discusssion of time synchronization protocols 23
23
24 2. Theoretical background
2.3.12. TSYNC
It provides network-wide synchronization. It has two versions [SBK05]:
1. Centralized version:
This is called Hierarchical Referencing Time Synchronization (HRTS).
2. Decentralized version:
This is called Individual Time Request (ITR) protocol,.
TSYNC shows the following advantages [SBK05]:
• Accurate.
• Lightweight.
• Flexible.
• Comprehensive
• This protocol manipulates the use of multi-channel radios to improve precision, re-
duce communication overhead and lower consumption of energy.
• This protocol can be easily extended to sensor networks that are devoid of multiple
channels.
TSYNC has the following disadvantages [SBK05]:
• Implementation of TSYNC at any layer above MAC layer could introduce more
imprecision.
• Implementation of TSYNC at any layer above MAC layer could introduce security
vulnerability.
Some time synchronization protocols are recently propsed. They are discussed as follows.
24
2.3. Discusssion of time synchronization protocols 25
2. Center node:
Based on the tables received from sensor nodes, a center node is localized by BS. A
center node has the highest degree and lowest depth (lowest number of hops from
BS). Center node is the root for the synchronization tree that will be constructed.
If a BS finds lots of nodes with highest degree and lowest depth, then it will choose
one of them as center node.
3. Coordinator nodes:
These nodes are designated by center node initially. Center node will designate
1-hop neighbors with highest degree as coordinator nodes, which will forward the
synchronization message. These coordinator nodes will then designate another set of
coordinator nodes that will propagate the synchronization message. This process will
end when leaf nodes get the synchronization message. In the beginning, center node
having level 0 will send messages to coordinator nodes having level 1. Then these
coordinator nodes will send messages to another set of coordinator nodes having level
2. In the end, coordinator nodes having level (n-1) synchronizes the leaf nodes.
4. Leaf nodes:
These nodes are located at the last level of synchronization tree. Only synchroniza-
tion of their clocks worry them.
25
26 2. Theoretical background
26
2.4. Comparison among time synchronization protocols 27
27
28 2. Theoretical background
network. Since wireless networks often suffer from severe bandwidth limitations, pig-
gybacking mitigates the communication demand on the network. Moreover, it also
cuts down the storage requirements on network nodes. Romer’s protocol and TPSN
use piggybacking.
• Computational complexity:
Since wireless networks often suffer from limited hardware capacity and severe energy
constraints, the complexity level of a synchronization protocol is very important to
know. A highly complex protocol might be unsuitable for many applications. In this
work, the computational complexity of a protocol (run-time and memory require-
ments) is differentiated from message complexity (number of exchanged messages
during synchronization).
• Convergence time:
This is the time required for synchronizing a network. If a protocol needs a large
number of exchanged messages per synchronization, then it will result in long con-
vergence time. In order to make a protocol cost efficient, the message complexity
has to be reduced. Since convergence time dependent on message complexity and
bandwidth usage, low convergence time is a highly desirable feature in wireless net-
work.
• Network size:
The empirical evaluation of the synchronization protocols on the actual sensor net-
works has been done by some authors. This information is unavailable for most of
the protocols studied yet. TPSN can handle neighborhoods with of up to 300 nodes.
• Compatibility with sleep mode:
In order to meet the energy requirements, the ability to go to low power (sleep) mode
is crucial. The nodes have to be synchronized and have to remain active only when
the application needs. RBS shows this feature by using post facto synchronization.
Table 2.3 compares various time synchronization protocols in terms of the quantitative
performance. The data for precision is taken from [RN10],[Yan12].
Different protocols are suitable for different conditions.
28
2.4. Comparison among time synchronization protocols 29
• Energy efficiency:
Energy efficiency is the most important feature in most sensor networks. The require-
ment of energy efficiency varies with applications. For instance, a sensor network
with strict energy consumption will force the nodes to go to sleep mode as frequently
as possible, thus limiting the energy available for time synchronization. The prime
reason behind the energy constraint in the networks is the small size of the batteries
in sensor nodes, which greatly limits the amount of energy that can be stored and
used. There is an important tradeoff between use of the available energy to commu-
nicate or compute. In case of sensor networks having radio frequency transmitters
and receivers, the energy needed to communicate is far greater than that needed to
compute. The CPU also shuts down often to save energy.
• Overall complexity:
It is a combination of communication overhead, overhead due to fault tolerance and
algorithmic complexity. Highly accurate protocols very often suffer from high overall
complexity.
• Fault tolerance:
It shows the behavior of the protocol in case of node failure. Wireless media is error
prone. In many protocols, there are one or more special nodes with respect to which
other nodes get synchronized. If any of these nodes fails during synchronization
process, it can lead to the increase in the level of synchronization error until the
failed node is replaced. In the mean-time, nodes can waste both data and energy.
Any node is not regarded as robust unless the selection of a new special node does
not affect the synchronization process.
Table 2.4 compares various time synchronization protocols in terms of the qualitative
performance.
According to Table 2.4, different protocols are more suitable for different qualitative cri-
teria.
29
30 2. Theoretical background
30
2.6. GPS receiver 31
Figure 2.5.: A visual example of 24 satellite constellation in motion with the rotating earth. Max-
imum 9 satellites are in line of sight with the GPS receiver in this case [GPS]
31
32 2. Theoretical background
32
2.7. U-blox Neo-6M GPS Module 33
ing NEO-6 GPS receivers excellent navigation performance even in the most challenging
environments.[Neoa]
Figure 2.8.: Connection between a microcontroller and a NEO-6M GPS receiver [Ele]
33
34 2. Theoretical background
2.7.5. PPS
PPS is the abbreviation of 1 Pulse Per Second. This signal is synchronized at the rising
edge. The pulse is of duration 500ms [Neoa]. PPS pin is internally connected to an LED
in GPS receiver. By default there are two states in PPS signal [Ele]:
• Always on, which means that the module has started to work, but have not estab-
lished positioning yet.
• Flashing (100ms off, 900ms bright), which means that the module has established
successful positioning.
• Accuracy is the measure of how close the PPS signal edge is with respect to
the second of the actual UTC boundary. We want this value to be as low as
possible. Sometimes this value is within the range of few microseconds. This
error is usually fixed for a given firmware version.
• Precision is the measure of how much the PPS signal edge changes from one
second to the other. This value can range from 10’s of nanoseconds to the order
of few microseconds.
2. The PPS signal edge and rise time are very important if resetting of a counter is
needed. Large capacitance and long signal length can make the rise time slow. Slow
rise tim will add an offset the accuracy value. In order to cancel that, we will need
calibration. In case of noisy signal, the reset circuit might see more than one PPS
signal edge or a variable delay on the offset time where the resetting of counter takes
place.
3. Lots of GPS receiver have precision in the scale of 10’s of nanoseconds.Crystal oscil-
lators usually have errors in the range 20-100 ppm. In that case, those oscillators can
be calibrated using PPS. But the precision of GPS can not be guaranteed to be fixed.
This value can vary due to many factors which are not easy to measure. So, this
error due to precision can change from one PPS to the next. Using a median filter
or moving average of several PPS counts, the actual count value can be determined.
4. Viewing the sky clearly is one of the fundamental requirements for a GPS system
to work properly. If the GPS receiver is placed indoor or shielded then the problem
might worsen. Running the antenna of the GPS outside is a possible solution.
5. The GPS serial data isused to set the system date and time. The data com out of
the GPS some time usually from 100-500 ms after the PPS signal edge [Jba].
34
2.7. U-blox Neo-6M GPS Module 35
35
36 2. Theoretical background
Figure 2.10 shows an example of parallel communication where 8 bits are transmitted with
every clock pulse.
Parallel communication has the following advantages over serial communication [Tam]:
• It has high data rate because of the ability to transmit/receive multiple bits at each
clock cycle.
• Straightforward
• Easy to implemenent
36
2.8. Communication Protocols 37
Although parallel communication has some advantages over serial communication, it suf-
feres sevely from cross-talk and clock skew which ultimately affects the data rate. More-
over, parallel interfaces need lots of input/output(I/O) lines. But microcontrollers have
limited number of pins avalable. Hence, serial communication is preferred in exchanging
information with microcontrollers [Tam].
There are two modes of serial communication:
1. Asynchronous serial.
2. Synchronous serial.
In this case, data bits are not synchronized with a clock signal. This transmission method
is perfect for minimizing the required wires and pins. There is no control over when data
is sent. In order to reliably transmit and receive data, asnchronous serial interfaces add
an extra start bit and an extra stop bit to each byte that helps the receiver remaining
synchronized with the incoming data from the sender (Refer to figure 2.12) [Tam].
In case of synchronous serial communication, data bits are synchronized with clock pulses.
Here no additional start and stop bits are needed for synchrozing data between sender
and receiver. The clock signal, shared by all the devices on the serial bus, takes care
of that problem (see figure 2.13). This makes for a more straightforward, often faster
serial transfer, but it also requires at least one extra wire between communicating devices.
Examples of synchronous interfaces are SPI, and I2C [Tam].
37
38 2. Theoretical background
38
2.9. Real-Time Clock(RTC) 39
format. Correction for 28, 29 (leap year), 30, and 31 day of the month are performed
automatically.The RTC can provide a programmable alarm and programmable periodic
interrupts with wakeup from Stop and Standby modes. The sub-seconds alarm is also
available in binary format [STMd].
RTC is clocked by a 32.768 kHz external crystal, resonator or oscillator, the internal
low-power RC oscillator or the high-speed external clock divided by 128. The internal
low-speed RC has a typical frequency of 32 kHz. The RTC can be calibrated using an
external 512 Hz output to compensate for any natural quartz deviation [STMd].
Two alarm registers are used to generate an alarm at a specific time and calendar fields
can be independently masked for alarm comparison. To generate a periodic interrupt,
a 16-bit programmable binary auto-reload downcounter with programmable resolution is
available and allows automatic wakeup and periodic alarms from every 120 Î 14 s to every
36 hours [STMd].
A 20-bit prescaler is used for the time base clock. It is by default configured to generate
a time base of 1 second from a clock at 32.768 kHz [STMd].
39
40 2. Theoretical background
In order to select RTC clock source, program the RTCSEL[1:0] bits in the RCC Backup
domain control register and the RTCPRE[4:0] bits in RCC clock configuration register
[STMd].
When LSE is selected as the RTC clock, the RTC will work normally even if the backup
or the system supply suddenly disappears. If the LSI is selected as the clock source, the
normal working state of RTC is not guaranteed if the system supply disappears [STMd].
The LSE clock is in the Backup domain,but the HSE and LSI clocks are not. So [STMd]:
• If LSE is selected as the RTC clock source:
– The RTC will continue to work even if the VDD supply is switched off, provided
the VBAT supply is maintained.
• If LSI is selected as the Auto-wakeup unit (AWU) clock:
– The AWU state is not guaranteed if the VDD supply is disconnected.
• If the HSE clock is selected as the RTC clock:
– The RTC state is not guaranteed if the VDD supply is disconnected or if the
internal voltage regulator is powered off (removing power from the 1.2 V do-
main).
40
2.9. Real-Time Clock(RTC) 41
Figure 2.16.: RTC calender fields. RCTD R, RT CT R are RTC Date and Time registers.The sub-
second field is the value of the synchronous prescaler’s counter
A software calendar could be a software counter (usually 32 bits long) that represents/counts
the number of seconds. Software routines convert the counter value(the number of seconds)
to hours, minutes, day of the month, day of the week, month and year. This data can be
converted to both BCD format and Binary format and could be displayed on a standard
LCD [STMc], Also, the 12-hour format with an AM/PM indicator is also programmable
(see Figure 2.17).
Conversion routines consume considerable amount of memory and CPU-time making them
not useful in certain real-time applications. When using the STM32 RTC calendar, there
is no need for software conversion routines because their functions are done by hardware
[STMc].
The STM32 RTC calendar is provided in BCD format. This avoids an additional step
of binary to BCD software conversion routines, thus saving significant memory space and
CPU-load in real time applictions [STMc].
41
42 2. Theoretical background
Figure 2.18.: Prescalers from RTC clock source to calendar unit [STMc]
RT CCLK
ck − spre = (2.11)
(P REDIVA + 1)(P REDIVS + 1)
whereas,
Table 2.7 shows several ways to deliver 1 Hz frequency to the RTC calender.
Table 2.7.: RTC calendar clock equal to 1 Hz with different clock sources [STMc]
42
2.9. Real-Time Clock(RTC) 43
An alarm comprises a register with the same length as the RTC time counter. When the
RTC time counter reaches the value programmed in the alarm register, a flag is allowed
to set to indicate the occurance of an alarm event.
The STM32 RTC alarm can be configured by hardware to generate various types of alarms.
The desired alarm event can be configured by using the MSKx bits (x = 1,2,3,4) of the
corresponding alarm register.
Some possible alarm settings are shown in Table 2.8. For all possible alarm settings please
refer to table 2.19
43
44 2. Theoretical background
• LSE is selected as the RTC clock source (for example LSE = 32768 Hz).
• The Asynchronous prescaler is set to 127.
• The Synchronous prescaler is set to 255 (the Calendar clock is equal to 1Hz).
• The alarm A sub-second is set to 255 (255 is put in the SS[14:0] field).
44
3. System description
The main task of this thesis is divided intwo two parts: the first part is to choose an
algorithm from the protocols that are mentioned in 2.2 or to develop an optimum time
synchronization algorithm that will fulfill the specific requirements needed in order to
monitor overhead powerlines. The second one is to test the desired algorithm and evaluate
its suitability to OLMS system. The system architecture of a sensor unit is shown in
figure 3.1. The architecture of OLMS is shown in figure 3.2 The software used to develop
this algorithm is IAR Embedded Workbench. This algorithm was run on two different
microcontrollers namely, Discovery kit with STM32F407VG MCU and STM32F429ZI-
EVAL, an evaluation board. Both of them are the two most powerful microcontrollers of
the family STM in terms of processing power. Two microcontrollers are needed to evalaute
and compare performance of two sensor units.
Figure 3.1.: Structure of a sensor unit. The yellow structure on the right side is the GPS receiver
In this chapter how the time synchronization algorithm that was programmed and imple-
mented in the two STM32F4 microcontrollers will be presented and discussed in details.
Besides how the NMEA protocol, used by GPS for serial communication with a microcon-
troller, works and how the detailed structure of the program will also be illustrated.
45
46 3. System description
1. If a microcontroller is made the master node, then it will act as the master clock.
The other microcontrollers will act as the slave clock and they will try to synchronize
their time based on the clock of the master. But in that case, it is not easy to be
46
3.2. An innovative time synchronization algorithm 47
sure about the type of connection to be used between the master and its slaves. It
is mainly because there could be minimum 300 m between sensor units along a line
that can be around 20 km between each processing units. So, one possibility could
be wired connection such as optical fibers. But fibers are expensive. Moreover, they
could be damaged quite easily due to pressure, bad weathers etc. We want to make
our optimum in terms of both performance and cost. So, wired connection is not a
solution. Then the only possibility remains is to use a wireless connection. But there
could be significant delay involved in between transmission of time information from
master clock and reception of that information by the slave clocks. So the amount of
deviation in time among sensor unit clocks could be very high. That is why, making
a microcontroller as the master node will not produce optimum performance for our
proposed sensor network.
2. Secondly, we want flexibility in our system. Since an arbitraty number of sensor units
will be deployed, each of them is supposed to act on its own. Therefore, the optimum
option in that case is to use a GPS receiver which is able to receive time information
from a global source of time (such as UTC or GMT). A good GPS receiver is able
to receive time information from the satellites that are constanly rotating around
the atmosphere. So even in harsh and hostile conditions, a GPS receiver is able to
receive data and send it to an external device (in our case the external device is
a microcontroller). Each microcontroller will have its own GPS receiver. So each
sensor unit will be synchronized with a global time source at all times and does not
have to depend on other sensor units for time synchronization which can offer great
flexibility in terms of system complexity. Moreover, a GPS receiver also takes care
of the amount of delay involved in receiving clock information from the satellites.
Hence, making a GPS receiver as the master clock and the attached microcontroller as its
slave clock for each sensor unit offers more advantages over making a single microcontroller
as the master clock and all other microcontrollers as its slave.
47
48 3. System description
48
3.2. An innovative time synchronization algorithm 49
The proposed algorithm works in the following sequence as shown in Figure 3.3.
Figure 3.3.: The flow chart of proposed time synchronization algorithm. Here tw stands for time
to wait.
1. PPS signal:
In each second, an external signal from the GPS receiver through the Pulse per
second (PPS) pin will be received by a GPIO pin in the microcontroller. This PPS
signal will contain updated information about time. In each rising edge of the PPS
signal there will be an external interrupt in the microcontroller.
2. Counter/Timer reset:
With the reception of each PPS signal, a timer will be reset. The frequency of this
49
50 3. System description
timer is to be 1 KHz so that this timer produces a counting tick in each 1ms. We
are doing this so that we have our own definition of subseconds.
For better understanding of the reader, an example diagram of this new algorithm is
shown in Figure 3.4. In the image is shown an example where the time interval between
two consecutive GPS time update and RTC clock set (tw) is six PPS rising edges.
It is needed to seperate the calculation of seconds from that of subseconds. The GPS
receiver that we are using provides time information only upto the scale of seconds. But
it is desirable to have more finer resolution in time, in the scale of subseconds which could
be ms, µs or ns. In order to differentiate among different events occuring at the same,
calculation in the scale of subsecond is needed. That is why, a timer was reset at the
starting of a second( the arrival of PPS signal every second). PPS singal is used as a time
reference since the start of a new second is very close to the corresponding rising edge of
the PPS signal. A timer of 1 KHz frequency is used which produces a tick (a count) in
each 1ms. So, in 1 second there will be 1000 ticks starting from 0 ms upto 999 ms. With
the start of the next second, the subsecond value starts from 0 ms again and reaches upto
999 ms. So the start of the a new second is ensured by the incoming PPS signal each
second whereas the start of the range of subsecond values is ensured by resetting a timer
at the same instant a PPS signal arrives (see Figure 3.5).
50
3.2. An innovative time synchronization algorithm 51
51
4. Results
In this chapter the tests, conducted with the two microcontrollers, are properly explained
along with results of these tests. The order of these tests are organized in the same way the
requirements on time synchronization protocols of wireless sensor networks are introduced
The tests were conducted to check the suitability of the proposed time synchronization
algorithm in the OLMS.
53
54 4. Results
In this section, the results obtained through the tests will be discussed and analyzed .
An extra timer(TIM 1) of 168 MHz frequency was used to calculate the amount of time
needed to reset the timer(TIM 5) of 1 KHz frequency asscoiated with the arrival of each
PPS signal. A timer of 168 MHz frquency was used for counting because that corresponds
to the frequency of the system core clock. At first, TIM 1 counter register value was checked
just before and just after the TIM 5 was reset. The difference in the counter register values
at these two instants was divided by the frquency of TIM 1 (which is 168MHz) to obtain
the time needed to reset TIM 5.
This processing time for two microcontrollers are shown in Table 4.1. The resetting time
was same for both microcontrollers. The pseudocode of the processing time needed to
reset a timer is 16:
∆N
Pocessing time = (4.1)
f
Here ∆N is the difference in counter register values at two instants and f is the frequency
of the timer used for counting.
Table 4.1.: Comparison of processing time needed to reset timer/counter in two microcontrollers
54
4.2. Test Results 55
4.2.2. Processing time needed to update GPS and set RTC seperately
Again TIM 1 was used for measuring time. The value of the counter register was checked
just before and just after updating the GPS data. The same technique is also used when
RTC clock was set based on the obtained updated GPS data. Table 4.2 shows the calcu-
lated values.
Table 4.2.: Comparison of processing time needed to update GPS and set RTC seperately in two
microcontrollers
The pseudocode of the processing time needed to update GPS and set RTC is 25:
Algorithm 3 Calculate processing time needed to update GPS and set RTC
Require: A timer of 168MHz frequency(TIM1)
f = 168M Hz
PPS signal received at any instant(v=1)
The tests were conducted using 10s of waiting time
Some other value could also have been used
Wait for 10 PPS time duration
Ensure: v = 10
if v = 10 then
Check the value of TIM1 counter register for first time
F irstvalue ← x
Update GPS hour, minute, second.
RT Csecond ← GP Ssecond
RT Cminute ← GP Sminute
RT Chour ← GP Shour
Check the value of TIM1 counter register for again
Secondvalue ← y
Find out the difference (d1 ) in counter register values
if x < y then
d1 ← y − x
else if x > y then
d1 ← (65535 − x) + y
else
d1 = 0
end if
end if
Calculate processing time (t1 )
t1 ← d1 /f
The deviation in processing time to update GPS was more than the deviation in processing
time to set RTC clock for STM32F407VG and STM32F429ZI microcontrollers. The time
needed to set RTC clock in two different microcontrollers was different since the crystal
oscillators running the RTC clocks in those microcontrollers were oscillating at different
frequencies.
55
56 4. Results
4.2.3. Total processing time needed to update GPS and set RTC
Table 4.3 shows the total processing time needed to update GPS and set RTC clock in
STM32F407VG and STM32F429ZI microcontrollers.
Microcontrollers Time needed to update GPS & set RTC
STM32F407VG 87.07 µs
STM32F29ZI 107.66 µs
Table 4.3.: Comparison of processing time needed to update GPS and set RTC in two
microcontrollers
56
4.2. Test Results 57
57
58 4. Results
58
4.2. Test Results 59
Using equation 4.4, the value of clock skew was found to be 0.167 Hz which is a reasonable
value for time synchronization in OLMS system.
Using equation 2.9 it is possible to verify the already obtained clock skew value.
In Table 4.6 the power consumed by each microcontroller and GPS setup is calculated by
multiplying the mean of current cosumption by the voltage of the corresponding micro-
controller. Then when the tests were conducted with two microcontrollers parallely along
with the single GPS receiver, the power consumed by the whole setup is also calculated.
Table 4.6.: Comparison of power consumption in two microcontrollers seperately and combinedly
It is to be noted that,in the combined setup, both microcontrollers were sharing the same
GPS receiver. So in that occassion, current was consumed by only one GPS receiver. So,
based on this fact, we can calculate the current consumed by the GPS receiver,
whereas, Ctotal is the total current consumption when two microntrollers were used par-
allely =0.235A, C1 is the current consumption by STM32F407VG MCU along with the
connected GPS receiver =0.145A, C2 is the current consumption by STM32F29ZI MCU
along with the connected GPS receiver=0.145A, Cgps is the current consumed by the GPS
receiver only.
Using equation 4.6, the value of Cgps was found to be 0.055A. Hence, the power consumed
by GPS receiver was,
59
60 4. Results
where,
ErrorRTC is the drift = 1 second;
TRTC is the processing time needed to update GPS and set RTC;
Tdiff is the deviation in the pulse width of RTC alarm signal from its ideal value;
t is the time interval between each GPS update.
Using equation4.8 the value of t was found for the two microcontrollers.
Table 4.7.: Comparison of Time interval between each GPS update in two microcontrollers
Here we see that, waiting periods for two microcontrollers were not the same. Time in-
terval value is much higher for STM32F407VG MCU. In this sense, it is logical to assume
that STM32F407VG MCU is more energy conservative than STM32F429ZI MCU. This
is mainly because the frequency crytal oscillator driving the clock of the STM32F429ZI
MCU is fluctuating at a much higher rate than the crystal oscillator of STM32F407VG
MCU. This problem could be solved by recalibrating the crystal oscillators of each micro-
controllers.That means the STM32F429ZI MCU needs recalibration at a scale larger than
that in STM32F407VG MCU.
60
4.3. Analysis 61
4.3. Analysis
Now some aspects of the proposed time synchronization algorithm in the given sensor
network architecture will be analyzed in details as follows.
• Robustness
If we consider the whole system, there are an arbitraty number of sensor units each
having its own microcontroller and GPS receiver. So, even if one or more than one
GPS receiver and microcontroller fail, the time synchronization among other sensor
units will not be affected.
• Scalability
The whole sensor network can support an arbitrary number of sensor units as well.
Hence, it could be said that this new algorithm is highly scalable.
• System complexity
The proposed algorithm is very simple to implement. Moreover, providing individual
GPS receiver to each SU offers huge flexibility in terms of system complexity.
• Scope
The proposed algorithm provides common time scale for all sensor units in the net-
work since each SU works independently.
• Message complexity
It is simple. Since for each round of synchronization, only one directional message
transfer is needed (from GPS receiver to the microcontroller), that’s why the number
of exchanged messages is one.
• Network size
It depends on how many microcontrollers the protocol can support. Since an arbi-
trary number of SU is supported by this time synchronization protocol, henceit can
be said that the size of the network supported by this protocol is not limited by the
time synchronization algorithm developed in the master thesis.
• Convergence time
It is the time required for synchronizing the network. Convergence time depends on
the message complexity and bandwidth usage. Since one message transfer from GPS
receiver to microcontroller is needed for one round of synchronization, it can be said
that the network is synchronized every second.
• Piggybacking
The proposed algorithm does not offer piggybacking.
61
5. Conclusion and Outlook
5.1. Conclusion
In this thesis a time synchronization algorithm was developed to synchronize time among
the sensor units that are used to monitor the overhead power lines. The performance of
this algorithm was evaluated in order to check whether it fulfills the time synchronization
requirements of a WSN.
Since it is desirable that the developed algorithm will be suitable to work with any num-
ber of sensor units, hence the algorithm program was tested with two different microcon-
trollers. More microcontrollers could have been used for testing purpose, but the obtained
results would have been in more or less the same range as with two microcontrollers.
STM32F407VG and STM32F429ZI, both of them are high performance 32 bit ARM Cor-
tex M4 devices with FCU core.
The algorithm is energy efficient since the RTC clock of microcontrolllers is not set every
second. The time interval between each consecutive GPS update and RTC set was found
to be 86 seconds and 109 seconds for each microcontrollers. These values are satisfactory
for the deveolped system.
The clock offset and the relative precision among two microcontroller clocks were found
to be the same. A timer was reset every time an external PPS signal is received. In other
words, with the beginning of each second, a timer was reset to ensure that the start of a
new second corresponds to the starting of a new subsecond. Since the frequency of the
resetting timer was set to 1 KHz, hence the subseconds were restricted to millisecond scale
(starting from 0 ms up to 999 ms).
The deviation in processing time to update the GPS was more than the deviation in
processing time to set RTC clock for STM32F407VG and STM32F429ZI microcontrollers.
A precise timer was used to calculate the processing times for both microcontrollers. The
frequency of the timer was set equal to the frequency of the system, which is 168MHz. It
was done so that the obtained processing times become highly accurate.
Based on the waiting period between each GPS update criteria, it can be concluded that
STM32F407VG MCU is more energy efficient than STM32F429ZI MCU.
63
64 5. Conclusion and Outlook
5.2. Outlook
The performance of the overall system could be improved by using a GPS receiver which
provide much more accurate time information. In other words, a GPS receiver which is
used for timing purpose only. This type of receiver however, could be more expensive than
the one that has been used in this thesis. But the used NEO 6M GPS receiver has some
drawbacks. The PPS signal was not activated as soon as the GPS receiver was turned on.
Sometimes the waiting time was about 30 minutes which can affect the system performance
too much. Moreover, since the connection setup and tests were conducted inside a building,
there were instances when the GPS module was not receiving the updated data at the
expected data rate. Hence using the whole setup outside buildings or connecting a more
powerful antenna to the GPS receiver could solve these problems.
A microcontroller was used as a processing unit inside each sensor unit to process the
incoming data from sensors. It is comparatively easier to program microcontrollers. Al-
though microcontrollers provide satisfactory performance, there are more powerful pro-
cessing devices such as FPGA(Field Propagation Gate Array)available. Using such device
could improve the overall performance of the system.
Last but not the least, since each of these microcontrollers will be placed along overhead
power lines that carry high voltage, these voltage lines will have high temperature as
well. Hence, the attached microcontrollers will be affected by the high temperature unless
they are sorrounded by insulating materials. The sensor unit could be also installed on
the tower and not directly on the overhead line. Even though the ambient temperature
can affect the internal clock. Since, the clocks inside a microcontroller are driven by a
crystal oscillator, its stability is one of the most important charactersitics. Stability is
defined as the tendency of a crystal oscillator to stay at the same frequency over time.
Unstable oscillators will adversely affect the clock rate of a microcontroller. In order to
keep accurate clock rate of a microcontroller, recalibration could be done. As a refrence for
the calibration, the GPS data could be used since it is not be affected by the temperature
changes.
64
Bibliography
[Bie15] L. Bies. (2015) Time synchronization with a garmin gps. [Online]. Available:
https://www.lammertbies.nl/comm/info/GPS-time.html
[BM10] J. Bae and B. Moon, Time Synchronization in Wireless Sensor Networks. IN-
TECH Open Access Publisher, 2010.
[BT15] R. Beghdad and F. Tinsalhi, “Otsp: an optimised time synchronisation pro-
tocol for wireless sensor networks,” International Journal of Sensor Networks,
vol. 19, no. 3-4, pp. 217–233, 2015.
[Ele] G. Electronic, “User manual, u-blox neo-6m gps module,” GI Electronic.
[Online]. Available: http://www.gie.com.my/download/um/wireless/gps/um
gps.pdf
[GPS] Global positioning system. [Online]. Available: https://en.wikipedia.org/wiki/
Global Positioning System
[HLL+ 10] K. Hung, W. Lee, V. Li, K. Lui, P. Pong, K. Wong, G. Yang, and J. Zhong, “On
wireless sensors communication for overhead transmission line monitoring in
power delivery systems,” in Smart Grid Communications (SmartGridComm),
2010 First IEEE International Conference on. IEEE, 2010, pp. 309–314.
[Jba] Jbattles. Gps pps use as a time reference. [Online]. Available: http:
//mtnstormdaq.com/blog/2012/10/gps-pps-use-as-a-time-reference/
[JIM] JIMBO. Serial communication. [Online]. Available: https://learn.sparkfun.
com/tutorials/serial-communication
[KBDR07] A. Krohn, M. Beigl, C. Decker, and T. Riedel, “Syncob: Collaborative time
synchronization in wireless sensor networks,” in Networked Sensing Systems,
2007. INSS’07. Fourth International Conference on. IEEE, 2007, pp. 283–290.
[MB11] B. Moon and J. Bae, “A global time synchronization scheme for wireless sensor
networks,” in Grid and Distributed Computing. Springer, 2011, pp. 383–391.
[Mik] MikeGrusin. Serial peripheral interface (spi). [Online]. Available: https:
//learn.sparkfun.com/tutorials/serial-peripheral-interface-spi
[MKSL04] M. Maróti, B. Kusy, G. Simon, and Á. Lédeczi, “The flooding time synchroniza-
tion protocol,” in Proceedings of the 2nd international conference on Embedded
networked sensor systems. ACM, 2004, pp. 39–49.
[MOT12] M. K. Maggs, S. G. O’Keefe, and D. V. Thiel, “Consensus clock synchronization
for wireless sensor networks,” IEEE Sensors Journal, vol. 12, no. 6, pp. 2269–
2277, 2012.
[MPJ08] M. Muhr, S. Pack, and S. Jaufer, “Usage and benefit of an overhead line mon-
itoring system,” in High Voltage Engineering and Application, 2008. ICHVE
2008. International Conference on. IEEE, 2008, pp. 557–561.
65
66 Bibliography
66
Appendix
A. List of Abbreviations
• MCU : Micro-Controller Unit
• SU : Sensor Unit
• GPS : Global Positioning System
• OLMS : Overhaed Line Monitoring System
• WSN : Wireless Sensor Network
• USART : Universal Synchronous Asynchronous Receiver Transmitter
• UART : Universal Asynchronous Receiver Transmitter
• UTC : Coordinated Universal Time
• GMT : Greenwich Mean Time
• PPS : Pulse Per Second.
• FPGA : Field Propagation Gate Array
• NMEA : National Marine Electronics Association
• RTC : Real-Time Clock
• HSE: High Speed External
• LSE: Low Speed External
• LSI : Low Speed Internal
• CPU: Central Processing Unit
67
68 Appendix
B. Software
The software is attached in a CD-ROM.
68
C. Hardware 69
C. Hardware
STM32F429ZI-EVAL: see the user manual [STMb].
STM32F407VG-Discovery Kit: see the user manual [STMa].
69