Operácie

MEMS Cvičenie 8: Rozdiel medzi revíziami

Z SensorWiki

(Principle of operation)
(2 medziľahlé úpravy od rovnakého používateľa nie sú zobrazené.)
Riadok 24: Riadok 24:
 
toho rozhodnite:<BR>
 
toho rozhodnite:<BR>
 
Ktorým smerom sa má vydať na prieskum, aby minul čo najmenej času a energie na otáčanie?
 
Ktorým smerom sa má vydať na prieskum, aby minul čo najmenej času a energie na otáčanie?
 +
 +
 +
 +
 +
= Ultrasonic sensor for distance measurement =
 +
 +
 +
 +
[[Obrázok:SensorPING.jpg|right|200px]]
 +
 +
In following application we will use the Parallax PING))) Ultrasonic sensor.
 +
 +
* [http://www.parallax.com/Portals/0/Downloads/docs/prod/acc/28015-PING-v1.6.pdf PING)))™ Documentation v1.6]  (.pdf)
 +
 +
'''Features:'''
 +
 +
* Provides precise, non-contact distance measurements within a 2 cm to 3 m range
 +
* Simple pulse in/pulse out communication
 +
* Burst indicator LED shows measurement in progress
 +
* 20 mA power cosumption
 +
* Narrow acceptance angle
 +
 +
'''Key Specifications:'''
 +
 +
* Power requirements: +5 VDC
 +
* Communication:Positive TTL pulse
 +
* Dimensions: 22 x 46 x 16 mm
 +
* Operating temp range: 0 to +70 °C
 +
 +
 +
 +
=== Principle of operation ===
 +
 +
 +
The Ping sensor measures distance using sonar; an ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return. Output from the PING))) sensor is a variable-width pulse that corresponds to the distance to the target.
 +
 +
[[Obrázok:SensorPingOperation.png|center|450px]][[Obrázok:SensorPingUS_Cone.png|center|350px]]
 +
 +
The PING))) sensor detects objects by emitting a short ultrasonic burst and then "listening" for the echo.
 +
Under control of a host microcontroller (trigger pulse), the sensor emits a short 40 kHz (ultrasonic) burst.
 +
This burst travels through the air, hits an object and then bounces back to the sensor. The PING)))
 +
sensor provides an output pulse to the host that will terminate when the echo is detected, hence the
 +
width of this pulse corresponds to the distance to the target.
 +
 +
<!--
 +
[[Obrázok:SensorPingTiming.png|right]]
 +
-->
 +
 +
== Example program ==
 +
 +
<source lang="c">
 +
int pingPin = 11;
 +
 +
void setup()
 +
{
 +
  Serial.begin(9600);
 +
}
 +
 +
void loop()
 +
{
 +
  long duration;
 +
 +
  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
 +
  // We give a short LOW pulse beforehand to ensure a clean HIGH pulse.
 +
 +
  pinMode(pingPin, OUTPUT);
 +
  digitalWrite(pingPin, LOW);
 +
  delayMicroseconds(2);
 +
  digitalWrite(pingPin, HIGH);
 +
  delayMicroseconds(5);
 +
  digitalWrite(pingPin, LOW);
 +
 +
  // The same pin is used to read the signal from the PING))): a HIGH
 +
  // pulse whose duration is the time (in microseconds) from the sending
 +
  // of the ping to the reception of its echo off of an object.
 +
 +
  pinMode(pingPin, INPUT);
 +
  duration = pulseIn(pingPin, HIGH);
 +
 +
  Serial.print(duration);
 +
  Serial.print("us");
 +
  Serial.println();
 +
 +
  delay(100);
 +
}
 +
 +
</source>
 +
 +
 +
 +
=== pulseIn() ===
 +
 +
'''Description'''
 +
 +
Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for
 +
the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns
 +
the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.
 +
 +
The timing of this function has been determined empirically and will probably show errors in longer pulses.
 +
