5

Alright so I understand this question is fairly saturated, but my use in pwm is for two differing pieces of hardware.

https://www.modmypi.com/blog/raspberry-pi-gpio-en-franais (Sourced from: https://www.modmypi.com/blog/raspberry-pi-gpio-en-franais)

From what i understand i have two available ports that support PWM but i've noticed from research that primarily suggests that GPIO 18 is the only usable PWM output.

Now forgive me for being ignorant, but my understanding from the wiring diagram concludes that i use this topology:

enter image description here

Now the servo motor will be needed to controlled in real time (Hardware PWM) as the solenoid I dont mind having a slight delay (I assume software PWM). (Please note the power will be supplied by an external source)

If anything i'm primarily writing the control code in python, but can anyone recommend a library to use for this application or at least point me in the right direction as i'm struggling to get over this coding/wiring block (Its my first time using the pi).

Pariah
  • 382
  • 1
  • 5
  • 14

1 Answers1

5

I doubt you'll need to use the PWM capability of gpio 18.

There are many ways to provide hardware timed PWM on the Pi on all the user gpios. They are all variations on a theme and use DMA transfers paced by the PWM or PCM peripherals.

You can ignore that as they are all wrapped up in simple wrappers.

My offering is pigpio which will let you send servo/PWM pulses from C, Python, or the command line (via the pigs utility).

joan
  • 71,852
  • 5
  • 76
  • 108