1
\$\begingroup\$

I'm making a class D amplifier as a school project, and we are currently at a stage where we simply need to add the comparator. But the comparator (LM311n) does not seem to run as intended.

My cicuit setup

My triangle and audio wave are both lifted above ground and referenced to an artificial ground at 5 V.

The signal we get from the comparator is weird looking:

current output from circuit

The triangle wave is running at 250 kHz and the audio is running at around 10 kHz. Both audio and triangle is running as intended so I figure my problem is with the comparator as the signal is kind of messed up. Anyone know how I can use the LM311n as a normal comparator to make the PWM signal that drives a speaker? If so I could really use input on how to do so.

\$\endgroup\$
1
  • \$\begingroup\$ try reducing R1 to 1k \$\endgroup\$ Commented Apr 15, 2016 at 12:42

2 Answers 2

2
\$\begingroup\$

The comparator is possibly too slow (200 ns response time) and has an open collector output. The open collector output will undoubtedly contribute to the main problem of the exponential rise. This is also due to the 10k interacting with the o-scope input capacitance (maybe 10pF). Together they form a low pass filter of 3 dB point of about 1.6 MHz and therefore severely restrict the rise time.

I'd consider using a MAX999 comparator run on a 5V rail driving logic level MOSFETs feeding the speaker. To do this you'll need to arrange for your audio signal and triangle wave to be limited to within the 5V rail. I'm not ruling out a different comparator with a push-pull output but I don't think you'll ever get great success with driving a speaker (~ 8 ohms) directly.

\$\endgroup\$
1
  • \$\begingroup\$ Thankyou for you help on this, and thanks for awnsering. Ill consider using the other comparator after i have tried it as you have instructed. \$\endgroup\$ Commented Apr 16, 2016 at 21:53
2
\$\begingroup\$

The rising edge of your signal on the scope is "slow" meaning that there is a large time constant somewhere. Hint: the output of the LM311 is an "open collector" type output and it can only pull the output voltage down. How does the output signal rise, because we see that it does rise on the scope. What component makes this happen ? If you've read Andy's answer you already know it's the 10 kohm resistor, you need to make it a lower value so that the "pulling up" is quicker.

\$\endgroup\$
0

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.