Vous êtes sur la page 1sur 42

Analysis of Handover in VLC systems

Submitted in partial fulfillment of the requirements for the degree of

Bachelor of Technology
in
Electronics and Communication Engineering

by
Snigdh Bhalotia, Shubham Sagar
13BEC0310,13BEC0486

Under the guidance of


Dr. Jabeena A
School of Electronics Engineering,
VIT University, Vellore.

May, 2017
DECLARATION

I hereby declare that the thesis entitled “Handover in VLC


systems” submitted by me, for the award of the degree of Bachelor of
Technology in Electronics and Communication Engineering to VIT
University is a record of bonafide work carried out by me under the
supervision of Dr. Jabeena A.
I further declare that the work reported in this thesis has not been
submitted and will not be submitted, either in part or in full, for the award
of any other degree or diploma in this institute or any other institute or
university.

Place : Vellore
Date : 10/04/17 Snigdh, Shubham
Signature of the Candidate
CERTIFICATE

This is to certify that the thesis entitled “Analysis of handover in VLC


Systems” submitted by Snigdh Bhalotia, Shubham Sagar, School of Electronics
Engineering, VIT University, for the award of the degree of Bachelor of Technology
in Electronics and Communication Engineering, is a record of bonafide work carried
out by them under my supervision, as per the VIT code of academic and research
ethics.

The contents of this report have not been submitted and will not be submitted
either in part or in full, for the award of any other degree or diploma in this institute or
any other institute or university. The thesis fulfills the requirements and regulations of
the University and in my opinion meets the necessary standards for submission.

Place : Vellore
Date :10/04/17 Signature of the Guide

The thesis is satisfactory / unsatisfactory

Internal Examiner External Examiner

Approved by

Program Chair [B.Tech ECE]

School of Electronics Engineering


ACKNOWLEDGEMENTS

We are extremely grateful to our guide Dr.


Jabeena A, School of Electronics Engineering, VIT University,
Vellore, for her kindness, motivation, and valuable guidance that
has enabled us to complete this work successfully.
I express my sincere gratitude to Professor Renuga Devi S,
Program Chair, School of Electronics Engineering, VIT
University, Vellore, for accepting the topic of the final year
project thesis and for guiding and motivating me whenever I
faced any difficulties regarding the project work.
My sincere thanks to my well-wishers and friends from whom I
have received liberal support for completing this work
successfully.

Snigdh Bhalotia, Shubham Sagar


Executive Summary

This thesis is for the final year project of Snigdh Bhalotia,


Shubham Sagar titled Analysis of Handover in VLC systems.
This thesis discusses all aspects of the project. Including: Project
Description, Goals, Technical specifications, Design Approach,
Milestones, Demonstration and summary. This thesis will help
understanding this project better.
Visible Light Communication is the future of communication.
The speeds received are considerably faster than RF
transmission. Even though in its early years right now, VLC
holds the potential to be the primary indoor communication
channel in the near future. Our project deals with analyzing
handover in most basic cost effective VLC systems. The
analysis is done using MATLAB software to show handover
based on received power. We have implemented the system in
hardware using the most basic LEDs and a couple of arduinos.
CONTENTS Page
No.
Acknowledgement i
Executive Summary ii
Table of Contents iii
List of Figures ix
List of Tables xiv
Abbreviations xvi
Symbols and Notations xix
1 INTRODUCTION 1
1.1 Objective 1

1.2 Motivation 2

1.3 Background 3
2 PROJECT DESCRIPTION AND GOALS 3

3 TECHNICAL SPECIFICATION 3

4 DESIGN APPROACH AND DETAILS .

4.1 Design Approach .

4.2 Codes and Standards .

4.3 Constraints, Alternatives and Tradeoffs .

5 SCHEDULE, TASKS AND MILESTONES .

6 PROJECT DEMONSTRATION .

7 COST ANALYSIS .

8 SUMMARY .
9 REFERENCES .

List of Figures

Figure No. Title

1 Hardware Block Diagram


2.1 Transmitter Position
2.2 Receiver Position
3.1 Transmitter Model
3.2 Hardware Model
3.3 Receiver Model
3.4 Output

List of Abbreviations

VLC Visible Light Communication


LED Light Emitting Diode
QoS Quality of Service
HO Handover
RF Radio Frequency
OW Optical Wireless
Wi-Fi Wireless Fidelity
IR Infrared

1. INTRODUCTION

Visible light communication (VLC) is a data communications variant


which uses visible light between 400 and 800 THz (780–375 nm). VLC is
a subset of optical wireless communications technologies.
The technology uses fluorescent lamps (ordinary lamps, not special
communications devices) to transmit signals at 10 kbit/s, or LEDs for up
to 500 Mbit/s. Low rate[vague] data transmissions at 1 and 2 kilo metres
(0.6 and 1.2 mi) were demonstrated. RONJA achieves full Ethernet speed
(10 Mbit/s) over the same distance thanks to larger optics and more
powerful LEDs.

Specially designed electronic devices generally containing a photodiode


