Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Adafruit 16-Channel PWM + Servo HAT: Examples, Pinouts, and Specs

Image of Adafruit 16-Channel PWM + Servo HAT
Cirkit Designer LogoDesign with Adafruit 16-Channel PWM + Servo HAT in Cirkit Designer

Introduction

The Adafruit 16-Channel PWM + Servo HAT (Manufacturer Part ID: 2327) is a versatile add-on board designed for the Raspberry Pi. It provides 16 channels of Pulse Width Modulation (PWM) output, making it ideal for controlling servos, LEDs, and other devices requiring precise timing. This HAT is powered by the PCA9685 PWM driver chip, which communicates with the Raspberry Pi via I2C, allowing for easy integration and control.

Explore Projects Built with Adafruit 16-Channel PWM + Servo HAT

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino-Controlled Multi-Servo Positioning System with Potentiometer Feedback
Image of robootic arm: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
This circuit uses an Arduino UNO to control five servos through an Adafruit 16-Channel 12-bit PWM Servo Driver, with the position of each servo being adjusted by a corresponding potentiometer. The Arduino reads the analog values from the potentiometers connected to its analog inputs and sends PWM signals to the servos via the I2C-connected PWM driver. The servos are powered by a separate power supply that also powers the PWM driver, ensuring adequate current for servo operation.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Controlled Servo Driver for Multi-Channel PWM Applications
Image of SPG: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
This circuit is designed to control multiple servo motors using an Arduino Mega 2560 microcontroller and an Adafruit 16-Channel 12-bit PWM Servo Driver. The Arduino communicates with the PWM driver over I2C (using SDA and SCL lines) to send PWM signals to individual servos for precise angle control. A separate 5V power supply provides power to the PWM driver and the servos, ensuring stable operation for high-current applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano Controlled Robotics System with Wireless Communication and Touch Sensing
Image of AI: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
This circuit features two Arduino Nanos controlling a variety of components. One Arduino interfaces with a 12-bit PWM servo driver to manage multiple servos, an OLED display, a stepper motor via an A4988 driver, and communicates using an NRF24L01 wireless module. The other Arduino handles inputs from several TTP233 touch sensors and also communicates wirelessly using its own NRF24L01 module. Power management is handled by a 12V battery, a step-down converter to 5V, and rocker switches to control power flow.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and Bluetooth-Controlled Servo Motor System with PWM Driver
Image of Robotic Arm I: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
This circuit uses an Arduino UNO to control multiple servos via an Adafruit 16-Channel 12-bit PWM Servo Driver, with communication facilitated by an HC-05 Bluetooth module. The Arduino communicates with the PWM driver over I2C, and the servos are powered and controlled through the PWM driver, allowing for precise servo movements based on commands received over Bluetooth.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Adafruit 16-Channel PWM + Servo HAT

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of robootic arm: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
Arduino-Controlled Multi-Servo Positioning System with Potentiometer Feedback
This circuit uses an Arduino UNO to control five servos through an Adafruit 16-Channel 12-bit PWM Servo Driver, with the position of each servo being adjusted by a corresponding potentiometer. The Arduino reads the analog values from the potentiometers connected to its analog inputs and sends PWM signals to the servos via the I2C-connected PWM driver. The servos are powered by a separate power supply that also powers the PWM driver, ensuring adequate current for servo operation.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of SPG: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
Arduino-Controlled Servo Driver for Multi-Channel PWM Applications
This circuit is designed to control multiple servo motors using an Arduino Mega 2560 microcontroller and an Adafruit 16-Channel 12-bit PWM Servo Driver. The Arduino communicates with the PWM driver over I2C (using SDA and SCL lines) to send PWM signals to individual servos for precise angle control. A separate 5V power supply provides power to the PWM driver and the servos, ensuring stable operation for high-current applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of AI: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
Arduino Nano Controlled Robotics System with Wireless Communication and Touch Sensing
This circuit features two Arduino Nanos controlling a variety of components. One Arduino interfaces with a 12-bit PWM servo driver to manage multiple servos, an OLED display, a stepper motor via an A4988 driver, and communicates using an NRF24L01 wireless module. The other Arduino handles inputs from several TTP233 touch sensors and also communicates wirelessly using its own NRF24L01 module. Power management is handled by a 12V battery, a step-down converter to 5V, and rocker switches to control power flow.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Robotic Arm I: A project utilizing Adafruit 16-Channel PWM + Servo HAT in a practical application
Arduino UNO and Bluetooth-Controlled Servo Motor System with PWM Driver
This circuit uses an Arduino UNO to control multiple servos via an Adafruit 16-Channel 12-bit PWM Servo Driver, with communication facilitated by an HC-05 Bluetooth module. The Arduino communicates with the PWM driver over I2C, and the servos are powered and controlled through the PWM driver, allowing for precise servo movements based on commands received over Bluetooth.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Robotics: Controlling multiple servo motors for robotic arms, legs, or grippers.
  • LED Lighting: Driving multiple LEDs with precise brightness control.
  • Animatronics: Coordinating servo movements for lifelike animations.
  • Model Railroads: Controlling switches, signals, and other accessories.
  • General-purpose PWM control for hobbyist and professional projects.

