Help on Hexapod

Hello everyone,

I have a question on my hexapod project.

I will be using 18 sg90 servos on Arduino Mega. I thought it would be useful if I bought a driver so I bought a pca9685. The problem is, I bought only one cause the buyer said it would be enough with the pins on Arduino itself but now I feel at loss and I actually don't know if it would be okay if I connect 16 of them to PCA and 2 of them to Mega? Or how can I connect them exactly? I will use S-Link 5V 20A power supply and I have included my schematic. I didn't know how to connect the grounds and reds of the 6th leg to the arduino.

I would be very happy if someone would be nice enough to help me! Many thanks :smiley:

I also draw this one without a PCA. Would it be much better? If so, are these connections correct?

I use 3 ESP32's on a hexapod platform. One ESP32 operates the LIDAR for imaging. Another ESP32 is the brain that takes in LIDAR info and makes a decision on where to go and sends instructions to the 3rd ESP32. The 3rd ESP32 runs 12 hexapod servos .

I use metal geared servos. I allocate 1 amp per servo. I use a 7000mAh battery. To be honest the battery does not last all that long when the hexapod is continuously walking around. Mostly, the hexapod sets up in a location and monitors.

I mention the above because I see a 9V battery and I believe that those plastic geared servos shown in the frtizthingy have a 800mA stall current. That 9V battery will not last long.

Oh the grounds. Imagine a single spot, all the grounds should go there, in this instance.

1 Like

Tricky question. The Mega has plenty of digital pins to run 18 servos and you can use any of them. But it may not have enough processing power to run a hexapod on its own. The advantage of the PCA9685 is that it takes some of the load off the Mega, having its own controller on board. The big disadvantage of using one PCA9685 and connecting a few servos directly is that the code to drive the two sets of servos will be completely different, making the whole thing very messy to write, test and maintain.

I'd probably just use 2 x PCA9685s, sharing the load between them. And since you have a 5V 20A power supply the 9V battery has no useful purpose. You can power the Mega directly through its 5V pin.


1 Like

Hello, thank you so much for this explanation. 9V is for the Arduino actually, I was thinking of connecting the servos to the PCA, and the PCA to the 5V 20A power supply. I don't know if that's the correct thing to do but on the second option I will still connect all the servos to the 5V 20A and the Arduino to the 9V.

On different forum pages and places, using 2 different sources for servos and Arduino was recommended. As a beginner, I have followed their advice. Thank you so much for the answer, but I don't have the option to use 2 PCAs now unfortunately. I can either use one or none. What would your recommendation would be in this case?

The Grounds go to both the Arduino ground and the Ground side of the 5V supply. The Reds go to the +5V side of the 5V supply. The control pins (usually white or yellow) go to the chosen Arduino pins.

1 Like

Thank you so much. I was thinking of feeding the Arduino with 9V Battery, and PCA and the servos with the 5V20A supply. The connections you have recommended wouldn't be a problem in this case, right?

Right. It will not matter if you connect 7-12V to the power jack or Vin pin, or you connect a +5V supply to the +5V pin. Both should work the same.

1 Like

Thanks a lot! :slight_smile: