<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Lesson_10--Microduino_Ultrasonic_Sensor_Measures_Distance</id>
		<title>Lesson 10--Microduino Ultrasonic Sensor Measures Distance - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Lesson_10--Microduino_Ultrasonic_Sensor_Measures_Distance"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Lesson_10--Microduino_Ultrasonic_Sensor_Measures_Distance&amp;action=history"/>
		<updated>2026-04-22T05:02:50Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Lesson_10--Microduino_Ultrasonic_Sensor_Measures_Distance&amp;diff=8168&amp;oldid=prev</id>
		<title>1304410487@qq.com：Created page with &quot;{{Language | 第十课--Microduino 超声波测距}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This lesson will show how to use the Microduino ultrasonic sensor to control b...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Lesson_10--Microduino_Ultrasonic_Sensor_Measures_Distance&amp;diff=8168&amp;oldid=prev"/>
				<updated>2015-03-26T02:46:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language | 第十课--Microduino 超声波测距}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This lesson will show how to use the Microduino ultrasonic sensor to control b...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language | 第十课--Microduino 超声波测距}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
This lesson will show how to use the Microduino ultrasonic sensor to control buzzer and measure distance. You'll know the ultrasonic control by this simple example.&lt;br /&gt;
&lt;br /&gt;
Test object is the SRF-04 ultrasonic sensors with four pins: 5v power supply (Vcc), trigger control pin (Trig), the receiver (Echo), and the GND.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
*Other equipments:&lt;br /&gt;
**Breadboard Jumper            one box   &lt;br /&gt;
**Breadboard  	               one piece  &lt;br /&gt;
**USB Data cable               one&lt;br /&gt;
**Buzzer                       one&lt;br /&gt;
**Ultrasonic sensor            one&lt;br /&gt;
&lt;br /&gt;
[[File:intermediateLesson10All1.jpg|600px|center|thumb]]&lt;br /&gt;
[[File:intermediateLesson10All2.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
'''Ultrasonic sensor'''&lt;br /&gt;
[[File:第十课-超声波传感器.jpg|600px|center|thumb]]&lt;br /&gt;
'''Brief Introduction：'''&lt;br /&gt;
Ultrasonic sensor is designed by the characteristics of ultrasonic. Ultrasound is a kind of mechanical wave of vibration frequency is higher than the sound wave, is generated by changing the chip vibration under the excitation of voltage. It has a higher frequency, shorter wavelengths, small diffraction phenomenon, especially good directivity, can become rays and directional transmission etc. Ultrasonic penetrating power of liquid and solid is very big, especially in sunshine opaque solid, it can penetrate tens of metres in depth. Ultrasonic encounter impurities or interface can produce significant reflection form into echo, touching the moving objects can produce doppler effect. So ultrasonic detection is widely used in industry, national defense, biomedicine etc.&lt;br /&gt;
&lt;br /&gt;
'''Components：'''&lt;br /&gt;
Ultrasonic probe is mainly composed of piezoelectric wafer, can emit ultrasonic already, also can receive ultrasonic. Low power ultrasound probe for detecting effect. It has a lot of different structure, can be divided into straight probe (longitudinal wave), oblique probe (shear wave) and surface wave probe (surface wave), lamb wave sensor (lamb wave), double probe (a probe reflection, a probe receiving) etc.&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
[[File:第十课-Microduino超声波测距原理图.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
Download program:&lt;br /&gt;
https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced/MicroduinoUltrasonicRanging&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
const int TrigPin = 3;&lt;br /&gt;
const int EchoPin = 2;&lt;br /&gt;
float cm;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
	Serial.begin(9600);&lt;br /&gt;
	pinMode(TrigPin, OUTPUT);&lt;br /&gt;
	pinMode(EchoPin, INPUT);&lt;br /&gt;
	pinMode(8,OUTPUT);&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
	digitalWrite(8, LOW);&lt;br /&gt;
	digitalWrite(TrigPin, LOW); //Send a low level voltage pulse to TrigPin&lt;br /&gt;
	delayMicroseconds(2);&lt;br /&gt;
	digitalWrite(TrigPin, HIGH);&lt;br /&gt;
	delayMicroseconds(10);&lt;br /&gt;
	digitalWrite(TrigPin, LOW);&lt;br /&gt;
&lt;br /&gt;
	cm = pulseIn(EchoPin, HIGH) / 58.0; //Echo time convert to cm&lt;br /&gt;
	cm = (int(cm * 100.0)) / 100.0; //Keep two decimal places&lt;br /&gt;
	if (cm&amp;gt;=2 &amp;amp;&amp;amp; cm&amp;lt;=10)&lt;br /&gt;
		digitalWrite(8, HIGH);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
Step 1：Copy the upper code to IDE and compile&lt;br /&gt;
&lt;br /&gt;
Step 2：Compile no error, then set up the circuit, as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:intermediateLesson10Connect1.jpg|600px|center|thumb]]&lt;br /&gt;
[[File:intermediateLesson10Connect2.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
[[File:第十课-Microduino超声波测距电路图.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Step 3: Run program&lt;br /&gt;
&lt;br /&gt;
Step 4：Put the hand in front of ultrasonic sensor, listening the sound of the buzzer.&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
If there is an object in front of the ultrasonic sensor, and the distance of the object is larger than 2 cm, less than 10 cm, buzzer will sound. You can make an ultrasonic alarm based on this.&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
http://v.youku.com/v_show/id_XNjc1NjQxMjU2.html&lt;/div&gt;</summary>
		<author><name>1304410487@qq.com</name></author>	</entry>

	</feed>