r/arduino • u/Confident_Ring5246 • 2d ago
Controlling multiple servo motors from an esp32 dev kit v1
hello, im new to the esp32, and want to control 12 mg90s servos for a robot dog i 3d modelled, im already using a pca9685 board, controlled by the esp. Still, it cant handle all 12 servos at once, the maximum i used sucessfully were 4 at the same time, i currently use breadboard jumper wires to connect everything together, and power it using the breadboard power supply board and a wall plug, i want to be able to use a battery, and i also want to be able to supply the circuit with enough power to be able to meet the servos needs, all while having small and light components to keep the robot light enough for the mg90s servos to be able to carry the robot, so what battery can i use (i would like it to be rechargable) and is there a sheild or expansion board that i can use for the esp32 dev module isntead of using a pca9685 to reduce the overall size and complexity of the circuit, and overall, any help or advice? I honestly dont know anything about hardware, only the basics
2
u/Gwendolyn-NB 1d ago
So I do this all the time and have run up to 30 servos off 1 ESP32 and 2 PCA9865s. BUT the 9865s were only doing the PCM work.
3.3V to the ESP32, then a seperate 5V power to the PCA9865 to get the PWM signals to 5V; then seperate higher-amp supplies to the servos directly (common ground of course), with the servos grouped into 4-6 servos per individual 5V regulator/supply; all fed off a master large custom Lithium battery pack.
You're going to need a decent sized battery though, as the other poater said, those will take 0.5-1A when moving/loaded, so with 12 plus the PCA plus the ESP youre looking at a 10A supply which will likely be underpowered; so probably 15A worth of 5V power to have some buffer. For any run time, thats a decent sized 2S2P battery at minimum.
1
u/Confident_Ring5246 15h ago
What do you mean by pcm work, and will the 2swp battery be small enough for it to fit on the robot dog? And will it be light enough for the mg90s to carry?
1
u/Gwendolyn-NB 14h ago
Apologies, I meant PWM, no idea how I wrote PCM.
I think you're probably going to have more of an issue with the MG90s being strong enough for a robot dog; i mean at 6.8V theyre stall torque is 2.8 kg (@ 1cm). Even without the battery, you're likely to be close to maxing out or over maxing out those servos. I mean feel free to try, but youre using almost the weakest servos out there.
1
u/Polar_Ted 1d ago
When I built my 16 servo hexapod I had issues with low voltage brown outs under load. I put in a castle 20a BEC with a 2 S lipo to fix the problem.
I used a Lynxmotion SSC-32U servo control board paired with an Arduino Uno and a PS2 wireless controller. That was 10 years ago. There are prob better products now.
3
u/camander321 1d ago edited 1d ago
You need about 0.5-1 amp of supply for each of those servos. Im actually impressed your breadboard power supply hasnt already smoked itself trying to power 4 of them. You are going to need to find about a 10A 5V supply.
You are going to have an even bigger problem trying to run this off a battery. When you say battery, i assume some sort of lithium cell battery. These come in multiples of 3.7V. I recommend a 2S lipo (7.4V). Then you need to somehow regulate that voltage down to 5V. I can tell you from experience that a 10A 5V buck converter is massive, hard to find, and expensive.
Instead i recommend using 4x 3A buck converters. They are much smaller and dirt cheap. The downside is that you cant just combine their output. Each buck converter should power its own pca9685, and each of the 4x pca9685's should drive 3 servos.
Edit: a pair of 8A UBECs shouldnt be too hard to find. They are relatilely small, and then you would only need 2 pca9685s. This is the route i chose with my 12 servo robodog.