1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

cảm biến siêu âm sensor RF05

33 668 3

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 1,96 MB

Nội dung

sensor sr05 cảm biến siêu âm, tài liệu sử dujnh tiếng việt giúp các bạn nào cần làm báo cáo tiếng anh, trong tài liệu trình bày rõ ràng cấu tạo, tác dụng và cách giao tiếp giữa vi điều khiển với cảm biến siêu âm rf05

2014 Application of Distance Sensor in Parking Car Phạm Duy Khanh Đinh Tiến Đạt Lê Thanh Tùng CTT Cơ Điện Tử K55 Distance Sensor in Parking Car Table of Contents A Abstract B Introduction and Overview C Approach I Structure of our system II Hardware Distance sensor Microcontroller 10 Display device 11 Actuator and Status devices 12 III Software 13 Programer and complier software 13 Simulation platform 15 PCB design platform 15 D Design System 16 I Hardware 16 Power Supply Block (LM7805) 16 Main Block 17 Actuator Block 20 II Software 22 Distance sensor (HC SR04) code 23 Display device (LCD 16x2) code 26 Actuator (DC motor) code 29 E Results of our system 32 F Conclusion 32 Page | HaNoi University of Science and Technology Distance Sensor in Parking Car List of fingures Figure 1: Structure of System Figure 2: Operation of Optical Sensor Figure 3: Sharp GP2Y0A02YK0F analog distance sensor 20-150 cm Figure 4: Operation of Ultrasonic Sensor Figure 5: HC SR04 Ultrasonic sensor Figure 6: Operation of Microwave Sensor Figure 7: HB-100 Microwave Sensor Figure 8: Some types of lcd panel 11 Figure 9: LCD text 16x2 12 Figure 10: DC Motor 13 Figure 11: AVR Studio 14 Figure 12: User Interface of AVR Studio 14 Figure 13: Proteus 7.8 15 Figure 14: User Interface of Proteus 7.8 15 Figure 15: Altium Designer 14 15 Figure 16: PCB Design of Product 16 Figure 17: IC LM7805 16 Figure 18: Schematic of Power Block 17 Figure 19: Block Diagram of Main Block 17 Figure 20: Schematic of Main Block 18 Figure 21: Real Product 19 Figure 22: IC LM298 20 Figure 23: Schematic of L298 Module 21 Figure 24: Real of L298 Module 21 Figure 25: Flow Chart of Main Program 22 Figure 26: Timing Diagram of HC SR04 23 Figure 27: Flow Chart of Get Width Pulse on HC SR04 24 Figure 28: Flow Chart of LCD in 4bit mode 26 Figure 29: PWM Waveform 30 Figure 30: A Simlifed H Bridge 30 Figure 31: Timing Diagram of fast PWM on Timer in Atmega8 31 Page | HaNoi University of Science and Technology Distance Sensor in Parking Car A Abstract An increasing number of new vehicles are being equipped with ultrasonic sensors These sensors detect the presence and proximity of objects in the pathway of the reversing vehicle and warn the driver through an audible signal This report investigates the performance capabilities and potential safety effectiveness of these systems in reducing the risks to small children and other pedestrians from reversing vehicles These sensor systems are primarily designed and marketed as parking aids However, some are being promoted as safety systems with the potential to reduce or prevent collisions with pedestrians, especially small children In terms of detection area performance, parking aid systems sacrificed detection distance and height in order to suppress false or nuisance alarms The durability and reaction time results revealed there were no substantial performance differences between the systems The safety benefits of these devices were then estimated based on these test results B Introduction and Overview There are many pedestrians struck and injured by reversing vehicles each year in Viet Nam However, this is likely an underestimate as this figure only represents those pedestrians struck in traffic situations It does not account for pedestrians injured or killed in private driveways or parking lots for example Therefore, the exact number of pedestrians injured or killed in Viet Nam is not known but studies in other jurisdictions have highlighed this problem The study also found that most of these non-traffic collisions involved toddlers Among the recommendations was to investigate the potential of rear proximity sensors in detecting the presence of nearby children This paper reports on the performance of ultrasonic sensor systems The purpose was not to set out performance criterea but rather to investigate the capabilities of commercially available systems and to asses their potential effectiveness in reducing pedestrian collisions Page | HaNoi University of Science and Technology Distance Sensor in Parking Car C Approach of Product I Structure of System In our system, we have monitor to display infomation of status and distances recieved from distances sensor If the car is in dangerours regions, the red light is turned on and the buzzer is notified and speed of motor also reduced to zero to the car not cross to object Figure 1: Structure of System II Hardware Distance sensor a Introduce types of distance sensor Measuring the level, position, distance and displacement of physical objects is essential for many applications: process feedback control, performance evaluation, transport, traffic control, robotics, security systems, to name just a few In our problem, we need a sensor that can mearsure extractly distances from source (car) to unknown body (unknown about shape, material, movement,etc) Hence, we will consider types of distance sensors: optical sensor, microwave sensor and ultrasonic sensor  Optical Distance Sensor: A light wave is transmitted by the sensor, reflected by the measuring object and received by the detector The simplest way to calculate distances with optical sensors is based on the determination of the elapsed time interval between emission and reception of a pulse (signal burst) or series of pulses Page | HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 2: Operation of Optical Sensor Typical parameters: Measurement range: up to m range Resolution: 1mm Examples: Figure 3: Sharp GP2Y0A02YK0F analog distance sensor 20-150 cm US $13.95  Ultrasonnic Distance Sensor: Ultrasonic waves are mechanical oscillations at a frequency which is beyond the audibility of humans (more than 20 kHz) By a mutual interference of ultrasonic waves from the individual sensors, the high density of emitted energy in a certain direction can be reached Using the proper phasing of the transducers configured in a matrix, the concentration of energy in a small area is feasible The same phasing principle can be implemented on the matrix of receivers for a reflected wave By the computer control of phases of transducers operating in a transmitting or receiving mode  Travel time principle The pulses containing a definite number of periodic waves propagate with sound http://www.pololu.com/product/1137 Page | HaNoi University of Science and Technology Distance Sensor in Parking Car velocity towards a measured object The pulses are then reflected from the measured object and picked up by the receiver (Figure 7.29) with a lag time equal to the elapsed time between the emission and reception of pulses The received pulses of ultrasonic waves are transformed to the electrical signal by means of the piezoelectric effect the scanning regime of operation is feasible (e.g in ultrasonic tomography)  Doppler effect The Doppler effect, (discovered by C Doppler in 1843) is the change in frequency undergone by radiation (be it mechanical or electromagnetic) when it is reflected by an object that is moving with respect to the radiation transmitter If the reflector moves with velocity v the shift of frequency is approximately given by relation where fe is the emitted frequency, fr is the received frequency, and α is the relative angle between reflector velocity and propagation direction Figure 4: Operation of Ultrasonic Sensor Typical parameters: Measurement range: up to m range Page | HaNoi University of Science and Technology Distance Sensor in Parking Car Resolution: mm Examples: Figure 5: HC SR04 Ultrasonic sensor US $3.61  Microwave Distance Sensor (radar) Microwaves are electromagnetic waves with high frequency (GHz range) The procedures used in microwave sensors for distance and position measurement are analogical to those of ultrasonic sensors The measurements are based on: – The travel time measurement – Doppler effect – Frequency Modulated Continuous Wave (FMCW): The FMCW-based sensor continuously sends signals with a periodical frequency modulated carrier wave The frequency difference is proportional to the distance which can be calculated from the following equation: Where fm is the frequency of the triangular modulating signal and fh s the frequency sweep The precision of a FMCW radar system depends mainly on the linearity of the triangular waveform of the frequency modulating signal http://www.robotshop.com/en/hc-sr04-ultrasonic-range-finder.html Page | HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 6: Operation of Microwave Sensor Travel time measurement is the original procedure used in radar systems for a distance measurement Typical parameters: Measurement range: up to km range Resolution: 1m Examples: Figure 7: HB-100 Microwave Sensor US $29.30 3 www.aliexpress.com/HB100 Page | HaNoi University of Science and Technology Distance Sensor in Parking Car In Vietnam, we cannot buy HB100 or Sharp GP2Y0A02YK0F, so we decide choose HC SR04 Ultrasonic Sensor to use in our problem b Introduce features and characteristics of HC SR04 Ultrasonic ranging module HC-SR04 provides 2cm - 400cm non-contact measurement function, the ranging accuracy can reach to 3mm The modules includes ultrasonic transmitters,receiver and control circuit The basic principle of work  Using IO trigger for at least 10us high level signal  The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back  If the signal back, through high level,time of high output IO duration is the time from sending ultrasonic to returning Test distance=(high level timexvelocity of sound (340M/S) /2 Wire connecting direct as following: 5V Supply Trigger Pulse Input Echo Pulse Output GND If you are sourcing a ultrasonic ranging module , the HC-SR04 is good choose Its stable performance and high ranging accuracy make it a popular module in electronic market Compared to the Shape IR ranging module , HC-SR04 is more inexpensive than it But it has the same ranging accuracy and longer ranging distance More details:  Power supply :5V DC  Quiescent current : 2mA Page | HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 20: Schematic of Main Block Page | 18 HaNoi University of Science and Technology Distance Sensor in Parking Car c Real Board Figure 21: Real Product Page | 19 HaNoi University of Science and Technology Distance Sensor in Parking Car Actuator Block a Introduce IC Driver LM298 In our product, we want to drive a DC motor by Pulse Width Modulation There are many way to solve problem In our product, we use IC Dirver LM298 to driver our motor A very popular and reasonably priced all-in-one H-bridge motor driver is the L298 It can control two motors, not just one It can handle amps per motor, though to get the maximum current be sure to add a heat sink The L298 has a large cooling flange with a hole in it, making it easy to attach a homebrew metal heat sink to it If there’s a downside to the L298 it’s that it comes in a special “Multiwatt 15” package, with 15 offset pins that don’t match the standard 0.100" spacing of breadboards But with care, the pins can be rebent as needed Or you may prefer to simply get a breakout board for the L298, which is a small circuit board with holes drilled in it to accept the chip You then plug the breakout board into your breadboard Problem solved The schematic below shows a basic connection diagram for controlling two motors using the L298 motor bridge IC.There are three input pins for each motor: Input1, Input2, and Enable1 controls Motor1 Input3, Input4, and Enable2 controls Motor2 The motors connect to Output1/Output2 and Output3/Output4, as shown Figure 22: IC LM298 b Schematic circuit Page | 20 HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 23: Schematic of L298 Module c Real Board Figure 24: Real of L298 Module Page | 21 HaNoi University of Science and Technology Distance Sensor in Parking Car II Software In our system, we will depend distances ared measured to control speed of motor Here is Flowchart of Main program Figure 25: Flow Chart of Main Program Page | 22 HaNoi University of Science and Technology Distance Sensor in Parking Car Distance sensor (HC SR04) code a Basic Operation and Timing of the HC-SRO4 Ultrasonic Sensor Figure 26: Timing Diagram of HC SR04  Make "Trig" (pin 2) on the sensor high for 10µs This initiates a sensor cycle Code: Trigger  8x40kHz pulses will be sent from the "T" transmitting piezzo transducer of the sensor, after which time the "Echo" pin on the sensor will go from low to high  The 40kHz sound wave will bounce off the nearest object and return to the sensor  When the sensor detects the reflected sound wave, the the Echo pin will go low again  The distance between the sensor and the detected object can be calculated based on the length of time the Echo pin is high  If no object is detected, the Echo pin will stay high for 38ms and then go low b Calculate length of time the Echo Pin high After 40kHz sound wave has trig, the Echo Pin is high If Sensor is received the reflected sound wave, the Echo Pin will low We will calculate lenght of time the Echo in high by using timer 32bit of Atmega8 Page | 23 HaNoi University of Science and Technology Distance Sensor in Parking Car Flow Chart: Figure 27: Flow Chart of Get Width Pulse on HC SR04 Code: Page | 24 HaNoi University of Science and Technology Distance Sensor in Parking Car We are running on CPU speed of 16MHz, so our i/o clock is 16MHz We divide this by to get a 2MHz clock for our timer This means the timer increments its value in 0.5 microsecond We can divide the value by two to get exact microsecond time base So the TCCR1B is configured by only setting up CS11, this is written in C as above So Length of Time (width of pulse on High Level) wil be caculate by Counter*1us c Calculate Distance base on Length of time the Echo pin in High The speed of sound: 340.29 m/s (meters per second) We will be measuring distance to an object by the time it takes a sound wave to make a round trip to the object and back again, so the the useful number is actually: The speed of sound to an object and back: 170.15 m/s Since our sensor can only detect items relatively nearby, let's change to more useful units by converting from m/s to µs/cm: 𝑠 𝑚 × 106 𝜇𝑠 58𝜇𝑠 × × ≈ 170.15 𝑚 100 𝑠 𝑠 Time for pulse to travel 1cm to an object and then return to the sensor: 58µs So Distances: 𝑑= 𝑟 58 with r is width of pulse on High level on Trig Pin Page | 25 HaNoi University of Science and Technology Distance Sensor in Parking Car Code: Display device (LCD 16x2) code a Flowchart Figure 28: Flow Chart of LCD in 4bit mode Page | 26 HaNoi University of Science and Technology Distance Sensor in Parking Car b Detail about LCD code LCDInit(uint8_t style) This function Initializes the lcd module must be called before calling lcd related functions LCDWriteString(const char *msg) This function Writes a given string to lcd at the current cursor location LCDWriteInt(int val,unsigned int field_length) Page | 27 HaNoi University of Science and Technology Distance Sensor in Parking Car This function writes a integer type value to LCD module LCDGotoXY(uint8_t x,uint8_t y) set the LCD display position Page | 28 HaNoi University of Science and Technology Distance Sensor in Parking Car LCDWriteStringXY(x,y,msg) This function Writes a given string to lcd at the location defined by position x,y LCDWriteIntXY(x,y,val,fl) This function writes a integer type value to LCD module at the location defined by position x,y Actuator (DC motor) code Using Timer (8bit) to control speed of motor The value that we set in variable OCR is equivalent to speed of motor In addition, by using status led: Red, yellow, green to denote the state We are going to know the speed of motor  Timer2 8bit of Atmega8 Timer/Counter2 is a general purpose, single channel, 8-bit Timer/Counter module The main features are: • Single Channel Counter • Clear Timer on Compare Match (Auto Reload) • Glitch-free, phase Correct Pulse Width Modulator (PWM) • Frequency Generator • 10-bit Clock Prescaler • Overflow and Compare Match Interrupt Sources (TOV2 and OCF2) • Allows Clocking from External 32kHz Watch Crystal Independent of the I/O Clock  Pulse Width Modulation with Timer2 bit of Atmega8 Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a modulation technique that controls the width of the pulse, formally the pulse duration, based on modulator signal information Although this modulation technique can be used to encode information for transmission, its main use is to allow the control of the power supplied to electrical devices, especially to inertial loads such as motors PWM can have many of the characteristics of an analog control system, in that the digital signal can be free wheeling PWM does not have to capture data, although there are exceptions to this with higher end controllers One of the parameters of any square wave is duty cycle Most square waves are 50%, this is the norm when discussing them, but they don't have to be symmetrical The ON time can be varied completely between signal being off to being fully on, 0% to 100%, and all ranges between Shown below are examples of a 10%, 50%, and 90% duty cycle While the frequency is the same for each, this is not a requirement Page | 29 HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 29: PWM Waveform Another popular application is motor speed control Motors as a class require very high currents to operate Being able to vary their speed with PWM increases the efficiency of the total system by quite a bit PWM is more effective at controlling motor speeds at low RPM than linear methods PWM is often used in conjunction with an H-Bridge This configuration is so named because it resembles the letter H, and allows the effective voltage across the load to be doubled, since the power supply can be switched across both sides of the load In the case of inductive loads, such as motors, diodes are used to suppress inductive spikes, which may damage the transistors The inductance in a motor also tends to reject the high frequency component of the waveform While basically accurate, this schematic of an H-Bridge has one serious flaw, it is possible while transitioning between the MOSFETs that both transistors on top and bottom will be on simultaneously, and will take the full brunt of what the power supply can provide This condition is referred to as shoot through, and can happen with any type of transistor used in a H-Bridge If the power supply is powerful enough the transistors will not survive It is handled by using drivers in front of the transistors that allow one to turn off before allowing the other to turn on Figure 30: A Simlifed H Bridge In our system, we use IC Driver LM298 It include H-bridge, so we can drive motor together But, in our product, we drive only a motor  Pulse Width Modulation with Timer2 bit of Atmega8 The fast Pulse Width Modulation or fast PWM mode (WGM21:0 = 3) provides a high frequency PWM waveform generation option The fast PWM differ from the other PWM option by its single lope operation The counter counts from BOTTOM to Page | 30 HaNoi University of Science and Technology Distance Sensor in Parking Car MAX the restarts from BOTTOM In non-inverting Compare Output mode, the Output Compare (OC2) is cleared on the Compare Match between TCNT2 and OCR2, and set at BOTTOM In inverting Compare Output mode, the output set o Compare Match and cleared at BOTTOM Due to the single-lope operation, the operating frequency of the fast PWM mode can be twice as high as the phase correct PWM mode tha uses dual-slope operation The high frequency makes the fast PWM mode well suited for power regulation, retification, and DAC appliction Figure 31: Timing Diagram of fast PWM on Timer in Atmega8  Code for Setup Timer: Page | 31 HaNoi University of Science and Technology Distance Sensor in Parking Car  Code for Control Speed depend on distance E Results of our system Our system design work well on both simulation and real pcb circuit All video recorded our project result have added to project file F Conclusion In order to get those results, we would like to express our deep gratitude to Professor Nguyễn Cảnh Quang for putting the group together and helping us throughout the project Beside his diligent and easily-understand instructions, meticulous preparation, and top-quality support and information, his attitude also lent us a fresh perspective to the subject of Digital design subject After finished our project , we got more knowledge about Safety Parking Car system and microprocessor AVR, how to control motor using PWM, module LM298 and, Ultrasonnic Distance Sensor HC SR04 ; and many peripheral interface , and have the chances to practice what we learn in lectures… This is very useful experience for us to work well in the future References Mordem Sensor Handbook, Pavel Ripka and Alois Tipek, ISTE Ltd, 2007 Sensor Technology Handbook by Jon S Wilson - Newnes (December 22, 2004) Datasheet of Atmega8, Atmel Corp http://extremeelectronics.co.in/avr-tutorials/ultrasonic-rangefinder-hc-sr04interfacing-with-atmega8/ Page | 32 HaNoi University of Science and Technology [...]... Technology Distance Sensor in Parking Car 1 Distance sensor (HC SR04) code a Basic Operation and Timing of the HC-SRO4 Ultrasonic Sensor Figure 26: Timing Diagram of HC SR04  Make "Trig" (pin 2) on the sensor high for 10µs This initiates a sensor cycle Code: Trigger  8x40kHz pulses will be sent from the "T" transmitting piezzo transducer of the sensor, after which time the "Echo" pin on the sensor will go... Block b Schematic Page | 17 HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 20: Schematic of Main Block Page | 18 HaNoi University of Science and Technology Distance Sensor in Parking Car c Real Board Figure 21: Real Product Page | 19 HaNoi University of Science and Technology Distance Sensor in Parking Car 3 Actuator Block a Introduce IC Driver LM298 In our product,... which time the "Echo" pin on the sensor will go from low to high  The 40kHz sound wave will bounce off the nearest object and return to the sensor  When the sensor detects the reflected sound wave, the the Echo pin will go low again  The distance between the sensor and the detected object can be calculated based on the length of time the Echo pin is high  If no object is detected, the Echo pin will... Echo Pin is high If Sensor is received the reflected sound wave, the Echo Pin will low We will calculate lenght of time the Echo in high by using timer 32bit of Atmega8 Page | 23 HaNoi University of Science and Technology Distance Sensor in Parking Car Flow Chart: Figure 27: Flow Chart of Get Width Pulse on HC SR04 Code: Page | 24 HaNoi University of Science and Technology Distance Sensor in Parking... 170.15 m/s Since our sensor can only detect items relatively nearby, let's change to more useful units by converting from m/s to µs/cm: 𝑠 𝑚 1 × 106 𝜇𝑠 58𝜇𝑠 × × ≈ 170.15 𝑚 100 𝑠 𝑠 Time for pulse to travel 1cm to an object and then return to the sensor: 58µs So Distances: 𝑑= 𝑟 58 with r is width of pulse on High level on Trig Pin Page | 25 HaNoi University of Science and Technology Distance Sensor in Parking... AVR, how to control motor using PWM, module LM298 and, Ultrasonnic Distance Sensor HC SR04 ; and many peripheral interface , and have the chances to practice what we learn in lectures… This is very useful experience for us to work well in the future References 1 Mordem Sensor Handbook, Pavel Ripka and Alois Tipek, ISTE Ltd, 2007 2 Sensor Technology Handbook by Jon S Wilson - Newnes (December 22, 2004)... Output3/Output4, as shown Figure 22: IC LM298 b Schematic circuit Page | 20 HaNoi University of Science and Technology Distance Sensor in Parking Car Figure 23: Schematic of L298 Module c Real Board Figure 24: Real of L298 Module Page | 21 HaNoi University of Science and Technology Distance Sensor in Parking Car II Software In our system, we will depend distances ared measured to control speed of motor Here... Technology Distance Sensor in Parking Car b Detail about LCD code LCDInit(uint8_t style) This function Initializes the lcd module must be called before calling lcd related functions LCDWriteString(const char *msg) This function Writes a given string to lcd at the current cursor location LCDWriteInt(int val,unsigned int field_length) Page | 27 HaNoi University of Science and Technology Distance Sensor in Parking... HaNoi University of Science and Technology Distance Sensor in Parking Car Pin No 1 2 3 Function Name Input voltage (5V-18V) Ground (0V) Regulated output; 5V (4.8V-5.2V) Input Ground Output Schematic: Figure 18: Schematic of Power Block 2 Main Block a Introduce Main Block include module display (LCD 16x2), Microcontroller (atmeg8), status led, Ultrasonic Sensor and Conector to Motor Module Block Diagram... to control 2.Enough space to display the information that user need to know about module : distance , warning level 3.Friendly to users Page | 11 HaNoi University of Science and Technology Distance Sensor in Parking Car Introduce features and characteristic of LCD 16x2 Figure 9: LCD text 16x2 FEATURES • 5 x 8 dots with cursor • Built-in controller (KS 0066 or Equivalent) • + 5V power supply (Also

Ngày đăng: 29/09/2016, 09:32

TỪ KHÓA LIÊN QUAN

w