receive signals from light sources, although in some cases a cell phone
camera or a digital camera will be sufficient. The image sensor used in
these devices is in fact an array of photodiodes (pixels) and in some
applications its use may be preferred over a single photodiode. Such a
sensor may provide either multi-channel communication (down to 1 pixel
= 1 channel) or a spatial awareness of multiple light sources.

VLC can be used as a communications medium for ubiquitous


computing, because light-producing devices (such as indoor/outdoor
lamps, TVs, traffic signs, commercial displays and car
headlights/taillights) are used everywhere. Using visible light is also less
dangerous for high-power applications because humans can perceive it
and act to protect their eyes from damage.
The first main task of this project was to get our hands on a pair of VLC
transceivers. However in the process we managed to come across a
design that is extremely cost effective and is perfect for further
experimentation and analysis Handover, ranges and many other factors
are analyzed which helped us analyze the feasibility of the system. This is
mostly analyzed using hardware. Using MATLAB, we have implemented
an algorithm for handover based on power reception from transmitters. A
room environment is created with multi transmitters where a mobile
receiver is analyzed for power from different transmitters at different
positions of the receiver.

A handover in a communication system is basically a transfer of the


connection of receiver from one transmitter to the other. A handover can
be done in many ways. Such as,
-> Breaking connection from previous transmitter and then connecting
to the latter one.
-> Making connection from the next transmitter and then
disconnecting from previous.
We will be analyzing handovers in a VLC systems.

The importance of this project is to analyze the continuity of signal in a


cheap VLC system to reduce cost factor for future designs. Our analysis
of this system will help us to know VLC systems better and give an
insight to receiving signals. This analysis is really important as there are
many designs of VLC systems coming up.

1.1 OBJECTIVE

The primary objective of this project is to get a better understanding of


VLC systems and to try and contribute to the betterment of this
upcoming technology that is going to be a key component of our
communication systems in the future.
Signal loss due to any sort of attenuation or disruption to the LOS is
one of the key concerns while implementing this technology, others
being interference from other sources of light. So we need to ensure
we have plans in place to fix the issue we are currently facing.

We want to study handovers in a Visible Light Communication system


and analyze handovers taking place. We want to present a detailed
report on different types of handovers and find the best way a
handover can be achieved in a VLC system.

We want to analyze handover using MATLAB simulations as well has


a hardware working model of the same to demonstrate whatever we
achieve in the project.

1.2 Motivation

The motivation for this project was mainly our quest of achieving a
goal for our final year curriculum. After all the hard work and learning in
the past three years, there was a motivation to implement all that
knowledge to really achieve something.

Visible light communication in itself is a major challenge and an


upcoming technology which is very inspiring. If you think of your tube
light streaming media to your devices, it seems really amazing right?
VLC is the near future for communication too. The technology motivates
young engineers to study more about it.

Another motivation is VIT University, where our teachers and friends


always inspire us to do our best. The completion among students is also a
major factor for motivation.

1.3 Background

In this project we expect to study handover in VLC systems.

The background we require for this project is the knowledge of


MATLAB, knowledge of modulation and demodulation, knowledge
of communication, knowledge of microcontrollers, knowledge of
optical communication.

We will be needing the knowledge for the transmitters and the


receivers of VLC systems so them we can code them on MATLAB
and can design them to be implemented on the hardware.
1. PROJECT DESCRIPTION AND GOALS

Our project is to show handover in VLC systems in a multi transmitter


room environment. The process is shown in MATLAB simulation as well
as hardware. Our goal is to build a sustainable system in which the
connection to the receiver does not break. This can be done by
implementing handover algorithms in the receiver.

Software:

We have designed a room environment having four transmitters. We have


shown the receiver receiving power for different positions based on
which the handover takes place. We have observed the SNR, power
distribution and the region coverage of transmitters in graph.

The goal here is to see how VLC system transmitters behave with certain
parameters like irradiance angle, distance between transmitters, etc. so
that a handover algorithm can be designed.

Hardware:

We made a box with two rooms containing one transmitter each. We


made an LED matrix in the transmitter to increase the region of reception
and power. The handover is clearly seen as the reveiver receives signal
from different transmitters in different regions. We transmit different data
from both transmitters to differentiate between the signals.
We observe how data is being transferred throughout the region.
We have used a phototransistor instead of photo resistor or an LED to
make the receiver more sensitive and increase the range.

Goals:
Our main goal is to create seamless handover throughout the region of
reception. This goal is achieved by making an LED matrix at the
transmitter. Our goal is also to increase the range and efficiency of the
system.

2. Technical Specification

Handover Mechanism:

In this section we investigate recent works on seamless connectivity in


Optical Wireless (OW) systems. In next generation networks the use of
heterogeneous technologies relies on the growing user demand to be
seamlessly connected to the Internet, maintaining high Quality-of-Service
(QoS) services, as well as avoiding network congestions and delays.
In mobility scenarios users can maintain their connectivity through an
automatic and seamless mechanism, called as handover (HO). This
represents a switching process from one serving network to a candidate
network. Typical handover is known as horizontal handover which allows
connectivity switching whenever a mobile terminal moves from an access
point to another without changing the service access network. HO was
initially adopted in cellular system to avoid service disconnections due to
mobility issues. An HO is traditionally initiated on the basis of physical
parameter measurements, such as the Received Signal Strength (RSS),
providing the service maintenance when the power level from a serving
cell decreases. Optimality criteria for handover decisions balance
different factors including, monetary cost, energy consumption,
positioning and end user QoS.
RF and OW access technologies have been investigated as hybrid systems
achieving seamless connectivity. In a fuzzy logic-based vertical handover
decision algorithm is proposed for an integrated WiFi–IR system. The
benefits of both IR and WiFi schemes achieve optimal handover when
handover decisions consider short- and long-period interruptions.
Moreover, in the authors investigate the potential of a combination of
VLC and WiFi for an indoor broadcasting service.
In this paper we investigate how basic horizontal handover mechanisms
can be applied in VLC systems in which the user connectivity switches
from one lighting cell to another. Uniform and spotlighting coverage have
been assumed in this work. By exploiting the analogy between the
RSS parameter in cellular systems and the Received Signal Intensity
(RSI) in optical wireless, we extend the traditional RSS-based handover
procedures into an RSI-based technique for mobile
VLC systems.

Manchester Coding:

In telecommunication and data storage, Manchester coding (also known


as phase encoding, or PE) is a line code in which the encoding of each
data bit is either low then high, or high then low, of equal time. It
therefore has no DC bias, and is self-clocking, which means that it may
be inductively or capacitively coupled, and that a clock signal can be
recovered from the encoded data. As a result, electrical connections using
a Manchester code are easily galvanically isolated using a network
isolator—a simple one-to-one isolation transformer.

Manchester code ensures frequent line voltage transitions, directly


proportional to the clock rate; this helps clock recovery.

The DC component of the encoded signal is not dependent on the data


and therefore carries no information, allowing the signal to be conveyed
conveniently by media (e.g., Ethernet) which usually do not convey a DC
component.

An example of Manchester encoding showing both conventions


Extracting the original data from the received encoded bit (from
Manchester as per 802.3):
Original data Clock Manchester value
0 0
0
1 XOR 1
=
0 ⊕ 1
1
1 0

Summary:
 Each bit is transmitted in a fixed time (the "period").
 A 0 is expressed by a low-to-high transition, a 1 by high-to-low
transition (according to G.E. Thomas' convention—in the IEEE
802.3 convention, the reverse is true).
 The transitions which signify 0 or 1 occur at the midpoint of a
period.
 Transitions at the start of a period are overhead and don't signify
data.

Manchester code always has a transition at the middle of each bit period
and may (depending on the information to be transmitted) have a
transition at the start of the period also. The direction of the mid-bit
transition indicates the data. Transitions at the period boundaries do not
carry information. They exist only to place the signal in the correct state
to allow the mid-bit transition. The existence of guaranteed transitions
allows the signal to be self-clocking, and also allows the receiver to align
correctly; the receiver can identify if it is misaligned by half a bit period,
as there will no longer always be a transition during each bit period. The
price of these benefits is a doubling of the bandwidth requirement
compared to simpler NRZ coding schemes (or see also NRZI).

Software:

We have used the VLC extension for MATLAB 2016a. We have built a
room environment for 4 transmitters. We can see graphs for the Power
distribution, SNR, region coverage. We have used an algorithm based on
power for handover.

Hardware:
We have built transmitter and receiver circuits using basic green LEDs for
VLC. Arduino Uno is being used to code and decode the signal. Green
LEDs in our project are being received as far as 64cms currently. We have
interfaced both the circuits using Arduino which processes and modulates
demodulates the signal being sent and received. We have made a 4/4
matrix to increase the region of coverage. A baud rate 115200 is used as a
serial communication to transmit the message. The coding and decoding
is done by using Manchester coding algorithm. A photo transistor is being
used as a receiver.

4. Design approach and details

4.1 Design Approach

Software:

We have designed a room simulation with four transmitters in MATLAB.


We can adjust the sliders in the GUI to change the irradiance angle of the
transmitters and also the distance between the transmitters. This allows us
to setup the environment we want to. We can visualize the final position
and range of the transmitters.

Then we have designed an algorithm to calculate the channel gain across


the room. This is used to calculate the power distribution which is
displayed as a graph. The channel gain multiplied by supplied power
gives the final power.

A receiver is put in the room. We can use sliders to move the receiver
along the x and the y axes. Then the powers from individual transmitters
to the receiver will be displayed which is calculated using the power
gains. These power levels can be analyzed to find out the transmitter
giving the maximum power at a particular position. This can be the basis
of handover in the system.

The VLC transmitter and the receiver design was obtained online to make
the project easier.
Hardware:

To design the hardware, we had to find out how to make the transceiver
for VLC systems. We modulated the input signal using Arduino so we
didn’t have to make a circuit for modulating the input signal.

Fig 1.1 Hardware Block Diagram

So we gave the signal from our computer to the arduinos. The data signal
was modulated and sent to the Arduino using serial communication. The
baud rate selected was 115000. Both the transmitter arduinos were given
different data. Both transmitters were put in room environment cardboard
box. Two compartments were made for both the different rooms. One
transmitter was placed in one compartment. We moved the receiver from
one room to the other and saw the change in reception of data. Thus
seeing the handover.

