SonaMini Sonar Sensor Info

SonaMini Description:

The SonaMini Sonar Sensors are complete sonar transmitter/receiver systems. They are designed to be used as rangefinders, but can be hacked for a variety of other purposes (communications, etc). The SonaMini is conrtolled by a small on-board microprocessor and can be used in a variety of modes.


  1. All I/O signals are 5V signals except for the power input. Do not exceed a range of 0-5V on the sonar I/O lines.
  2. Do not adjust any potentiometer settings on the back board of SonaMini sensor - you can render your SonaMini useless.
  3. A high voltage is used to drive the sonar transducer. Do not touch the "H" tab going to the transducer, as it will shock you. The shock is unpleasant but not dangerous.
General Specs
Spec Value
Supply Voltage 8-16VDC (pinging will still occur at lower voltages but the unit will not function predictably)
Min Range ~15cm (0.5 feet) (confirmed)
Max Range ~5.8 meters (19 feet) (confirmed)
Beam Angle 15 degrees nominal, cone shaped
Speed of Sound 340.29 meters/second (at sea level, 25C, 101.325kPa)

SonaMini-S Model Sonar Sensor

Pin # Description
1 8-16VDC Power Input (note: sonar will start pinging at ~5VDC, but will not really work until 7-8V power input is reached)
2 Ground
3 External Trigger Input (a brief 5V high pulse here will trigger a sonar ping)

External Trigger Enable (digital input: High=self-trigger 5Hz, Low=ext. trigger, Pin3)


Sonar TOF Out (This pin goes high at the instant that a ping is transmitted, and then goes low when the echo of the ping is received. In other words, the pulse width of this electrical signal is equal to the time-of-flight, or TOF, of the sonar sound pulse.)


Range Trigger 1 (NPN open-collector output that goes low when the sonar detects an object closer than a preprogrammed distance. The distance at which this output triggers is unknown for our sensors.)

7 Range Trigger 2 (NPN open-collector output that goes low when the sonar detects an object closer than a preprogrammed distance. The distance at which this output triggers is unknown for our sensors.)
Determining Range using the SonaMini:

Determining range with the SonaMini Sensor is easy but requires careful measurement of the pulse width on the Sonar TOF Out pin. Every time the sonar "pings", a pulse is generated on the Sonar TOF Out pin. If you measure the pulse width in seconds, you will get the amount of time the sound pulse took to travel to the target and then travel back to the SonaMini. This time is called the sonar Time-of-Flight, or TOF. If you multiply the TOF by the speed of sound, the result is the round-trip distance, or twice the range to your target.

To get accurate distance measurements, two sources of error must be taken into account: detection delay, and variations in the speed of sound. The first is the sonar detection delay in the SonaMini. This is the amount of time that the SonaMini takes to detect a sonar echo pulse (I have measured it to be 1.7ms typically, but your sensor may be different). You must subtract this detection delay from the Sonar TOF pulse width to get the "real" time-of-flight. The you can multiply this corrected TOF by the speed of sound.

Actual TOF[s] = TTOF Pulse width[s] - TDet Delay[s]
Range[m] = (Actual TOF[s] * 340.29[m/s]) / 2

To get the best possible readings, you must also calculate or measure the actual speed-of-sound at your location. The speed of sound is directly related to air density, and gets slower as air gets less dense. Thus anything that causes air to change density will alter your readings slightly. Factors include elevation, temperature, and weather patterns. Typical error due to temp and weather is small, usually +/- a few percent, but elevation can be very important.

The easiest way to take into account these two error sources is to calibrate your sonar range readings against two known ranges. From two known-distance readings, you can easily figure out both detection delay, and your local speed of sound using simple algebra. For extra precision, you can average across several readings at each of the two distances, or measure at several distances and do a linear regression line.

Using a microcontroller to operate the SonaMini:

When using a microcontroller like the BasicStamp or AVR to operate the SonaMini sensor, you must do two things:

  1. Trigger the sensor to send a sonar pulse, or "ping"
    (this is optional since the SonaMini will automatically ping at 5Hz if the external trigger is not enabled)
  2. Accurately measure the resulting TOF output pulse-width
    On a BasicStamp, you might use the pulsein command
    On an AVR, you can use the Input Capture pin (IC1) and Input Capture logic on Timer1

SonaMini Links:

Written by Pascal Stang | Updated: Tuesday November 02, 2004