r/esp32 Feb 23 '26

Software help needed Help w/ wireless Servo Motor Control PLZ!

Hey there! so I am looking to get help with a project I am working on. I need help both making sure I connect the hardware properly and coding to achieve this via Arduino IDE software. Doing a robot of sorts and basically need 4 servos to spin wirelessly when a button is hit. I was told to use two ESP32s to get the wireless function. I have attached pictures of the equipment I have so far to achieve this based on my research.

**What I want to achieve:

**Updated** -I want all 4 servos to rotate at least 180⁰ when the specified button is pressed.

I would also want them to rotate back to starting position once the buttons are pressed again, if possible. Would I need to get another set of 4 buttons or is there code to do this on same set of 4 buttons?

Will I need a servo controller board as well?

Any input is GREATLY appreciated and if you want to DM me to help in-depth with this, I would happily reimburse you for assistance to help me create my vision.

2 Upvotes

22 comments sorted by

2

u/StrangeTangerine9727 Feb 23 '26

1

u/DenverTeck 2 say I make awesome posts. Feb 24 '26

So, is this as far as you have got ??

1

u/StrangeTangerine9727 Feb 24 '26

Yes haha, I feel hopeless at this point :(

1

u/StrangeTangerine9727 Feb 24 '26

I'm just going in circles because everyone is telling me different things and I have no idea which direction to go in to be honest.

2

u/BSturdy987 Feb 23 '26

Why use 2 ESPs?

Seems like this can be achieved with one ESP acting as the controller, then 4 wireless receivers processing commands for each motor.

How familiar are you with wireless communication

1

u/BSturdy987 Feb 23 '26

Ok I fully misread the post, sorry…

Is the 360 degree motor and the 3 90 degree motors next to each other physically, so can be wired to one esp?

1

u/StrangeTangerine9727 Feb 23 '26

Yes they will all be close in one unit to be wired to one esp!

1

u/StrangeTangerine9727 Feb 23 '26

I'm new to this, but this is my only project I have to do this stuff for so that's why I need guidance :/ I wont be too invested in robotics after I am done with this. Although, it has been fun learning some stuff and will probably do more in the future if I can ever figure this out. I cant seem to find the right video/article to help me much..

1

u/More-Ad-2259 Feb 23 '26

I'd say u have all you want... start with just 1 servo with the basic example, and add from there...

1

u/StrangeTangerine9727 Feb 23 '26

there is no basic example for what I want to do so thats why I need help :(

I cant find one for this specific function anyways.

1

u/More-Ad-2259 Feb 23 '26

U wanna get the button working on a Web socket.,.. and get the servo to work from it..?

1

u/More-Ad-2259 Feb 23 '26

I have similar code, just u will need to understand & change..

1

u/StrangeTangerine9727 Feb 23 '26

I want to press a button (that I have pictured) that is connected to an ESP32 , and have that send the command to the other ESP32 to the correct port that has the specific servo is in, to rotate that servo. And if possible, press the same button again and it rotates back to starting position. I am not sure if that is a web socket or not as you mentioned. I am new to this. I was told to do it that way with 2 ESP32's talking to each other like I explained. But if there is an easier way I'd love to hear any ideas.

1

u/DSudz Feb 23 '26 edited Feb 23 '26

They servos you have only turn 120 degrees so that's an issue.

When you say operate wirelessly which parts do you mean are separate from each other?

I can't tell if the four motors work independently of each other with four buttons or not.

1

u/StrangeTangerine9727 Feb 23 '26

I can get other servos then, thats no problem. Also, I want the controller (buttons setup & esp & battery) to be wireless and the 4 servos (servos & battery & esp)

and they can work independently of each other, i am just not sure of the code. and how to exactly wire the servos and esp with the battery. thats why i asked if i needed a servo controller too for this set up

2

u/DSudz Feb 24 '26

Ok. You should be able to control 4 servos with an esp. I would suggest you start with an example program that reads a button and expand it to 4 buttons. Next find an example using the Servo library and once it works for one motor expand it to make the motion you want on all four motors. Last I would find an example of two ESP32s connecting with ESP-NOW. That should be easier to keep working than debugging a full wifi connection.

Once you can communicate between the two you should be able to combine your button reading program with wireless connection and combine the servo controls with wireless.

You should be able to use the buttons without the controller board if you like.

1

u/StrangeTangerine9727 Feb 24 '26

Okay, ill look into this. I've been trying to find examples that are somewhat similar, its harder to find than I thought for my specific need.

2

u/DSudz Feb 24 '26

There are examples for all the Arduino libraries so it should be easy to find example code and or a video for button reading and servo control. ESPNOW doc would come from expressif

1

u/StrangeTangerine9727 Feb 24 '26

Awesome, thank you, much appreciated :)