ultrasonic level sensor programmingLike anything else, there are both cheap and good quality ultrasonic sensors out there. Besides good manufacturing, one of the major differences between a good sensor and everything else is programmability. While non-configurable sensors might seem like a bargain, the advantages of programmable sensors add up to dependable readings and better control of your operation.

Since we can’t speak for all ultrasonic sensors on the market, let’s explore some of the benefits offered through our sensor’s programmable settings. Here are the 18 settings you can adjust in an APG ultrasonic sensor for optimal performance:

Output Control

Units Of Measure

The needs and requirements of every customer and application are different, including the units of measure being used. Your sensor's utility software ought to be able to do metric and imperial conversions for you, so you and your staff don't have to.

Analog Scaling

Our sensors not only let you select the unit of measure you need (including volumetric units), but they let you set the end points of your output signal (0-5V, 4-20mA, etc) as needed. So you can measure the distance between your sensor face and the liquid level, or you can measure the distance between the bottom of your tank and the level surface.

This is also useful for focusing the output of your sensor over the actual physical range of your target area.

For example, an unconfigured ultrasonic sensor with a range of 1.5’ to 25’ operating over an actual range of 10’ to 18’ will only ever have an output between 9.78mA and 15.23mA, with an approximate resolution of .68mA/foot. In contrast, a programmable ultrasonic sensor with analog scaling over the same 10’ to 18’ range can be configured to use its entire 4-20mA output over that 8’ range, with a resulting resolution of 2mA/foot.

Ignoring Obstacles

Blanking Distance

pipe in an oil storage tankThe transducer in your ultrasonic sensor needs time to transition from creating sound waves to receiving the reflected sound waves back from the target surface. If an object is too close to the sensor, the vibrations on the transducer from reflected waves will be indistinguishable from the vibrations creating sound waves.

The time necessary to stop the residual vibrations on the transducer translates into a minimum distance between the sensor and the closest objects it can accurately measure. Or, to turn it around, there is a minimum void space in front of the sensor, in which nothing will be measured. This is called the Blanking Distance.

By increasing the Blanking Distance, you can configure your sensor to ignore echoes from objects in close proximity to the front of the sensor. Your sensor can now be mounted above potential sources of interference (i.e., in a stand-pipe), rather than necessitating a flush mount at the lowest point above the surface of the measured material.

Maximum Distance

The Maximum Distance serves a similar function as Blanking Distance control. It has its limitations, but can be adjusted to ignore obstacles beyond a certain point.

It’s the farthest distance from the sensor face (regardless of Offset) from which the sensor will accept readings (regardless of Window). It is also the default sensor reading for loss of echo or no targets detected (e.g. no signal was received within range, so any target surface must be at least the maximum distance away).

Automation Functions

Trip Points

In addition to an analog level output, some sensors also include programmable trip relays or NPN trip outputs. These on/off outputs are fully configurable via the sensor’s programming software. Each output can be configured with two trip points and one of six trip types, allowing for greater control over and a better understanding of your system.

Signal Strength Control

Sensitivity and Pulses both work to increase your sensor’s ability to accurately receive signals from target objects. But they do so in opposite ways: one increases the ability of the sensor to detect weak incoming signals, while the other boosts the strength of the outgoing signal.


