Presentation is loading. Please wait.

Presentation is loading. Please wait.

Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.

Similar presentations


Presentation on theme: "Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino."— Presentation transcript:

1 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino Board

2 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Needed Parts Arduino (e.g. Arduino Uno) Sensor (HC-SR04) Cabling – 1 x USB PC-Arduino – 10 x Cable 0,75 mm² (length approx. 10 cm) 1 x Computer / Laptop 1 x Breadboard 2 x LEDs (green, red) 2 x Resistor 220 Ω

3 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Module Specification Distance: Detection between 2cm and 3m Resolution: approx. 3mm Voltage: 5V Current: < 2mA Triggering: Falling edge (TTL - level) Self measuring after sending a trigger (input) PWM Signal will be returned (output) Duration Measurement (Interval): 20ms – 50 Measurements/Second

4 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Area of Application Obstacle Detection Distance Measurement Level Indicators Industrial Applications

5 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection HW Setup on Breadboard Pins (Sensor) 1: VCC, Voltage 5V 2: Trigger input, TTL-Level 3: Echo, output Measurement result, TTL-Level 4: GND, 0V

6 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Schematic

7 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Start Measurement -> Arduino set a digital signal to 1 -> Sensor will watch that signal at pin2 -> After 10μs Arduino can set signal to 0 -> Measurement started Send out ultra sonic -> After 200μs, a 40 kHz Burst-Signal, the ultra sonic sound wave will be send out by the sensor -> Duration: 200μs -> Sensor sets the output to high Waiting for echo -> If echo will be detected, the -> Output falls to L-Level. -> Time between high and low signal can be read out by Arduino -> Time which the ultrasonic needs forth and Get the measurement -> The Arduino can directly fetch the measurement result (duration) Programming Rules

8 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Physics Ultrasound Ultrasounds are sound waves Frequencies higher of limit of human hearing. Ultrasound is not different from 'normal‘ sound Frequencies from 20 kHz up to several gigahertz. Speed of ultrasound is 343,2 m/s – in dry air, – at 20 °C

9 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Physics Ultrasound

10 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Programming Sample #define trigPin 12 // Trigger Pin #define echoPin 6 // Echo Pin #define REDLED 8 #define GREENLED 10 #define SpeedOfSound 0 // Constant – at defined temperature – see physics long duration, distance; // duration used to calculate distance void setup() { pinMode(trigPin, OUTPUT); //Define Output Port pinMode(echoPin, INPUT); //Define Input Port pinMode(REDLED, OUTPUT); pinMode(GREENLED, OUTPUT); } void loop() { digitalWrite(trigPin, LOW); // Set Trigger Port to Low Signal – just to be sure delayMicroseconds(2); digitalWrite(trigPin, HIGH); // Set Trigger Port to high delayMicroseconds(10); // Be sure that signal is high for 10 ms digitalWrite(trigPin, LOW); // Start measurement duration = pulseIn(echoPin, HIGH);// Get result in µs distance = duration*SpeedOfSound/2; //Calculate distance based on the speed of sound /2 due to back and forth if (distance < 5) digitalWrite(REDLED, HIGH); // Handle distance - E.g. switch on RED LED if (distance < 30) digitalWrite(GREENLED, HIGH); // Handle distance - E.g. switch on GREEN LED delay(50); //Delay 50ms before next reading digitalWrite(REDLED, LOW); digitalWrite(GREENLED, LOW); }

11 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Sensor Accuracy The system-conditioned measuring exactness amounts to approx. 3 mm and is combined with the internal sample rate of the module. Another factor is the temperature dependence of the sonic speed in air. Approximately the sonic speed in relation of the temperature in the area of -20°C till +40°C can be calcutated with fomular: C air ≈(331,5 +0,6 * ϑ/°C) m/s ϑ = Surrounding temperature in °C

12 Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Best Practise The best measurement results are obtained by reflection on smooth, flat surfaces. For distances up to 1m, the material of surface is rather uncritically. Over short distances, of less than 1m, the angle to the object can reach up to 45 °. Even quite thin objects are reliably detected. A normal pen, for example, can be safely detect at a distance of about 30cm. At maximum distance (3m) the object must be exact targeted and there should be no other object in the area (similar distance) in a emission cone of 15 °.


Download ppt "Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino."

Similar presentations


Ads by Google