I recently put together a servo HAT https://www.adafruit.com/products/2327
and I am not quite sure how to move a servo that I have attached to it.
Do I use the wiringPi i2c library or the wiringPi PWM library, or both? I am confused because the wiringPi PWM library uses a gpio pin but I am using an i2c address.
I have recently bought a Servo HAT as well, and found that Adafruit's tutorial is great ... until it gives you the OLD location for the driver software - and then the screen shots do NOT match the software you download and use ! Extremely confusing
I'm pretty new to this myself, but my understanding is that:
- - PWM is used to operate servos
- The Raspberry Pi has only one GPIO pin which natively does PWM (pin 18)
- hence you need to use an expansion board (such as the servo HAT) to control multiple servos
- if the Servo HAT used one GPIO pin for each servo, you would quickly use all of the GPIO pins
- SO... the Servo HAT uses I2C to receive instructions from the raspberry Pi, and
- the Servo HAT does its bit of magic to drive up to 16 servos without the Raspberry Pi needing to manage all the details
Specificly, you need to use I2C to send commands to the Servo HAT. I guess the wiringPi i2c library will work, but you may need to do some research to find the correct format for the command to send to the Servo HAT.
I found that https://www.adafruit.com/products/815
(Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685) is essentially the same board but without the Raspbery Pi GPIO connector (and https://www.adafruit.com/products/1411
is the same but with connectors for an arduino). They all use the PCA9685 chip, and the same driver software. By following the directions for installing the adafruit driver in https://learn.adafruit.com/adafruit-16- ... it-library
I got my servoHAT working easily.