VOGONS


First post, by Darmok

User metadata
Rank Newbie
Rank
Newbie

Hi all!

In order to play older games that don't support soundcards and only use a PC speaker, I connected the output of the speaker on the motherboard to the PC_SPK AWE64 input. This led to a sharp increase in noise at the output of the sound card, as a result of which I had to remove the gain at the speaker input with a mixer and increase it again if the game required a speaker. I got fed up with it and decided to do something.

A brief study of AWE64 showed that noise and interference at the PC_SPK input are inevitable due to the very simplified Creative solution. In effect, the input, with little filtering, is connected directly to the +5V rail of the motherboard, with all its powerful noise. Even worse, this input does not have a ground pin, which means that it is simply impossible to get a low noise level at this input. The good news is that the TAD and PC_SPK inputs are essentially the same input, which means that the TAD input can be used to connect a speaker while still allowing the mixer to adjust the signal level. In the absence of the TAD input, you can use the CD_IN input, and if the CD_IN input is occupied, then it is desirable to keep the ability to use the PC_SPK input, trying to reduce the noise level.

In my opinion, the only cardinal way to get rid of interference is the use of optical isolation. In order not to mess with a galvanically isolated power supply, which in itself is a source of interference, I decided to use the photovoltaic effect in a pair of LED - photodiode. The experiment showed that a photodiode loaded with a resistance of 1 kOhm develops a voltage of 0.45 V on it and has sufficient speed for our purpose.

I did not want to lose the opportunity to hear the caressing ear of BEEP at the start of the computer 😀, and at the same time I needed to ensure silence during nightly games with headphones. Therefore, I implemented a timer that turns on the speaker for 30 seconds after the power is turned on or when the reset button is pressed.
The use of the timer entailed the use of its own speaker driver, and since I added a driver, why not give it additional features.

Thus the PC Speaker Sound Device was born.

The following application modes are possible:

1. We connect only the speaker and set J1 to the Enable position. You can connect a useless switch Keylock or Turbo (if it is not used) to J1, in which case it becomes possible to turn the speaker on and off as needed. This mode corresponds to the standard use of a speaker with a peak power of 120 mW (8 ohm speaker). You can also jumper pins 1-2 of the CN5 connector and get a maximum peak output power of 315 mW. Or connect a potentiometer and be able to adjust the volume from 0 to maximum. This mode also allows the speaker to be used on motherboards that are designed to use a piezo buzzer and have a high internal resistance of the output driver, as a result of which a standard 8 ohm speaker sounds too quiet.
2. Everything is the same as in the previous mode, but we connect the output of the sound card amplifier to the AMP_IN input. This allows you to use sound cards that do not have any sound inputs at all (for example, Adlib). In this case, it is better to install a speaker with a larger diameter for better sound quality.
3. Connect the speaker, connect the sound card to the LINE_OUT or PC_SPK output and set J1 to Auto. In this mode, the speaker will be connected for about 30 seconds after the power is turned on or the reset button is pressed, allowing you to hear the start-up BEEP or alarms if something happens. In games, we listen to speaker sounds through stereo speakers connected to the sound card.
4. Everything is the same as in the previous mode, but we connect the output of the sound card amplifier to the AMP_IN input and use only the built-in speaker in mono mode.

Before making a prototype of the device, I would like to ask your opinion about it. What other useful functionality could be added? Maybe all this is superfluous and only the basic possibility of a low-noise output is needed? Criticism and suggestions on the electrical circuit are also welcome.

Thanks for support.

Update: I have made changes to the circuit based on the results of testing the device.

Attachments

  • devicen.GIF
    Filename
    devicen.GIF
    File size
    125.55 KiB
    Views
    1179 views
    File license
    Public domain
Last edited by Darmok on 2023-03-02, 13:02. Edited 2 times in total.

Reply 1 of 24, by Jo22

User metadata
Rank l33t++
Rank
l33t++

Hi there! I really like your design, kudos! 😎👍

Darmok wrote on 2023-02-13, 12:56:

In my opinion, the only cardinal way to get rid of interference is the use of optical isolation.

I'm speaking under correction, but maybe it's possible to use some sort of a schmitt trigger as a refresher.

It would essentially clean up the TTL pulses which the PC speaker is made of (PC speaker output is using a pin of the system timer).

Some people use this to clean up and/or buffer the output of TTL oscillators.
The final signal is then used to clock a CPU etc.

Using two inverter ICs may also do, not sure.

The basic idea/principle is akin to early telegraph "amplifiers".

They consisted of electro-mechanical relays that reacted to
the on/off switching (morse code) produced by the telegraph key.

By using multiple power circuits and relays, each relay was essentially
amplifying the signal - by repeating the pulses it got.

