2

I've connect a servo motor to raspberry. I have too an speaker connect via audio jack 3.5 mm. When I use gpio pwm it produces interference with speaker and it begins to make annoying noise. When I did "gpio in", stopped it.

I think that like both works with frecuency mHz it makes interference, but its impossible that the pulse output be only on the pin? and do not make interference with the output audio? If I have pwm mode, and play music, servo motor gets crazy turning around.

Any ideas?

1 Answer 1

2

Normal audio on the Pis uses the hardware PWM peripheral to generate the sound. The (wiringPi) gpio pwm command uses the hardware PWM peripheral to generate PWM. You can only use one of those functions at any one time.

For driving servos you are better off using a module such as (my) pigpio which by default does not use the hardware PWM peripheral and can provide servo pulses on any or all of the GPIO on the expansion header.

pigpio may be used from C or Python or from the command line.

E.g. to provide 1200µs pulses to GPIO 23 from the command line

sudo pigpiod # start daemon (only do once per session)

pigs s 23 1200
1
  • thanks, i will test it, but sounds great!! Aug 30, 2017 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.