Go Down

Topic: [Solved] Noise and low volume Issues with audio amplifier. (Read 30477 times) previous topic - next topic

Snowman815901

Quote
TL092 currently, but origianlly I had 358s in there, same as the ones you're using. I attached a schematic of my project for you to look at if you want. It's DigitalAmplifier.pdf. The main volume control stage is slightly different than the one I gave you, but the end result is the same.


Impressive, I can tell you're an engineer. I hope to get to that level some day.

Quote
A description is still not as good as a schematic drawing.


I've attached an old drawing that I never posted. This shows how I had the pot wired.

Quote
Just to be sure, I have attached the setup I want you to make as 2nd Schematic.png. If this does not boost the volume significantly, please post a picture of your setup so we can verify the wirings.


I cleaned up the wiring the best that I could for a breadboard (which reduced the noise, but not quite far enough) and took some hi-res photos. You'll see in the pictures that I used a 220k and 47k resistors rather than a single 270k (it's what I had on hand). I also shot some 10sec videos, one with the op amp and one with the midi shield connected directly to the power amp for comparison.

I did the best that I could in a short amount of time to keep the camera in the exact same place for each video. If you compare the two short videos at a given volume you'll hear that the op amp set up does increase the volume but you'll also hear the noise that it introduces as well.

The pictures and clips can be found at:
https://drive.google.com/folderview?id=0BxhYs4r5NIW6dmZVei1acE9tRlU&usp=sharing

At this point, I'm skeptical that putting this on copper clad would reduce the noise sufficiently. I'm open to suggestions for different hardware as well.

Jiggy-Ninja


Quote
Impressive, I can tell you're an engineer. I hope to get to that level some day.

Actually I'm still just a student. I graduate this September.

Quote
I've attached an old drawing that I never posted. This shows how I had the pot wired.

That would explain having to chase it down. That sounded like a capacitor charging up and it was.

Quote
I cleaned up the wiring the best that I could for a breadboard (which reduced the noise, but not quite far enough) and took some hi-res photos. You'll see in the pictures that I used a 220k and 47k resistors rather than a single 270k (it's what I had on hand). I also shot some 10sec videos, one with the op amp and one with the midi shield connected directly to the power amp for comparison.

I did the best that I could in a short amount of time to keep the camera in the exact same place for each video. If you compare the two short videos at a given volume you'll hear that the op amp set up does increase the volume but you'll also hear the noise that it introduces as well.

The pictures and clips can be found at:
https://drive.google.com/folderview?id=0BxhYs4r5NIW6dmZVei1acE9tRlU&usp=sharing

At this point, I'm skeptical that putting this on copper clad would reduce the noise sufficiently. I'm open to suggestions for different hardware as well.

Nice photos. Adding the videos was also a good choice.

Is the noise you are referring to that high pitched squeal in the second video? I replaced the op amps in my project (it's still breadboarded at this point, even though I've been working on it for months now) with 358s (probably a different brand than yours), and will they did hiss a little more than my TL972s, they didn't squeal like that.

It could be the MIDI signal. My project has an LCD screen, and every time it updates the speaker "chirps" a little bit. It's not that audible when music is playing, but it is when it's turned all the way down. This is caused by the digital ground not being isolated from the analog ground. This is just my guess, but it seems to be the most probably solution. I confess that I don't know anything at all about MIDI. Is your Teensy constantly sending data to the shield? If so, what is the baud rate (if such a thing is applicable to MIDI signals)? That could be causing your squeal.

Try increasing the gain on your op amp configuration (change the 270k ohm to 1M ohm) and decreasing the digital gain of the power amp to about +20 dB, instead of the max +30 dB (46 or thereabouts on the volume scale). If my estimation is correct, this should give about the same volume (maybe a tiny bit louder) and might have less noise.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
Actually I'm still just a student. I graduate this September.


Congratulations. I graduate from my program in august. I'm a commercial/industrial electrician apprentice. 5 year program.

Quote
Is the noise you are referring to that high pitched squeal in the second video?


Correct.