Of course, this required special circuits for two way communications.
Three relays were used, afaik. This was in 18xx, the schematics are described in old books.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 3 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Jo22 wrote on 2023-02-13, 13:51:
Hi there! I really like your design, kudos! 😎👍 […]
Show full quote

Hi there! I really like your design, kudos! 😎👍

Darmok wrote on 2023-02-13, 12:56:

In my opinion, the only cardinal way to get rid of interference is the use of optical isolation.

I'm speaking under correction, but maybe it's possible to use some sort of a schmitt trigger as a refresher.

It would essentially clean up the TTL pulses which the PC speaker is made of (PC speaker output is using a pin of the system timer).

Some people use this to clean up and/or buffer the output of TTL oscillators.
The final signal is then used to clock a CPU etc.

Using two inverter ICs may also do, not sure.

The basic idea/principle is akin to early telegraph "amplifiers".

They consisted of electro-mechanical relays that reacted to
the on/off switching (morse code) produced by the telegraph key.

By using multiple power circuits and relays, each relay was essentially
amplifying the signal - by repeating the pulses it got.

Of course, this required special circuits for two way communications.
Three relays were used, afaik. This was in 18xx, the schematics are described in old books.

@Jo22 You describe a method for regenerating the shape and amplitude of a signal, which is used when transmitting a signal over long communication lines and its inevitable degradation. In our case, this does not happen, on the contrary, we need to convert the input signal into a form acceptable for the sound card.

The speaker PC signal is a PCM binary signal with an amplitude of approximately 5V. The transformation of this signal into sound occurs directly in the speaker itself due to its mechano-acoustic properties. If you apply this signal to the input of the sound card, lowering its level to a standard value of 1V, then it, having passed through the audio path and the amplifier, will be restored again to approximately the same initial level and, having reached the speaker at the output of the sound card, it will also be converted by it in sound. If the sound card had infinite bandwidth, the output signal would be exactly equal to the input signal, but in reality this is not the case and the sound card introduces distortion into the waveform. From this it is clear that there is no point in preserving the exact shape of the signal at the input of the sound card; rather, on the contrary, it is better to narrow its spectrum to reduce intermodulation distortion.

By the way, the question of whether the sound card strongly distorts the speaker signal is quite interesting. I experimented with two identical standard 8 Ohm 2" speakers and connected one to the output on the motherboard and the other to the output of the sound card amplifier and placed them side by side on the table. Running a tune from the Supaplex game and leveling the volume of the speakers, I tried to determine if they sounded much different. To my non-musical ear, the speakers sounded exactly the same.

The speaker's input level is so much higher than the interference level that it is effectively masked by the signal itself, so the problem is not that interference is superimposed on the signal, but that interference is present when there is no signal. The signal source is connected to the 5V bus and ground on the motherboard, which are the source of interference, as long as such a connection exists, interference cannot be eliminated. The only way to break this link is optical isolation.

Reply 4 of 24, by Jo22

User metadata
Rank l33t++
Rank
l33t++
Darmok wrote on 2023-02-14, 08:13:

The only way to break this link is optical isolation.

For DC, likely yes. Though the relay model as such isn't completely obsolete yet.

https://www.allaboutcircuits.com/technical-ar … ital-isolators/

^I think that's overkill, however. At least for this purpose here.

If the the PC speaker output was a traditional audio signal (AC signal), a transformer was an alternative, too. A passive one, even.

Alas, it's essentially the output of a slow TTL oscillator, so a transformer can't be used.
Well, not easily, at least. With certain tricks it could be made work (using saturation effect etc), but that's not practicable at this frequency, I suppose.

Edit: It's also worth considering that square wave signals, as used by TTL normally, generally cause harmonics.
So it might be that they interfere with audio circuits at some point if no low-pass filtering is applied.

Edit: Both square wave and sawtooth are imperfect, dirty wave forms.
They cause lots of radio interference due to their nature. Hence please be careful feeding them into something.
They can cause unwanted oscillations and other malfunctions if the target is designed to handle sine.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 5 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Jo22 wrote on 2023-02-14, 12:35:
For DC, likely yes. Though the relay model as such isn't completely obsolete yet. […]
Show full quote
Darmok wrote on 2023-02-14, 08:13:

The only way to break this link is optical isolation.

For DC, likely yes. Though the relay model as such isn't completely obsolete yet.

https://www.allaboutcircuits.com/technical-ar … ital-isolators/

^I think that's overkill, however. At least for this purpose here.

If the the PC speaker output was a traditional audio signal (AC signal), a transformer was an alternative, too. A passive one, even.

Alas, it's essentially the output of a slow TTL oscillator, so a transformer can't be used.
Well, not easily, at least. With certain tricks it could be made work (using saturation effect etc), but that's not practicable at this frequency, I suppose.

Edit: It's also worth considering that square wave signals, as used by TTL normally, generally cause harmonics.
So it might be that they interfere with audio circuits at some point if no low-pass filtering is applied.

Edit: Both square wave and sawtooth are imperfect, dirty wave forms.
They cause lots of radio interference due to their nature. Hence please be careful feeding them into something.
They can cause unwanted oscillations and other malfunctions if the target is designed to handle sine.

Well, I agree that the phrase "The only way to break this link is optical isolation" is not entirely correct in the general case. There are other devices for galvanic isolation. Electromagnetic transformer, piezoelectric transformer, magnetostrictive transformer, electromagnetic relays, etc. In most of these methods, including optical isolation, active devices are required to restore the waveform and, accordingly, a power source. There is only one power source in the computer, from which we want to get rid of interference. You can use a galvanically isolated converter, but this will greatly complicate the circuit, in addition, such a converter will itself be a source of interference that you will have to deal with.

For this reason, I chose a method based on the photovoltaic effect. This solves the problem of signal regeneration, it is simply not needed. The photodiode gives a voltage of 0.45V at a load of 1 kOhm, by connecting two photodiodes in series we get a voltage of 0.9V, which corresponds to the required standard level at the input of the sound card.

Unfortunately, a circuit based on the photovoltaic effect has a limited speed. I don't have a Vishay IL300 Linear Optocoupler at the moment, so I was experimenting with an ancient optocoupler with much worse parameters and only one photodiode. I have an oscilloscope, but no tunable square wave generator, so I used a 5 kHz fixed frequency generator. The results were satisfactory, there was a slight drop in signal fronts, according to my estimates, the circuit will be able to work up to frequencies of 10 kHz, which is quite enough for our purposes. The bandwidth can be increased by lowering the load impedance, but this will lead to a large drop in signal level. In any case, only the manufacture and testing of a prototype will show the possibility of using this solution in practice.

Reply 6 of 24, by Tiido

User metadata
Rank l33t
Rank
l33t

I would have fed the output to a logic gate powered by your own clean source, and then do some analog conditioning on it (level adjust, filtering etc.). That defeats all the noise etc. and it is easy to implement gating and other stuff as seen it your idea too.

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 7 of 24, by Jo22

User metadata
Rank l33t++
Rank
l33t++
Darmok wrote on 2023-02-14, 15:11:
Jo22 wrote on 2023-02-14, 12:35:
For this reason, I chose a method based on the photovoltaic effect. This solves the problem of signal regeneration, it is simply […]
Show full quote

For this reason, I chose a method based on the photovoltaic effect. This solves the problem of signal regeneration, it is simply not needed.
The photodiode gives a voltage of 0.45V at a load of 1 kOhm, by connecting two photodiodes in series we get a voltage of 0.9V,
which corresponds to the required standard level at the input of the sound card.
[..]

Darmok, that's fine. I didn't say otherwise any time.
I merely took "Need advice" literally and wrote down what comes to mind.. 😀

Tiido wrote on 2023-02-14, 16:51:

I would have fed the output to a logic gate powered by your own clean source, and then do some analog conditioning on it (level adjust, filtering etc.).
That defeats all the noise etc. and it is easy to implement gating and other stuff as seen it your idea too.

That's about what my father said, too - what a coincidence.. 😁

Personally, I like the idea of the galvanic isolation. Since this is the system timer (originally the Intel 8253 PIT) that's involved, care should be taken.
If there's a short or any unexpected damage happening, the whole mainboard will be damaged permanently.
Or if there's too much capacity/load etc on the pin, the PC may run unstable, too.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 8 of 24, by Tiido

User metadata
Rank l33t
Rank
l33t

Hahaha, it is a good idea, or at least I and him preceive as such 🤣

PIT output goes to a logic gate first, which is controlled by an IO from the Keyboard Controller to turn the tone on or off, so you're not directly connecting to core system bits, though for most machines it still is going to be direct connection to southbridge equivalent though a driver transistor, which is unlikely to die if anything does go wrong (i.e a direct short).

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 9 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Jo22 wrote on 2023-02-14, 18:36:
Darmok, that's fine. I didn't say otherwise any time. I merely took "Need advice" literally and wrote down what comes to mind.. […]
Show full quote
Darmok wrote on 2023-02-14, 15:11:
Jo22 wrote on 2023-02-14, 12:35:
For this reason, I chose a method based on the photovoltaic effect. This solves the problem of signal regeneration, it is simply […]
Show full quote

For this reason, I chose a method based on the photovoltaic effect. This solves the problem of signal regeneration, it is simply not needed.
The photodiode gives a voltage of 0.45V at a load of 1 kOhm, by connecting two photodiodes in series we get a voltage of 0.9V,
which corresponds to the required standard level at the input of the sound card.
[..]

Darmok, that's fine. I didn't say otherwise any time.
I merely took "Need advice" literally and wrote down what comes to mind.. 😀

