I've got a sensor that outputs a .7Vpp square wave at 36kHz-60kHz. I need to take that square wave and amplify it to 5Vpp, as close to 0V to 5V rails as possible. Then I need to send that signal over a long cable, 6-50 feet depending on where I'm using the sensor and have that square wave still be nice and square when it reaches the other end.

I have a single +5VDC supply to work with.

Currently I can get a good square wave by using an LM311P comparator, but when I try to drive it over a long cable I end up with a wave that looks like a shark fin.

Should I be taking a different approach all together instead of the comparator, or is there something I can put between the comparator and the long cable to help the signal?

This is a little bit of a simplification of what I'm doing, but it's basically what I'm doing now. NOTE: the BJT shown is actually part of the LM311P comparator. Also, the 1V source is actually 5V.


simulate this circuit – Schematic created using CircuitLab

Here's the shark fin output at 36kHz, about 5Vpp, that I was describing: Shark Fin Wave

  • \$\begingroup\$ Can you post a picture of your "shark fin"? That is caused by cable capacitance, and my approach to a solution depends how bad it is. \$\endgroup\$
    – Matt Young
    Commented Aug 8, 2013 at 22:22
  • \$\begingroup\$ Should V1 actually be 5V? \$\endgroup\$
    – The Photon
    Commented Aug 8, 2013 at 22:37
  • \$\begingroup\$ Yes, sorry the V1 should actually be 5V. It was my first time trying that circuit editor and I missed the voltage before inserting the image and couldn't figure out how to change it. Also, I added the shark fin waveform. \$\endgroup\$ Commented Aug 8, 2013 at 22:58
  • 1
    \$\begingroup\$ Thanks for the accept. It's generally a good idea to wait 24 hours before accepting to give people in every time zone a chance to see your question. There are alternate solutions to this problem, and someone else might give you one that fits your situation better than mine does. \$\endgroup\$
    – The Photon
    Commented Aug 8, 2013 at 23:20

3 Answers 3


The circuit you're using is able to drive the cable very quickly to the low level, but only pulls up slowly to the high level because R1 limits the current available to charge up the capacitance of the cable. The maximum current you're going to be sourcing into your cable is about 3.3 mA.

One solution is, instead of buffering with the Q1/R1 combination, use a buffer/driver IC such as SN74LVC1G126. This can supply up to 32 mA current either sourcing or sinking. You'll have to work out from your cable length and capacitance per foot whether that will give you adequate edge speeds for your application.


The comparator you are using is an open drain output, which means it only sinks current and uses the resistor to pull the line high.
This means you have an uneven output impedance, with the output high impedance effectively being being the same as the pullup resistor (1.5k in your circuit)

So to put it simply, you need a lower impedance drive, and it helps if the OH/OL drive is similar. The reason for needing a lower impedance is the longer the line, the more capacitance (between the line conductors) the output needs to charge.

You can either swap the comparator to one with a decent push-pull output (i.e. a PNP and NPN or P-ch and N-ch MOSFET working together) or you can buffer the output with a logic gate with decent drive, or even parallel a few together.

Here's a rough simulation with the gate representing your comparator, with a 36kHz square wave input, and a worst case line capacitance estimate of 2nF (Cline).
In the top trace the gate is set to an output high of 1.5kΩ, and in the bottom trace it is set to 20Ω. You can see the expected "shark fin" slope as it takes longer to go high, and then a considerable difference when the impedance is dropped.





Maybe you should rethink this - why not just send the 0.7Vp-p signal down the cable then use a comparator at the receiving end to restore it. I'd suggest a MAX999 comparator at the far end because it's very fast and swings close to 0V and +5V.

If you can't have any circuit added at the far-end then still, I'd use the MAX999 for driving down the cable, or, if you are insistant on 5Vp-p use an AC series CMOS driver like TI's 24mA drive output 74AC86 - I picked on this because I designe dit into something the other day and I believe you can get it in an equivalent single gate package.

  • \$\begingroup\$ Unfortunately, with the given project I can't change the circuit at the receiving end. With your suggestion of using the 74AC86, I assume the idea is to tie one of the OR gate inputs to GND and the output of the comparator go into the other OR input. Then the gate would be driving the line instead of the comparator. Is that right? \$\endgroup\$ Commented Aug 8, 2013 at 23:11
  • \$\begingroup\$ @JonathanAdams that is correct - you have the possibility of inverting it as well by tying the grounded input to positive. \$\endgroup\$
    – Andy aka
    Commented Aug 8, 2013 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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