ESP32S Servo REFUSES to move

Hey guys,

My project is an electric longboard controlled with a Carrera Evolution controller. The inside is replaced by a Potentiometer connected to an ESP32. This communicates with a second ESP32 on the longboqard via the esp now library. This ESP32 is connected to an ESC.

I tried to control the ESC but it did not work.

So i took a servo and tested the basic example sketch of the "ServoESP32 by Jaroslav Paral" (platform.io)
The code is just the example:

#include <Servo.h>

static const int servoPin = 15;

Servo servo1;

void setup() {
    Serial.begin(115200);
    servo1.attach(servoPin);
}

void loop() {
    for(int posDegrees = 0; posDegrees <= 180; posDegrees++) {
        servo1.write(posDegrees);
        Serial.println(posDegrees);
        delay(20);
    }

    for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
        servo1.write(posDegrees);
        Serial.println(posDegrees);
        delay(20);
    }
}

I tried out different GPIOs and the result is always the same:
The servo stays in 0 position, same as if i ground the Signal Pin.

(GPIOs like 15 correspond to the labels on the ESP, like P15, if i am right:
https://docs.zerynth.com/latest/official/board.zerynth.nodemcu_esp32/docs/index.html )

Servo is receiving external Power.
Servo is tested with a servo tester and working.

The ESP in use is a NODEMCU ESP-32S

What could possibly be wrong?
I tested everything i can think of.

Help is greatly appreciated.

EDIT: 128 views so far but no response. Feel free to share any thought, i will not judge and be thankful for even a "hi".

You'll want to get a servo library for the ESP32. I have used ESP servo and it works quite well. GitHub - jkb-git/ESP32Servo: Arduino-compatible servo library for the ESP32. This library works quite well as long as you take care with using the hardware timers.

Even better is to use the ESP32 MCPWM API Motor Control Pulse Width Modulator (MCPWM) - ESP32 - — ESP-IDF Programming Guide latest documentation to do the servo thing. The MCPWM does not use the hardware timers.

"Servo is receiving external Power."

Do you have a ground connection between the servo power supply and the ESP board?

1 Like

Thanks for the reply <3

Using the library you provided leads to the same (NEW) problem i also have when using mine from above:

The servo moves, but extremely jitterish. It also draws about 0.7A, while it draws 0.2A using the servo tester. And it also runs smooth with the latter.

I thought the problem could be due to the logic level, so i built a 5v non inverting logic level shifter, but it changes nothing.

Servos behaviour can be seen in the vid:

zoomkat:
"Servo is receiving external Power."

Do you have a GROUND connection between the servo power supply and the ESP board?

Say no more. WTF ( MOD EDIT )

Spent like 3 hours trying... Forgot common ground.

So embarrassing.

Thanks so much

Expletives are forbidden and grounds for a ban.
Please remember that for future.

Could you also take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.