circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 150 January 2003
The PSoC RangeFinder
A Simple Ultrasonic Distance Meter


by Fabio Piana

Some distances are more difficult to measure than others. Therefore, Fabio built his own ultrasonic rangefinder, which won First Prize in the Cypress PSoC design contest. It can be used for measuring liquid levels, generic distances, and even the depth of snow.


Start Micro ConfigurationThe Hardware Practical Construction Things To ConsiderSources and PDF

There are several ways to measure distance without contact. Some products have infrared light emitters and receivers that determine an object’s distance by implementing the optical triangulation method. Other devices have laser-based systems that increase accuracy and precision. For electrically conductive metal objects, the eddy current method is an option, and capacitive sensors that are independent of the metal used in the measured objects can be used.

I decided to use ultrasonic waves. My ultrasonic PSoC RangeFinder measures the amount of time it takes for a pulse of sound to travel to a particular surface and return. Then, the device calculates the distance based on the estimated speed of sound. In this article, I’ll explain how I built this simple ultrasonic distance meter.

Photo 1a is a picture of my PSoC RangeFinder with an LCD. The display is optional, and I removed it for Photo 1b. For this particular application, the only required components are a PSoC microcontroller, two 40-kHz ultrasonic transducers, two resistors, and two capacitors. Similar circuits are typically complicated and expensive, consisting of a large number of integrated circuit and passive components.

(Click here to enlarge)

Photo 1a—There are several things to consider when building your own ultrasonic rangefinder, including whether or not to incorporate an LCD. b—Take a look at the PSoC RangeFinder without the LCD.

Take a look at the RangeFinder’s system block diagram in Figure 1. As you can see, it’s divisible into three parts: the transmitting section, receiving section, and output section. Each section contains several PSoC blocks. Using the PSoC chip family, all of the digital and analog devices are on-board with the microcontroller.

(Click here to enlarge)

Figure 1—There are three distinct sections in my PSoC RangeFinder project: digital blocks, analog blocks, and transducers.

The RangeFinder has numerous applications. You can use it for the positioning of robots as well as measuring generic distances, liquid levels in tanks, and the depth of snow banks. The device can also serve as a motion detector in production lines where surfaces must not be damaged, or you can use it for educational purposes.

A restricted target angle (it requires a near-perpendicular surface) and large beam, which can create poor resolution, seem to be the RangeFinder’s only limitations. Despite these drawbacks, you’ll find the device’s main features to be extremely useful.

The RangeFinder has a 40-kHz operating frequency, a range of 25 to 200 cm, and 1-cm resolution. In addition, it requires only a single 5-VDC power supply and draws just 25 mA (23 mA without the LCD). The device has one PWM output and one TTL-level serial output (9600 bps, 8 bits, 1 stop bit, and no parity). Finally, don’t forget the optional 2 × 16 LCD, software calibration, and dynamic receiver stage gain increment.