Works on pulses from 10 microseconds to 3 minutes in length.
 +
 +
'''Syntax'''
 +
 +
pulseIn(pin, value)
 +
pulseIn(pin, value, timeout)
 +
 +
'''Parameters'''
 +
 +
pin: the number of the pin on which you want to read the pulse. (int)
 +
 +
value: type of pulse to read: either HIGH or LOW. (int)
 +
 +
timeout (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)
 +
 +
'''Returns'''
 +
 +
the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long)
 +
 +
== Connection ==
 +
 +
 +
Interfacing to the microcontrollers is a snap: a single (shared) I/O pin is use to trigger the Ping sensor and "listen" for the echo return pulse.  An onboard three-pin header allows the PING))) to be plugged into a solderless breadboard (on an Acrob, for example), and to be connected to its host through a standard three-pin servo extension cable.
 +
 +
[[Obrázok:SensorPingConnection.png|center|600px]]
 +
 +
 +
== Sources of errors ==
 +
 +
 +
=== Air Temperature ===
 +
 +
Changing environmental conditions are the main source of the differences. Many quantities influences measurement
 +
including temperature, humidity, turbulences, pressure and damping. Main source of error is air circulation and
 +
temperature. Many equations appears in literature, two of them are mentioned here:<BR>
 +
<math>
 +
(1) \qquad    c = c_0 ( 1 + \gamma \vartheta )( 1 + A_V \eta ) 
 +
</math>
 +
 +
where
 +
* <math>c_0</math> - speed of the sound at 0° C and 0% RH (c0 = 331,5 [m/s]),
 +
* <math>\gamma</math> - temperature coefficient of the speed (@ 0° C), γ = 1.83 10-3 [°C-1],
 +
* <math>A_V</math> - humidity constatnt (AV = 2,2 . 10^-4, for 50 ÷ 200 kHz),
 +
* <math>\eta</math> - relative humidity of air [%],
 +
* <math>\vartheta</math> - air temperature [°C].
 +
 +
For practical purposes we can abandon humidity influences and then simplified formula applies:<BR>
 +
<math>
 +
(2)  \qquad  c = c_0 + 0,6 \vartheta  [m/s]
 +
</math>
 +
 +
The percent error over the sensor’s operating range of 0 to 70 ° C is significant, in the magnitude of 11
 +
to 12 percent. The use of conversion constants to account for air temperature may be incorporated into
 +
your program.
 +
 +
 +
  
  
Riadok 34: Riadok 190:
  
  
[MEMS inteligentné senzory a aktuátory#Cvi.C4.8Denia|Návrat na zoznam cvičení...]]
+
[[MEMS inteligentné senzory a aktuátory#Cvi.C4.8Denia|Návrat na zoznam cvičení...]]
  
 
[[Category:MEMS]]
 
[[Category:MEMS]]

Verzia zo dňa a času 08:17, 3. apríl 2017

Ultrazvukové snímače

Zadanie pre ultrazvukový snímač

  1. Zmerajte dobu odozvy UZ snímača pri odraze od prekážky
  2. Prepočítajte zmeranú dobu odozvy na vzdialenosť v cm (výpočet)
  3. Pridajte kompenzáciu na vplyv teploty (výpočet)
  4. Zmerajte prevodovú charakteristiku snímača s kompenzáciou a bez kompenzácie (tabuľka + grafická závislosť zmeranej vzdialenosti od skutočnej)
  5. Zmerajte kritický uhol pre vzdialenosť 50, 100 a 150 cm.
  6. Zmerajte minimálnu veľkosť detekovanej prekážky
  7. Určte minimálnu a maximálnu detekovanú vzdialenosť
  8. Nájdete objekt neviditeľný pre tento senzor?
  9. Zmerajte vyžarovaciu charakteristiku senzora

Domáca úloha

Mobilný robot na Marse je natočený smerom na východ. Ultrazvukový otočný senzor zmeral objekty, ktoré treba preskúmať v nasledovných troch smeroch (uvedená je vždy séria niekoľkých meraní v stupňoch):

  • a) 85, 95, 110, 90
  • b) 350, 360, 0, 10
  • c) 350, 360, 10, 360