The transmitter we made used a green LED initially. Then to increase the
reliability, we made a 4x4 matrix of green LEDs. A matrix ensured better
range and power of the transmitted signal. The receiver was made of a
phototransistor which was the most sensitive and reliable we could find
among phototransistor, photodiode and LED.

The coding and decoding was also done by using the Arduino. We used
Manchester coding algorithm as it is widely used for optical
communication.
Transmitter Coding:

/*
LiFi Emitter and Receiver
The purpose of this demos is to demonstrate data communication using a
pair of blue LED (one led as emitter one led as receiver).
Communication can go at up to 600bs (can depend on led quality)
Hardware is the following :
I/O D2 ------[resistor]----- led -------------- GND
Using a blue led should not require resistor, one may be needed for red or
green
A byte is sent as follow :
Start(0) 8bit data Stop(1)

Each bit is coded in manchester with


0 -> 10
1 -> 01
A data frame is formatted as follow :
0xAA : sent a number of time to help the received compute a signal
average for the thresholding of analog values
0xD5 : synchronization byte to break preamble
0x02 : STX start of frame
N times Effective data excluding command symbols, with N < 32
0x03 : ETX end of frame

#include <TimerOne.h>
#include <util/atomic.h>
//Start of what should be an include ...

//#define TRANSMIT_SERIAL

// change to alter communication speed,


// will lower values will result in faster communication
// the receiver must be tuned to the same value
#define SYMBOL_PERIOD 500 /* Defined a symbol period in us*/

#define WORD_LENGTH 10 /* Each byte is encoded on 10-bit with


start, byte, stop */
#define SYNC_SYMBOL 0xD5 /* Synchronization symbol to send after
a preamble, before data communication happens */
#define ETX 0x03
#define STX 0x02

//Fast manipulation of LED IO.


//These defines are for a LED connected on D13
/*#define OUT_LED() DDRB |= (1 << 5);
#define SET_LED() PORTB |= (1 << 5)
#define CLR_LED() PORTB &= ~(1 << 5)
*/

//These defines are for a RGB led connected to D2, D3, D4


/*#define OUT_LED() DDRD |= ((1 << 2) | (1 << 3) | (1 << 4))
#define SET_LED() PORTD |= ((1 << 2) | (1 << 3) | (1 << 4))
#define CLR_LED() PORTD &= ~((1 << 2) | (1 << 3) | (1 << 4))
*/

//These defines are for a single led connected to D2


#define OUT_LED() DDRD |= ((1 << 2))
#define SET_LED() PORTD |= ((1 << 2))
#define CLR_LED() PORTD &= ~((1 << 2))

unsigned char frame_buffer [38] ; //buffer for frame


char frame_index = -1; // index in frame
char frame_size = -1 ; // size of the frame to be sent

//state variables of the manchester encoder


unsigned char bit_counter = 0 ;
unsigned short data_word = 0 ; //8bit data + start + stop
unsigned char half_bit = 0 ;
unsigned long int manchester_data ;

void to_manchester(unsigned char data, unsigned long int *


data_manchester){
unsigned int i ;
(*data_manchester) = 0x02 ; // STOP symbol
(*data_manchester) = (*data_manchester) << 2 ;
for(i = 0 ; i < 8; i ++){
if(data & 0x80) (*data_manchester) |= 0x02 ; // data LSB first
else (*data_manchester) |= 0x01 ;
(*data_manchester) = (*data_manchester) << 2 ;
data = data << 1 ; // to next bit
}
(*data_manchester) |= 0x01 ; //START symbol
}

//emitter interrupt
void emit_half_bit(){
if(manchester_data & 0x01){
SET_LED();
}else{
CLR_LED();
}
bit_counter -- ;
manchester_data = (manchester_data >> 1);
if(bit_counter == 0){
//is there still bytes to send in the frame ?
manchester_data = 0xAAAAAAAA ; // keep sending ones if nothing
to send
if(frame_index >= 0 ){
if(frame_index < frame_size){
/*Serial.println(frame_index, DEC);
Serial.println(frame_buffer[frame_index], HEX);*/
to_manchester(frame_buffer[frame_index], &manchester_data);
frame_index ++ ;
}else{
frame_index = -1 ;
frame_size = -1 ;
}
}
bit_counter = WORD_LENGTH * 2 ;
//Serial.println(manchester_data, BIN);
}
}

void init_frame(unsigned char * frame){


memset(frame, 0xAA, 3);
frame[3] = SYNC_SYMBOL ;
frame[4] = STX;
frame_index = -1 ;
frame_size = -1 ;
}

int create_frame(char * data, int data_size, unsigned char * frame){


memcpy(&(frame[5]), data, data_size);
frame[5+data_size] = ETX;
return 1 ;
}

int write(char * data, int data_size){


if(frame_index >= 0) return -1 ;
if(data_size > 32) return -1 ;
create_frame(data, data_size,frame_buffer);
ATOMIC_BLOCK(ATOMIC_RESTORESTATE){
frame_index = 0 ;
frame_size = data_size + 6 ;
}
return 0 ;
}

