ultra sonic sensor network communicating using nrf 24l01 radio

34
ULTRASONIC SENSOR NETWORK COMMUNICATING USING NRF24L01+ TEAM MEMBERS: ANKITH KUMAR HANUMANTHAPPA SHANMUGAVEL RAMANI ASHOK RAJ PILLI SAIMA KHAN EHSAN GOZARNOEE

Upload: ashok-raj

Post on 15-Jan-2017

112 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Ultra sonic sensor network communicating using NRF 24L01 radio

ULTRASONIC SENSOR NETWORK

COMMUNICATING USING NRF24L01+

TEAM MEMBERS:ANKITH KUMAR HANUMANTHAPPA

SHANMUGAVEL RAMANIASHOK RAJ PILLI

SAIMA KHANEHSAN GOZARNOEE

Page 2: Ultra sonic sensor network communicating using NRF 24L01 radio

INTRODUCTIONTHE FOLLOWING SUBJECTS ARE INCLUDED IN THIS PRESENTATION:• NRF24L01

• CONTENTION BASED PROTOCOLS

• STOCHASTIC AND DETERMINISTIC THRESHOLD ALGORITHMS

• THE MICROCONTROLLER STRUCTURE OF THE INTERFACES

• PROGRAMMING

• RESULTS

• CONCLUSION

• BIBLIOGRAPHY

Page 3: Ultra sonic sensor network communicating using NRF 24L01 radio

OVERVIEW

Page 4: Ultra sonic sensor network communicating using NRF 24L01 radio

nRF24L01+

The nRF24L01+ is a single chip 2.4Ghz transceiver, suitable for ultra low power communication.

For designing a radio system we require a MCU.

In our project we operate and configure the nRF24L01+ through SPI.

It has internal FIFOs which ensure a smooth data flow between radio and MCU.

It has 126 channel It has 6 pipes. In our project we are using pipe0.

Page 5: Ultra sonic sensor network communicating using NRF 24L01 radio

nRF24L01+ It has data rate of 250 kbps, 1 Mbps and 2 Mbps.

Channels while running at < 1 Mbps require minimum spacing of 1 Mbps

Channels while running at 2 Mbps require minimum spacing of 2 Mbps

Two nrf24L01+ chips must have the same channel and air data rate in order to communicate.

Radio operates in 4 different modes.1. Power down mode

2. Standby mode

3. Transmit mode

4. Receiver mode

Page 6: Ultra sonic sensor network communicating using NRF 24L01 radio

Powermode

Standby-I

mode

RX

TX

Standby-II

mode

150 μs

130μs

130μs

130μs

130μs

Radio control state diagram

130μs

Page 7: Ultra sonic sensor network communicating using NRF 24L01 radio

Packet Structure

Page 8: Ultra sonic sensor network communicating using NRF 24L01 radio

Packet StructureAddresses Every wireless transmission is preceded by the address of the receiver it is intended for.

Addresses can be 3, 4 or 5 bytes long.

Payloads The payload is the actual data you are trying to send in your wireless transmission.

The wireless chips can handle payload sizes from 1-32 bytes.

Page 9: Ultra sonic sensor network communicating using NRF 24L01 radio

Category Xbee Bluetooth WiFi nRF24L01

Distance 50-1600 m 10 m 50 m 40 m

Transmission Speed 250 Kbps 1 Mbps 1-54 Mbps 250 -2 Mbps

Frequency Range 868 MHz -916 MHz 2.4 GHz 2.4 GHz 2.4 -2.525 GHz -2.4 GHz

Cost of terminal unit Low Low High Low

Difference between different RF radios

Page 10: Ultra sonic sensor network communicating using NRF 24L01 radio

CONTENTION BASED PROTOCOLS

MACA

MACAW

PAMAS

Page 11: Ultra sonic sensor network communicating using NRF 24L01 radio

A B C DRT

SRTS

CTS

CTS

DATA

ACK

MACA-MULTIPLE ACCESS WITH COLLISON AVOIDANCE

Page 12: Ultra sonic sensor network communicating using NRF 24L01 radio

Problems A B C D

CTS

RTS

RTS

CTS

