Nix's PIC based sonar system



Why another PIC sonar?

There are several PIC based ultrasonic ranging systems available on the Net, but all of them use the hard-to-get Polaroid ultrasonic module. So I decided to make a device that will use standard ultrasonic transmitter and receiver modules (such as SQ40T and SQ40R available from   Conrad Electronic). But if you like you can use waterproof modules and use the device on your boat as a depth-meter.
 

The code

The code compiles well with Timo Rossi's picasm for Linux. I took some ideas from Daniel Henzulea's SonaPIC project, mainly reffering to the measurig method. In order to learn using Microchip's floating point math library, I used the library to calculate the distance as a function of echo delay time. Reffering to the Hitachi HD44780U display controller documentation, I coded all the display-control procedures. The rest of code is also my work.
Since this is the first working version, the math operation is not really optimized. So I thik about not using math libs for this project in future.They cost many registers, anyway.

The hardware

The hardware is very simple (look at the shematic part). The transmitter module is connected to proper pins on PORTA with no external components needed. LCD data lines are connected to PORTB, signal lines to proper pins on PORTA(look at the Sonar.h include file). The signal from the receiver has to be detected and converted to TTL-level in order to generate interrupt on RB0. There is also the EchoDisable line which disables the TTL-level echo detection signal on RB0 while talking to LCD.
That's all.

Download

Source Code
Shematic diagram
Everything (.tar.gz)
I will try to draw a better shematic diagram and maybe a pcb layout if there will be some interest for this project.

If you have any suggestions or comments, please feel free to E-mail me.