PCA9685 16-channel PWM / servo driver con ESP32
Alimentazione 3.3-5 V
Bus I2C
Indirizzo I2C
0x40 / 0x41 / 0x42 / 0x43 / 0x44 / 0x45 / 0x46 / 0x47 / 0x48 / 0x49 / 0x4A / 0x4B / 0x4C / 0x4D / 0x4E / 0x4F / 0x50 / 0x51 / 0x52 / 0x53 / 0x54 / 0x55 / 0x56 / 0x57 / 0x58 / 0x59 / 0x5A / 0x5B / 0x5C / 0x5D / 0x5E / 0x5F / 0x60 / 0x61 / 0x62 / 0x63 / 0x64 / 0x65 / 0x66 / 0x67 / 0x68 / 0x69 / 0x6A / 0x6B / 0x6C / 0x6D / 0x6E / 0x6F / 0x71 / 0x72 / 0x73 / 0x74 / 0x75 / 0x76 / 0x77 / 0x78 / 0x79 / 0x7A / 0x7B / 0x7C / 0x7D / 0x7E / 0x7F
Pin e collegamento all’ESP32
| Pin | Ruolo | Pin ESP32 | Note |
|---|---|---|---|
| GND | Massa | GND | |
| OE | Ingresso (lo pilota l’ESP32) | D25 | Output enable, active LOW. Leave unconnected (pulled LOW) |
| SCL | Clock I2C (SCL) | D22 | |
| SDA | Dati I2C (SDA) | D21 | |
| VCC | Alimentazione | 3V3 | Logic supply: 3V3 |
| V+ | Non collegato all’ESP32 | — | Servo power from a separate 5 to 6 V supply. Never the logic pin |
Collegamento consigliato per l’ESP32 DevKit a 30 pin, evitando i pin della flash, di sola lettura e di strapping. BoardPilot lo controlla mentre colleghi.
Codice di partenza (Arduino)
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // SDA = GPIO 21, SCL = GPIO 22
Wire.beginTransmission(0x40);
bool found = Wire.endTransmission() == 0;
Serial.println(found ? "PCA9685 16-channel PWM / servo driver found at 0x40" : "Not found: check power, GND and SDA/SCL");
}
void loop() {}
Fonti
- NXP PCA9685 datasheet, Device address 1 A5 A4 A3 A2 A1 A0 (0x40 to 0x7F); 0x70 is the All Call address
Provalo in 3D in BoardPilot
Componenti simili
AT24C256 I2C EEPROM moduleAW9523 16-bit I/O expander and LED driverDRV2605L haptic motor driver (I2C)MB85RC256V I2C FRAM breakout (32 KB)MCP23008 8-bit I/O expander (DIP-18)MCP23017 16-bit I/O expander
Dati dei componenti: CC BY 4.0, riutilizzabili citando BoardPilot.