Difference between revisions of "Pi-servo-HAT"
From SB-Components Wiki
(→Python) |
|||
Line 38: | Line 38: | ||
== Installation == | == Installation == | ||
==== Python ==== | ==== Python ==== | ||
− | * | + | * Stack Servo HAT on Raspberry Pi. |
+ | |||
+ | * Now connect the external power supply of 6V - 12V DC on the Green connector as shown below, Turn on the adapter and it will power the Raspberry Pi. | ||
+ | |||
+ | * Now connect Servo motor on any servo port ranging between 0-15. | ||
+ | |||
+ | * Clone Github repository by running below command in terminal. | ||
+ | <source lang="shell"> https://github.com/sbcshop/Raspberry-Pi-Servo-Driver.git </source> | ||
+ | |||
+ | * It will clone the repository in the '/home/pi' location, To enter cloned repository, enter the below command. | ||
+ | <source lang="shell">cd Raspberry-Pi-Servo-Driver </source> | ||
+ | |||
+ | * Now run the below command to execute the python code. | ||
+ | <source lang="shell">sudo python3 servo_controller.py </source> | ||
+ | |||
+ | * If you are using any other pin (between 0-15) then change the default servo pin to the designated pin in code i.e <source inline> controller.Set_Pulse(15,i) </source> | ||
== Resources == | == Resources == |
Revision as of 10:49, 21 June 2021
Raspberry Pi Servo HAT
16 Channel Servo Driver HAT for Raspberry Pi is a motor driver HAT from which one can control up to 16 motors simultaneously. If you're building a robot with a lot of moving parts, or if you need to monitor a lot of servo motors with PWM yields, the microcontroller's limited PWM yields will be a big problem. The most important thing you can do to solve this problem is to obtain a 16-Channel 12-Bit PWM/Servo Driver.
Features
- Adjustable frequency PWM up to about 1.6 kHz
- Up to 16-Channel servo/PWM outputs, 12-bit resolution for each channel (4096 scales)
- 3 pin connectors in groups of 4 so you can plug in 16 servos at once
- This board/chip uses an I2C 7-bit address
- 40-Pin GPIO accessibility
- I2C controlled and power supply connector
- Compatible with all the Raspberry Pi Models such as 4B, 3B+, 3, 2, B+, A, Zero, Zero W, etc.
Specifications
- Power supply: 5V OR 6V (power supply connector)
- Servo voltage: 5V
- Logic voltage: 3.3V
- Driver: PCA9685
- Control interface: I2C/GPIO
Pinout
Motor Driver HAT | BCM |
---|---|
VCC | 5V |
GND | GND |
SDA | GPIO 2 |
SCL | GPIO 3 |
Installation
Python
- Stack Servo HAT on Raspberry Pi.
- Now connect the external power supply of 6V - 12V DC on the Green connector as shown below, Turn on the adapter and it will power the Raspberry Pi.
- Now connect Servo motor on any servo port ranging between 0-15.
- Clone Github repository by running below command in terminal.
https://github.com/sbcshop/Raspberry-Pi-Servo-Driver.git
- It will clone the repository in the '/home/pi' location, To enter cloned repository, enter the below command.
cd Raspberry-Pi-Servo-Driver
- Now run the below command to execute the python code.
sudo python3 servo_controller.py
- If you are using any other pin (between 0-15) then change the default servo pin to the designated pin in code i.e
controller.Set_Pulse(15,i)