srf04 – Neil's Log Book https://nrqm.ca What could possibly go wrong? Wed, 05 Jan 2011 06:33:59 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 Low-rent acoustic transmitter https://nrqm.ca/2010/12/low-rent-acoustic-transmitter/ Sun, 12 Dec 2010 22:44:02 +0000 https://nrqm.ca/?p=324 Acoustic transmitter circuit

Acoustic transmitter circuit.

Above you can see the transmitter part of my acoustic modem.  From left to right, the components are: the power supply, the acoustic transducer, the amplifier, and the microcontroller.

The problem: I need to send a 40 kHz, 20 V peak-to-peak square wave to the transducer.  The circuit has two outputs, + and -, that are connected to the two transducer pins.  In other words, each output needs to switch from +10 V to -10 V  and back once every 25 microseconds.

As always, there are a few decent solutions, and as always I didn’t implement the best one.

Solution: Transformer

I think the best solution, or at least the awesomest, is to use a step-up transformer.  I don’t need a transformer because the transducer I’m using is pretty low-voltage, so I can use it with a reasonable power supply.  A higher voltage transducer such as the Meas-Spec US40KT-01 [PDF], which operates at up to 300 V peak-to-peak, would definitely need a transformer.  The main downside of using a transformer is that I don’t know very much about using transformers, and also I suspect the circuitry will be more expensive (I do have room in my budget).  The upside is that it will produce a  high voltage signal and should be a simpler circuit once I figure it out.

Solution: Amplifier

I have a little microcontroller generating a 0 V to 5 V square wave at 40 kHz.  Originally I had some kind of vague notion that I would use an amplifer to bump the micro’s output up to 0 V to 20 V.

My stumbling block is that the microcontroller is grounded to the -10 V rail, so according to the op-amp, the micro’s outputs are actually from -10 V to -5 V.  How do you amplify that to a signal that goes from -10 V to +10 V?  I’m sure there’s a slick way of doing it by mucking around with virtual ground, but I gave up pretty quickly.

Solution: Schmitt Trigger

Suddenly it’s clear why I wrote a log entry about the Schmitt trigger!  Another reason: I was too busy to make a long log entry about something more complicated.

Originally I learned about the Schmitt trigger trying to figure out how to turn the receiver’s analog output into a digital signal.  It transforms a signal of arbitrary amplitude into a digital signal flipping back and forth between the op-amp’s two power rails.  I was going to turn the ±10 V output into a 0-5 V output by adding a diode to block the -10 V signal and a voltage divider to turn the +10 V signal into +5 V.

Anyway, the Schmitt trigger produces a ±10 V signal and hey, that’s exactly what I want, so I just made a Schmitt trigger with threshold levels between -10 V and -5 V (that being, again, the microcontroller’s output from the op-amp’s perspective).

It works okay.  The ±10 V waveform is more trapezoidal than square.  Square waves are always are kind of trapezoidal, but this one is really trapezoidal.  But it’s square enough and the acoustic signal it produces is fine.  The raw output of a receiver module receiving my signal is indistinguishable from that of the SRF04 I’m trying to copy, except my signal is marginally more powerful (since I’m sending the transducer a slightly higher voltage).

So that’s what I’m using as a transmitter for now.  The plan is to upgrade the transducer and switch to a transformer amplifier at some point down the line.  This transmitter functions as a proof-of-concept that works well in air (how to get it working underwater is TBD).

Output

Acoustic modem output waveform

Visualization of the output waveform.

The modem encodes data in acoustic pulses, as shown above.  The image is a representation of a single 1 bit, encoded as eight consecutive pulses at 40 kHz.  I will discuss this more later.

]]>
How to power an acoustic modem https://nrqm.ca/2010/11/how-to-power-an-acoustic-modem/ Thu, 18 Nov 2010 22:21:10 +0000 https://blizzle.cybertavern.net/?p=261 I mentioned before that I’m basing my acoustic transducer off the Devantech SRF04 ultrasonic ranger.  I’m removing the piezoelectric transducers from a dead SRF04 unit and using them for my modem.  The transducers, which are the part that generate and receive the acoustic pressure wave that carries data, have a range of about 6 metres or so (one way), are driven with up to 20 V, and resonate at around 40 kHz.

The puzzle I’m working on right now is how best to actuate the transducer to generate a 40 kHz pulse.  The SRF04 does it using a chip that’s intended to convert 5 V logic signals into the ±12 V signals used for the RS-232 serial protocol.  Unfortunately most RS-232 converter chips aren’t made to power an acoustic transducer, and they aren’t able to provide enough current to generate a strong signal.

I bought a couple ADM208EANZ RS-232 converters, which seem like they should be able to provide up to 40 mA.  I didn’t read the datasheet carefully enough and failed to notice that it needs a bunch of 0.1 μF polarized (i.e. aluminum electrolytic) capacitors.  I have 0.1 μF ceramic caps, and I have various electrolytic caps, but I don’t have 0.1 μF electrolytic caps.  The chip will generate +9 V with a 10 μF cap, but it won’t generate the -9 V rail.  I have no idea why some circuits require capacitors with polarity, but if the diagram has a plus sign next to a capacitor you really need to pay attention.  Ceramic capacitors, which don’t have polarity, might not work.

(Most RS-232 converter chips generate ±9 V instead of ±12 V, presumably because ±9 V is easier.  The input is 5 V, then they put that through a voltage doubler to generate 10 V and put that through an inverter to generate -10 V.  Then I guess they put both through something that drops 1 V (a regulator or something to stabilize the output) and you end up with ±9 V.)

If the ADM208EANZ can power the transducer, I think it will be the best solution.  I see three downsides to using an RS-232 converter:

  1. You’re limited to an 18 V swing (or perhaps even less) instead of the full 20 V.  This isn’t a major problem because the transducer output is roughly a logarithmic function of the voltage input, so the output difference between 18 V and 20 V isn’t very high.  But if you want to upgrade your transducer to something like the Maxbotix MaxSonar-UT transducer, which takes up to 60 V, then you’re stuck at 20 V.
  2. The receiver’s amplifier is a little more complex because you have to operate it on a single rail (i.e. 0 V to 5 V instead of -10 V to +10 V).  This downside is overwhelmed by the upside of not having to generate a  ±10 V power supply.
  3. The SRF04 documentation notes that they had to turn the RS-232 chip off while receiving to reduce noise.  The noise is probably from the step-up converter and inverter that generate the positive and negative voltages.  This is pretty annoying, and now that I mention it I recall that the ADM208EANZ doesn’t have a disable feature.  I might be able to filter the noise.

The upside is that the RS-232 converter can be powered from the same 5V supply as the rest of the electronics.  It doesn’t need a complicated battery assembly or external step-up converter, or a bunch of regulators to generate reliable voltage rails.  It just needs a battery and one 5 V regulator, which is more power efficient and space efficient.

One final comment: ADM208EANZ looks like Adam 20 Beanz.

]]>