Quote
It could be the MIDI signal. My project has an LCD screen, and every time it updates the speaker "chirps" a little bit. It's not that audible when music is playing, but it is when it's turned all the way down. This is caused by the digital ground not being isolated from the analog ground. This is just my guess, but it seems to be the most probably solution. I confess that I don't know anything at all about MIDI. Is your Teensy constantly sending data to the shield? If so, what is the baud rate (if such a thing is applicable to MIDI signals)? That could be causing your squeal.


The Teensy should only be sending data when a MIDI command is sent. In the case of the example videos it was sending "noteOn" (3 bytes) every one second. That's the only code in the loop of my test program.

The example code from Sparkfun for the midi shield uses software serial to send the midi commands at a baud rate of 31250bps . Only the TX line is connected. I assume you could use the regular serial port/s as well and that they just used software serial so they could still print debugs.

It looks like the 31250 rate is fixed by the MIDI protocol.

Quote
Try increasing the gain on your op amp configuration (change the 270k ohm to 1M ohm) and decreasing the digital gain of the power amp to about +20 dB, instead of the max +30 dB (46 or thereabouts on the volume scale). If my estimation is correct, this should give about the same volume (maybe a tiny bit louder) and might have less noise.


I changed in the 1M ohm resistor. It didn't help with the noise but I was able to crank the gain on the power amp up to about 26 (56) or so before I noticed any sort of distortion. That gave it a pretty respectable volume. Along the lines of what I was hoping for when I changed out the speakers and amp for the 20w setup.

I noticed a few things while I was playing around with it today.

I got a pretty big surprise when I touched the leg of the 1Mohm resistor that was connected to the output of a channel and got sports radio! I thought I was just hearing voices for a second but no, they were clearly talking about batting averages and then it cut to a mattress commercial.

I tried disconnecting the MIDI shield completely and powering up everything else. The noise was still there though much quieter. It had some of the same characteristics of the noise in the full setup as well. About every 5 seconds there's a sort of bleep sound that occurs with and without the midi shield connected.

With only the amp powered there's no noise at all.


So I may just be talking nonsense here but could it be RF interference that's causing the noise? I tried changing the interval between notes being played and noticed that the notes seem to be completely independent of the noise. That makes me think that nothing that the Teensy or Midi shield is actively doing is causing the noise and that they may just be acting as an antenna to pick up all kinds of different EMI. As I sit here listening to the noise with no notes playing, like a crazy person, I'm starting to think that I'm hearing an un-tuned radio station and something that could give a  repetitive noise like a cellphone or router.

Also, I got my scope in the mail yesterday. It's a Rigol DS1102e. It seems pretty capable but I'm not familiar enough yet with it's functions to know how to apply it here to give any insights.

All I've managed so far is to measure the maximum peak to peak voltage between a stereo channel and ground at ~1V and the noise seems to be at about 150mvpp.

I'll be researching/fiddling with this for the foreseeable future and will report back if I find anything new.

Jiggy-Ninja

Larger resistors are more suseptable to noise. You could try reducing the impedance of the op amp's feedback network. Change the 100k and 1M into 1k and 10k, and change the 0.1uF to a 10uF. You'll probably have to use an electrolytic, so hook the - lead to the MIDI shield. It has the lower bias voltage. This will keep the gain and high-pass corner frequency the same, but should have less noise if it truly is picking up EM interference.

Also, so far you've done this with the MIDI shield hooked up. Have you tried it with your alternate source (I think your iPod, if I remember from the other thread).
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
Larger resistors are more suseptable to noise. You could try reducing the impedance of the op amp's feedback network. Change the 100k and 1M into 1k and 10k, and change the 0.1uF to a 10uF. You'll probably have to use an electrolytic, so hook the - lead to the MIDI shield. It has the lower bias voltage. This will keep the gain and high-pass corner frequency the same, but should have less noise if it truly is picking up EM interference.


I got some time to work on this tonight and tried this out. No change with the noise. I guess that eliminates the EMI. It still blows my mind that just touching an input of that power amp produces sports radio.

Quote
Also, so far you've done this with the MIDI shield hooked up. Have you tried it with your alternate source (I think your iPod, if I remember from the other thread).


