Sending PWM using ultrasound fails at different duty.

I am trying to send a burst of PWM pulses between a separate ultrasonic transmitter and receiver (stripped down a cheap HC-SR04) .

Sending a perfect squarewave with 50% duty will be received and amplified perfectly up to 16 meters using a multistage setup. However, when I try to send a burst with 25% or 75% duty, it will still output aprox 50% duty on the receiving end with/without transistor/op amp setup using my oscilloscope. I have verified with oscilloscope that the arduino output pin have the correct duty cycle.

Now I am beginning to think that the transmitter or receiver automatically transforms the incoming signal to an outgoing 50% duty signal?

Any suggestion what might be wrong?

Are you saying you're transmitting 40kHz PWM? I'm not sure the Murata-type U/S are sophisticated enough to distinguish PWM - they're just highly resonant piezo devices.

What are you trying to do?

Yes, 40khz it is.

I am trying to build an outdoor positioning network. I basically have multiple transmitters sending a short burst each second (no one is sending at the same moment) and a single receiver comparing the relative time difference between measurements to determine x and y position. To distinguish each burst, I want to encode an 4 or 8 bit ID identifying the transmitter. I could for example send some IR signal at the same time to identify which transmitter is currently sending, but I´d prefer to have this information encoded in the US signal for less components and logic.

Have you a link to the transmitter? How is it conected to the Tx'er.?

Mark

I have built my own transmitter using a Teensy3 and soldered off the transmitter from a HC-SR04 where I do not have the specific datasheet for the US transmitter (I do know that they are paired). I am basically making a PWM signal on pin 3 on the arduino that is connected to one of the pins of the transmitter US, the other one is grounded. I know that on some US they need a resistor to ground and/or parallell resistor between transmitter/receiver pins. I have had 2N2222A before in the cirquit but to minimize the debugging, I´m doing a simple cirquit to identify the problem. At first, I thought I might have distorted the signal using the bandpass filter and/or by using the transistors for amplifying the signal but the same problem occurs even if I hook up the receiver directly to the oscilloscope...

I might need to add that I am using a DSO 201 nano...

I think you may have TWO signals, the transmitter producing the ultra sound (with a constant freq and duty cycle) and you turning on and off the Tx'er using the pwm.

Mark

I think you might have misunderstood me, I have only dismantled the piezo speakers (one transmitter, one receiver, which are paired) from the HC-SR04 cirquit, so the only signal that can drive the piezos would be my PWM pin on the Arduino? Or do I miss something here?

I think your use of the word "speaker" is misleading you. A speaker is designed to faithfully reproduce a relatively wide band of frequencies.

In my experience, U/S transducers are devices designed to resonate strongly at one very narrow frequency band (witness their ringing after the excitation is removed). Although I've never tried to do what you're doing, I'm really not surprised it doesn't work.

dotnet: Or do I miss something here?

I think that what holmes4 is suggesting is that you use the ultrasound signal that you have already achieved, as a carrier for a data signal.

One way to do that would be to turn the signal on and off to represent high and low conditions and use that to send a serial bitstream.

Another possibility might be to modulate the frequency, if the hardware supports different frequencies and your receiver is capable of differentiating between them.

One way to do that would be to turn the signal on and off to represent high and low conditions and use that to send a serial bitstream.

but be aware that the ringing is going to limit the bit rate achievable.

(Before IR, wireless TV remotes used to use U/S, which is, I suspect, so many of the IR ones still operate at around the 40kHz mark)

As has already been said, PWMing the 40kHz directly won't work. The PWM information would be carries by harmonics of the 40kHz signal (80kHz, 120kHz etc.) and 40kHz transducers won't transmit or receive those frequencies.

Your options include:

  1. Modulate the amplitude of the 40kHz signal. The simplest form of this is just turning the signal on and off.

  2. Modulate the frequency of the 40kHz signal. You'll probably find that the transducers transmit and receive OK at 39 and 41kHz, maybe even at 38 and 42kHz. If the received signal is clear enough, you can count its frequency in the Arduino. Otherwise, you can use a phase locked loop to recover the received signal, then feed the PLL VCO control signal into either the analog comparator or an analog input pin.

Thank you all for your feedback!

I was hoping for a variable duty solution for the modulation but as it looks like now I think I'll go the IR route for transmitting the ID to free up some bandwidth at 40kHz.

What's wrong with using on-off modulation of the 40kHz to encode the ID? If you make each bit 10 cycles long, then you can transmit up to 4K bits each second - which should be more than enough for all your stations to transmit their IDs.

If you use IR, you'll have similar issues, because most IR receivers operate at 38kHz - except that the demodulation of the data from the 38kHz carrier is done for you.

My bad, try to think with 3 very small kids running around ;)

Guess I'll have a lot of changes tonight to try out, thnx everyone!