int transmitter_available(){
if(frame_index >= 0) return 0 ;
return 1 ;
}

void init_emitter(){
manchester_data = 0xFFFFFFFF ;
bit_counter = WORD_LENGTH * 2 ;
}

// the setup routine runs once when you press reset:


void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
OUT_LED();
init_frame(frame_buffer);
init_emitter();
Timer1.initialize(SYMBOL_PERIOD); //1200 bauds
Timer1.attachInterrupt(emit_half_bit);
}

// the loop routine runs over and over again forever:


char * msg = "Hello World" ;
char com_buffer [32] ;
char com_buffer_nb_bytes = 0 ;
void loop() {
#ifdef TRANSMIT_SERIAL
if(Serial.available() && transmitter_available()){ //constructing the data
frame only if transmitter is ready to transmit
char c = Serial.read();
com_buffer[com_buffer_nb_bytes] = c ;
com_buffer_nb_bytes ++ ;
if(com_buffer_nb_bytes >= 32 || c == '\n'){
if(write(com_buffer, com_buffer_nb_bytes) < 0){
Serial.println("Transmitter is busy");
}else{
com_buffer_nb_bytes = 0 ;
}
}
}
delay(10);
#else
static int i = 0 ;
memcpy(com_buffer, msg, 11);
com_buffer[11] = i + '0' ;
if(write(com_buffer, 12) < 0){
delay(10);
}else{
i ++ ;
if(i > 9) i = 0 ;
}
#endif
}

Receiver Code:

#include <TimerOne.h>
#include "receiver_types.h"

/*
LiFi Emitter and Receiver
The purpose of this demos is to demonstrate data communication using a
pair of blue LED (one led as emitter one led as receiver).
Communication can go at up to 600bs (can depend on led quality)
Receiver hardware :
|----1Mohm-----|
A3 ------|--- +led- ----|-------GND
A byte is sent as follow :
Start(0) 8bit data Stop(1), LSB first : 0 b0 b1 b2 b3 b4 b5 b6 b7 1
Each bit is coded in manchester with
time is from left to right
0 -> 10
1 -> 01
A data frame is formatted as follow :
0xAA : sent a number of time to help the receiver compute a signal
average for the thresholding of analog values
0xD5 : synchronization byte to indicate start of a frame, breaks the
regularity of the 0x55 pattern to be easily
0x02 : STX start of frame
N times Effective data excluding command symbols, max length 32 bytes
0x03 : ETX end of frame
*/

//#define DEBUG
//#define DEBUG_ANALOG

#define INT_REF /* Commen this to use AVCC reference voltage. To be


used when the receiver LED generate low levels */

enum receiver_state frame_state = IDLE ;

//This defines receiver properties


#define SENSOR_PIN 3
#define SYMBOL_PERIOD 500
#define SAMPLE_PER_SYMBOL 4
#define WORD_LENGTH 10 // a byte is encoded as a 10-bit value with
start and stop bits
#define SYNC_SYMBOL 0xD5 // this symbol breaks the premanble of
the frame
#define ETX 0x03 // End of frame symbol
#define STX 0x02 //Start or frame symbol

// global variables for frame decoding


char frame_buffer[38] ;
int frame_index = -1 ;
int frame_size = -1 ;

//state variables of the thresholder


unsigned int signal_mean = 0 ;
unsigned long acc_sum = 0 ; //used to compute the signal mean value
unsigned int acc_counter = 0 ;

//manechester decoder state variable


long shift_reg = 0;

//Start of ADC managements functions


void ADC_setup(){
ADCSRA = bit (ADEN); // turn ADC on
ADCSRA |= bit (ADPS0) | bit (ADPS1) | bit (ADPS2); // Prescaler of
128
#ifdef INT_REF
ADMUX = bit (REFS0) | bit (REFS1); // internal 1.1v reference
#else
ADMUX = bit (REFS0) ; // external 5v reference
#endif
}

void ADC_start_conversion(int adc_pin){


ADMUX &= ~(0x07) ; //clearing enabled channels
ADMUX |= (adc_pin & 0x07) ; // AVcc and select input port
bitSet (ADCSRA, ADSC) ;
}

int ADC_read_conversion(){
while(bit_is_set(ADCSRA, ADSC));
return ADC ;
}
//End of ADC management functions

#define START_SYMBOL 0x02


#define STOP_SYMBOL 0x01
#define START_STOP_MASK ((STOP_SYMBOL << 20) |
(START_SYMBOL << 18) | STOP_SYMBOL)
//STOP/START/16bits/STOP
#define SYNC_SYMBOL_MANCHESTER (0x6665) /* Sync symbol,
encoded as a 16-bit Manchester value to help the decoding */
inline int is_a_word(long * manchester_word, int time_from_last_sync,
unsigned int * detected_word){
if(time_from_last_sync >= 20 || frame_state == IDLE){ // we
received enough bits to test the sync
if(((*manchester_word) & START_STOP_MASK) ==
(START_STOP_MASK)){ // testing first position
(*detected_word) = ((*manchester_word) >> 2) & 0xFFFF;
if(frame_state == IDLE){
if((*detected_word) ==
SYNC_SYMBOL_MANCHESTER) return 2 ;
}
return 1 ;
// byte with correct framing
}else if(frame_state != IDLE && time_from_last_sync == 20){
(*detected_word)= ((*manchester_word) >> 2) & 0xFFFF;
return 1 ;
}
}
return 0 ;
}

