Distance measuring unit with zigbee protocol, Ultra sonic sensor

Post on 11-Apr-2017

219 views 8 download

Transcript of Distance measuring unit with zigbee protocol, Ultra sonic sensor

1Distance Measuring Unit

Presented by: Shanmugavel RamaniSaima khanAnkith kumar HanumanthappaAshok RajEshan gozarnoee

2Content:• Introduction• Aurdino board• Zigbee• X-ctu• Ultrasonic Sensor• Aurdino Software• Program• FT232RL Breakout Board• Xbee Shield• Result and Accuracy• Conclusion

3Project outline:

• Basically a unit which consists of ultrasonic sensor configured using a Arduino board.

• The sensors communicate using a Xbee trans-receiver which is also interconnected using the Arduino board.

• The ultrasonic sensor here is used to detect objects and its distance from the measuring unit.

• The distance of the object is calculated using the basic principle of sonar where distance is given by the formula

• Distance(d)

4FUNCTIONING OF THE SYSTEM:

5ARDUINO BOARD:

Description:We used the Arduino PRO Wifi board! The board contains a WiFly RN-171 802.11b/g Serial Module from Roving Networks connected to the Atmega328 through a SC16IS750 SPI-to-UART chip.

The chip allows the RN-171 module to communicate with the atmega328 over the SPI bus instead of the USART. By keeping the USART bus free, the board is able to communicate with a PC using a standard USB to Serial Converter.

The Atmega328P is pre-flashed with the Arduino Pro bootloader running at 5V and 16Mhz; which means it can be directly programmed with the Arduino IDE by just selecting Arduino Pro 5v/16Mhz w/ Atmega328 during programming.

This board has the ability to server up a website, or act as a client to get information for the world wide web! The possibilities are endless!

6SUMMARY :

Microcontroller ATmega328Operating Voltage 3.3V or 5VInput Voltage 5 - 12 V (5V versions)Digital I/O Pins 14 (of which 6 provide PWM output)Analog Input Pins 6DC Current per I/O Pin 40 mA

Flash Memory 32KB (ATmega328) of which 2 KB used by bootloader

SRAM 2 KB (ATmega328)EEPROM 1 KB (ATmega328)Clock Speed 16 MHz (5V versions)

Summary

7Memory The ATmega328 has 32 KB of flash memory for storing code (of which 2 KB is

used for the bootloader). It has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and written with the EEPROM library). The ATmega328 has 32 KB of flash, 2 KB of SRAM, and 1 KB of EEPROM

Communication The Arduino Pro has a number of facilities for communicating with a computer,

another Arduino, or other microcontrollers. The ATmega168 and ATmega328 provide UART TTL serial communication, which is available on digital pins 0 (RX) and 1 (TX). The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board via a USB connection.

8Input and Output Each of the 14 digital pins on the Pro can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead()functions. They operate at 3.3

volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the TX-0 and RX-1 pins of the six pin header.

External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not

currently included in the Arduino language. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off. The Pro has 6 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to VCC, though

is it possible to change the upper end of their range using the AREF pin and some low-level code. Additionally, some pins have specialized functionality: I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library. There are a couple of other pins on the board: AREF. Reference voltage for the analog inputs. Used with analogReference(). Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

9

The XBee radios can all be used with the minimum number of connections – power (3.3 V), ground, data in and data out (UART), with other recommended lines being Reset and Sleep. Additionally, most XBee families have some other flow control, I/O, A/D and indicator lines built in. A version of the XBees called the programmable XBee has an additional onboard processor for user’s code. The programmable XBee and a new surface mount (SMT) version of the XBee radios were both introduced in 2010.

XBee is the brand name from Digi International for a family of form factor compatible radio modules. The first XBee radios were introduced under the MaxStream brand in 2005 and were based on the 802.15.4-2003 standard designed for point-to-point and star communications at over-the-air baud rates of 250 kbit/s.Two models were initially introduced a lower cost 1 mW XBee and the higher power 100 mW XBee-PRO. Since the initial introduction, a number of new XBee radios have been introduced and all XBees are now marketed and sold under the Digi brand.

10

11

12What type of Modulation is used?

QPSK modulation is used for both XBee Series 1 and XBee-PRO series 1,however the emission designation is slightly different.

13

Why QPSK?QPSK uses two basis functions, a sine and a cosine whereas BPSK uses just one. By varying the phase of each of these carriers we can send two bits per each signal. The dimensionality of a modulation is defined by the number of basis functions used . That make QPSK a two dimensional signal . Not because it sends two bits per symbol, but because it uses two independent signals (a sine and a cosine) to create the symbols.

14

15

16

17

18Ultrasonic Sensor:

1. How do humans sense distance? Humans estimate distance using their eyes, which is usually not a very accurate method.

2. How do bats sense distance?Bats sense distance using sound. They emit sound waves and receive back reflected waves. The time it takes to receive the waves back provides them with a very good estimate of the distance. This is exactly how ultrasonic sensors estimate distance.

3. Example for bats: calls made by mouth > ears hear reflected waves > brain decides what to do > wing muscles move > flight path changed, as needed. Bats use this same method to catch mosquitoes too.

19Ultrasonic Sensor:

AN ULTRASONIC SENSOR HAS TWO PARTS:

• A TRANSMITTER THAT SENDS OUT A SIGNAL THAT HUMANS CANNOT HEAR

• A RECEIVER THAT RECEIVES THE SIGNAL AFTER IT HAS BOUNCED OFF NEARBY OBJECTS

