The SonarCE page

Sonar CE

Go to the main site index

A new version 2.01 for WM5,6 is available. I changed completly the sound engine. The program works now in VGA resolution. The biggest problem was with sound drivers. Before using set the microphone sensitivity to min!!! The new version has an option to test sound system.


Download SonarCE v1.30 Pocket PC 2002, 2003: SonarCE.arm.CAB (198.79 Kb)
Download SonarCE v1.30 for Pocket PC 2003: SonarCE.arm.CAB (199.30 Kb)
Download SonarCE v2.01 for WM5, WM6: SonarCE.arm.CAB (199.30 Kb)

Download WSP (the sonar versionfor PC computers in download section) WSP.exe (50 Kb) 

Copy the file to the device (do not uncompres it) double tap the icone. This will start the self instalatin process. The *.cab files are self extracting archives performing the complete instalation.

The PC version of the program made by Eddie and more explanation you can find here:www.eddiem.com/projects/chirp/chirp.htm Sonar PC. The Pocket PC version bases exactly on this project.

There is also a PC version WSP.exe for PC. You can ((Why register?|register)).

The SonarCE application is a real sonar for Pocket PC devices. It uses the internal Pocket PC sound system to detect echo from different obstructions. It is quite precise around 5-10 cm at distance of 10 m. The up distance is only limited by the output power of the device and the speaker. This program can be use in air or in water but in water you need external microphone and speaker closed in water proof case. The main window toolbar contains the most important functions: send one chirp, sonar loop and analyze window. More advanced functions are hidden under settings menu. Additionally program is equipped with testing functions which helps to tune the parameters crucial for the Sonar CE application.


If you can't run the sonar with default settings. Try to use offset test to find the correct value. This program shows the signal strength. If the offset and the signal are good enough the level should be above the second bar.

It is possible to change the scale (when the image is to noisy) after scanning. Just change the scale in Settings\Set scale and replot the screen.

Physical background

    The short sound (chirp) is sent by the speaker in interesting direction. When the sound “finds†on its way any obstruction, then is reflected and comes back to the device microphone. The device is in recording mode (after sending a chirp) and records the incoming sound wave. The recorded wave is autocorrelated with the output signal (played sound chirp). If the recorded data have the same or similar course as played one then the autocorrelation function returns maximum. Unfortunately the recorded signal is deformatted by the sound line (amplifiers, speakers, microphone and digitalization) and thus is not really the same. Additionally the correlation function itself generates sinusoid like course (due to limited data set) thus the correlation data needs a post processing. The correlation function can be improved by played the sound with different frequencies within the played time (1). This make the autocorrelation function more sharp (larger frequency spectrum sharper peak in autocorrelation function). The post processing function takes absolute value from the correlation function and reduces the output data to fewer points (let say 230). Every point represents the maximum value from the window operating on correlation function. For example, if the correlation function has 2300 points and the data window is 10 points wide then the first point from post processing data represents the maximum value from the first 10 point (of the absolute values) of the correlation data. The absolute distance measured by any sonar depends on the time the chirp is played (longer time more sound energy is cumulated in the chirp), from sound amplitude and in small degree from chirp frequency (different absorption wave in different medium e.g. low freq. waves can travel longer).

1 The speed of sound doesn’t depend on the frequency

extra.JPG  screen10.JPG

SonarCE aplication can work in two modes linear and angular. These screen shots were taken by using deafolt device speaker without any amplification.

Menu bar and tool bar

To access additional functions, click on the menu options. This allows you to change the way the Sonar CE works, or change its working mode.

List of options in tool bar:

• One chirp

• Sonar loop

• Pause of sonal loop

• Stop of sonar loop

• Clear the screen and the stored data

• Linear mode

• Angular mode

List of options in menu bar:

• File: open, save, exit

• Analyze: chirp, play recorded buffer, auto correlate, post processing, analyze window and ruler

• Settings: set out signal, set wave format, set offset, set scale, use recorded chirp and info

• Tests: check recording, check audio system, check correlation function and search offset

• Help: about and help(now it works)



Available options

Below is the list of all available options in menu bar.

File menu

Open and Save options allowed you to store and read from memory yours scans. The data file *.son contains full information about scans. The data are stored as char table of the scanned size. The *.par file stores only information about program settings.

Exit closes the program and clean all buffers


Analyze menu

Chirp allows you to generate and record the chirp defined by default on application start or by in Settings menu. This option is also available from the tool bar as 1x chirp.

Play recorded allows you to play content of recorded buffer.

Correlate this option starts only correlate function. The result is stored in correlation matrix.

Post processing this option starts post processing function (useful for tests). This routine compress the correlation function and takes the maximum value of absolute value of correlation data for given data window (calculated automatically based on in-buffer size).

Analyze window shows the four important data: amplitude of the played chirp (white), amplitude of the received sound (red) from microphone, correlation function of the microphone signal (green) and absolute values of correlation function (yellow). The post processing curve is displayed no beginning of the (yellow) curve.


Analyze window shows the microphone signal, autocorrelation data and absolute value of autocorrelation data. Beginning of the yellow data curve are post processing data.

Ruler shows the distance in meters to nearest obstructions. The distance is correctly calculated when the screen is with out noise (the /Settings/Set scale parameters help to obtain clear scan image).


Ruler window shows the distance to nearest obstructions.


Settings menu

Set out signal this menu window sets the most important parameters of the chirp and the record parameters.

Start frequency - define the beginning frequency of the chirp in Hz. The possible frequency is from range 10-40000Hz. This depends on the wave format settings. By default the application works with highest possible settings defined by wave format.

End frequency defines the final frequency of the chirp like for start frequency (the chirp can start from low frequency and end up on high or opposite way around).

