As it seems I cannot disable/turn off complete the DAC0 on my Arudino Due when it is hooked up to my LM 386 amplifier circuit (one of those pre-built ones) I was wondering what sort of filter I can install either on the output of the DAC0) aka input to the amplifier circuit) or at the output to the speaker.
What does your circuit look like now? Can you post a schematic?
There isn't much to the circuit right now. I am using the following item as my LM386 pre-built amplifier circuit: Amazon.ca
I have the DAC0 going to the the Vin of the LM386, 5V going to the 5V, Gnd going to Gnd. Then on the opposite side I have the speaker hooked up accordingly. Regardless of whatever I have the pot at, to control the gain and thus the volume of the 8 Ohm 0.5W Speaker, I'll hear the static of the amplified DAC0 when it's not playing. The higher the gain/volume the louder the static/noise is. If I ground the Vin there is no static/noise so I've assumed it's the DAC0 not being at 0 when it is not being used. I've tried to analogWrite(DAC0, 0) but still it seems there's enough voltage to get amplified and thus static/noise.
I've assumed it's the DAC0 not being at 0 when it is not being used.
No, it is the fact that you have a high input impedance on the input of the amplifier that is causing the noise to be picked up from the rest of the circuit.
Try a 3K3 resistor from the input to ground. Also try AC coupling the output of the D/A into the input of the amplifier through a 0.1uF cap.
Well I just tried adding the 3k3 from the input of the amplifier to ground and it doesn't seem to have done much. I will try the 0.1uF cap when I can find one, what 'type' of cap should be used, polarized or non-polarized?
0.1 uF capacitors are not usually polarized. But with a 3.3K load, 0.1uF will make a high-pass filter. If you need low frequencies (bass) use 1uF or greater. 1uF capacitors are usually electrolytic and these are polarized. Connect the + end to the Arduino where the voltage is always positive ant the negative end to the amplifier (which will be referenced at ground by the 3.3K resistor).
Doesn't seem to make a difference adding the 100nF capacitor to make the high-pass filter, still have the static/noise when the speaker isn't playing.
Remove the wire from the Due to the amplifier altogether, does the noise stop?
If so try reducing that input resistor, say to 1K
Do not use a bigger capacitor as the Due output has very limited output capacity and many people have blown up that output by loading it too heavily.
If I remove the wire from the Due to the amplifier the noise completely stops. And I swapped the 3k3 to 1k in the highpass filter seutp (Cap in series between Due and Amp and resistor where Cap/amplifier meet to ground) and there is no noticeable change in the amount of noise/filter.
Sorry then you are doing something else wrong that you are not telling us about.
I was able to make a circuit to show how I have it currently hooked up, hopefully this will make things easier for people to understand/troubleshoot.
How about bypassing Vcc to the amp?
Where is the capacitor between pins 1 & 8?
Why would I by-pass VCC to power the amplifier?
Pins 1 and 8? What pins 1 and 8?
Pins 1 and 8? What pins 1 and 8?
On the LM386 amp, you set the gain by placing a capacitor between those two pins. A 10uF cap gives you a 46dB gain.
Why would I by-pass VCC to power the amplifier?
Do you know what that means? You do it to reduce noise. It is a form of supply decoupling.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
And what are you doing with the other input? Have you read the data sheet for this part?
I found the datasheet which took some digging to find.
According to it there is a 10uF capacitor between pins 1 and 8 on the LM386. Also looks like the Pot is on/part of the input to the amplifier as well so it's not just straight from the DAC0 to the inverting terminal of the LM386.
which took some digging to find.
What?
Put
LM386
into google and the data sheet is the top hit.
You need to do something with the input you are not using if you only have a single ended input. The data sheet suggests a capacitor to ground.
The CIRCUIT I am using is THAT in the datasheet, it is PRE-BUILT as per the link I provided earlier to Amazon.
No idea sorry, the data sheet describes the chip. I notice from the reviewes someone said it didn't work.
The design dosn't seem good but it is hard to be definitive without a schematic. I would try some extra decoupling capacitors on the supply.
However tracing where noise is getting in is a bit of an art, nothing is garenteed to work. However I am supprised that lowering the input impedance didn't help. It worked very well for me with the audio amp I made with this chip.
Sorry, let me reiterate, this circuit layout is for the LM 386 amplifier module circuit that I am using, it has all the resistors and capacitors already.