inline int insert_edge( long * manchester_word, char edge, int


edge_period, int * time_from_last_sync, unsigned int * detected_word){
int new_word = 0 ;
int is_a_word_value = 0 ;
int sync_word_detect = 0 ;
if( ((*manchester_word) & 0x01) != edge ){ //mak sure we don't have
same edge ...
if(edge_period > (SAMPLE_PER_SYMBOL+1)){
unsigned char last_bit = (*manchester_word) & 0x01 ;
(*manchester_word) = ((*manchester_word) << 1) | last_bit ; //
signal was steady for longer than a single symbol,
(*time_from_last_sync) += 1 ;
is_a_word_value = is_a_word(manchester_word,
(*time_from_last_sync), detected_word);
if(is_a_word_value > 0){ //found start stop framing
new_word = 1 ;
(*time_from_last_sync) = 0 ;
if(is_a_word_value > 1) sync_word_detect = 1 ; //we detected
framing and sync word in manchester format
}
}
//storing edge value in word
if(edge < 0){
(*manchester_word) = ( (*manchester_word) << 1) | 0x00 ; //
signal goes down
}else{
(*manchester_word) = ( (*manchester_word) << 1) | 0x01 ; //
signal goes up
}
(*time_from_last_sync) += 1 ;
is_a_word_value = is_a_word(manchester_word,
(*time_from_last_sync), detected_word);
if(sync_word_detect == 0 && is_a_word_value > 0){ //if sync
word was detected at previous position, don't take word detection into
account
new_word = 1 ;
(*time_from_last_sync) = 0 ;
}
}else{
new_word = -1 ;
}
return new_word ;
}

#define EDGE_THRESHOLD 4 /* Defines the voltage difference


between two samples to detect a rising/falling edge. Can be increased
depensing on the environment */
int oldValue = 0 ;
int steady_count = 0 ;
int dist_last_sync = 0 ;
unsigned int detected_word = 0;
int new_word = 0;
char old_edge_val = 0 ;
void sample_signal_edge(){
char edge_val ;
//int sensorValue = analogRead(SENSOR_PIN); // this is too slow and
should be replaced with interrupt-driven ADC
int sensorValue = ADC_read_conversion(); // read result of previously
triggered conversion
ADC_start_conversion(SENSOR_PIN); // start a conversion for next
loop
#ifndef DEBUG
#ifdef DEBUG_ANALOG
Serial.println(sensorValue, DEC);
#endif
#endif
if((sensorValue - oldValue) > EDGE_THRESHOLD) edge_val = 1 ;
else if((oldValue - sensorValue) > EDGE_THRESHOLD) edge_val =
-1;
else edge_val = 0 ;
oldValue = sensorValue ;
if(edge_val == 0 || edge_val == old_edge_val || (edge_val !=
old_edge_val && steady_count < 2)){
if( steady_count < (4 * SAMPLE_PER_SYMBOL)){
steady_count ++ ;
}
}else{
new_word = insert_edge(&shift_reg, edge_val, steady_count,
&(dist_last_sync), &detected_word);
if(dist_last_sync > (8*SAMPLE_PER_SYMBOL)){ // limit
dist_last_sync to avoid overflow problems
dist_last_sync = 32 ;
}
//if(new_word >= 0){
steady_count = 0 ;
//}
}
old_edge_val = edge_val ;
}

int add_byte_to_frame(char * frame_buffer, int * frame_index, int *


frame_size, enum receiver_state * frame_state ,unsigned char data){
if(data == SYNC_SYMBOL/* && (*frame_index) < 0*/){
(*frame_index) = 0 ;
(*frame_size) = 0 ;
(*frame_state) = SYNC ;
//Serial.println("SYNC");
return 0 ;
}
if((*frame_state) != IDLE){ // we are synced
frame_buffer[*frame_index] = data ;
(*frame_index) ++ ;
if(data == STX){
//Serial.println("START");
(*frame_state) = START ;
return 0 ;
}else if(data == ETX){
//Serial.println("END");
(*frame_size) = (*frame_index) ;
(*frame_index) = -1 ;
(*frame_state) = IDLE ;
//Serial.println("END");
return 1 ;
}else if((*frame_index) >= 38){ //frame is larger than max size of
frame ...
(*frame_index) = -1 ;
(*frame_size) = -1 ;
(*frame_state) = IDLE ;
return -1 ;
}else{
(*frame_state) = DATA ;
}
return 0 ;
}
return -1 ;
}

// the setup routine runs once when you press reset:


