6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Sep 30, 2024 3:27 am

All times are UTC




Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sun Jun 11, 2017 3:18 pm 
Offline

Joined: Thu Jan 21, 2016 7:33 pm
Posts: 276
Location: Placerville, CA
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.

I think the proper answer is, "as high as you want to make it - provided there's a volume knob on the device itself."


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 4:40 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
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. :D
Ah, and a 100µ or more supply bypass cap (parallel to C24) - the better the supply the better the sound :lol:


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 5:04 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
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.

Each headphone should have specs about it nominal impedance and its sensitivity. Typical for modern in-ear-plugs are 32 Ohm impedance and somewhat around 96 dB SPL (sound pressure level). This means you need 1mW of electrical power to produce that uproar ;)

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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 6:32 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
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."


Sage words indeed. Certainly seems to sum up actual industry practice :P

GaBuZoMeu wrote:
.... snip ...


Max 281mW as per 1M resistors sounds good to me. It means swapping out the speaker for one that can do 300mW (the one I had lined up is only good for 200mW), but that's not a problem. Also the particular LM386 i've got is only rated for 375mW output, so we can't go much higher without it being a risk endeavour.

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


All looks good, for the 8ohm speaker at least. How well do you think this will work on typical headphones? Looking at your second post, I would guess it should work OK. on 32ohm impedance it comes out at 70mW peak power... i.e. 70x 96dB equals..... 132dB, I think. That seems like a lot. Perhaps a series resistor on the ground return from the headphones might be a good idea, to limit the power a bit.

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:
File comment: 82C54-based Sound Synth circuit schematic, revision 2.
Incorporating suggested changes by GaBuZoMeu

soundsynth rev2.png
soundsynth rev2.png [ 43.57 KiB | Viewed 1323 times ]

_________________
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.
Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 7:02 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Alarm Siren wrote:
Oh yes, and what about a reverse bias protection diode across the speaker, headphones or both?

Speaker & headphones are designed (and require) to work with AC signals :D

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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 7:12 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
Quote:
Speaker & headphones are designed (and require) to work with AC signals

Good point. No diode.
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.

I agree.
Quote:
Probably you will get a plop when power is turned on, but thats only a cosmetic problem.

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. I agree that "plop" is not the end of the world, but I'd rather avoid it if it can be avoided.

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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 7:31 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
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 ;)


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 8:51 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
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.

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.

Quote:
Thoughts on series resistor between the headphone's return and ground, to limit the effective dBs?

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.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 8:58 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
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.

You're quite right, I missed that part of the description on the datasheet. Makes sense now.

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.

Gotcha.

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.

Eeehhhh.... battery powered. Already struggling against permissable power draw as it is. I think I shall just have to cope with the pop.

_________________
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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 9:07 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
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.

Eeehhhh.... battery powered. Already struggling against permissable power draw as it is. I think I shall just have to cope with the pop.

I removed that part of my post, because upon re-reading, I think I had been misunderstanding what GaBuZoMeu said. Another way to do it is with MOSFETs in series with the output, but then it's harder to get the distortion really low. I've done it in our designs as part of a double-pole-type arrangement so a different source gets routed to the earphones when the power is down, but again, every way to do it has some kind of drawback.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 10:10 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
What I mentioned was something like this:
Attachment:
noplopp.png
noplopp.png [ 37.29 KiB | Viewed 1295 times ]

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:
Attachment:
noplop2.png
noplop2.png [ 20.53 KiB | Viewed 1294 times ]

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.

Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 10:15 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
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.
Attachment:
pop prevention.png
pop prevention.png [ 19.13 KiB | Viewed 1295 times ]

Yes, there's usually a large capacitor in series with the loudspeaker -- as shown in (a) -- and it can result in a pop or thump on power-up. That can be avoided if you use two capacitors, each half the original value, as shown in (b). This works best when the amplifier is powered by a regulated power supply. (That's because low-frequency supply noise, if any, may become audible in the speaker.)

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 12, 2017 12:08 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
GaBuZoMeu wrote:
edit(1):
This is easier:
Attachment:
noplop2.png

A P-channel MOSFET is turned ON during nRESET only. When nRESET becomes high, the MOSFET becomes non conductive. The IRF7406 should be sufficient.

However, note the diode integrated with the MOSFET, from the source to the drain, which will tun on during the negative-going half of the signal, producing distortion, except with small signals.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 12, 2017 12:37 am 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
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 :(


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 12, 2017 12:54 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: