Jukebox. Solving sound quality problem

 Last time I've finished connecting amplifier to the Raspberry Pi and playing music. But we heard not only music but the relatively high level noise as well.

Now we I'm trying to figure out where the noise is coming from and how to get rid of it.

What do we know?

The noise sounds like digital data line connected to the output. No surprise: the raspberry pi is a computer and the "sound card" there has interesting approach: the jack output is connected to the GPIO pins with a couple of resistors and capacitors. And PWM signal produced by the CPU is averaged over small time and looks like sound wave afterwards. There are blog posts about how does it work or how to do the "sound card" for smaller raspberry pi.

But we tested the sound with headphones already and haven't heard this noise.

The noise apparently appears only when the amplifier is connected.

Maybe amplifier is noisy? Let's connect it to the laptop output. 



No noise. So it is not amplifier

Maybe it's power output of Raspberry Pi provides noisy power? Let's connect amplifier to the separate power supply?


 No noise as well. So the noise appears only when the amplifier is connected to raspberry pi power. But in experiment with notebook, we connected the amplifier to the raspberry pi power and there was no noise.

So the noise appears only when the amplifier is connected to both power output of raspberry pi, and audio output.

Most credible explanation of this effect, that we build a circuit with something similar to a ground loop.

I.e. the power line, amplifier, raspberry pi internals and audio wires form a circular wire. And it acts as an antenna or a transformer winding. And some of the raspberry pi internals act as a sending antenna or primary winding of a transformer.

And as we see at the ground loop wiki page, the main approach to solve this problem is to break the ground loop. This is what we have done by connecting the second power supply. But two power supplies for a simple toy is an overkill. Let's try to solve the problem and use only one.

So the power line should stay, and we should break the ground loop on the sound wires.

There are devices to do ground loop isolation. One thing is that they cost something and are quite bulky for portable devices.

So basically, what we want is transfer two alternating current signals without having  electrical connection between circuits. There are two approaches for such decoupling: optoisolator (LED and photo-sensor) works well with didgital signals, since it can transfer direct signal. But since they are not used for sound transmission.

Another approach is to use transformers. So we need two transformers, one per channel. And the transformation coefficient should be 1. So that we do not change signal voltage.


 

Let's try it.



Sound looks good enough now.

Next we will connect NFC reader.




Comments

  1. The themes are baked into the mechanics as nicely for a little additional flair. For occasion, you win Wonka Bars within the Willy Wonka slots game. Chests are collected 더킹카지노 while spinning in any game, when leveling-up or by buying coin packs. You're also given two free chests each single day to play slots for fun.

    ReplyDelete

Post a Comment

Popular posts from this blog

Compilation from macOS(Intel) to linux x86_64 finaly works. Cross compilation of the rust code with bazel. Part 2.

Fetching toolchains at build time. Cross compilation of the rust code with bazel. Part 4

Cross compilation for ARM v7. Cross compilation of the rust code with bazel. Part 3.