0
\$\begingroup\$

I want to mix up to 4 rectangle audio signals which come directly from a microcontroller's timer output pin and contain only one frequncy each. For example, if the microcontroller outputs 400Hz and 600 Hz, i want the output to contain both freqencys like they are played on individual speakers.

Afterwards, the mixed signal is amplified by a BC547, then a 2SC5449 transistor and finally played by a speaker.

The problem is that just adding the signals wouldn't apply here because the transistors just cut off everything above 1V.

So i need a mixing "function" which accepts booleans and outputs booleans. Is that possible? I tried XOR, but combining 300Hz and 400Hz sounds like a razor, which is obviously wrong.

Do you have any idea how to do this? I already have an ATtiny13, which is connected to the raw signals and the amplifier, where I XORed the signals.

my 'amplifier'

The 120 ohm resistor was added later when i noticed the speaker was quite load.

\$\endgroup\$
  • 1
    \$\begingroup\$ What's wrong with the obvious: series resistors from each output to the common entry point of the audio amplifier? If you have a biasing problem with that amplifier, show it to us. \$\endgroup\$ – fgrieu Jun 29 '15 at 18:08
  • \$\begingroup\$ Square waves contain lots of odd overtones; it is not possible to generate the sum as a single square wave, i.e., with a boolean function. \$\endgroup\$ – CL. Jun 29 '15 at 18:11
  • \$\begingroup\$ So you need to convert a single frequency dc square wave into an AC sine wave (multiple ones), then mix them like any analog audio signal. \$\endgroup\$ – Passerby Jun 29 '15 at 18:44
  • \$\begingroup\$ @fgrieu adding via resistors wouldn't work because the "amplifier" can only deal with booleans. I think the two transistors will make the edge between on and off smaller. \$\endgroup\$ – Jufi Jun 29 '15 at 18:46
  • 1
    \$\begingroup\$ To do it in non-analog, you would need to produce a 3-state signal, e. g. 0V 1V and 2V or 0V 0.5V and 1V. You need to *add together the input signals and you cannot do it in 1-bit binary which is what your timer output are. \$\endgroup\$ – DoxyLover Jun 29 '15 at 18:56
1
\$\begingroup\$

I think you need to make two changes to the circuit. Firstly to mix the four signals together, then to bias the amplifier so the signals mix linearly.

1) To mix the signals together, you can just use a resistor from each of the four digital outputs, all connecting at the base of Q1. If you make each resistor 3k9 or 4k7, you will get a similar impedance to the 1k you have at the base of Q1 now.

2) You also need to bias the Q1/Q2 pair so that they are just starting to turn on when all four outputs are off. This way your outputs will combine linearly. You bias Q1/Q2 with another resistor from base of Q1 to VCC. Q1/Q2 start to turn on when base of Q1 is at around 1.3V. For VCC at 5V, and four 3k9 resistors from the digital outputs, the correct value here is (5-1.3)(3k9/4) / 1.3 = 2.775, so use a 2k7 resistor here. For VCC = 3.3V and 3k9 resistors, the value should be (3.3-1.3)(3k9/4) / 1.3 = 1.578, so use a 1k5 resistor.

So, in summary My suggestion is:
- Remove resistor R3
- 3k9 resistor from each of the four digital outputs to the base of Q1
- 2k7 resistor from the base of Q1 to VCC (if VCC is 5V), else 1k5 if VCC is 3.3V

These values aren't too critical, If you use 4k7 instead of 3k9, you can make your bias resistor a little larger too (3k3 for 5V or 1k8 for 3.3V VCC)

\$\endgroup\$
0
\$\begingroup\$

You will get some degree of what you want (adding the two output signals) by feeding an output to IN, and the second output to IN' connected to the base of Q1 through another series resistor R3'. Try R3 = R3' = 4.7 kOhm for a start.

You have a biasing problem, that you can improve by an additional resistor R4 from the collector of Q2 to the base of Q1, and another R5 from the base of Q1 to ground. Try R4 = R5 = 2.2 kOhm for a start. That will lower the volume but allow you to lower R2 (say to 22 Ohm) to get it back.

If you want to reduce the harmonic content, you can add a capacitor in parallel with R4.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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