Technical Specifications

Key Technical Details

  • PWM Driver Chip: PCA9685
  • Number of Channels: 16 independent PWM outputs
  • PWM Resolution: 12-bit (4096 steps)
  • Operating Voltage: 3.3V logic (compatible with Raspberry Pi GPIO)
  • Power Supply for Servos: 5V-6V (via external power terminal block)
  • Communication Protocol: I2C (default address: 0x40, configurable)
  • Maximum Frequency: 1.6 kHz
  • Dimensions: 65mm x 56mm x 13mm
  • Weight: 19g

Pin Configuration and Descriptions

The HAT connects directly to the Raspberry Pi GPIO header and provides additional pins for servo and PWM connections. Below is a description of the key pins and connectors:

GPIO Header (Raspberry Pi Connection)

Pin Name Pin Number Description
SDA GPIO 2 I2C Data Line
SCL GPIO 3 I2C Clock Line
3.3V Pin 1 Power supply for the HAT logic
GND Pin 6 Ground

Servo/PWM Output Pins

Pin Group Description
PWM 0-15 16 channels for servo or PWM signal output
V+ External power input for servos (5V-6V)
GND Ground connection for servos and external power

Power Terminal Block

Terminal Description
V+ External power input for servos (5V-6V)
GND Ground connection for external power

Usage Instructions

How to Use the Component in a Circuit

  1. Attach the HAT to the Raspberry Pi: Align the HAT with the GPIO header on the Raspberry Pi and press it down gently to ensure a secure connection.

  2. Connect Servos or Devices: Plug the servo connectors into the PWM output pins (PWM 0-15). Ensure the correct orientation: signal (white/orange), power (red), and ground (black/brown).

  3. Provide External Power: If driving servos, connect a 5V-6V power supply to the terminal block (V+ and GND). This is necessary to power the servos without overloading the Raspberry Pi.

  4. Install Required Libraries: Use the Adafruit CircuitPython PCA9685 library to control the HAT. Install it using the following command:

    pip3 install adafruit-circuitpython-pca9685
    
  5. Write and Run Code: Use Python to control the PWM outputs. Below is an example code snippet to control a servo:

    # Import necessary libraries
    import time
    from board import SCL, SDA
    import busio
    from adafruit_pca9685 import PCA9685
    from adafruit_motor import servo
    
    # Initialize I2C bus and PCA9685 module
    i2c = busio.I2C(SCL, SDA)
    pca = PCA9685(i2c)
    pca.frequency = 50  # Set frequency to 50Hz for servos
    
    # Initialize a servo on channel 0
    servo0 = servo.Servo(pca.channels[0])
    
    # Move the servo to different angles
    servo0.angle = 0  # Move to 0 degrees
    time.sleep(1)     # Wait for 1 second
    servo0.angle = 90  # Move to 90 degrees
    time.sleep(1)      # Wait for 1 second
    servo0.angle = 180  # Move to 180 degrees
    time.sleep(1)       # Wait for 1 second
    
    # Turn off the servo
    pca.deinit()
    

Important Considerations and Best Practices

  • Power Supply: Always use an external power supply for servos to avoid overloading the Raspberry Pi.
  • I2C Address Conflicts: If using multiple I2C devices, ensure they have unique addresses. The PCA9685 address can be changed by soldering the address jumpers on the HAT.
  • Servo Current Draw: Check the current draw of your servos to ensure the power supply can handle the load.
  • Frequency Setting: Use a frequency of 50Hz for servos. For LEDs or other devices, adjust the frequency as needed.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Servos Not Moving

    • Cause: Incorrect power supply or wiring.
    • Solution: Verify the external power supply is connected to the terminal block and the servo wires are correctly oriented.
  2. I2C Communication Errors

    • Cause: I2C address conflict or improper connection.
    • Solution: Check the I2C address of the HAT and ensure no other devices share the same address. Verify the SDA and SCL connections.
  3. Raspberry Pi Not Detecting the HAT

    • Cause: I2C interface not enabled.
    • Solution: Enable I2C on the Raspberry Pi using raspi-config and reboot.
  4. PWM Signal Not Stable

    • Cause: Incorrect frequency setting.
    • Solution: Set the correct frequency for your application (e.g., 50Hz for servos).

FAQs

  • Can I stack multiple HATs? Yes, you can stack multiple HATs by configuring unique I2C addresses for each HAT.

  • What is the maximum current the HAT can handle? The HAT itself does not limit current; the external power supply and connected devices determine the maximum current.

  • Can I use this HAT with other microcontrollers? Yes, the HAT can be used with any microcontroller that supports I2C communication, though it is designed for the Raspberry Pi.

  • How do I change the I2C address? Solder the address jumpers on the HAT to configure a new I2C address. Refer to the PCA9685 datasheet for address configuration details.