Designing an audio output circuit with 3 note polyphony for PIC18F45K20

Our project outputs three square waves from the PIC18 and is currently designed to go into an LM324 summing amplifier and then an LM386 audio amplifier to drive an 8ohm speaker. However, we have run in to the following issues:

• The biasing of the LM324 may be wrong, as we have both the positive input pin and the -Vcc of the chip tied to the same ground. One of our instructors mentioned this may be an issue and to use a voltage divider to bias up the positive input. We have inserted a 33kohm and 1kohm resistor to compensate for this.
• Although our measured voltage after the variable low pass filter is below the input voltage of the 386, we have blown two of them.
• The output from the 386 only works if the 3 notes being produced by the PIC are harmonic. Our instrument uses a Gamelan scale, so for example if we play 3 C's we get an ok output, however as soon as we play 3 separate notes (say C, Ab, Eb) we get heavy distortion and intermodulation.

We are wondering if there is any way we can improve on this circuit or alternative circuits we could try. We have tried replacing the LM386 with a transistor circuit to drive the speaker but this didn't resolve our issues. Also, ignore the absolute trash fire of a diagram.

Original Diagram

]

• Hello and welcome. I tidied up your image, hope that's okay. Commented Apr 5, 2023 at 14:46
• Much appreciated, thank you!
– HCon
Commented Apr 5, 2023 at 14:46
• I assume, that the circuit will work much better if you remove the LM324.
– Jens
Commented Apr 5, 2023 at 15:24
• If our reading of the datasheet is correct, I believe the 386 has a maximum input voltage of 400mV. The input signal from the pins would exceed that.
– HCon
Commented Apr 5, 2023 at 16:35

Summing square waves and summing sine waves produce very different audio results Consider lowpass filtering the three input signals before summing.

The problem with the dead 386's might be due to the input signal not being AC coupled. The DC output level of the 324 might be stressing the 386 input stage. For example, if the DC value of the 386 input is 1 V above GND, then the 386 output stage is trying to produce 20 V across the output load. It can't do that, so the output stage saturates high. Referring to the 386 internal schematic, the pull-up half of the output stage is an emitter follower, which cannot saturate. This will cause excessive heating the that transistor, and could be the cause of your device failures.

Note - individual transistor saturation and amplifier saturation are different things.

• Apologies, the ICs are meant to be powered by 9V. Our signals out of the PIC are 1.6V as per our latest measurement. The 330ohm feedback was a result of using the summing amp formula we are familiar with (I am totally open to being wrong here, as we get taught very little about circuit design in our program). We will definitely heed your advice here, this is extremely helpful.
– HCon
Commented Apr 5, 2023 at 14:54
• Great answer, but small nit-pick: The inputs to the 386, as drawn, are not AC coupled. Maybe it should be. Commented Apr 5, 2023 at 14:55
• We were thinking of trying that. We also neglected to add decoupling caps on the power supply to the ICs. I'm thinking we definitely need a few. Do you think a 100uF be sufficient to couple to the 386?
– HCon
Commented Apr 5, 2023 at 15:04
• HCon: The 386 has an input resistance of 50K, so you can calculate the coupling cap size based on the low-frequency response you want. Commented Apr 5, 2023 at 20:33
• evil: yes, the 386 signal input is not AC coupled. That's why I pointed it out. Commented Apr 5, 2023 at 20:34