Recently, Jaime Andres Arteaga designed a simple C program to use a SRF05 ultrasonic sensor, low cost ultrasonic rangefinder up to 5 meters, with AVR ATmega32. The microcontroller sends a pulse trigger (10 us minimum) and then, the sensor produces a pulse that is proportional to the distance.
In this project, the SRF05 is connected in MODE 1. This mode uses separate trigger and echo pins, and is the simplest mode to use. To use this mode, just leave the mode pin unconnected – the SRF05 has an internal pull up resistor on this pin. This project is very useful for hobbyist who wants to build range finder
The SRF05 Ranger has the unique ability to operate in two different modes to provide system design options when implementing the sensor into resource constrained microcontroller. The BrainStem GP tells the SRF05 module to emit a “ping” and measure the time it takes to receive an echo. It reveals the distance as a raw time in increments of the timer’s resolution which is 1.6 uSec that can be directly translated into distance. Operational Mode 1 is back compatible to the Devantech SRF04 , and requires two different digital pins to provide the trigger and the echo pulses when taking readings. A second example illustrates how to use the operational Mode 2 that only requires the use of a single digital IO pin to handle the triggering and echoing functions. Both examples use a host computer running the Console application to display the sonar readings measured from the BrainStem.