I looking for some help with design. I am outputting a sine wave from a PWM pin on the Arduino Uno board. I want to be able to adjust the amplitude/volume of this signal. The first thing I do is low pass filter (Chebyshev filter) the signal (12KHz cutoff) to remove sampling frequency. I then output the signal to a 10K Log pot to adjust the amplitude of the signal before outputting the signal to a speaker.
PWM Pin OUT - > Low Pass Filter - > 10K Log Pot - > Amplifier - > Speaker
The signal sounds fine at full amplitude/volume to about 1/2 volume but when the signal is played out at low amplitude it becomes distorted. I'm guessing this is done to signal resolution but wondered if there was anything which could be done to improve this?
Here are the two circuits. The first one feeds into the amplifier. All the circuits are currently on a breadboard and go to the same GND rail. This is attached to one of the GND pins on the Uno. The amplifier is a LM386. Thanks
Check to make sure you have the pins on the pot connected right-way-round. Outside pins to output of the filter and ground, center pin to the LM386.
Oh, and you should have a DC blocking capacitor between your filter circuit and the potentiometer. About 4.7uF to 47uF will be fine. The output of your lowpass filter has a DC offset because you have a 0-5V PWM signal going in and the two resistors form a voltage divider at DC.
I changed the pot to see if it was that and there is very little or no distortion now. Thanks for your help. I have added the DC blocking capacitor as well!