Adding Sound Generation
- commodorejohn
- Posts: 299
- Joined: 21 Jan 2016
- Location: Placerville, CA
- Contact:
Re: Adding Sound Generation
Alarm Siren wrote:
I have also never been able to find a straight answer with regards to what voltage a headphone output actually should be, peak to peak. Best I can work out? Somewhere between 0.5V and 1.5V depending on how fancy the audio equipment is - fancier equipment outputting higher voltages.
Re: Adding Sound Generation
You don't need that formula, Gain is roughly 20. To get 1Veff out (which isn't much for the speaker) you need 50mVeff at the input.
You have maximum 5V/0V at the input (before pot) - simple assume all three channels produce the same signal and the effect of the capacitors (C21..) is nearly zero due to high frequency.
This 5V/0V rectangle is equivalent to 2.5Veff - that is more than you wish to have at the outside
So you need to attenuate the sources by 2500/50 = 50. If you never ever want a higher amplitude, than Rser/Rpot must yield 50. That would roughly mean Rser = 470K, but as there are 3 in parallel (worst case) you need 1M5 (for R11, R12, R13 each).
As I said 1Veff out isn't much, P = U²/R = 1/8 = 125mW, a little more would helpful, say 250..400mW. Well we have P = U²/R so doubling U would mean 4x P. If you choose R11.. to 1M you would have upto 1,5x signal so 2,25x wattage. As this is peak power everything is fine.
I personally would choose R11,.. to 470K with a little risk of peak distortions.
One more hint: if you first join R11, R12, R13 and then insert the cap you save two caps.
Ah, and a 100µ or more supply bypass cap (parallel to C24) - the better the supply the better the sound
You have maximum 5V/0V at the input (before pot) - simple assume all three channels produce the same signal and the effect of the capacitors (C21..) is nearly zero due to high frequency.
This 5V/0V rectangle is equivalent to 2.5Veff - that is more than you wish to have at the outside
So you need to attenuate the sources by 2500/50 = 50. If you never ever want a higher amplitude, than Rser/Rpot must yield 50. That would roughly mean Rser = 470K, but as there are 3 in parallel (worst case) you need 1M5 (for R11, R12, R13 each).
As I said 1Veff out isn't much, P = U²/R = 1/8 = 125mW, a little more would helpful, say 250..400mW. Well we have P = U²/R so doubling U would mean 4x P. If you choose R11.. to 1M you would have upto 1,5x signal so 2,25x wattage. As this is peak power everything is fine.
I personally would choose R11,.. to 470K with a little risk of peak distortions.
One more hint: if you first join R11, R12, R13 and then insert the cap you save two caps.
Ah, and a 100µ or more supply bypass cap (parallel to C24) - the better the supply the better the sound
Re: Adding Sound Generation
Alarm Siren wrote:
I have also never been able to find a straight answer with regards to what voltage a headphone output actually should be, peak to peak. Best I can work out? Somewhere between 0.5V and 1.5V depending on how fancy the audio equipment is - fancier equipment outputting higher voltages.
Somewhere above 120..140 dB SPL your eardrums would get damaged. As we are talking about power +10dB means x10. So 136dB - 96dB = 40dB = 10x10x10x10 = 10000. Applying 10000 x 1mW = 10W to such a headphone would be sufficient to do severe damage to your ears. Luckily most speakers won't sustain that much power.
Voltages: 1 mW/32 Ohm = P/R = U² = > 177mVeff. 10x higher voltages gives 100x more power = +20 dB SPL.
- Alarm Siren
- Posts: 363
- Joined: 25 Oct 2016
Re: Adding Sound Generation
commodorejohn wrote:
I think the proper answer is, "as high as you want to make it - provided there's a volume knob on the device itself."
GaBuZoMeu wrote:
.... snip ...
I double-checked the calculations for 1M myself, partly to see if I understood it (this is all a learning exercise afterall!) and to be doubly sure you hadn't made an arithmetic error.
Me wrote:
Gain: 20
Desired Output Max: 1.5V
Desired Input Max: 1.5/20 = 75mV
2500/75 = 33.3
Rser/Rpot = 33.0
Rpot = 10000 -> Rser = 330000.
3 Channels -> Rser = 330000 * 3 = ~1000000 = 1M
speaker is 8 ohm
P=U²/R -> P = 1.5² / 8 = 281.25mW
Desired Output Max: 1.5V
Desired Input Max: 1.5/20 = 75mV
2500/75 = 33.3
Rser/Rpot = 33.0
Rpot = 10000 -> Rser = 330000.
3 Channels -> Rser = 330000 * 3 = ~1000000 = 1M
speaker is 8 ohm
P=U²/R -> P = 1.5² / 8 = 281.25mW
Oh yes, and what about a reverse bias protection diode across the speaker, headphones or both?
Here's the new schematic taking into account the suggested changes.
- Attachments
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Re: Adding Sound Generation
Alarm Siren wrote:
Oh yes, and what about a reverse bias protection diode across the speaker, headphones or both?
The schematic looks fine. As either a headphone or your loudspeaker is connected to the negative side of the 250µF there is no need for a 1..10K discharge resistor. Probably you will get a plop when power is turned on, but thats only a cosmetic problem.
- Alarm Siren
- Posts: 363
- Joined: 25 Oct 2016
Re: Adding Sound Generation
Quote:
Speaker & headphones are designed (and require) to work with AC signals
Quote:
As either a headphone or your loudspeaker is connected to the negative side of the 250µF there is no need for a 1..10K discharge resistor.
Quote:
Probably you will get a plop when power is turned on, but thats only a cosmetic problem.
Thoughts on series resistor between the headphone's return and ground, to limit the effective dBs?
---
Incidentally I want to thank you for your help thus far. Clearly I got the wrong end of the stick with my original calculations and would have ended up with some crazy high output...
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Re: Adding Sound Generation
If you would avoid that plop you can add a little relay (1x NC), contacts parallel to the speaker. The coil is driven by a small MOSFET (e.g. BSS138 or similar) plus a freewheel diode (1N4148) across the relays coil to protect the FET when relay is turned off. The FETs gate is connected to /RESET.
When you turn power on the relay remains closed (NC) until /RESET becomes 1 which drives the MOSFET which drives the relay so the contacts opens and the short circuit across the speaker/Headphone disappears.
The components selection mainly depends on the current requirements of the chosen relay - you should look for s.th. very tiny, there is no "power" to deal with
When you turn power on the relay remains closed (NC) until /RESET becomes 1 which drives the MOSFET which drives the relay so the contacts opens and the short circuit across the speaker/Headphone disappears.
The components selection mainly depends on the current requirements of the chosen relay - you should look for s.th. very tiny, there is no "power" to deal with
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Adding Sound Generation
Alarm Siren wrote:
Well, the LM386 datasheet (pg 9) says the inputs are internally biased to ground which I believe would resolve that issue, unless I'm misunderstanding the cause.
Quote:
Thoughts on series resistor between the headphone's return and ground, to limit the effective dBs?
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- Alarm Siren
- Posts: 363
- Joined: 25 Oct 2016
Re: Adding Sound Generation
GARTHWILSON wrote:
When the inputs are at DC ground, or connected through capacitors only, it biases the output to somewhere near half Vcc, to get the best output signal voltage swing. Suddenly coming up from ground to that voltage when you first turn it on is what causes the pop.
GARTHWILSON wrote:
5V is approximately the bottom end of the 386's operable supply voltage range, IIRC. It will be able to swing something like 3V that way, hopefully 1.5V peak each side of center (although probably more on the low side and less on the high side). That's not much. Putting a series resistor will make it clip at a lower level, which is probably undesirable. If you want to turn it down, do it at the input.
GARTHWILSON wrote:
If I understand the relay idea correctly, you might want to do it a little differently. What I can envision happening is that the power starts coming up and the pop is starting be generated before the relay has time and adequate voltage to actuate. None of the solutions to this problem are perfect (I've dealt with them many times in my work); but if you can spare the power, you can use the relay and make it so the output is muted when there's no power at all, and it takes a delay after power-up to get it out of mute.
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Adding Sound Generation
Alarm Siren wrote:
GARTHWILSON wrote:
If I understand the relay idea correctly, you might want to do it a little differently. What I can envision happening is that the power starts coming up and the pop is starting be generated before the relay has time and adequate voltage to actuate. None of the solutions to this problem are perfect (I've dealt with them many times in my work); but if you can spare the power, you can use the relay and make it so the output is muted when there's no power at all, and it takes a delay after power-up to get it out of mute.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Adding Sound Generation
What I mentioned was something like this:
During Reset (active low) the BS170 is not driven, so the relay is closed, any signal to the speaker (the plop) is suppressed. When Reset is through the relay toggles, the speaker can work as normal.
The only drawback is the size and the power consumption. There may be some relays with lesser current requirements.
edit(1):
This is easier: A P-channel MOSFET is turned ON during nRESET only. When nRESET becomes high, the MOSFET becomes non conductive. The IRF7406 should be sufficient.
The only drawback is the size and the power consumption. There may be some relays with lesser current requirements.
edit(1):
This is easier: A P-channel MOSFET is turned ON during nRESET only. When nRESET becomes high, the MOSFET becomes non conductive. The IRF7406 should be sufficient.
Last edited by GaBuZoMeu on Sun Jun 11, 2017 10:24 pm, edited 1 time in total.
Re: Adding Sound Generation
GaBuZoMeu wrote:
As either a headphone or your loudspeaker is connected to the negative side of the 250µF there is no need for a 1..10K discharge resistor. Probably you will get a plop when power is turned on, but thats only a cosmetic problem.
Of course there may be other reasons for a circuit to produce a thump on power-up, and the two-capacitor solution won't address those other issues if they exist. (A muting circuit, as shown in GaBuZoMeu's latest post, is more general solution.)
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Adding Sound Generation
GaBuZoMeu wrote:
edit(1):
This is easier: A P-channel MOSFET is turned ON during nRESET only. When nRESET becomes high, the MOSFET becomes non conductive. The IRF7406 should be sufficient.
This is easier: A P-channel MOSFET is turned ON during nRESET only. When nRESET becomes high, the MOSFET becomes non conductive. The IRF7406 should be sufficient.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Adding Sound Generation
Thank you Garth - i have overseen that !!
So I have to recommend the relay variant. This sadly means 120..200 mW of power requirements during runtime
So I have to recommend the relay variant. This sadly means 120..200 mW of power requirements during runtime
- Alarm Siren
- Posts: 363
- Joined: 25 Oct 2016
Re: Adding Sound Generation
I don't have 200mW spare. The entire system has to run off an absolute maximum of 600mA, 400mA or less being preferable. I'm hooking in an LCD at some point which draws 150mA typical, 310mA peak, so I've already used a LOT of my available current.
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.