Ultrasonic circuit

I have constructed my circuit as shown in the picture. I am using raspberry pi to generate PWM to the transistor base and an MCP3008 to convert the anolog signals from the receiver. However, both the transmitter and receiver are not working at as intended. When probed with oscilloscope, the transmitter showed a constant 2VDC. The receiver showed a messy/unorganised/running millivolt analog signal (I'm not sure how to describe it). Sorry for the missing pictures of oscilloscope

  • \$\begingroup\$ +1 for posting a schematic during first question. Do you have an oscilloscope for measuring both the PWM output and the sensor input? Do you have screenshots? \$\endgroup\$ – Ariser - reinstate Monica Sep 5 '19 at 14:25
  • 1
    \$\begingroup\$ The fundamental mistake is in expecting that this would work at any useful range. You need a boosted voltage to drive the transmitter, and you need a a bandpass filtered amplifier for the receiver. Until there is a lot more understanding of the concepts involved you should stick to using the modules. If you do a web search you can find a web site where someone reverse engineered their internals, or you can probably still find app notes on the original solutions from last century. \$\endgroup\$ – Chris Stratton Sep 5 '19 at 14:51
  • \$\begingroup\$ @Ariser Hi sir. I did measure the transducers input and output but I did not take screenshots as I thought they were not of any use. Probing at pin 1 of ultrasonic transmitter gives me a constant 2V whereas probing at pin 2 of ultrasonic receiver gives me messy lines of few hundres of millivolts. \$\endgroup\$ – Chong Lim Sep 5 '19 at 15:28
  • \$\begingroup\$ @ChrisStratton I did not choose to use the modules because I want an output of amplitude/magnitude of the ultrasonic waves. Do you have any suggestion that even a beginner can work on (I'm just a degree student)? \$\endgroup\$ – Chong Lim Sep 5 '19 at 15:31
  • 1
    \$\begingroup\$ @DmitryGrigoryev Hi sir. Sorry for the unclear description as this is my first time posting a question. I will edit my description for easier reference for everybody \$\endgroup\$ – Chong Lim Sep 16 '19 at 10:49

Beware poorly-described web pages...there are fatal flaws in this circuit.

Transmitter fatal flaws
PWM signal into the transistor base should switch the transistor ON and OFF, acting as a switch. PWM frequency should accurately match the piezo resonant frequency (perhaps near 40 kHz). In this circuit, the transistor is ON all the time. Try it with the 10K resistor removed. Ensure that when PWM is off, it idles at 0V.

Diode D1 shouldn't be necessary. Inductor L1 (330uH) seems rather small. Perhaps it is intended to parallel-resonate piezo capacitance. I've used 12mH, not as a resonating inductor, but to improve piezo envelope rise time. In this way, piezo amplitude of 40 kHz reaches maximum after about 5 cycles. Piezo transducers vary, and may require different component values - an oscilloscope is invaluable to optimize response.

Be aware that RPi PWM output voltage swing is less than 5V. If transistor collector voltage doesn't swing close to ground when PWM voltage goes "high", reduce R1 value somewhat.

Receiver flaws PIC A-to-D input voltage range does not extend below ground. The usual range is from Vss at the low end up to Vref (or Vdd) at the upper end. The PIC A-to-D would be unable to measure 40 kHz peaks extending below Vss here, but would be able to measure peaks that swing to positive voltages. In many applications, DC bias about half-way between Vss and Vref is applied. A MCP3008 has a similar input range as a PIC processor.
Adding a DC bias so that both +ve-going peaks and -ve-going peaks can be captured would help improve received pulse detectability, but software may have to be modified to take advantage.

Signal amplitude at 40 kHz. is feeble from the receiver transducer. An amplifier that provides both DC bias and gain can drive a fast single-ended analog-to-digital converter:


simulate this circuit – Schematic created using CircuitLab

To see individual cycles of 40 kHz received signal, the analog-to-digital converter should provide samples quickly, more than 80,000 samples-per-second. Doing so may be difficult with the MPC3008 ADC.

The second circuit detects the envelope of the received 40 kHz pulse. It also has a small DC bias with no signal. A received pulse-train of 40 kHz causes the DC output to rise, and then fall after the pulse-train ends.

| improve this answer | |
  • \$\begingroup\$ You are definitely right about the transistor. I should have noticed when the oscilloscope showed me a constant DC voltage. The circuit designer said D1 functions to protect the transistor from reverse voltage. I will try to use a higher inductor. I am aware RPi's GPIO does not give a high voltage swing. I do not really know how to operate transducer and how much voltage swing they needed. They are not stated in the datasheet. How do I do the biasing? I really appreciated your help. Thanks a lot sir \$\endgroup\$ – Chong Lim Sep 5 '19 at 16:14
  • \$\begingroup\$ Datasheet of the transducer I used : farnell.com/datasheets/… \$\endgroup\$ – Chong Lim Sep 5 '19 at 16:15
  • \$\begingroup\$ @ChongLim ...Data sheet suggests the transmitter can take 10vRMS @ 40 kHz. continuously. If you have a DC supply more than +5V, you can transmit a stronger pulse. For short bursts, I've used +25v DC. (Don't use that much for continuous 40 kHz). \$\endgroup\$ – glen_geek Sep 5 '19 at 17:13
  • \$\begingroup\$ Hi sir. I do not really understand the operation of the circuit you have designed. What is the purpose of Q1? And wouldn't the voltage at R2 be the same whether or not the ultrasonic receiver supplies voltage? \$\endgroup\$ – Chong Lim Sep 6 '19 at 19:32
  • \$\begingroup\$ The first circuit is merely an amplifier. Yes, output voltage is constant DC, with 40 kHz signal superimposed. The second circuit detects the received signal envelope. It's output is a small constant DC voltage. When a 40 kHz signal is received, its DC output momentarily rises - as long as the 40 kHz signal persists. It is an envelope detector. \$\endgroup\$ – glen_geek Sep 6 '19 at 21:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.