Sorry, I'm not sure what you're referring to. Are you talking about passing the signal from the iPod through the op amp? I could definitely try that if that's what you're suggesting.

I did make some progress tonight though. Powering the midi shield, op amp, and Teensy from a 9v battery through a 5v regulator reduced the noise significantly. The repeating noise that I mentioned in my last post must have been coming from the USB cable since it's gone when powered from a battery. I'm left with a steady hi-pitched whine. The 9v was putting out about 7.1v under load so maybe the regulator was dropping out and getting a fresh battery on there tomorrow will improve things.

With the volume solved and the noise improved, it's getting pretty close to where I want it. I just have to get rid of that last bit of noise and I'll be golden.


Jiggy-Ninja

Some more troubleshooting steps that I would follow:

Unplug the MIDI shield completely: power, signal, audio, everything. Completely remove it from the circuit. Take the sides of the capacitors that were formerly connected to the blue and orange wires (which I shall call the input sides) and ground them. This should remove any input signal from the op amp. Power the circuit back up and listen to the output: is the squeal still there?

If the squeal is still there, that isolates it to the op amp causing it. Take your oscilloscope and measure the following points on each op amp circuit:

1) The output
2) The inverting input
3) The non-inverting input
4) The node where the inpt cap and input resistor meet.

If I'm reading the specs of your scope properly, you should be able to save the waveforms as an image to USB. If so, please post the images for each point. Set the scope up to be AC coupled to remove DC bias so we can see the noise waveform, if there is one. Crank the volts/div setting as sensitive as possible until you see a signal, don't just settle for a flat line.

Also, 7.1 V is really low for a 9 V battery. Was it previously used and almost dead? Or are you drawing excessive current from it?
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
Unplug the MIDI shield completely: power, signal, audio, everything. Completely remove it from the circuit. Take the sides of the capacitors that were formerly connected to the blue and orange wires (which I shall call the input sides) and ground them. This should remove any input signal from the op amp. Power the circuit back up and listen to the output: is the squeal still there?


No squeal without the midi shield. Just some fairly quiet static. I picked up a 1000uF cap earlier today and tried replacing the 470uF cap the was next to the midi shield with it. It did reduce the noise a little, so I took it a bit further. I jammed the leads of the 1000uF cap into the female end of the m-f cables that power the board. Success! The "squeal" was greatly reduced. It's not yet perfect but it's now faint and tolerable.

A picture of what I did can be found here for anyone that's curious:
https://drive.google.com/file/d/0BxhYs4r5NIW6MEd5QnZnQkE2OEk/edit?usp=sharing

Quote
If I'm reading the specs of your scope properly, you should be able to save the waveforms as an image to USB. If so, please post the images for each point.


It turns out my scope saves waveforms in the least usable file format possible, .WFM, so taking a picture of the screen is easier. I took pictures of the probe at the above points and they're available to view here:
https://drive.google.com/folderview?id=0BxhYs4r5NIW6MXMzRVlzdU8yZ1k&usp=sharing
Although I don't think they're very relevant anymore.

Just playing around with the scope, I was able to trigger a semi-stable waveform at the resistor/cap node of the input with a rising edge trigger at 128mv. I'm guessing what I'm seeing here is just a voltage spike.

Placing a few 470uF caps, one across the teensy, one across the op amp and one across the 5v regulator did reduce the static slightly but not by much. It isn't that big of a deal though as it's mostly unnoticeable when there're notes playing .



I do have another problem now though, with the midi shield and op amp connected I'm now getting some distortion out of the speakers even with the gain of the power amp set to 0 (30). I thought maybe I had damaged them so I tried the iPod as the power amps input. They sound fine with the iPod connected. This is when I realized that someone was sleeping in another room so I'll get back to that later tonight.

I'm pretty sure this wasn't happening earlier (immediately after I put the 1000uF cap in the midi shield connectors and tested it) so I'm hoping I can solve that quickly.

Jiggy-Ninja