THE SENSOR SENDS OUT ITS SIGNAL AND DETERMINES HOW LONG THE SIGNAL TAKES TO COME BACK.

If the object is very close to the sensor, the signal comes back quicklyIf the object is far away from the sensor, the signal takes longer to come backIf objects are too far away from the sensor, the signal takes so long to come back (or is very weak when it comes back) .The sensor sends a message back to the controller telling it the time taken for the signal to return. Then it uses this info to compute how far away the object is.

20

21Echolocation

Bats produce a very high-pitch sound (ultrasonic, beyond the human hearing range greater than 20 KHZ). Those sound waves travel through air and bats listen carefully to any echoes that return.

By determining how long echoes take to return, bats estimate the distances of the objects. Bats also determine how big objects are and in which direction they are located. The bat brain processes the echoes similarly to human brains.

How does an ultrasonic sensor work? The ultrasonic sensor emits a sound pulse and measures the distance of the

object depending on the time taken by the echo to return back to the other side. Electrical energy is converted to sound to send the pulse,

and then the sound received back is converted to electricity.

22How Can We Measure Distance?

The ultrasonic sensor sends out sound from one side and receives sound reflected from an object on the other side. The sensor uses the time it takes for the sound to come back from the object in front to determine the distance of an object.The “sonic” in ultrasonic refers to sound, and “ultra” means that humans cannot hear it (but bats and dogs can hear those sounds). The ultrasonic sensor can measure distances in centimeters and inches. It can measure from 0 to 2.5 meters.

23Ultrasonic Sensor Application

Ultrasonic sensors have diversified functions including Detection Measurement Destruction

Eye axis lengthA probe applied to the surface of the cornea transmits an ultrasonic wave and receives the echo. From the propagation time of the echo, the length of the eye axis (the distance between the surface of the eye (cornea) and the back end of the eye (retina) = Diameter of the eyeball) can be determined. CellsApplying ultrasonic energy into the human body will generate thermal energy, which causes a heating effect that can destroy cells. This application is useful for treatment of cancer.

24 Level MeasuringLevel measuring is used in a wide variety of applications. They accurately monitor the fill level of silos or tanks used by dairies, chemical plants, mineral companies, and many others. Vehicle detection in Barrier System

In car parking lots and parking garages, entry is controlled using barrier systems. The barrier must not be lowered when there is a vehicle underneath. Ultrasonic sensors are particularly suitable for controlling this process. Spray NozelsUsing ultrasonic sensors can save on pesticides by detecting tree gaps. As soon as one of these gaps is recognized, the spraying process temporarily stops.

25Aurdino Software :

The Arduino Integrated Development Environment (IDE) is a cross-platform application written in Java.

It easy to write code and upload it to the board.

It includes a code editor with features such as syntax highlighting and brace matching

Arduino programs are written in C or C++

 Users only need define two functions to make a runnable cyclic executive program:

Setup() Loop()

26Program to find the Distance using sensor:int Sig= 3;void setup(){ Serial.begin(9600); }void loop(){ float dis; int time; pinMode(Sig,OUTPUT); digitalWrite(Sig,HIGH); delay(500); digitalWrite(Sig,LOW); pinMode(Sig,INPUT); time= pulseIn(Sig,HIGH); dis=(((time/2)*34.029)/1000)); Serial.write(dis); Serial.print(" cm "); Serial.print(‘\n’); delay(2000);}

27 FT232RL Breakout Board

This is a breakout board also known as FTDI USB to UART IC (FT232RL)

 There are two options for communicating:

1) Virtual COM Port (VCP) drivers for RS-232 style serial ports.

• Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC

2) Special Dynamic Link Library (DLL) to directly control access to the USB device and pin I/O

Three LEDs telling you the status of RX (red), TX (green) and POWER (blue).

28FT232Rl Pin Description

29 FT232RL Breakout BoardFeatures: 

• Implements full v2.0 USB protocol 

• Needs no external crystal  • 14 I/O lines for use with RS-232, bit-bang, or special function modes 

• Provides USB Bus power of 5V up to 500mA and regulated 3.3V up to 50mA • Clock generator to drive microcontrollers (6, 12, 24, and 48 MHz)  • Easy logic level selection jumper 

• All pins are labeled 

30Bread board

31XBEE SHIELD

32Significance of LED’SLED LABEL LED COLOR OPERATIONSPWR Red Power is presentDIO5 Green blinks when the XBee is associated with

another XBee.DOUT Red Indicates wireless data is being received.

DIN Green Indicates wireless data is being transmitted.

RSSI Green Indicates relative signal strength (RSSI) of last received transmission.

33DIN and DOUT pins can be connected to either the UART pins or any digital pin on the Arduino (D2 and D3 default)

34Result,Accuracy,Conclusion:

We were able to find the distance between the Obstacle and Sensor

Ultrasonic sensor is unable to measure the distance below 2cm

The precision of the sensor is 2 cm to 2.6 metre under lab condition

We successfully transmitted the signal through Zigbee radio

34

35

ANY QUERIES?

36

37Result and Accuracy:

We were able to find the distance between the Obstacle and Sensor

Ultrasonic sensor is unable to measure the distance below 2cm

The precision of the sensor is 2 cm to 2.6 metre under lab condition

We successfully transmitted the signal through Zigbee radio

38Bibliography:

www.wikipedia.com

www.atmel.com

Xp rf module

Jconsystem1

www.aurdino.com

Building of WSN textbook