Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Google
Search WWW Search seattlerobotics.org

SONAR as I Have Done it

Dennis Clark

dlc@verinet.com

I have taken quite a few Polaroid cameras apart now and I'd like to share a lot of what I have learned to get them to work with our microcontrollers we like to put in our robots. Below are the how-to steps for getting the SONAR unit safely out of the camera and how to modify it so you can use it in your projects. There is minimal electronics knowledge needed and in fact I got much of this information right from the "horses mouth", Polaroid. However, all of the pictures, text and schematics are mine so that I won't have to worry about someone else's copyrights. I will admit to seeing a bunch of code from other people, but this code is how I decided to do it, and really, there are only so many ways to do anything like this anyway... This page should get you going on the way to adding cheap SONAR to your robots to impress you friends and improve your sex life. Well, maybe it will impress your friends, unless you friends are Gordon McComb or Karl Lunt or Robert Nansel, they will just nod knowingly. Have fun.

Step One: Get a camera!

I have found these cameras mostly on eBay. I never pay more than $6 + shipping, total cost under $10 for the works. Some say that they find them in thrift shops, I've never seen a Polaroid camera in any thrift shop - good luck!

Step 2: Get the board out and hack it.

What follows are the steps required to get the board out and how to modify it. There are two different cameras used here, in some steps I share pictures because the step is the same for both. Mostly, the hacks are similar, but different - you'll see.

Polaroid One Step SONAR

Pictures

Click for big view

Polaroid 660 and SUN 660

Remove the film door. Do this by opening it (Duh) and prying between the two metal hinges on either side (see arrow).

Now remove the front plate, see the 660 method for how. <grin>

In addition you will need to remove the flash unit on top. Just pry at the plastic hinges and when it pops off, snip off the ribbon cable.

Now remove the front plate. This isn't graceful, just pry all around the seam until it pops off.

Remove the guts. Pry between the metal hinge pieces and the plastic housing on the bottom, lift the top flaps up on the top, with all four of your hands, do this at the same time and the guts will come right out! Pop off the plate around the flash connector on top or the guts will hang up on it.

Just pry at the arrrows shown to the left CAREFULLY and the guts will come right out, no problem. You should not have to use much force on the top, on the bottom it doesn't matter much.s

Ta da! This is your reward!

Here the arrow points to a place to loosen the wire to the transducer. Watch for these hangups before you remove the transducer.

The arrow on this picture points to a nifty little tab that holds the SONAR transducer in. Pull this tab out and keep it, it will help you mount the transducer as well. The transducer will just drop off now. Watch for places the wires are snugged to the camera, carefully un-snug them.

The transducer is held on by (yet another) plastic clip. Pry it off there where you see my helpful little arrow at the upper right of the transducer. Then just pull the transducer down and to the left to remove it. Just like the arrow shows. Watch for places the cable is tied to the camera and remove them now.

Here is your board! Its stuck to the camera shell with double sticky tape and tons of wires. Remove these wires carefully but leave the two for the transducer there so you won't forget where it goes. Then carefully pull the board loose. These nifty wires will make neato connectors later on for other projects, so keep 'em.

The two arrows point to (ahhh!) yet more clips that will hold this board in. Just pry them back, lift the front of the board and pull it forward. Oops, do this AFTER you gently pull the ribbon cable from the worthless connector that you will be removing later on...

Here I have the board ready for hacking. I have removed all the pins that are of no interest to us. The green arrow points to your first hack. cut that trace shown, there is no need to drill through the board, just use an Exacto blade to cut it.

Oh boy, more hacks! Cut the two traces pointed to by the arrows and then jumper the A-A and B-B connections. This brings two signals out to pins whose prior purpose isn't that interesting to us. The other hacks are shown in the first set of cheesy drawings two pictures below this one.s

There are two main versions and a few variations on the theme to these boards. By and large they look like the Polaroid 6500 kits you pay $50 for in the shops. But they are different. You will need to place the 100uf-(whatever size you want) capacitor in different places depending on the board, the connector pinouts are the same. I recomend you just remove that connector so you have access to the holes to install wires directly to the board, as I have done here All that shiny stuff is "Shoe Goo", I use it to hold things down when I don't want them to move. I recommed it for lots of robotics projects!

. As for the circuit that is "blobbed" on there, use the procedure shown in the second cheesy drawing below.

Use the upper drawing to add on the power line switch above. These Polaroid boards require you to power the main circuit off and then on before doing another SONAR ping cycle. This drawing shows how to do this very easily.

This board will work down to a minimum distance of between 8 and 11 inches (25-33cm) with at least a max range of 15 feet (5 meters).

For the 660 I have included the pinout of the connector and the functions that work with them. Ignore the BINH and BLNK lines, I have NEVER been able to make these boards use this functionality - I don't know why, it just doesn't work. If YOU get them to work write me and tell me how!!! Anyway, these drawings also show where to find the +5 and ground lines to attach the capacitors to. It is different on the two types of boards. It also shows how to construct the power switch circuit for the SONAR board.

Yes, this IS how I keep my logbooks, if yours look any better, well, good for you!

This board will work down to a minimum range of about 18-19 inches (50-60cm) and out to over 15 feet (5 meters).

 

Step 3: How do you use it?

Now you want to program your micro to use it? Geeze, some people's kids... Anyway, I have routines that I have written for either a Parallax Stamp II or a 68HC11 board. My 68HC11 board is a Marvin Green Botboard 2, it is very nice with lots of expansion room. I will be adding a Fred Martin Miniboard and an OOPIC controller soon to my experiments. Stay tuned.

So, this is Basic Stamp II code to run either of the two SONAR boards. Both routines are in the same file, just comment out the "goto" to get to the first one. I have commented the code so you should be able to figure out what I was thinking at the time. My calculations are based on the speed of sound at sea level at ambient (25 degrees C) temperature. However, I live at 5000 feet and it worked fine here so I don't think its all that much of a difference. Remember that rain plays hell with SONAR though! Stamp II code

Now, for those of you that are fans of the 68HC11 chip, Handyboard, Miniboard, whatever, here is my code to drive the SUN 660 board on my Botboard 2 using Karl Lunt's sbasiic. I haven't yet done a One-Step SONAR routine, but I may someday if the spirit moves me. sbasic 68HC11 code The sbasic code looks a LOT more formidable than the Stamp II code doesn't it? Well, its really simple, its just that the Stamp hides all of these details. The clever guys out there will see right away how to set it all up with interrupts for automatic range finding!

Barry Ward's Ideavision board and Stamp II Hack

Alternate circuit hack for Polaroid camera type SONAR boards.

The ideavision board, with a small board of my design that implements the circuit to the left.

C. Barry Ward has a very elegant two-port solution for SONAR ranging using the Parallax Stamp II. One port pin to enable power, and one to both ping the Init line and read back the Echo. Here is the code, in a nutshell:
Time var word
feet var word
inches var word

Start:
low 1    'Init low
high 0   'power off

Range:
low 0    'power on

pause 5  'wait for stabilization

pulsin 1,1,time

'This brings the Init line high, the cap on that line
'delays this so that pulsin has time to set up for 
'the reading.  When Echo returns this line (now an
'input) is pulled low, ending the pulsin command.

low 1    'remove Init and prepare for the next pulse
high 0   'power off

pause 25 'delay before next cycle
time = time*2  'because pulsin is in 2us increments
'distance = 1.78ms per foot for the round trip

inches = time/148
debug dec time,"us ",dec inches," inches",cr

pause 100 'delay a bit before pinging again
goto Range

end

Oh yeah, what do you do with the rest of the camera?

When you have ripped out the SONAR, you have a bunch of scrap to toss right? Wrong! In both cases you have bunches of gears, optics, motors, switches and a solenoid. in the case of the Pronto One-Step you also have a wheel encoder, sensor and motor for the lens focusing mechanism as well as a bunch of nifty wires with nice header-pin connectors on them. You are sure to find something in there for a project!


I hope you find this useful. I have left out some of the gory details about how these boards work and <yada yada>. Because really, who cares? Or, also, you can get those details on other sites. This site is dedicated to added the technology simply and cheaply to a robot, that's it. If you have any comments you'd like to share, let me know by bonking <this> and I'll add your useful comments to my page. If your commentary is mean, I'll share it with my wife over dinner for laughs.

October 1, 2000