void setup() {
// initialize serial communication at 115200 bits per second:
int i;
Serial.begin(115200);
Serial.println("Start of receiver program");
ADC_setup();
ADC_start_conversion(SENSOR_PIN);
//analogReference(INTERNAL); // internal reference is 1.1v, should
give better accuracy for the mv range of the led output.

Timer1.initialize(SYMBOL_PERIOD/SAMPLE_PER_SYMBOL); //120
0 bauds oversampled by factor 4
Timer1.attachInterrupt(sample_signal_edge);

// the loop routine runs over and over again forever:


void loop() {
int i;
unsigned char received_data;
char received_data_print ;
int nb_shift ;
int byte_added = 0 ;
if(new_word == 1){
received_data = 0 ;
for(i = 0 ; i < 16 ; i = i + 2){ //decoding Manchester
received_data = received_data << 1 ;
if(((detected_word >> i) & 0x03) == 0x01){
received_data |= 0x01 ;
}else{
received_data &= ~0x01 ;
}
}
received_data = received_data & 0xFF ;
#ifdef DEBUG
Serial.print(received_data & 0xFF, HEX);
Serial.print(", ");
Serial.println((char) received_data);
#endif
new_word = 0 ;
if((byte_added = add_byte_to_frame(frame_buffer, &frame_index,
&frame_size, &frame_state,received_data)) > 0){
frame_buffer[frame_size-1] = '\0';
Serial.println(&(frame_buffer[1]));
}
//if(frame_state != IDLE) Serial.println(received_data, HEX);
}
}

The code has been updated to be able to identify the transmitter it is


currently receiving signal from and it can measure Optical Power levels.
A threshold can now be set to improve communications and handover
smoothly by the system itself without any need for human interference.
The optical power is measured using the values of current and voltage in
the receiver sensor. The data is being sent in frames to ensure
synchronization. A bit was added to the frames that carries the identity of
the transmitter.

4.2 Codes and Standards

ITU-R M.1854 provides information on the range of radio-frequencies for


mobile-satellite service (MSS) in order to enable a variety of functions
such as voice and data communication; field reporting; data collection;
position information; and image transmission.
4.3 Constraints, Alternatives and Trade-offs:

Constraints:

There were many constraints to the project that we have made.

While designing the software, there were many things we did not have
the algorithm for. As this is an upcoming technology, not much
information was available on the internet.

In the hardware the main constraint was that we could not get more
powerful transmitter or receiver. Another constraint was the speed of
transmission. As we were using Arduino for coding and decoding, we
could not serially transmit data faster than the baud rate of 115240.

Alternatives:

The software alternative we had was using CANDLES of Boston


University, or Optisystem.

In the hardware design, we have used Green LED. We have alternatives


of using red, blue or white LEDs. For the receiver we used a
phototransistor. We had alternatives of using an LED or a photodetector.
For the coding and decoding we used Manchester algorithm. We had the
alternatives to use other mechanisms too. We used an arduino to modulate
and demodulate the message. Instead we could directly use a modulating
circuit to modulate the signal.

4.4 Schedule, Tasks and milestones:


TIME FRAME WORK COMPLETED

JANUARY Detailed Study of Existing System and


Research paper

FEBRUARY - MARCH Mathematical Analysis of the Design in


the Research paper to complete
simulations

MARCH - APRIL Worked on hardware implementation.

APRIL – MAY Successfully implemented the base


Research paper and its analysis.

Future enhancement of the literature is


under review.

We started at the beginning of semester with researching on what would


be the appropriate platform to simulate a VLC circuit.

Once we got fixed on MATLAB, our primary milestone was to simulate a


VLC transceiver on MATLAB. We expected to get and analyze our
software results by Review 1. We successfully simulated a receiver
moving under multiple transmitters and got our results by review 1.

After review one, we started looking for viable circuits to make a VLC
transceiver. Once we achieved data transmission, we started working on
implementing handover algorithms using multiple transmitters.
In review 2, we finally showed the project to our guide and started
working on the research paper and our thesis for the project.

Project Demonstration:

Software:

Fig 2.1 Transmitter Position

First, adjust the transmitter switches to 1 to switch it on, or 0 to switch


off. Adjust the space between transmitters and the irradiance angle using
sliders. We will then see the position of transmitters as adjusted and we
will see the transmitted power distribution across the room.

After this, we will adjust the receiver position sliders to see the receiver
position. After this, we will see the power received from all the
transmitters at the receiver in the boxes shown. The max power is what
we need to see.
Fig 2.2 Receiver Position

Hardware:

In the hardware, we setup arduinos to send and receive data. The LEDs
get power from the Arduino itself. We can see the received data on our
laptop screen. This shows the received signal in the signal. Moving the
receiver from one box to the other will show us the handover.

Transmitter:

Fig 3.1 Transitter Model


The program is transferred to the arduinos. The transmitters switch on
and start to transmit signal in the box.

The Box:

Fig 3.2 Hardware Model

The box has two rooms which have signals from different transmitters.
The receiver is being moves to display output in both the rooms.
The Receiver:

Fig 3.3 Receiver Model

The receiver has a phototransistor which receives the signal.


The Output:

Fig 3.4 Output


Cost Estimation:

One of the main features of our project is the cost effectiveness of it. We
have used most simple components to build our project. We started by
making the transceiver.
The following was used:

1 waste cardboard box. 0 ₹


32 LEDs 64 ₹
2 pcb boards 20 ₹
Soldering 50 ₹
Connecting wires 100₹
3 Arduino mini 900₹
2 bread boards 40 ₹
Scotch tape 30 ₹
Scissors 50 ₹
Phototransistor 5 ₹
5 Resistors 10 ₹

Thus total estimate around 1300rs.

Another 1500 ₹ for paper publishing and 300 ₹ for poster presentation.
Summary:

We can conclude from the software analysis that the receiver generally
connects to the nearest transmitter.

We can conclude from the hardware analysis that the best emitters are
closer to RED while poor ones are closer to Blue. We also concluded that
the blue ones give a better angle compared to the Red.

Visible Light Communication is the future of communication. The speeds


received are considerably faster than RF transmission. Even though in its
early years right now, VLC holds the potential to be the primary indoor
communication channel in the near future. Our project deals with
analyzing handover in most basic cost effective VLC systems. The
analysis is done using MATLAB software to show handover based on
received power. We have implemented the system in hardware using the
most basic LEDs and a couple of arduinos.

The first main task of this project was to get our hands on a pair of VLC
transceivers. However in the process we managed to come across a
design that is extremely cost effective and is perfect for further
experimentation and analysis Handover, ranges and many other factors
are analyzed which helped us analyze the feasibility of the system. This is
mostly analyzed using hardware. Using MATLAB, we have implemented
an algorithm for handover based on power reception from transmitters. A
room environment is created with multi transmitters where a mobile
receiver is analyzed for power from different transmitters at different
positions of the receiver.

A handover in a communication system is basically a transfer of the


connection of receiver from one transmitter to the other [4]. A handover
can be done in many ways. Such as,
 Breaking connection from previous transmitter and then connecting
to the latter one.
 Making connection from the next transmitter and then
disconnecting from previous [5].
We will be analyzing handovers in a VLC systems.

The importance of this project is to analyze the continuity of signal in a


cheap VLC system to reduce cost factor for future designs. Our analysis
of this system will help us to know VLC systems better and give an
insight to receiving signals. This analysis is really important as there are
many designs of VLC systems coming up.
Red Green LED Blue

LED LED

Range 90 cms 63 cms 42 cms

Irradiance 20 Deg 35 Deg 62 Deg

Angle

REFERENCES:

References
[1] A. Boucouvalas. “Challenges in Optical Wireless Communications”.
Optical Photonic News, 16(9):36–39, 2005.

[2] J.B. Carruthers. Wireless Infrared Communications. Wiley


Encyclopedia of Telecommunications, 2002.

[3] J. Hou and D.C. O’Brien. “Polling scheme for Indoor LOS Optical
Wireless LAN”. Electron. Lett., 39(10):794–795, 2003.

[4] Z. Wu and T.D.C. Little. “Network Solutions for the LOS Problem of
New Indoor Free Space Optical System”. In IEEE, IEE Int. Symp. on
Communications Systems, Networks, and Digital Signal Processing,
Newcastle, UK, July 2010.

[5] M. Rahaim, T. Borogovac, and J.B. Carruthers. “Candles:


Communications and lighting emulation software”. In Proc. on 5th
ACM Int. Workshop on Wireless Network Testbeds, Experimental
Evaluation and Characterization, 2010.

[6] http://www.vlcc.net.

[7] T. Douseki. “A Batteryless Optical-wireless System with White-LED


Illumination”. In Proc. on 15th IEEE International Symposium on
Personal, Indoor and Mobile Radio Communications, 2004.
[8] T.D.C. Little, P. Dib, K. Shah, N. Barraford, and B. Gallagher. “Using
LED Lighting for Ubiquitous Indoor Wireless Networking”. In Proc.
of 4th IEEE International Conference on Wireless and Mobile
Computing, Networking and Communications, Avignon, France,
October 2008.

[9] G.P. Pollini. “Trends in handover design”. IEEE Communications


Magazine, 34(3):82–90, 1996.

[10] M. Kassar, B. Kervella, and G. Pujolle. “An Overview of Vertical


Handover Decision Strategies in Heterogeneous Wireless Networks”.
Computer Communications, 31(10), 2008.

[11] T. Inzerilli, A.M. Vegni, A. Neri, and R. Cusani. “A Cross-Layer


Location-Based Approach for Mobile-Controlled Connectivity”.
International Journal of Digital Multimedia Broadcasting, 2010:13,
2010.

[12] J. Hou and D.C. O’Brien. “Vertical Handover Decision-Making


Algorithm using Fuzzy Logic for the Integrated Radio-and-OW
system”. IEEE Trans. on Wireless Communications, 5(1):176–185,
January 2006.

[13] D.J.T. Heatley, D.R. Wisely, I. Neild, and P. Cochrane. “Optical


wireless: the story so far”. IEEE Communications Magazine,
36(12):72–74, 79–82, December 1998.

Vous aimerez peut-être aussi