So I am trying to make a raspberry pi control a servo but it also needs to have speakers attached. But whenever the servo is powered there is a horrible audio output through the speakers. This will happen even when the audio out put is set to hdmi or the PWM pin either way it comes out of the audio jack and changing the volume doesn't help either. But as soon as the servo powers off it stops. To program and wire the servo I used adafruits raspi lesson 8: using a servo. Any help?
2 Answers
\$\begingroup\$
\$\endgroup\$
1
This is likely to be caused by shared noise through the power supply. There are three possible fixes:
- Put the servo on its own supply (common ground, but different supply). Although it looks from that tutorial that it's already powered by batteries.
- Use digital audio to another board with its own supply (I believe there are various Raspi DAC projects out there, or USB audio may work). You could even have optical isolation over TOSLINK.
- Attempt to suppress the noise from the servo with chokes, decoupling capacitors, etc. Start with a few uF across the power rails near where the servo is connected.
You said you'd set audio to HDMI but were getting noise out of the audio jack. I believe if you do that you should get audio on the television or monitor used for the display, and you should disconnect the audio jack.
-
\$\begingroup\$ Agreed with the HDMI audio output, it's digital and should not be getting analog power supply noise. The audio jack is irrelevant and should not be connected to a speaker if using HDMI \$\endgroup\$– KyranFCommented Aug 4, 2015 at 16:39
\$\begingroup\$
\$\endgroup\$
1
I know this is a late response but ...
use ./servod --pcm
-
1\$\begingroup\$ Welcome to EE.SE, but this wouldn't rate as one of the all-time great answers. Would you care to explain (1) how to use this commend, (2) what this command does and (3) why you think it would help eliminate what appeared to be power supply noise. Put the additional info in your answer and not in the comments. \$\endgroup\$ Commented Apr 7, 2016 at 19:45