Sensitivity represents the amount of amplification applied to the returning signal, gauged from 0-100%. The higher the percentage, the better the sensor will be able to pick up a weak returning signal (i.e., one from the far end of the sensor's range). At the same time, higher gain also increases the likelihood of false positives from echoes and other electrical or acoustical noise.

Cranking up the Sensitivity of your sensor sounds like an easy way to extend its range. Ultimately, however, a longer-range sensor, with an intended target in the middle of its range and a lower sensitivity setting, will be more accurate than a shorter-range sensor that requires a much higher sensitivity setting to read an intended target near the end of its range.


volume knob on a guitarWhat Sensitivity does for the reflected signal, controlling the Pulse number can do, in essence, for the signal being created by the transducer. Increasing the number of pulses sent by the sensor’s transducer in each ultrasonic burst increases the strength of the outgoing signal. However, as with Sensitivity, increasing the Pulse number increases the likelihood of echo-based false positives.

Increased pulses also shorten the life of the transducer. So choosing a sensor that is fully capable for your application, rather than barely adequate, will result in more accurate readings across a longer sensor life.

As an added bonus, a sensor with Pulse set to 0 can provide useful troubleshooting feedback, as any readings other than the Maximum Distance indicate electrical interference. The sensor will not transmit when pulse is set to 0, so the only signals that would register with the sensor must be ambient electrical signals rather than signals originating from the sensor.

Automatic Optimization

Gain Control

Gain control allows you to choose how the percentage gain set in Sensitivity is applied to the incoming signals. There are four methods (helpfully numbered 0-3) to choose from:

  • 0, Manual, is exactly what it sounds like: the manually set gain percentage is applied to all in-coming signals.
  • 1, Autosense, is also straight-forward: the sensor automatically adjusts the gain, based on the strength of the received signal and the Sensitivity and Pulse settings. Because of the time required for signal processing, Autosense does not perform well with fast moving targets.
  • 2, Hard-Target, designed for good reflecting targets, uses a slowly increasing gain so that minimal gain will be applied to reach an optimal gain setting without over shooting.
  • 3, Soft-Target, is conversely designed for poor reflecting targets, ramping up gain quickly in anticipation of a high-gain need.

Stabilizing The Reading

The Average & Sample Rate settings will determine how quickly your sensor reacts to changing levels. By manipulating the number of samples taken per second, and how many of those are averaged to produce a valid reading, you can configure your sensor to react quickly or slowly to level changes.

Window and Out of Range Samples calibrate the physical space your sensor is “looking” at (listening to, really) for valid return signals. Together they create a specifically monitored area that moves with the changing level of the target surface.


Average sets the number of qualified received signals to average for the displayed reading. Qualified received signals are placed in a first-in, first-out buffer, the contents of which are averaged for the displayed output. The higher the number of qualified received signals being averaged, the smoother the output reading, as each new signal has a proportionally small impact on the averaged reading. By extension, an average based on a higher number of samples will be slower to react to quickly changing targets.

Sample Rate

Measured in Hertz, the Sample Rate is the number of samples taken by the sensor every second. Lower sample rates result in longer sensor life. And while higher sample rates allow for quicker sensor response times to changing levels, lower sample rates reduce the likelihood of echo-based false positives. As such, the sample rate ought to be carefully set to handle anticipated rates of level change.

Average and Sample Rate must be considered together in light of anticipated system conditions. A large number of samples to Average and a low Sample Rate will create a system slow to react to rapid level changes. For example, if your sensor is set with an Average of 20 (samples per reading) and a Sample Rate of 4 (samples per second), a significant change in material level won’t fully register on the output reading for 5 seconds.

Conversely, a low number of samples to Average and a high Sample Rate can create a system that reacts too quickly to insignificant changes. To turn the previous example around, a sensor with an Average of 4 and a Sample Rate of 20 updates its output reading 5 times per second.


Window determines the physical range of qualified received signals, based on the current reading. For example, if the sensor reading is 10 feet, and the window is 2 feet, any signal between 8 feet and 12 feet will be qualified for the averaging buffer. Signals less than 8 feet or beyond 12 feet will not qualify unless the average moves.

Out Of Range Samples

Signals outside the extents of the Window are not summarily ignored, however. The Out of Range Samples parameter establishes the number of consecutive samples outside the Window necessary to automatically adjust the current reading, and thus the window.

Using the previous example of a current reading at 10 feet and a +/- 2 foot window, let’s add an Out of Range Samples setting of 12. If 10 consecutive readings register around 6 feet, followed by one at 9 feet, those 10 are ignored. If, however, those 10 are followed by two at 7 feet, all twelve will be added to the average buffer, and the reading recalculated.

ultrasonic graph for window, average, and sample rate effectsThe graph to the right illustrates the example readings we've provided. It shows how Averaging, Sample Rate, Window, and the Out Of Range Samples settings work together to filter out returning echoes until they become consistent. While this can stop erroneous readings, it also slows down the response time to legitimate change.

Use these settings with careful consideration to balance clean readings and response time. It's possible use too much averaging and too high of a sample rate to ever see the correct readings. However, balance these settings effectively and you will end up with very reliable and smooth readings.

Dealing With Environmental Variables

Temperature Compensation

tanks in the sun get hotTemperature is the application variable that affects ultrasonic sensors the most. Without successful compensation for temperature change, the sensor fails to take accurate measurements.

The Temperature Compensation setting turns the sensor’s internal temperature compensation on or off in order to adjust for the 0.18% change in the speed of sound for every 1° C of temperature change. This works provided the sensor and the sensing range maintain approximately equal ambient temperatures. However, if there is a remarkable difference between the target surface temperature and that of the sensor, temperature compensation might do more harm than good.

Hence, the ability to turn temperature compensation on and off is quite valuable.


Multiplier and Offset are ways for you to make semi hardcoded adjustments to your sensor’s readings based on the physical conditions around your sensor.

Multiplier provides a calibration caveat against all the other settings of the sensor and the atmospheric conditions which may influence the reading of the sensor (temperature, humidity, etc.). Using the above example again, if the sensor reads 10 feet, but an actual measurement reads 9’-6”, the sensor could be adjusted by setting the multiplier to 9.5/10=.95 feet. This will multiply all the sensor’s reading by .95, producing a signal output that is 95% of the original reading.


Offset is used to adjust the zero point of the sensor. The default setting is 0, which corresponds to the front face of the sensor. A negative number moves the zero point behind the sensor, while a positive number moves it in front of the sensor. A positive offset allows for the sensor to be mounted above a highpoint, say above a spillway or levee, and give readings relative to the top of those structures, rather than wherever the face of the sensor happens to be.

Finding & Eliminating Noise

In theory, a smooth, motionless target surface in an ideal tank would reflect only one signal back to the sensor. Increased chaos in the system, e.g., motion on the target surface or welds and dents in the surface of the tank, create extraneous echoes, which can impede the sensor’s ability to read the target surface accurately. View Noise Level and Set Noise Threshold can help overcome the noise.

View Noise Level

View Noise Level isn’t actually a programmable parameter, but a display of the number of echoes being picked up by the sensor. The presence of more than 30 echoes often indicates a noise source (acoustical or electrical) that could hamper sensor operation. Reducing the sensitivity may help cut down the influence of noise.

Set Noise Threshold

The Set Noise Threshold feature can hold the sensor reading during an event of increased noise to avoid confusion. You can set a noise threshold that, when exceeded, activates a steady reading on the sensor until the noise level (number of echoes) returns below the set threshold.

Calculating Volume In Irregular Tanks

Strapping Charts

Not all tanks are linear. Many are irregular, and will not product an accurate volume measurement with a level measurement sensor. To compensate for non-linear tanks, some of our ultrasonic sensors have a strapping chart, or a linearization table. Strapping charts allow you to assign a volume to a series of given level measurements. The sensor will use those known points to linearize the tank and give a continuous volume measurement.

Choosing The Right Sensor

Selecting the right ultrasonic level sensor is critical. Make sure you select a range that is strong enough to detect your surface or level at the furthest distance. Ensure that you consider chemical compatibility and mounting needs. And make sure you can get the right output and wiring connectors. Finally, if we match up to all these requirements, select a programmable ultrasonic from APG, so we can help you get a consistently reliable measurement.

Contact us if you have any questions about ultrasonic sensors or the measurement challenge you need to solve. We'll give you honest feedback and help you find the best sensor - whether it's ours or not.


Explore APG Ultrasonic Sensors


photo credits:

tank pipes - darkday via flickr cc cropped

volume knob - Gary J. Wood via flickr cc cropped

tanks in the sun - Tim Evanson via flickr cc cropped & straightened