Page 13: Ultra sonic sensor network communicating using NRF 24L01 radio

A B C D

CTS

RTS

RTS

CTS

DSDATA

MULTIPLE ACCESS COLLISON AVOIDANCE FOR WIRELESS

ACK

RRTS

Page 14: Ultra sonic sensor network communicating using NRF 24L01 radio

PAMAS:POWER AWARE MULTIPLE ACCESS WITH SIGNALLINGA B C D

Data channel

Control channel

Busy tone

RTS

CTS

DATA

Page 15: Ultra sonic sensor network communicating using NRF 24L01 radio

CSMA

WHICH IS THE BEST ONE ?

PAMAS

PAMAS

MACAWMACA

Page 16: Ultra sonic sensor network communicating using NRF 24L01 radio

SPISerial Peripheral Interface (SPI) is an interface commonly used to send data between microcontrollers and small peripherals.

SPI is a serial data protocol used by microcontroller for communicating to one or more peripheral devices.

Master device (Microcontroller)MISOMOSISCK

Begin() SetBitOrder() Transfer() End()

CE Chip enable(Activate RX or TX mode) CSN SpI chip select Setup NRF Radio on SPI bus

Page 17: Ultra sonic sensor network communicating using NRF 24L01 radio

RX (PRIM_RX)-> HIGHTX(PRIM_RX)-> LOW

NRF24 LibraryAbstract Low –level communication between microcontroller and transeiver.Start sending voltage to radio.Setup data rate .Setup the internal clock.Setup frequency/channel.ShockBurstIt is a packet based data link layer that featuresAutomatic packet handlingAuto AcknowledgementAuto Retransmission

SPI (CONTD.)

Page 18: Ultra sonic sensor network communicating using NRF 24L01 radio
Page 19: Ultra sonic sensor network communicating using NRF 24L01 radio

#include <SPI.h>#include <RF24.h>#define CE_PIN 9#define CSN_PIN 10int Sig=3;const uint64_t pipe = 0xF0F0F0F0A1; RF24 radio(CE_PIN, CSN_PIN); void setup() { Serial.begin(9600); radio.begin(); radio.setAutoAck(false); radio.openWritingPipe(pipe);}

void loop() { Serial.print("test");int time;int dis,z;pinMode(Sig,OUTPUT);digitalWrite(Sig,HIGH);delay(50);digitalWrite(Sig,LOW);pinMode(Sig,INPUT);time= pulseIn(Sig,HIGH);dis=(((time/2)*340.29*100)/1000000);Serial.print(dis);For(i=0;i<15;i++){ radio.write( dis, sizeof(dis) );}delay(50);}

Transmitter Code

Page 20: Ultra sonic sensor network communicating using NRF 24L01 radio

