Visual programming for not programmers

Expander PWM PCA9685

When you build project with a large number of servos, the conventional capabilities of the Arduino may not be enough.
This controller will allow you to bypass the restrictions of the Arduino to control multiple servos without much overhead the Arduino. To one bus controller can connect up to 62 devices, and in sume is 992 devices. PCA9685 operates on the I2C interface, so to connect to the Arduino is only used 4 pins (two digital port and Board):

The "Classic" Arduino:
+5v -> VCC (this voltage only for Board, not servos/LEDs);
Analog 4 -> SDA;
Analog 5 -> SCL.

The old version of the Arduino Mega:
+5v -> VCC (this voltage only for Board, not servos/LEDs); GND -> GND;
Digital 20 -> SDA;
Digital 21 -> SCL.

Version R3 and later Arduino (Uno, Mega & Leonardo):
+5v -> VCC (this voltage only for Board, not servos/LEDs); GND -> GND;

This Board has 16 PWM outputs, it is possible to connect 16 servos. But if that is not enough – the Board is free contacts GND, OE, SCL, SDA, VCC, V+, which by means of 6-wire cable DuPont can connect another controller PCA9685, and it, in turn another. Each Board in the chain must be assigned a unique address. This can be done using the address contacts A0, A1, A2, A3, A4, A5. The base address for each Board is 0x40. To assign a unique address you need to use a drop of solder to assign the appropriate address for each controller. Programmatically it would look like this:

Board 0: Address = 0x40 Offset = binary 00000 (the fee that is attached to the Arduino, without solder);
Board 1: Address = 0x41 Offset = binary 00001 (solder on А0);
Board 2: Address = 0x42 Offset = binary 00010 (solder on А1);
Board 3: Address = 0x43 Offset = binary 00011 (solder on А0, А1);
Board 4: Address = 0x44 Offset = binary 00100 (solder on А2) etc.

As you can see – you can use 6 controllers, that is, 96 servos. Almost all servos are standard 3-pin connector. The red wire connects to positive pole of power source (V), brown to negative (G), and the orange wire connects to the power supply control signals (S). Most servos are designed to work for about 5 or 6. you Need to remember that under load, each servo consumes a lot of current (over 1 A), so a good choice of food are: 5V 2A switching power supply, 5V 10A switching power supply, Ni-MH rechargeable battery 6 V/4.8 V. The power supply is connected to the terminal Board with the contacts V+ and GND. On the Board there is 4 mounting holes.

Connection diagram extension Board:

The documentation can be viewed here


model: PCA9685;
supply voltage of controller: 3.3 or 5 V;
the power to the servos: 5-6;
PWM frequency: 40-1000 Hz;
the ability to connect 16 servos;
the ability to connect up to 62 devices on the same bus;
Board size: 66 x 25 mm;
dimensions: 80 x 25 x 12 mm;
weight: 11 g

Blocks in FLProg:

Block to connect the servo using the PCA9685 chip

The control block PWM output of the chip PCA9685

Block to record the values in an arbitrary output chip PCA9685

Block read the value at the output of the chip PCA9685

Block changes the frequency of the PWM chip PCA9685