Tiido wrote on 2023-02-14, 16:51:

I would have fed the output to a logic gate powered by your own clean source, and then do some analog conditioning on it (level adjust, filtering etc.).
That defeats all the noise etc. and it is easy to implement gating and other stuff as seen it your idea too.

That's about what my father said, too - what a coincidence.. 😁

Personally, I like the idea of the galvanic isolation. Since this is the system timer (originally the Intel 8253 PIT) that's involved, care should be taken.
If there's a short or any unexpected damage happening, the whole mainboard will be damaged permanently.
Or if there's too much capacity/load etc on the pin, the PC may run unstable, too.

Many, many years ago, when I worked as a developer of electronic devices, it was customary in our laboratory to absolutely ruthlessly criticize the developments of colleagues, looking for large, small, as well as imaginary and non-existent shortcomings in their solutions. The author of the development was obliged to reasonably defend the technical solutions he had adopted. This belligerent process was highly effective in finding weak solutions and eliminating them. In addition, it nurtured in the developers resistance to external pressure, strengthened their willpower and forced them to realize responsibility for their decisions. The development and testing of some electronic devices can be very dangerous and people with a weak nervous system are better off not doing this. 😉

Here I defend my decision, explaining why it is so. This does not mean that I consider my scheme ideal, it is not. My motto has always been - Keep it simple, if possible, of course. For the sake of simplicity, I made some compromises when developing the device and there is reason for criticism. Therefore, I am completely open to any criticism, suggestions and ideas. You can freely express them, and I will defend my decision with arguments or agree with your proposals. So we will make the device better. In addition, it is invigorating and will be useful for everyone.
Due to being very busy, I can not always answer quickly, but I will answer without fail.

As for the possibility of damage during short circuits. Due to some vision problems, I do not see very well in low light, thanks to this I happened to short the adjacent pins on the speaker connector more than once, and since on older motherboards the pin adjacent to the + 5V pin is connected to ground, this led to a short circuit and protection operation in the power supply. There were no other consequences. However, it cannot be hoped that all motherboards will be as resistant to such barbarism. Therefore, my decision is made in such a way that you can freely close any pins on the output connectors and this will not lead to any consequences, also if the connectors connected to the motherboard are mistakenly turned on in a mirror, the device simply will not work, but no breakage will not occur.

Does anyone have any suggestions for adding some more functionality. I don't have enough imagination to come up with anything else. Maybe the collective mind will help?

Now I have no more time, a little later I will answer TIIdo.

Reply 10 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Tiido wrote on 2023-02-14, 16:51:

I would have fed the output to a logic gate powered by your own clean source, and then do some analog conditioning on it (level adjust, filtering etc.). That defeats all the noise etc. and it is easy to implement gating and other stuff as seen it your idea too.

The speaker's PC signal source is connected to the digital ground on the motherboard and the +5V power rail. The noise source is both the power rail and the digital ground. Interference on the digital ground occurs as a result of the action of powerful current pulses flowing through the ground bus. The internal resistance of such a noise source is about ten milliohms. How can you filter them out? The use of a logic gate will not help this in any way, nor will a good power supply, since the signal at the output of the gate will also be tied to digital ground. Connecting digital ground to analog ground at the input of a sound card is a bad idea. Sound card developers specifically take steps to somehow decouple these two grounds to reduce interference. This can not always be done efficiently enough, so special solutions are used to obtain noise-resistant sound inputs. Such an input, for example, on Creative sound cards and many others is the CD_IN input. If you try to measure the resistance between the ground at the CD_IN input and the analog ground, for example, at the TAD input, with a multimeter, it will show a fairly large resistance. This is because the ground at CD_IN is not a "real" ground, but a virtual one. In fact, this is the output of an operational amplifier involved in a special circuit solution that, in theory, completely eliminates common mode noise. In reality, due to the non-ideality of electronic components, it is not possible to completely eliminate interference, but it is possible to significantly (by orders of magnitude) reduce their level.
In my device, optical isolation does not serve the purpose of protecting the sound card from short circuits or anything like that, but only to decouple the signal source from the digital ground and thus from the source of interference.

Reply 11 of 24, by Tiido

User metadata
Rank l33t
Rank
l33t

Like you I am no stranger to analog electronics and I actually specialize in very high performance linear systems so this definitely caught my interest since I have already done such a thing successfully and it was interesting to see a different take on it.
Those small and nearly unimaginable deficiencies sometimes are all that differentiate a good and a great design 🤣
What gets written here is not so much to you but to all the others who may be reading, since the general process of how sound happens on PC-speaker is described and perhaps someone else will find it useful too.

PC-speaker signal from chipset is just a logic signal that is gated by another to silence it when needed. That signal alone is too weak to drive a big inductive load like a little speaker so there's always an external "low side driver" mechanism, the most basic transistor inverter type of thing often seen when needing to drive relays etc. with a tiny signal otherwise incapable of a task like that. "Big" currents only if one drives a speaker too, which is not what you have to do there but even if you did it won't matter a whole lot still. +5V is there only because of the way the single transistor drivers work but all one needs is a 1k+ resistor for your own next stage or if you want to go pro, a constant current source, and it doesn't even matter where that positive rail comes from and to some extent what it even is.

CCS will actually help with performance of the optocoupler, allowing signal edges to get a little bit faster. Another thing that can be relevant to your design is that most newish boards I see even have 3.3V instead of 5V and it will be a problem to your design without an additional power supply but then again, a machine that new is probably out of scope for it anyway. In the end all that really does matter is that it "connects" your chosen positive rail to a GND point somewhere else, however noisy that GND may be and as a result you have the squarewave signal.

Any noise or interference in it won't matter much when you get it amplified to both of your own power rails which aren't polluted like that, logic gate can be seen as a very high gain amplifier or even a comparator and any crap that can pass is only at the signal transitions which already have all the odd harmonics and if there is some really strong noise in the source it can only manifest as some sort of phase jitter this way. Only real problem one may have are some wiggles in power rails that end up modulating the output at the signal transitions from the instantaneous cirrent demands but this is a concern only for suboptimal connectivity. Bypass capacitor and low inductance supply paths will fix that, and for extra measure one or two 10...100pF capacitors on input and/or output will definitely fix that (nothing is digital when you go deep enough 🤣) so it shouldn't ever be a problem in a competent physical design.

Once a logic chips is in the mix, you can probably get rid of the NE555 too and create your delayed gating mechanism with that alone. A logic chip of the right family (something CMOS with +/-24mA drive) can actually help with the optocoupler too as they're designed so that saturation type effects are minimal and you get a more ideal duty cycle response through it so the signal durations will be less distorted. Small duty cycle effects will alter the tonality a little since harmonics are going to shift. There are few operating modes on the PIT that are useful for PC speaker sound and some games definitely make use of them, few of those produce a narrow pulse instead of 50% duty cycle and those narrow pulses will suffer most when the drive mechanism isn't optimal, logic chip can help with this.

Now one has their own squarewave, which should be bandlimited a bit first since sound card mixer components tend to use almost the worst parts with really poor bandwidth and they can start to do funny things when significant ultrasonic content is to be passed through them, but that is still a matter of a simple RC filter and it won't even have to be multiorder or anything. The reference plane crossing will be a problem but it is a trivial problem, using the exact same ways that CD inputs work in many sound cards as you mentioned and for exactly this same reason. With the right parts it makes the problem inaudible and a very very hard task to measure aswell, effectively irrelevant. Optocoupler does both tasks here (reference plane crossing and filtering from its slowness), no denying that but finding one fast enough is definitely a problem, and I am not sure how well the one you chose performs, my "fast enough" may not be same as yours and it can be among those small and nearly unimaginable problems hahaha

In any case your idea definitely works though it seems to end up with just as many parts neceassy as some other would which may improve in a few areas that should make a positive difference. The few ideas I had about this may prove useful and should be worth exploring. I do wish I had my work setup ready to actually do few experiments, but I moved to another country not so long ago and the work area isn't really up to the task yet...

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 12 of 24, by georgel

User metadata
Rank Member
Rank
Member

First check the output stage of the PC speaker schematics. It is very simple. But it does not allow DC current through the PC speaker still for the audio band you can accept it as a purely digital signal. That's a huge advantage when you want to get rid of the noise. I would have just put a single open emitter saturated transistor stage with a couple of resistors at base and collector placed near the sound card's input plus would use a 78Lxx linear stabilizer (with decoupling capacitors around it) to power that stage and that's it.

Reply 13 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Tiido wrote on 2023-02-16, 06:30:
Like you I am no stranger to analog electronics and I actually specialize in very high performance linear systems so this defini […]
Show full quote

Like you I am no stranger to analog electronics and I actually specialize in very high performance linear systems so this definitely caught my interest since I have already done such a thing successfully and it was interesting to see a different take on it.
Those small and nearly unimaginable deficiencies sometimes are all that differentiate a good and a great design 🤣
What gets written here is not so much to you but to all the others who may be reading, since the general process of how sound happens on PC-speaker is described and perhaps someone else will find it useful too.

PC-speaker signal from chipset is just a logic signal that is gated by another to silence it when needed. That signal alone is too weak to drive a big inductive load like a little speaker so there's always an external "low side driver" mechanism, the most basic transistor inverter type of thing often seen when needing to drive relays etc. with a tiny signal otherwise incapable of a task like that. "Big" currents only if one drives a speaker too, which is not what you have to do there but even if you did it won't matter a whole lot still. +5V is there only because of the way the single transistor drivers work but all one needs is a 1k+ resistor for your own next stage or if you want to go pro, a constant current source, and it doesn't even matter where that positive rail comes from and to some extent what it even is.

CCS will actually help with performance of the optocoupler, allowing signal edges to get a little bit faster. Another thing that can be relevant to your design is that most newish boards I see even have 3.3V instead of 5V and it will be a problem to your design without an additional power supply but then again, a machine that new is probably out of scope for it anyway. In the end all that really does matter is that it "connects" your chosen positive rail to a GND point somewhere else, however noisy that GND may be and as a result you have the squarewave signal.

Any noise or interference in it won't matter much when you get it amplified to both of your own power rails which aren't polluted like that, logic gate can be seen as a very high gain amplifier or even a comparator and any crap that can pass is only at the signal transitions which already have all the odd harmonics and if there is some really strong noise in the source it can only manifest as some sort of phase jitter this way. Only real problem one may have are some wiggles in power rails that end up modulating the output at the signal transitions from the instantaneous cirrent demands but this is a concern only for suboptimal connectivity. Bypass capacitor and low inductance supply paths will fix that, and for extra measure one or two 10...100pF capacitors on input and/or output will definitely fix that (nothing is digital when you go deep enough 🤣) so it shouldn't ever be a problem in a competent physical design.

Once a logic chips is in the mix, you can probably get rid of the NE555 too and create your delayed gating mechanism with that alone. A logic chip of the right family (something CMOS with +/-24mA drive) can actually help with the optocoupler too as they're designed so that saturation type effects are minimal and you get a more ideal duty cycle response through it so the signal durations will be less distorted. Small duty cycle effects will alter the tonality a little since harmonics are going to shift. There are few operating modes on the PIT that are useful for PC speaker sound and some games definitely make use of them, few of those produce a narrow pulse instead of 50% duty cycle and those narrow pulses will suffer most when the drive mechanism isn't optimal, logic chip can help with this.

Now one has their own squarewave, which should be bandlimited a bit first since sound card mixer components tend to use almost the worst parts with really poor bandwidth and they can start to do funny things when significant ultrasonic content is to be passed through them, but that is still a matter of a simple RC filter and it won't even have to be multiorder or anything. The reference plane crossing will be a problem but it is a trivial problem, using the exact same ways that CD inputs work in many sound cards as you mentioned and for exactly this same reason. With the right parts it makes the problem inaudible and a very very hard task to measure aswell, effectively irrelevant. Optocoupler does both tasks here (reference plane crossing and filtering from its slowness), no denying that but finding one fast enough is definitely a problem, and I am not sure how well the one you chose performs, my "fast enough" may not be same as yours and it can be among those small and nearly unimaginable problems hahaha

In any case your idea definitely works though it seems to end up with just as many parts neceassy as some other would which may improve in a few areas that should make a positive difference. The few ideas I had about this may prove useful and should be worth exploring. I do wish I had my work setup ready to actually do few experiments, but I moved to another country not so long ago and the work area isn't really up to the task yet...

Tiido, thank you for your qualified and detailed discussion. I will express my opinions. I think your proposals are more in line with the measures used in the development of precision devices. However, the solution must be adequate to the problem. The device I propose serves a primitive purpose and is designed for low cost and easy repeatability.

I use just one transistorized inverter that generates all the necessary signal levels for the optocoupler, PC_SPK output and for driving the speaker driver. All these loads do not have a direct capacitive component, no matter how significant. The intrinsic speed of the transistor is at least three orders of magnitude higher than the maximum signal frequency. I don't see any reason to significantly delay the signal front, which means that the jitter caused by this reason will be negligible relative to our operating frequencies. Rather, the cause of some jitter may be the decoupling electrolytic capacitor at the input of the transistor inverter. But should such jitter be taken into account? It should not be forgotten that in the end the signal will pass through the audio path, in which it will be subject to much more significant distortion and there are many more reasons for jitter in this path. The reason for the use of a coupling capacitor is the ambiguity in the level at the output of motherboards in the absence of an input signal. I was surprised to find that on one of my 386 boards, the output transistor is closed in this case (a strange decision - a current of 120 mA flows through the speaker all the time), and on the other 486 it is open.

The optocoupler is a linear device, which means that if there is a signal and current flows through the LED, the source of which is a noisy +5V bus and digital ground, interference will also be present in the signal. I deliberately went for it, without bothering to filter the supply voltage to simplify the circuit (such filtering would also require the use of a fairly large inductance, at least in the ground bus). The reason for this decision is that the signal level is many times higher than the noise level and they simply will not be heard against the background of the signal itself. In the absence of a signal, the current does not flow through the LED (the reverse currents of transistors are on the order of tens of nanoamperes and are absorbed by relatively low-resistance resistors connected to the collector of the transistor inverter) and there is no noise at the output. In my opinion, such a simple and cheap scheme is quite appropriate for the task.

Also, I see no reason to use any other solutions instead of NE555. This microcircuit requires a minimum of external parts, it is cheap, widespread, easy to obtain, and in general, everyone who deals with electronics should have stocks of it.

I left solutions based on virtualization of the reference ground plane in case a positive result cannot be achieved with an optocoupler. This option will greatly increase the cost and dimensions of the device. You will need a fast, low-noise op amp, precision resistors, blocking capacitors, and a good power supply. It will also be necessary to somehow solve the problem of the lack of two polar power supply, which is simply nowhere to be found.

The question of the maximum frequency and minimum duration of the PC speaker signal pulses remains unexplored. I can only give my guesses based on what I hear while playing games. I am not detecting high frequencies either directly through the speaker connected to the motherboard, or through the speakers connected to the sound card. According to my estimates, there are no frequencies above 3 kHz, although I may be wrong. Narrowing the pulse about 50% at a given frequency reduces the energy transmitted to the speaker, and hence the volume of the sound. This technique could be used by game developers. With a decrease in the duration of the pulse, the volume decreases very quickly and it should not have made sense for the developers to use sounds that are barely audible, wasting processor resources for this. In games, there is also not a large range of sound volumes.

As soon as I have free time, I plan to assemble a simple circuit for the full-scale verification of a voltaic circuit. By connecting the oscilloscope in differential mode, I can observe and evaluate the difference between the signals at the input and output. Could someone please tell me the game with the most complex and interesting sounds to test, and where can I download it.

Attachments

  • test.GIF
    Filename
    test.GIF
    File size
    5.57 KiB
    Views
    1492 views
    File license
    Public domain

Reply 14 of 24, by Jo22

User metadata
Rank l33t++
Rank
l33t++

Speaking of opto coupler speeds.. It does not need to be fancy.
Way back in the past (19th century ?), incandescent lamps and selenium cells were used to build lightphones.

So even a light bulb is fast enough to transmit sound, even if it merely covers the minimum bandwidth needed for human speech (~3 KHz)..

Edit: Strictly speaking, more bandwidth is needed to fully replicate human speech.
Especially in case of children/female voices. Information is stored in the heights, but the lows sound more friendly to the ear.
When listening to lo-fi transmissions (3KHz), the brain/hearing tries to reconstruct the missing information in the heights.

So in essence, a passive interface could be build in a cardboard box
by using a 6v bicycle incandescent lamp* and a solarcell or photodiode on Line-In. ;)

Likewise, the timer could be build with a few capacitors and a classic electro mechanical relay, too.

Edit: Here'e an old clip of a basic flip-flip built using relays and caps.
It's not always necessary to use solid-state tech/semiconductors. :)

(* depending on how the Speaker Output stage on motherboard is implemented.
This is just a fictional idea, of course.
May need an extra one-transistor amp using a BC548 or 2N2222 etc.)

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 15 of 24, by BitWrangler

User metadata
Rank l33t++
Rank
l33t++

Got me wondering if an optocoupler out of an optomechanical mouse would work. Got a couple with dead hard to source button switches, and another one or two that have been neutered (no balls)

However I'd tend toward something simpler myself, something around 100hz or a bit less in a high pass filter to get rid of the farts, and something around 10khz or so in a low pass to get rid of the whistles. Though nipping the noise level off with a diode is a good plan, something in a low power Schottky if it's millivolts.

Though I would also assume that a generic hookup wire would be as much to blame and try some basic shielded audio cable even stolen off crappy headphones for a bit of screening instead of being an antenna.

Unicorn herding operations are proceeding, but all the totes of hens teeth and barrels of rocking horse poop give them plenty of hiding spots.

Reply 16 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
Jo22 wrote on 2023-02-17, 04:16:
Speaking of opto coupler speeds.. It does not need to be fancy. Way back in the past (19th century ?), incandescent lamps and s […]
Show full quote

Speaking of opto coupler speeds.. It does not need to be fancy.
Way back in the past (19th century ?), incandescent lamps and selenium cells were used to build lightphones.

So even a light bulb is fast enough to transmit sound, even if it merely covers the minimum bandwidth needed for human speech (~3 KHz)..

Edit: Strictly speaking, more bandwidth is needed to fully replicate human speech.
Especially in case of children/female voices. Information is stored in the heights, but the lows sound more friendly to the ear.
When listening to lo-fi transmissions (3KHz), the brain/hearing tries to reconstruct the missing information in the heights.

So in essence, a passive interface could be build in a cardboard box
by using a 6v bicycle incandescent lamp* and a solarcell or photodiode on Line-In. 😉

Likewise, the timer could be build with a few capacitors and a classic electro mechanical relay, too.

Edit: Here'e an old clip of a basic flip-flip built using relays and caps.
It's not always necessary to use solid-state tech/semiconductors. 😀

(* depending on how the Speaker Output stage on motherboard is implemented.
This is just a fictional idea, of course.
May need an extra one-transistor amp using a BC548 or 2N2222 etc.)

I have no prejudice to the use of solutions based on the use of components made in accordance with the technologies of the last century. Sometimes I use them when creating simple devices. But for this, a number of conditions must be met: such components must be available in my stocks accumulated over the years, the device is supposed to be made in a single copy, the device is intended for low-responsibility applications, and it must be possible to easily replace a failed component with its modern analogue.

Reply 17 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie
BitWrangler wrote on 2023-02-17, 05:53:

Got me wondering if an optocoupler out of an optomechanical mouse would work. Got a couple with dead hard to source button switches, and another one or two that have been neutered (no balls)

However I'd tend toward something simpler myself, something around 100hz or a bit less in a high pass filter to get rid of the farts, and something around 10khz or so in a low pass to get rid of the whistles. Though nipping the noise level off with a diode is a good plan, something in a low power Schottky if it's millivolts.

Though I would also assume that a generic hookup wire would be as much to blame and try some basic shielded audio cable even stolen off crappy headphones for a bit of screening instead of being an antenna.

An optocoupler is a pair of LED - photodiode enclosed in a single housing with no possibility to mechanically interrupt the optical connection between them. This is the only difference with the LED-photodiode pair used in mice. However, mice use a photoconductive photodiode circuit. This option has a very high performance. A similar solution is used in optical communication lines with a bandwidth of gigahertz. However, the photoconductive circuit requires the use of active elements for regeneration of the signal and power supply, which is what I am trying to avoid.

At the input of the sound card there is already a filter that limits the frequency range of the signal to the required values, so it makes sense to cut only the higher harmonics of the PC speaker signal, which will be done in my solution.

If you look closely at my schematic, you will see that I am using a shielded cable for LINE_OUT. PC_SPK input-output is implemented in such a way that it has a low impedance. The source of electromagnetic interference induced on the connecting wires has a very high impedance. The resulting divider reduces the penetration of electromagnetic interference to a very low level, they will be undetectable against interference from the ground and + 5V buses. It is not necessary to use a shielded cable for the PC_SPK input.

Reply 18 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie

I made a tunable square wave generator with adjustable duty cycle and tested the optocoupler in photovoltaic mode.

Last time I was too casual about the experiment by setting too much current through the LED. As it turned out, there is an optimal current value at which maximum performance is achieved. For the optocoupler I used, this current was 6 mA. In this case, the minimum pulse duration at which its full amplitude is maintained was 7.5 microseconds. The duration of the leading edge of the pulse is weakly dependent on the current through the LED and has a duration of 2.5 microseconds. The duration of the trailing edge at the optimum value of the LED current is 5 microseconds. As the LED current increases, the trailing edge duration increases rapidly. Reducing the current below the optimum leads to a decrease in the signal amplitude.

The limiting frequency that the tested optocoupler is able to pass without reducing the amplitude of the output signal is approximately 65 kHz. A decrease in amplitude of 3 dB is observed at a frequency of about 70 kHz.

I used an ancient AOD101A optocoupler manufactured 40 years ago, its parameters are significantly inferior to the IL300 optocoupler, therefore, the use of IL300 is also possible, but you need to choose the optimal current value for it through the LED.

I also developed a new version of the device circuit using logic gates. I have not used power supply filtering as I find it unnecessary and useless. I invite you to express your opinion on this option.

The values of the resistors that set the duration of the timer and the current of the optocoupler LED are approximate and require clarification when testing the device.

Attachments

  • dev2.GIF
    Filename
    dev2.GIF
    File size
    114.01 KiB
    Views
    1329 views
    File license
    Public domain

Reply 19 of 24, by Darmok

User metadata
Rank Newbie
Rank
Newbie

Since I don't have the 74HC132 and IL300, and it's too long to wait for them to arrive, I made a version with transistors and AOD101A optocouplers. An excellent result has been obtained. Having set the maximum signal level, I connected and disconnected the LINE_OUT output to the input of the sound card, while comparing the noise level at the amplifier output. No additional noise was detected at all. Similarly, I checked the output of PC_SPK, there was an extremely small little noticeable increase in noise. The sound quality when using LINE_OUT is excellent and does not differ in any way from that obtained when using PC_SPK. The photovoltaic circuit is quite usable. The rest of the device works as it was designed.

Attachments

  • dev3sh.GIF
    Filename
    dev3sh.GIF
    File size
    109.1 KiB
    Views
    1231 views
    File license
    Public domain
  • dev3ph.JPG
    Filename
    dev3ph.JPG
    File size
    310.03 KiB
    Views
    1231 views
    File license
    Public domain