I tried disconnecting the MIDI shield completely and powering up everything else. The noise was still there though much quieter. It had some of the same characteristics of the noise in the full setup as well. About every 5 seconds there's a sort of bleep sound that occurs with and without the midi shield connected.

When you did this, did you leave the shield's power plugged in, or did you truly unplug everything?

If you left the power plugged in, it could be digital noise caused by the MIDI shield's power line. Getting rid of that might be difficult.

The problem with most of the scope photos you took is that the horizontal setting is 200 ms / div. The squeal is likely at a couple of kHz, so you need to set the scope to about 500 us / div, possibly lower in order to see the squeal waveform.

I think your 1000 uF capacitor hookup pretty definitively puts the MIDI shield as the culprit. What does it sound like when you use the iPod as the input to the opamp circuit?

And according to this product page on Amazon (http://www.amazon.com/Rigol-DS1102E-Oscilloscope-Channels-Sampling/dp/B001VKCJ0M), your scope should be able to save *.bmp files.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
When you did this, did you leave the shield's power plugged in, or did you truly unplug everything?


Back when I did this, I completely removed it. The shield was on the other side of the table. I'm guessing that removing the midi shield got rid of the "squeal" which reduced the noise but I still heard that repeating sound because of the USB connection.

Quote
The problem with most of the scope photos you took is that the horizontal setting is 200 ms / div. The squeal is likely at a couple of kHz, so you need to set the scope to about 500 us / div, possibly lower in order to see the squeal waveform.


Copy that, I wasn't sure what sort of time frame you wanted to see. New pictures inbound shortly.

Quote
What does it sound like when you use the iPod as the input to the opamp circuit?


That I haven't done yet. I'll have to wire up a 3.5mm plug to test it. Though I'm less concerned now about the "squeal" and "static" (which are fairly under control) than I am about the distortion I discovered earlier which I've since learned more about (see below).

Quote
And according to this product page on Amazon (http://www.amazon.com/Rigol-DS1102E-Oscilloscope-Channels-Sampling/dp/B001VKCJ0M), your scope should be able to save *.bmp files.


Good to know. I looked around in the menus for a file type option but didn't see anything, I'll have to read that section of the manual.



So I did some more digging on the distortion I'm getting now. Here's a spreadsheet of the results.
https://docs.google.com/spreadsheets/d/1cjm9gXsybVgqGnxOpC3SnaK3CGTCr35Zfq4wWYrR_Q8/edit?usp=sharing

The results here are a bit confusing.

The tests with the 10k/1k resistors Vs. the tests with the 1M/100k resistors would lead one to believe that the resistor values used are the cause of the distortion.

But the tests with the 1M/100k resistors Vs. the tests with the 680k/100k resistors would lead one to believe that the total gain is the cause of the distortion and that the speakers are just being over-driven.


That's all I have time for tonight. More to come tomorrow.

Jiggy-Ninja

The distortion could be caused by the op amp circuit clipping. I can't imagine the input impedance of the op amp, even with the small resistors, is causing a problem. The 358's ouput is only able to go to Vcc-1.5V, so 3.5 V in this case. With the center of the output biased to 2.5 V, that leaves 1 V of headroom. If the input of the opamp is more than 100 mV peak, it will clip the top end of the waveform. The fact that it happens with a short duration between notes and not on a long duration suggests to me that the notes are "stacking" on top of each other, adding greater swing to the output voltage, possibly causing it to clip.

Do you have two probes for your scope, or just one? If you have two, you can use AC coupling to monitor the signal at both the input and the output at the same time and see at what level the clipping happens.

Can you download a frequency generator app onto your iPod that is able to create a pure sine wave as a test tone? I know android has a few of them, I'm sure iOS must have some too. That should help with troubleshooting to be able to set the frequency and amplitude of the test tone.

If it is clipping, the 358 can handle a supply voltage of up to 32 V, so you can increase your headroom by powering it with the same 12 V supply as the power amp, rather than the 5 V regulator.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
Do you have two probes for your scope, or just one? If you have two, you can use AC coupling to monitor the signal at both the input and the output at the same time and see at what level the clipping happens.


I do. I just used both as you described and here's what I've found so far.

- I super-imposed the input of the op amp on top of the output of the op amp looking for any obvious flattening of the signal, which is what I assume the clipping would look like. I didn't see anything dramatic but,

- I measured the peak voltage from the output in DC coupling mode to be 3.62v (10k/1k) and 3.72v (1M/100k). Which leads me to believe it is in fact reaching the maximum output of the op amp.

- Oddly I measured the peak to peak voltage of the input to only be 34mv. Shouldn't the output of the op amp be only ~2.2v to ~2.8v with a gain of 10?

I'd like to try increasing the supply voltage of the op amp but I have a question first:

Do I leave the 10k/10k voltage divider on both channels connected to 5v? I'm thinking yes, because the 2.5v from this is what sets DC bias but I'm not 100% on that.

Quote
Can you download a frequency generator app onto your iPod that is able to create a pure sine wave as a test tone? I know android has a few of them, I'm sure iOS must have some too. That should help with troubleshooting to be able to set the frequency and amplitude of the test tone.


My iPod cannot, but my android phone can. I'll wire up a 3.5mm jack for that after this post.


Jiggy-Ninja


Quote
- I super-imposed the input of the op amp on top of the output of the op amp looking for any obvious flattening of the signal, which is what I assume the clipping would look like. I didn't see anything dramatic but,

You're correct about what clipping would look like.
Quote
- I measured the peak voltage from the output in DC coupling mode to be 3.62v (10k/1k) and 3.72v (1M/100k). Which leads me to believe it is in fact reaching the maximum output of the op amp.

What was the minimum voltage?
Quote
- Oddly I measured the peak to peak voltage of the input to only be 34mv. Shouldn't the output of the op amp be only ~2.2v to ~2.8v with a gain of 10?

That's correct, it shouldn't be overdriven with an input that small. Have you double-checked your resistor values with a multimeter? Can you post a photo of your current setup?
Quote
I'd like to try increasing the supply voltage of the op amp but I have a question first:

Do I leave the 10k/10k voltage divider on both channels connected to 5v? I'm thinking yes, because the 2.5v from this is what sets DC bias but I'm not 100% on that.

Connect the divider to +12 V too. To get as much headroom as possible, you should bias your op amp to half-supply.

Quote
My iPod cannot, but my android phone can. I'll wire up a 3.5mm jack for that after this post.

I have PA Tone on my phone.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

I gathered a lot of information today.

Highlights:

- After a second look, there does appear to be some clipping with the op amp supplied by 5v. Most of the pictures taken during the 5v setup show some slight flattening on the high end.
https://drive.google.com/file/d/0BxhYs4r5NIW6dk9hOHJDajNfNlE/edit?usp=sharing

- Supplying the op amp with 12v did not remove the distortion. In fact, it's significantly worse as the gain of the power amp increases.
https://drive.google.com/file/d/0BxhYs4r5NIW6eHZkV3hmNUhDcU0/edit?usp=sharing

- When the op amp is supplied with 12v, as the gain of the power amp increases, the signal, read at the input of the power amp, shifts further to the negative.
https://drive.google.com/file/d/0BxhYs4r5NIW6M244cFg2bVl1OGM/edit?usp=sharing

- There appears to be no distortion when using an iPod as the signal source, through the op amp.

- Generating a 900hz sine wave on my phone and passing it through the op amp produces a very clean signal on the output of the op amp (1M/100k) when the power amp is off, and a noisy signal when the power amp is on. When the volume of the phone is brought to max, the sine wave "squares" a bit. The op amp clipping I guess?
https://drive.google.com/folderview?id=0BxhYs4r5NIW6QUR4ZTNtTTFjM3M&usp=sharing


- Changing the value of the capacitor connected to the output of the midi shield has a large effect on the distortion. With 1M and 100k resistors on the op amp, reducing the capacitor to 4.7nF completely removes the distortion, though the sound becomes softer and hollow. I assume this is just because the high pass filter is now filtering a large portion of the lower frequencies.

Many photos and short clips for a few different setups and tests can be found here:
https://drive.google.com/folderview?id=0BxhYs4r5NIW6NlB3RFVRYW44ZUk&usp=sharing

Quote

What was the minimum voltage?


During a rapid note sequence, the minimum voltage was between 880mv and 480mv.

Quote
Can you download a frequency generator app onto your iPod that is able to create a pure sine wave as a test tone? I know android has a few of them, I'm sure iOS must have some too. That should help with troubleshooting to be able to set the frequency and amplitude of the test tone.

Quote
I have PA Tone on my phone.


I downloaded PA Tone and wired up a 3.5mm plug.  Aside from just looking at a sine wave I'm not sure what else I can check with these tools that will be helpful.

Quote
Have you double-checked your resistor values with a multimeter? Can you post a photo of your current setup?


Pictures abound and I check the resistor values every time before I change them.


More to come tomorrow.

Jiggy-Ninja

GAH!!! I'm running out of things to try! They don't teach you this in school. I'm having fun anyway though.

Just to be clear, when you measured the noisy 900 Hz signal with the power amp on, did the sound coming out of it sound scratchy or raspy like it does for the MIDI shield?

I just noticed that my speaker makes a bit of a rattling too when I overdrive it a certain way. This isn't distortion of the audio signal, it's actual physical rattling of the speaker against my hard glass desk. Maybe put something like a folded up T-shirt under your speakers and see if that helps. I doubt it will, since your oscilloscope is pretty definitively showing electrical noise, but it's something to try.

Maybe it's caused by overdriving the input stage. It's only biased at 1.5V, so its output can only swing that far low before it hits ground. It's set up in the schematic for a 1x gain, and you're currently feeding it with a much more massive signal than that. Though that doesn't make sense for the iPod which, at max volume, should be overdriving it even more.

Try halving the size of the feedback resistor (use a 4.7 k instead of 10 k) and seeing if that improves the scratchy sound from the MIDI shield. Power the op amp and bias voltage divider from 5V again.

What is the current rating on your 12V supply?

I noticed you left the Mute pin unconnected. It doesn't have a resistor pulldown on the PCB. Ground it, see if that helps, though I doubt it will. I'm kind of grasping at straws here.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
GAH!!!


Word.

Quote
Just to be clear, when you measured the noisy 900 Hz signal with the power amp on, did the sound coming out of it sound scratchy or raspy like it does for the MIDI shield?


I just tried it again. It sounds fine. Though I'm not sure if conditions were exactly the same as the time before. I'll test it again tomorrow.

Quote
I just noticed that my speaker makes a bit of a rattling too when I overdrive it a certain way. This isn't distortion of the audio signal, it's actual physical rattling of the speaker against my hard glass desk. Maybe put something like a folded up T-shirt under your speakers and see if that helps. I doubt it will, since your oscilloscope is pretty definitively showing electrical noise, but it's something to try.


I've got two layers of 1/8in foam under each speaker. Though I wish it was that simple.

Quote
Maybe it's caused by overdriving the input stage. It's only biased at 1.5V, so its output can only swing that far low before it hits ground. It's set up in the schematic for a 1x gain, and you're currently feeding it with a much more massive signal than that. Though that doesn't make sense for the iPod which, at max volume, should be overdriving it even more.


The bias is intended to be 2.5v isn't it? I'm confused.

Also, I never took the ipod up to max volume. It would've been scary loud.

Quote
Try halving the size of the feedback resistor (use a 4.7 k instead of 10 k) and seeing if that improves the scratchy sound from the MIDI shield. Power the op amp and bias voltage divider from 5V again.


No good. Less volume same distortion.

Quote
What is the current rating on your 12V supply?


5 amps. Should be well over enough.

Quote
I noticed you left the Mute pin unconnected. It doesn't have a resistor pulldown on the PCB. Ground it, see if that helps, though I doubt it will. I'm kind of grasping at straws here.


Didn't get to this today. Worth trying tomorrow though.



Today wasn't entirely unproductive. I found that if I plug the midi shield directly into my computer's mic jack and listen to it, I get plenty of volume, no noise, no distortion and loads of bass. So it is possible to achieve some quality sound with this midi shield. I just need the right setup.

Go Up