radio.openReadingPipe(1,pipe); radio.startListening();}void loop() { if ( radio.available() ) { bool done = false; while (!done) { done = radio.read(dis, sizeof(dis) ); Serial.print(" Y = "); Serial.println(dis); Serial.print(“ cm "); delay(500); } } else { Serial.println("No radio available"); }delay(300);}

#include <SPI.h>#include <nRF24L01.h>#include <RF24.h>#define CE_PIN 9#define CSN_PIN 10const uint64_t pipe[4] = {0xF0F0F0F066,0xF0F0F0F0AA, 0xF0F0F0F0A1,0xF0F0F0F0B4};RF24 radio(CE_PIN, CSN_PIN); // Create a RadioInt dis;void setup() { Serial.begin(9600); delay(1000); Serial.println("Nrf24L01 Receiver Starting"); radio.begin(); radio.setAutoAck(false);

Receiver Code

Page 21: Ultra sonic sensor network communicating using NRF 24L01 radio

LEACH PROTOCOL

• LEACH stands for Low-Energy Adaptive Clustering Hierarchy• This WSN is considered to be a dynamic clustering method• LEACH has two phases

Page 22: Ultra sonic sensor network communicating using NRF 24L01 radio

THE PROBLEM

• The reason we need network protocol such as LEACH is due to the fact that a node in the network is no longer useful when its battery dies• This protocol allows us to space out the lifespan of the nodes,

allowing it to do only the minimum work it needs to transmit data• LEACH uses a TDMA MAC protocol to communicate between

its nodes.

Page 23: Ultra sonic sensor network communicating using NRF 24L01 radio

THE CLUSTER-HEAD

• The LEACH Network is made up of nodes, some of which are called cluster-heads• The job of the cluster-head is to collect data from their surrounding

nodes and pass it on to the base station• LEACH is dynamic because the job of cluster-head rotates and it

selects a cluster head in each round freshly.

Page 24: Ultra sonic sensor network communicating using NRF 24L01 radio

DIRECT V. MINIMUM TRANSMISSION

• The amount of energy used in figure (a) can be modeled by this formula:• eampk(3d1 + d2)2

• Whereas the amount of energy used in figure (b) uses this formula:• eampk(3d12 + d22)

Page 25: Ultra sonic sensor network communicating using NRF 24L01 radio

THE AMOUNT OF ENERGY DEPLETION

• This is the formula for the amount of energy depletion by data transfer:

Page 26: Ultra sonic sensor network communicating using NRF 24L01 radio

LEACH’S TWO PHASES

• The LEACH network has two phases: the set-up phase and the steady-state

• The Set-Up Phase• Where cluster-heads are chosen

• The Steady-State• The cluster-head is maintained• When data is transmitted between nodes

Page 27: Ultra sonic sensor network communicating using NRF 24L01 radio

STOCHASTIC THRESHOLD ALGORITHMCluster-heads can be chosen stochastically

(randomly based) on this algorithm:

If n < T(n), then that node becomes a cluster-headThe algorithm is designed so that each node

becomes a cluster-head at least once

Page 28: Ultra sonic sensor network communicating using NRF 24L01 radio

DETERMINISTIC THRESHOLD ALGORITHM

• A modified version of this protocol is known as LEACH-C (or LEACH Centralized)• This version has a deterministic threshold algorithm, which

takes into account the amount of energy in the node…

Page 29: Ultra sonic sensor network communicating using NRF 24L01 radio

DETERMINISTIC THRESHOLD ALGORITHM

• …and/or whether or not the node was recently a cluster-head.• This formula helps us to stimulate a new cluster head making

sure it wasn’t a cluster head previously.

Page 30: Ultra sonic sensor network communicating using NRF 24L01 radio

WHAT’S THE DIFFERENCE?

• REMEMBER: The goal of these protocol is to increase the life of the network

• The changes between the LEACH stochastic algorithm and the LEACH-C deterministic algorithm alone is proven to increase the FND (First Node Dies) lifetime by 30% and the HND (Half Node Dies) lifetime by 20%

Page 31: Ultra sonic sensor network communicating using NRF 24L01 radio

AN EXAMPLE OF A LEACH NETWORK

• While neither of these diagrams is the optimum scenario, the second is better because the cluster-heads are spaced out and the network is more properly sectioned

Page 32: Ultra sonic sensor network communicating using NRF 24L01 radio

Conclusion: We were successful in building a sensor node which senses the distance from obstacle.

Arduino are not so useful in designing the low power consumption node.

Study of various contention based protocols were done.

PAMAS seem to be the most suitable one.

The sensors and the radio was programmed completely in Arduino and found to be completely functional.

Page 33: Ultra sonic sensor network communicating using NRF 24L01 radio

Result: We were successful in communicating in the wireless sensor network.

The communication is not smooth.

The collision of packet occur and there is loss of data.

Future Work: The protocols can be used for smooth communication.

Minimize energy consumption by maximizing sleep time.

Include error control protocol for efficient transmission.

Page 34: Ultra sonic sensor network communicating using NRF 24L01 radio

BIBLIOGRAPHY

“Low Energy Adaptive Clustering Hierarchy with Deterministic Cluster-Head Selection”; M.J. Handy, M. Haas, D. Timmermann; 2002; http://www.vs.inf.ethz.ch/publ/se/IEEE_MWCN2002.pdf

“Probabilistic Modeling of Leach Protocol and Computing Sensor Energy Consumption Rate in Sensor Networks”; Song, Dezhen; February 22, 2005; http://www.cs.tamu.edu/academics/tr/tamu-cs-tr-2005-2-2