📄 008.htm
字号:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>008 - Ultrasonic Range Meter</title>
</head>
<body background="http://www.techdesign.be/pic-main/bg1.jpg" topmargin="0" leftmargin="5" vlink="#0000FF" alink="#0000FF" link="#0000FF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="37">
<tr>
<td width="87%" height="37">
<b>
<font color="#0099FF" size="4" face="Lucida Sans Unicode">Ultrasonic Range
Meter </font>
</b></td>
<td width="13%" height="37" bgcolor="#FFFF00">
<p align="center"><font face="Lucida Sans Unicode">
<a style="text-decoration: none" href="../../projects.htm"><font color="#0099FF">
Projects </font>
<font color="#3399FF">Home</font></a></font></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="81%">
<p align="justify">
Measure the distance to an object within 25 cm to 8 meters using standard 40
kHz transducers. Takes around 20 samples per second.<p align="justify">
Very useful for robotics! The first v2 version takes only 5 mA at 9v. The
schematics are based on a project from
<a href="http://www.elektor-electronics.co.uk/" style="text-decoration: none">
Elektor</a> dating from 1982!!!<p align="justify">
Here again, the
<a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/nokia_3310_LCD.jpg">NOKIA LCD</a> has been chosen for display. The circuit is controlled by a
PIC16F877 running at 4 MHz.<p align="justify">
In the next v3 version i'll try to reduce the minimum distance & power consumption.</td>
<td width="19%">
<img border="0" src="008_sensors.jpg" width="150" height="139" align="right"></td>
</tr>
</table>
<hr color="#FF0000">
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
<tr>
<td width="26%">
<img border="0" src="008_v2_lcd.jpg" width="250" height="221"></td>
<td width="74%">At 20<font face="Times New Roman">篊/68篎</font>, sound travels
through the air at 343,8 m/s. This is approximately 29祍 for 1 cm.<p>We want
to measure the distance to an object. To do so, we will have to measure the
time between the transmission & the reflected reception of an ultrasonic pulse.</p>
<p>Because the reflected pulse will travel twice until received back, we
divide the speed by two. So, this makes 58礢 for 1 cm.</p>
<p>This v2 version counts the amount of periods of 58礢 it takes until the
ultrasonic pulse is received back.</td>
</tr>
</table>
<hr color="#0000FF" size="1">
<p><font face="Lucida Sans Unicode"><b>
<span style="BACKGROUND-COLOR: #ffffcc">Waveforms:</span></b></font></p>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<td width="100%">
<p align="center">
<img border="0" src="008_timing.jpg" width="789" height="122"><p align="center">
</td>
</tr>
</table>
<hr color="#FFFF00" size="1">
<p><font face="Lucida Sans Unicode"><b><span style="background-color: #FFFFCC">
Schematic:</span> </b></font><b><font size="2" face="Lucida Sans Unicode"> right-click & "save picture as" for
full resolution or download the eagle-file below.</font></b></p>
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
<tr>
<td width="100%">
<p align="center"><b><font size="4" color="#0099FF">basic v2 version </font>
</b></td>
</tr>
<tr>
<td width="100%">
<img border="0" src="008_v2_sch.gif" width="980" height="578"></td>
</tr>
</table>
<hr color="#808080" size="1">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="93%" id="AutoNumber3">
<tr>
<td width="5%"> </td>
<td width="35%">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="88%" id="AutoNumber5" align="left" bgcolor="#FFFFCC">
<tr>
<td width="50%" align="center">
<p align="center"><b>PIC</b></td>
<td width="50%" align="center"><b> NOKIA LCD</b></td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center">1= +5v</td>
</tr>
<tr>
<td width="50%" align="center">RD6</td>
<td width="50%" align="center">2= sclk</td>
</tr>
<tr>
<td width="50%" align="center">RD7</td>
<td width="50%" align="center">3= sda</td>
</tr>
<tr>
<td width="50%" align="center">RD0</td>
<td width="50%" align="center">4= d/!c</td>
</tr>
<tr>
<td width="50%" align="center">RD3</td>
<td width="50%" align="center">5= !cs</td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center">6= gnd</td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center">7=Vout</td>
</tr>
<tr>
<td width="50%" align="center">RD1</td>
<td width="50%" align="center">8= !res</td>
</tr>
</table>
</td>
<td width="28%">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="81%" id="AutoNumber6" bgcolor="#FFFFCC">
<tr>
<td width="50%" align="center">
<p align="center"><b>PIC</b></td>
<td width="50%" align="center"><b>US signal</b></td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center"> </td>
</tr>
<tr>
<td width="50%" align="center">RB2</td>
<td width="50%" align="center">USRX_q</td>
</tr>
<tr>
<td width="50%" align="center">RD2</td>
<td width="50%" align="center">USRX_res</td>
</tr>
<tr>
<td width="50%" align="center">RD4</td>
<td width="50%" align="center">USTX_en</td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center"> </td>
</tr>
</table>
</td>
<td width="85%">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="59%" id="AutoNumber6" bgcolor="#FFFFCC">
<tr>
<td width="50%" align="center">
<p align="center"><b>PIC</b></td>
<td width="50%" align="center"><b> i瞔</b></td>
</tr>
<tr>
<td width="50%" align="center"> </td>
<td width="50%" align="center"> </td>
</tr>
<tr>
<td width="50%" align="center">RC3,SCK</td>
<td width="50%" align="center">SCL</td>
</tr>
<tr>
<td width="50%" align="center">RC4,SDI</td>
<td width="50%" align="center">SDA</td>
</tr>
</table>
</td>
<td width="96%">
</td>
</tr>
</table>
<hr color="#FFFF00" size="1">
<p align="left">
<b><font face="Lucida Sans Unicode"><span style="background-color: #FFFFCC">
Downloads:</span></font></b><p align="left">
<font face="Lucida Sans Unicode" color="#FF9900" size="2"><b><span style="background-color: #FFFFCC"> WARNING:
</span> </b><span style="background-color: #FFFFCC">may not be
duplicated for any commercial use whatsoever without explicit consent from the
author.</span></font><font face="Lucida Sans Unicode" size="2"><b>
<a style="text-decoration: none" href="mailto:info@techdesign.be?subject=008 - US Range Meter">(c) Michel Bavin.</a></b></font><font face="Lucida Sans Unicode" color="#FF9900" size="2"><b><span style="background-color: #FFFFCC"><a style="text-decoration: none" href="mailto:info@techdesign.be?subject=008 - US Range Meter">
</a>
</span> </b></font><p align="justify">
<u><font face="Lucida Sans Unicode" size="2">
<b>
Hex files:</b></font></u></p>
<p align="justify"><font face="Lucida Sans Unicode" size="2">
<a style="text-decoration: none" href="008_v2_hex.zip"><b>
008_v2_hex.zip</b>,</a> October 7,
2003: <b>us_v2.hex</b> (to program the PIC) <b> </b></font></p>
<p align="justify"><font face="Lucida Sans Unicode" size="2"><b>
<a style="text-decoration: none" href="ascii_eeprom_v2.zip">ascii_eeprom_v2.zip,</a>
</b>September 10, 2003: <b>ascii_eeprom_v2.hex</b> (for the EEPROM.)</font></p>
<p align="justify"><font face="Lucida Sans Unicode">
----------------------------------------------</font></p>
<p align="justify"><font face="Lucida Sans Unicode" size="2">
<u>
<b>
Source code</b>:</u>
<b>
<a style="text-decoration: none" href="008_v2_c.zip">008_v2_c.zip </a> </b>(Hi-Tech
PICC), October 7, 2003: <b>us_v2.c</b> , with<b> </b>include files <b>defs.h</b>, <b>delay.c</b>,
<b>delay.h </b></font></p>
<p><font face="Lucida Sans Unicode" size="2">
<u>
<b>
Schematics:</b></u><b>
</b></font><b>
<a style="text-decoration: none" href="008_v2_sch.zip">
<font face="Lucida Sans Unicode" size="2">
008_v2_sch.zip</font></b><font face="Lucida Sans Unicode" size="2"> </font></a><font face="Lucida Sans Unicode" size="2">
(Eagle), October 7, 2003.</font></p>
<p><font face="Lucida Sans Unicode" size="2">
<u>
<b>
PCB:</b></u><b>
</b></font><b>
<font face="Lucida Sans Unicode" size="2">
<a style="text-decoration: none" href="008_v2_brd.zip">008_v2_brd.zip</a></font></b><font face="Lucida Sans Unicode" size="2">
(Eagle), march 26, 2004.</font></p>
<hr color="#FFFF00" size="1">
<p><font face="Lucida Sans Unicode"><b><span style="background-color: #FFFFCC">Source code explanation:</span> </b>(Hi-Tech
PICC)</font></p>
<p><font face="Lucida Sans Unicode" size="2">ultrasonic driving: coming soon.</font></p>
<p><font color="#0000FF"><u>
<a href="../routines/eeprom_to_nokia_void_a.htm" style="text-decoration: none">i瞔
EEPROM to NOKIA:</a></u><a href="../routines/eeprom_to_nokia_void_a.htm" style="text-decoration: none">
void ext_eeprom_to_nokialcd(void)</a></font><font size="2" color="#0000FF">:
</font><font size="2">read character en symbol data in eeprom & send them to the
NOKIA LCD.</font></p>
<p><font color="#0000FF"><u>
<a href="../routines/nokia_voids.htm" style="text-decoration: none">NOKIA LCD:</a></u><a href="../routines/nokia_voids.htm" style="text-decoration: none">
various routines<font size="2">.</font></a></font></p>
<hr color="#0000FF" size="1">
<p><b><font face="Lucida Sans Unicode"><span style="background-color: #FFFFCC">
Tools:</span></font></b></p>
<p><font face="Lucida Sans Unicode" size="2">I work with the
<a href="http://www.htsoft.com/" style="text-decoration: none">Hi-tech PICC </a>compiler.
It is relatively easy to use AND has a complete working FREE version (PICC Lite)
available. This lite version is limited to 2K for the 16F877 (1/4 of total code
size) but this is sufficient for this projects. You'll have to install
Microchip's free
<a href="http://www.microchip.com/1010/pline/tools/picmicro/devenv/mplabi/mplab6/index.htm" style="text-decoration: none">
MPLAB IDE</a> to get things going.</font></p>
<p><font face="Lucida Sans Unicode" size="2">Programming of the PIC was done with
<a href="http://www.ic-prog.com/" style="text-decoration: none">IC-Prog </a>on a
<a href="../004/004.htm" style="text-decoration: none">PIC-
programmer</a> built from Electronique pratique nr 253 (January 2001).</font></p>
<p><font face="Lucida Sans Unicode" size="2"><font color="#FF9900">Eagle</font> was used for the PCB layout. The
<a href="http://www.cadsoft.de/freeware.htm" style="text-decoration: none">free version</a> was ok for this
design. Best is to download the schematic below and then to create your own
board.</font></p>
<hr color="#FF0000" size="1">
<p><font face="Lucida Sans Unicode"><b><span style="background-color: #FFFFCC">Info & datasheet:</span></b></font></p>
<p><font face="Lucida Sans Unicode" size="2">
<a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/24LC256.pdf">24C256 i瞔
EEPROM</a></font></p>
<p><font face="Lucida Sans Unicode" size="2">Graphic LCD module type
<font color="#0000FF">
<a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/nokia_3310_LCD.jpg">LPH7779 (NOKIA 3310 LCD)</a></font></a><a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/nokia_3310_LCD.jpg">
</a>and its integrated controller
<font color="#0000FF">
<a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/pcd8544.pdf">PCD8544</a></font></a><a style="text-decoration: none" href="http://www.techdesign.be/projects/datasheet/pcd8544.pdf"><font color="#0000FF">.</font></a></font></p>
<hr style="background-color: #FFFF00" color="#FFFF00" size="1">
<p align="center"><font face="Lucida Sans Unicode">
<font color="#0099FF">
<a style="text-decoration: none; background-color:#FFFF00" href="../../projects.htm">Projects
</a> </font>
<a style="text-decoration: none; background-color:#FFFF00" href="../../projects.htm">Home</a><font color="#0000FF"></a></font><a style="text-decoration: none; background-color:#FFFF00" href="../../projects.htm"> </a> </font></p>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -