Using a logarithmic pot to control a PC internal speaker

Thread Starter

popcalent

Joined Mar 17, 2018
128
I want to use a 1K logarithmic pot to control a 0.25W 8Ω PC internal speaker [*]. The pot has a switch that I want to use to completely turn on and off the speaker and also to turn on and off an LED to indicate the speaker is on.

I assembled the following circuit.

IMG_20240422_013333.jpg

I initially used a 2N2222 transistor for Q1, but it burned after a while. I'm going to try with a D880 and a heat sink now. With either transistor, the volume is always too low. The reason I'm using a transistor and not just a pot is that the volume is too low with just a pot, even when the variable pin is brought all the way up (no resistance).

Digging on the Internet, I figured out another circuit shown in the picture below. With this circuit, the volume is always too high.

IMG_20240422_013355.jpg

How can I get this to work??

[*] Just to clarify. This is the internal PC speaker of a vintage computer (beep beep). The input signal is either 0 or 5V. It's not an audio signal proper.
 
Last edited by a moderator:

Audioguru again

Joined Oct 21, 2019
6,752
Your circuits put DC on the speaker instead of the AC they are made for. Then the maximum loudness is half it is with AC.
The logarithmic volume control works backwards: turn it anti-clockwise then get loud sounds and turn it clockwise for low level sounds.

The 1k base resistor barely turns on the transistor. The input signal might not be strong enough to feed a higher base current (31mA to 62.5mA).
 

MisterBill2

Joined Jan 23, 2018
18,928
Your circuits put DC on the speaker instead of the AC they are made for. Then the maximum loudness is half it is with AC.
The logarithmic volume control works backwards: turn it anti-clockwise then get loud sounds and turn it clockwise for low level sounds.

The 1k base resistor barely turns on the transistor. The input signal might not be strong enough to feed a higher base current (31mA to 62.5mA).
In addition, the LED probably provides a clamp function to the voltage available for the speaker.
You should be able to adjust the speaker volume in the operating system, which also provides an icon to show the speaker is off. OR maybe you have an old OS, where that is not the case.
And the circuit shown put the transistor directly across your 5 volt source at a maximum volume setting. Of course something will burn up..
 

Thread Starter

popcalent

Joined Mar 17, 2018
128
Your circuits put DC on the speaker instead of the AC they are made for. Then the maximum loudness is half it is with AC.
The logarithmic volume control works backwards: turn it anti-clockwise then get loud sounds and turn it clockwise for low level sounds.
But the signal that goes into the speaker is a digital PWM signal isn't it? This is not the speaker that's connected to the sound card output. This is the loudspeaker that is on the motherboard.

The 1k base resistor barely turns on the transistor. The input signal might not be strong enough to feed a higher base current (31mA to 62.5mA).
So, a smaller Rb?
 

Thread Starter

popcalent

Joined Mar 17, 2018
128
In addition, the LED probably provides a clamp function to the voltage available for the speaker.
I was thinking about isolating the LED somehow... perhaps through a transistor?

You should be able to adjust the speaker volume in the operating system, which also provides an icon to show the speaker is off. OR maybe you have an old OS, where that is not the case.
Again, this is not the speaker that's connected to the sound card output. This is the loudspeaker that is on the motherboard. It only outputs beeps. This is a 386 computer running MSDOS.

And the circuit shown put the transistor directly across your 5 volt source at a maximum volume setting. Of course something will burn up..
How can I fix the circuit? Thanks!
 

Audioguru again

Joined Oct 21, 2019
6,752
5V/8 ohms= a peak current of 625mA! The base current of a saturated transistor must be 62.5mA which is a lot for a computer logic output. Then maybe the original beeper was a low current piezo beeper which works fine with a DC input signal. Then you need an audio power amplifier to drive a new 8 ohm speaker.
 

Thread Starter

popcalent

Joined Mar 17, 2018
128
5V/8 ohms= a peak current of 625mA! The base current of a saturated transistor must be 62.5mA which is a lot for a computer logic output. Then maybe the original beeper was a low current piezo beeper which works fine with a DC input signal. Then you need an audio power amplifier to drive a new 8 ohm speaker.
Ok. I happen to have this lm386 based audio amplifier. I tried my best to draw the circuit based on the PCB, hopefully I didn't make any mistake... Will this work?

IMG_20240422_180924.jpg

The pot is a B100K. I can put a logarithmic one, instead. Right know, I only have an A1K.


Edit: I tried the lm386 amplifier (with the B100K pot). It immediately goes from no sound (or perhaps very low) to very loud (but not the loudest), and it stays like that for the rest of the pot range until the very end, where the sound is distorted. Is it because it's a linear pot? Will it help if I use the A1K? Also, I used 5V. Is there any difference if I use 12V (since it takes both as DC input)?
 
Last edited:

Audioguru again

Joined Oct 21, 2019
6,752
1) Your LM386 amplifier schematic has no important speaker impedance.
2) The 10uF capacitor causes the gain to be too high (for a dynamic microphone as the input signal). Remove the capacitor for a gain of 20 (for a line level input).
3) R2 converts the linear (B type) volume control poorly into a logarithmic (A type) volume control but it also changes the LM386 input resistance too low when it is set high. Then the 0.1uF input capacitor cuts all low frequencies below 200Hz.
R2 should be removed when a log volume control is used.
4) The 100uF output capacitor does not have enough capacitance for good low frequencies. It can be used if the speaker is a tiny shrieker and with your higher frequency beeps.
5) The datasheet shows a max undistorted output of only 0.1W (almost nothing) with a power supply of only 5V and an 8 ohm speaker. WIth a 9V supply, the max undistorted output into 8 ohms is 5 times more at 0.5W. With a 12V supply the max output is about 0.6W but then the IC fries when playing loudly.

All amplifiers produce clipping distortion when trying to produce more output power than they have for a power supply voltage and speaker impedance.
 

MisterBill2

Joined Jan 23, 2018
18,928
The very simplest way to gain an adjustable volume level, with a range from too loud to too soft, will be to use a CD 4049 hex inverter as a bridge driver. two sections in parallel on each side of the speaker coil, one pair with one more inverter feeding it to provide 180 degrees phase shift, and the last inverter feeding both sides, the inverter input and the other pair input. Put the volume control as a variable resistor in series with the speaker. Also a capacitor, the value will affect the volume.The CD4049 will need to pick up both the 5 volt common and the five volt supply from one of the extra drive connectors. It is difficult to get much simpler than that scheme. It is a distorted wave, but beeps are distorted a bit.
 

Audioguru again

Joined Oct 21, 2019
6,752
The very simplest way to gain an adjustable volume level, with a range from too loud to too soft, will be to use a CD 4049 hex inverter as a bridge driver. two sections in parallel on each side of the speaker coil, one pair with one more inverter feeding it to provide 180 degrees phase shift, and the last inverter feeding both sides, the inverter input and the other pair input. Put the volume control as a variable resistor in series with the speaker. Also a capacitor, the value will affect the volume.The CD4049 will need to pick up both the 5 volt common and the five volt supply from one of the extra drive connectors. It is difficult to get much simpler than that scheme. It is a distorted wave, but beeps are distorted a bit.
He showed an 8 ohm speaker.
The CD4049 bridged. paralleled and powered from 5V would drive a Cmos speaker fairly well but not the 8 ohm speaker.
 

Thread Starter

popcalent

Joined Mar 17, 2018
128
Another thing that occurred to me is directing the pc speaker output from the main board to the speakers that are connected to the soundcard output, and use those speakers (which have an amp) for both the sound card and the internal speaker.

My question is: is this the same as a stereo to mono converter circuit, but instead of left/right to mono it's internal_speaker/sound_card_right_output to right speaker plus internal_speaker/sound_card_left_output to left speaker ?

Will the caps in the speaker's block the pc speaker signal since it's a digital signal (DC)?
 

MisterBill2

Joined Jan 23, 2018
18,928
I have driven an 8 ohm speaker exactly as I described and it worked quite well. five volts in series with a capacitor will work. How much sound does the TS require???
 

MisterBill2

Joined Jan 23, 2018
18,928
An "L-Pad" is used to present a constant resistance to either the load or the source, depending on which way it is wired. It will provide no benefit at all for a computer speaker. So why waste money and have a larger device to mount someplace?? What is the anticipated benefit??
 
Top