Record time defines the time of recording the signal from microphone in ms. This parameter defines the “observed†distance longer recording time means longer observed distance (Information about accessible distance is displayed on the bottom of the window in text box). The recommended values are from range of 10 to 600 ms.

Play chirp the time of played chirp in ms. The longer played chirp the more caustic energy is cumulated in a chirp and smaller amplitude of the sound wave is neccesery. Hoewer the longer chirp time the more calculations is needed and this slow down the computer. The recommended values are between 500-5000 ms.

Chirp up the chirp is played from start frequency to the end frequency.

Chirp up down the chirp is played from start frequency to the end frequency and again to the start frequency in time defined by play chirp time.

Air/water/iron/granite the environment for which the calculations are performed. This is important only for scale calculations.

In this window also the absolute size of in-buffer and out-buffer is displayed in bytes. The max distance shows the maximum possible distance available with time defined in record time.


Settings for output signal.

Set wave This window allows changing the basic settings of the wave format. Available are following options:

mono/stereo Selection of the bar indicates stereo selection. Selecting this option gives possibility to sampling the sound with twice the frequency selected below. For example with option 44100Hz the frequency of sampling is double 88200Hz. However to have this effect the left and right channel of device must be connected together on output as on input.

8/16 Selected bar indicate 16 bites mode. 16 bits mode improves the quality of sampled amplitude with 256*256 resolution when 8 bits gives only 256 levels of sampled amplitude. The 16 bits per sample is recommended.

The available sampling frequencies are: 8.0 kHz, 11.025 kHz, 22.05 kHz and 44.1 kHz. The frequency can be doubled by selecting the mono/stereo option.

Set offset

Set offset this option allows you to change manually the offset settings. Offset is a time presented in Bytes (different settings required different amount of memory to store sound data) between the played signal and the same signal recorded by microphone. Correct setting of this value speed up the calculations (this program has a test option in /Tests/Search offset to find this parameter).

Delta offset is an acceptance of maximum positive deviation from the offset value. When the calculated offset from recorded chirp is higher from the sum of offset and delta offset then such record is repeated. On some devices the fluctuations in Bytes/s are significant. Set this parameter to high value e.g. 2000.

Set scale this option allows you to calibrate the distance scale.

Use recorded chirp

This option allows using the recorded chirp however it is not working well due to weak amplitude of recorded data.


Settings window for wave format. These are the recomendet options.


Set offset window.

Set scale this option allows you to set the start of the scale to limit the background.


This window shows important information about program parameters:

- Nr of scans performed (the wrong scans are not counted),

- Max correlate maximum value of the correlation function later on this function is normalized to this value as 255,

- Set offset set offset by default or by user in settings wave format window,

- Last offset the last calculated offset from recorded data. This value is used as a start point for drawing,

- Ave offset average value of all measured offsets,

- Dev offset standard deviation of all measured offsets,

- Buffer in size of input buffer,

- Buffer out size of output buffer,

- Time in time of recorded data,

- Time out time of chirp,

- Start frequency of the chirp,

- End frequency of the chirp,


Info windo.

Tests menu

Check recording
This test gives the opportunity to record the signal from microphone and after that plays this signal from the device. In this case the recording time is defined by in- time in /Settings/Set out signal options.

Check audio system
This simple test allows checking the frequency spectrum played and recorded by device. In this case the speaker should be close to the microphone (10cm). The voice level should be set in such way that all bars are in the plotting area (not cut off by the display frames).

Check correlation function
This option copies the output buffer to in-buffer three times and then does auto correlation of the output signal with such prepared in-buffer

Search offset
This test searches for the correct offset. The additional informations are displayed during the test. This test is important when the device is recording but can’t find the played signal.

Know problems

This program was written for 2002 Windows CE Pocket Pc devices therefore can makes some problems in 2003 and 2005 versions of Windows CE.

If the device uses for playing and recording the same speaker or for some construction reasons the output and input uses the same connections the program will not work. It needs separate lines for input and output.

This program depends on build-in sound drivers and thus strongly from the device model. If you can’t record echo signal than as a first step you have to check the /Tests/Check recording (just speak to microphone after selecting this test. After some time you will cheer the recorded sound). If this works use the /Tests/Search offset test to find the correct value for your device. The offset value depends on the device. If you here the recorded sound you can check the analyze window. This also gives you information about the offset between the played and recorded signal. Standard value of offset value is 5000 bytes in stereo 44100 samples/s mode. In mono mode with 44100 samples/s is selected than this value is 2500 bytes. After that you can try to record echo.

For more information about the physical basis visit the website at Sonar PC.

Or contact by email: daniel_kaminski3 at wp.pl

Mirror: (not the latest version v1.0): http://www.cutabovecounters.com/sonar/SonarCE.arm.CAB

My profile: Daniel

Main Index

Switch Theme


eddie, 11:29 AEST, Sat 22 of Jun, 2024: Offline wiki repair is mostly done. It is running on tiki-27-alpha
eddie, 18:14 AEST, Sun 12 of May, 2024: Phase one of wiki repair is to upgrade to V22 (the last version with image galleries). All 150 images in the wiki-up directory are broken and need manual wiki page repairs.
admin2, 19:45 AEST, Sun 28 of Apr, 2024: Tested tiki 26.2 on a raspberry pi. Tiki 26 does not support image galleries so I have to try again after migrating images to file galleries.
eddie, 13:04 AEST, Thu 10 of Aug, 2023: Offline tiki 26 upgrade went badly. Waiting for 26.1. Will limp on.
System Administrator, 18:45 AEST, Wed 26 of Jul, 2023: Recovered from lockout but unable to upgrade to V24

Last-Visited Pages

Online Users

12 online users