Všetky tri sa nachádzajú vo vzdialenosti 100 m. Vypočítajte priemernú hodnotu a smerodajnú odchýlku a na základe toho rozhodnite:
Ktorým smerom sa má vydať na prieskum, aby minul čo najmenej času a energie na otáčanie?



Ultrasonic sensor for distance measurement

SensorPING.jpg

In following application we will use the Parallax PING))) Ultrasonic sensor.

Features:

  • Provides precise, non-contact distance measurements within a 2 cm to 3 m range
  • Simple pulse in/pulse out communication
  • Burst indicator LED shows measurement in progress
  • 20 mA power cosumption
  • Narrow acceptance angle

Key Specifications:

  • Power requirements: +5 VDC
  • Communication:Positive TTL pulse
  • Dimensions: 22 x 46 x 16 mm
  • Operating temp range: 0 to +70 °C


Principle of operation

The Ping sensor measures distance using sonar; an ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return. Output from the PING))) sensor is a variable-width pulse that corresponds to the distance to the target.

SensorPingOperation.png
SensorPingUS Cone.png

The PING))) sensor detects objects by emitting a short ultrasonic burst and then "listening" for the echo. Under control of a host microcontroller (trigger pulse), the sensor emits a short 40 kHz (ultrasonic) burst. This burst travels through the air, hits an object and then bounces back to the sensor. The PING))) sensor provides an output pulse to the host that will terminate when the echo is detected, hence the width of this pulse corresponds to the distance to the target.


Example program

int pingPin = 11;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  long duration;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // We give a short LOW pulse beforehand to ensure a clean HIGH pulse.

  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.

  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  Serial.print(duration);
  Serial.print("us");
  Serial.println();

  delay(100);
}


pulseIn()

Description

Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.

The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length.

Syntax

pulseIn(pin, value) pulseIn(pin, value, timeout)

Parameters

pin: the number of the pin on which you want to read the pulse. (int)

value: type of pulse to read: either HIGH or LOW. (int)

timeout (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)

Returns

the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long)

Connection

Interfacing to the microcontrollers is a snap: a single (shared) I/O pin is use to trigger the Ping sensor and "listen" for the echo return pulse. An onboard three-pin header allows the PING))) to be plugged into a solderless breadboard (on an Acrob, for example), and to be connected to its host through a standard three-pin servo extension cable.

SensorPingConnection.png


Sources of errors

Air Temperature

Changing environmental conditions are the main source of the differences. Many quantities influences measurement including temperature, humidity, turbulences, pressure and damping. Main source of error is air circulation and temperature. Many equations appears in literature, two of them are mentioned here:

 (1) \qquad    c = c_0 ( 1 + \gamma \vartheta )( 1 + A_V \eta )

where

  • c_0 - speed of the sound at 0° C and 0% RH (c0 = 331,5 [m/s]),
  • \gamma - temperature coefficient of the speed (@ 0° C), γ = 1.83 10-3 [°C-1],
  • A_V - humidity constatnt (AV = 2,2 . 10^-4, for 50 ÷ 200 kHz),
  • \eta - relative humidity of air [%],
  • \vartheta - air temperature [°C].

For practical purposes we can abandon humidity influences and then simplified formula applies:

 (2)  \qquad  c = c_0 + 0,6 \vartheta  [m/s]

The percent error over the sensor’s operating range of 0 to 70 ° C is significant, in the magnitude of 11 to 12 percent. The use of conversion constants to account for air temperature may be incorporated into your program.



Potrebujete pravítko, alebo uhlomer?

  1. Printable paper rules
  2. Uhlomer 1
  3. Uhlomer 2
  4. Uhlomer 3


Návrat na zoznam cvičení...