PCA9685, Arduino nano and 16 pairs of motors

I have the following schematics:

I would like to control 32 motors (in the picture I have only 8 pairs) with different speed for each pair of motors.

I understand the PCA9685 is the right board but I never worked with it before.

Is my connections are right?

is there a specific code to use with this board?

I want to control the pwm of each motors via serial.

so I will send value between 0 - 255 to each pair of motors with and id.

A 55

B 255

C 10

etc etc.

how can I implement that?

regarding PSU to give a power for all motors. I was thinking to use MeanWell 3.3v 20A

motors are rated as follow:

Your wiring is mostly correct. Connect PCA9685 V+ to motor power supply and all grounds together. Use the Adafruit PWM library, map 0–255 to 0–4095 for each channel, and control motors via serial by sending ID and value. Make sure your power supply can handle total current; 3.3V 20A may be insufficient for all 32 motors.

Use Adafruit PCA9685 library, try some example to set PWM duty cycle.
PCA9685 outputs 12-bit PWM, so its range is 0–4095. Either use that on your serial commands or use for example 0-100 and map it to 0-4095 on your code.
20A is way more than you need for your motors, doesn't hurt though.

FYI:
All PCA9685 boards that I have seen, have a 220Ω resistor in series with each output.
The source current capability of the PCA9685 is very limited. It is primarily designed to sink current for LEDs

What is the purpose of the 100nF capacitors?

Is there a better alternative for the job I’m looking for?

What is the purpose of the 100nF capacitors?

To filter out noises (?)

like this?

Better in what way?

You are in a questionable area, you will need about 200mA just to drive the bases. A much better solution is to use a MOSFET in place of the 2n2222. You also need some additional bypass capacitors to filter out noise.

With a 100mA load that regulator will be very hot, near shutdown with a 12V supply. I recommend you use an external power supply for the 5V but use the Vin to power the Nano because of the extra filtering and noise immunity you will get.

True. The PCA9685 is better at sinking current.
If PCA VCC is the same as motor VCC, then you could use HIGH-side switching, with PNP transistors.

A better option is to use the ULN2803 (8 outputs) instead of transistors + diodes.
Then you can also use a more common 5volt supply, because of the higher saturation loss of darlingtons.
Leo..

I looked into that IC - it looks like a good solution for the transistor motor drivers I shared in my schematics. But I will then need to use 16 output of the Arduino in order to control each of my 16 pairs of motors separately, isn’t it?

Have you considered the power dissapation of the IC. Under certain combinations of speed and number of motors running you may exceed the total power dissapation of the IC.
You also need to consider the Vce(sat). Your motors will now have a much lower voltage and run slower

That chip can replace the motor drivers, but you still need that PCA9685 board to generate the 16 PWM control signals, assuming you want speed control.
Leo..

ULN chips drop about 1volt.
Which is a good thing for those 4volt vibration motors.
Leo..

They could also drop more or less. Running a motor at it absolute max voltage will only shorten it's life.

so I can drive this IC with the PCA 9685?

is this the away to connect this IC with motors and the PCA9685?

Can I avoid the flying back diode and the filter capacitor?

You could and you could burn it out.

I would prefer of course not to burn it. How I should make the connection in order it to work as intended?

I recommend that you buy one of the ICs and experiment with a breadboard protype to see if it will control your motors the way you want.

Check voltage and current, make sure you are not exceeding maximum power dissipation.
You may find it's not what you want.

Have you spent any time trying to learn from any of the recommended books and websites that were provided to you?

There is more to doing a circuit design that just placing a bunch symbols on a piece of paper.

I just grabbed Electronics for Dummies and Practical Electronics for Inventors

Will see how it goes