PIC Based Imaging Sonar using PIC16F84 microcontroller
I’ve wanted to build a sonar for a while now, and I was hoping to be able to do it with a design someone else had made, but alas, I’ve never had much luck. I’ve done many searches of web pages, and all that ever comes up are sonars that give a single range to one object. Nothing that would be useful for my purposes: an imaging sonar.
Over 10 years ago, I’d guess, there was an article in Radio-Electronics magazine about an imaging sonar that was using one of the Polaroid sonar modules and a stepper motor for azimuth. This only gave one range per azimuth step- still not what I really wanted.
So it ends up that I’ve built my own. I have two 40KHz ultrasonic transducers, one for transmit, one for receive. These transducers are steered by an R/C servo over 180 degrees of azimuth. I’m using 2 Microchip PIC microcontrollers, a 16C71 for the sonar portion, and a 16F84 for the servo control. There are two microswitches that sense the ends of travel of the servos, and this information is stored in non-volatile memory on the ‘F84. It can scan the full 180 degrees, or it will scan just a sector, or it will give multiple readings in a single direction. All control and output is over a single 19.2 Kbps serial port.
The analog portion of this is pretty involved- I need to receive, amplify, detect and filter the signal before I put it into the ‘C71. I built an extremely wide dynamic range full wave rectifier which rectifies the 40KHz signal without (much) distortion from 10mV P-P to about 3V P-P. I also incorporated a receiver protector circuit that shorts out the receiving transducer during the outgoing pulse and for 1ms afterwards.
The range right now is somewhat limited: about 6 inches to about 4 feet. The near range is limited by the ringing of the receiver caused by the coupling between the tansmitting and receiving transducer. I could have used just one transducer, but that would have extended the close-in blind period, because the ringing would have been harder to quiet. The far range is limited by the RAM of the ‘C71. I’m hoping to get a 16C711 which has more RAM, which will let me double the range.
As it is, the transducers have a response that is much too wide in azimuth. I do need to figure out a way to focus the signal. I’m exploring the possibility of a phased array or a parabolic reflector.
The image you see above was an image of the junk on my workbench. Yeah, you can’t see much detail, but it does demonstrate that I’m not just looking at noise. This image was done with a logarithmic response to bring out the detail in the low level returns. There is no sensitivity time control (STC) so the response still has to be scaled by 1/r4 (two way 1/r2 losses). I generated the image with Matlab, the raw data would not be very interesting to most. I’m hoping to write some code so I can generate images with one of my Linux computers, and place it live on a web-page.
For more detail: PIC Based Imaging Sonar using PIC16F84 microcontroller
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- sonar pic
- polaroid pic