Ultrasonic sensors

Hi
I recently got an ultrasonic sensor. However, I am not very sure how to use it on my breadboard. The many tutorials on the internet deal with modules as sensors (like SR04). Mine consists of two parts, T and R, both with two leads. I don't know where to connect what wire. One end should connect to the 5V power supply, two to ports 2 and 4, and one lead is to be connected to GND. I know exactly what to do for the HC-SR04, but I am stuck here. Any help would be highly appreciated.

. Mine consists of two parts, T and R, both with two leads

You can't sensibly connect those devices to an Arduino - it sounds like you've bought bare transducers (Hint: photo)
Well, you could connect Tx and get something out of it, but the return received by the Rx is going to be of the order of a few microvolts to maybe a couple of millivolts, and is not usable without amplification.

Is there a relatively simple method for amplification?

Your best bet is to google to see if the Devantech schematics are online (they used to be), but unless you have a 'scope to debug things, I don't really recommend homebrew.

Note also that the commercial units also use things like MAX232 drivers to boost the output voltage too, to give a louder main bang.

coolcheetah:
Is there a relatively simple method for amplification?

Well - simple is in the eye of the beholder - but most circuits use either an h-bridge or a half-bridge of some sort to drive the transmitter; sometimes an A/B style amplifier (like that for an audio amplifier - which is all you are really doing, just at a higher frequency).

Here are a few pages to get you started, and let you see what you are dealing with:

http://www.kerrywong.com/2011/01/22/a-sensitive-diy-ultrasonic-range-sensor/

This one uses an h-bridge on the transmit side (for a full + to - swing of the transducer; on the receive side, it uses a simple 2-stage amplifier to boost the received "ping".

This one uses much simpler circuitry:

On the transmit side, you have a simple single transistor coupled to the transducer, which has an inductor across it; the inductor is used to create a resonant LC circuit, which effectively helps to boost the output of the transducer - it might also be more efficient. Even though it is only running off 5 volts, according to the author the LC circuit boosts the output across the transducer to 20 volts, which increases the distance.

But on the receive side - there isn't any kind of amplification; this is a very simple circuit, I would bet that if you combined both approaches (that is, an LC amp on the transmit - perhaps driven h-bridge style for full swing - along with an amplifier stage or two on the receive side) - you might create a better solution overall.

Note, though - that the microcontroller used in this one (plus the code) is for a PIC - so you would also need to convert that (but all of these circuits work essentially the same - send a ping, wait a bit of time for the receiver to settle, start a counter, then listen and stop the counter when you get the return pulse).

Here's a third circuit - very similar in design to the first (h-bridge transmitter, 2-stage amp on the receiver):

No code shown, but the amp used in the receive section is a fairly low-cost and common one.

Here's a slightly different take:

https://courses.cit.cornell.edu/ee476/FinalProjects/s2007/jjl49_mar97/jjl49_mar97/index.htm

(same circuit - but the second link from the initial page wasn't easy to spot)

Basically - it uses a small amplifier on the output side (an LM311 voltage comparator used as an amp - supposedly because it has a faster switching speed - I like the outside-the-box thinking), and on the receive side, a hex-inverter (usually used in digital logic) used as a amplifier (again - outside the box thinking), plus a few other parts. It's a fairly simple circuit, using certain parts in an unorthodox manner.

Last - here's a page detailing how a single transducer ultrasonic system can be created:

Note that you must have transducers that can work on both the transmit and receive side of things; the ones you have are not meant for this application - but it might be something you could play around with. If you look at the circuits shown (all are virtually the same - just different microcontrollers), you'll see that they are similar to the previous ones I have referenced for you - albeit with one large difference (besides the single transducer!).

Note near the transducer a pair of back-to-back diodes, along with the strange PNP/NPN transistor configuration. Those are the key parts. The transistors basically act as an amplifier stage, but with a "switch-on" element - while the diodes act as a voltage clamp. What this all does is basically (I'm simplifying things greatly here) isolate the transmit and receive stages from each other (the receive stage, as you can see, is a familiar 2-stage amp design) - so that pings from the transmit side don't destroy the receiver, and received pulses don't feedback into the output of the transmit amp stage and cause it to be damaged.

You might also want to explore hexamite's site in total - you probably won't find the above page; it's more a historical artifact of the site, as they've moved on to other products (they used to sell raw ultrasonic transducers off the site - including some nice all-weather sealed metal designs that could be used underwater and in inclement weather). But you will find a ton of other interesting ultrasonic-related information, including a page on calculations for microcontrollers. Overall it is nice complementary information.

Finally - something to note in regards to all of these designs - if you want to be most successful in implementing and building your own ultrasonic sensor, you are going to definitely need a few things. First - you need to know what the resonant frequency is of your transducers, because you want to drive them at this frequency for best (longest distance, greatest amplification) results. Most transducers are either 25 KHz or 40 KHz - but there are others out there. Check your part numbers, see if you can find a datasheet on them; sometimes the part number might be a clue, too (ie - the part number will say something like "40K" or "25K" or have those numbers in it - but don't rely on any such guessing, unless you have no other choice).

Secondly - you are going to want to have at hand a couple of tools that aren't common for hobbyists to own, mainly due to cost and the fact that they aren't used for most normal experimentation. But they are both essential tools to have on hand when building these kinds of circuits.

The first is something you have already seen images of in the above links: A 2-channel oscilloscope. This tool is useful for the purposes of ultrasonic experimentation because it both lets you see the the actual driving wave of your output stage (on one channel), and it let's you see the returned "ping" on the receive stage; there will be a difference in time between the two events; that correlates to the target distance from the transducers. Also - you can use it to "tune in" a transducer to its optimum resonant frequency.

The second tool is just as useful, in that it helps you to get a feel for the transducers without needing to build anything "blind" - that's a "signal generator" - you'll want something that can output a variety of waveforms (standard ones are triangle, square, and sinusoidal), at a frequency range of about 0 Hz to at least (if not a bit beyond) your transducer's resonant frequency; if you don't know that information, shoot for 50 - 100 KHz on the top end. The signal generator will let you design the transmitter and receiver amplification sections without need to worry about coding something on a microcontroller and knowing it works properly as well. You can also drive the transducers continuously - or in pulses - depending on the need and such, so you can tune everything to perfection.

You don't need "top of the line" versions of either of these tools to work with ultrasonic sound - since the frequency is comparatively low, you can get away with a small low-cost scope (as long as it has 2 input leads and at least 1 MHz of bandwidth), and a low-cost audio signal generator (as long as it has an upper limit of around 50 KHz).

Hope this all helps, and good luck with your project!

@cr0sh, Thank you so much for your time. I'll try it.