I am new to Arduino and need some help. I am trying to control a servo (Reely D15022MG) with an Arduino Nano ESP32, but it does not move at all. The same setup works perfectly with an Arduino Uno.
My setup:
Servo signal wire connected to pin D2
Servo powered by external 5V power supply
All GNDs connected: Arduino GND, breadboard GND rail, and external power supply GND
ESP32Servo library installed manually via ZIP from GitHub
Things I already tried to rule out hardware defects:
Replaced the Arduino Nano ESP32 with a new one
Replaced all cables
Tried pin D9 instead of D2 on the Nano ESP32
Same result every time.
Strange behavior: When I disconnect all GND wires between the Arduino and the breadboard, the servo starts twitching. As soon as I reconnect the GND, it stops completely and does not move at all.
With the Arduino Uno and the standard Servo.h library, the exact same wiring works without any problems.
Does this also matter for the signal pin. The voltage itself is provided by my 5v external power supply. It has alredy worked for a few days but stopped now for no obvious reason
I can think of many reasons why it is not working and I think it is not working the way it should.Those two processors are as different as a balloon and an airplane, they both fly but??? The best way to get an accurate answer is post your annotated schematic showing exactly how you wired it. I am assuming you did not just connect wires. Post links to technical information on the hardware items you are using, there are many parts with the same name such as Nano but are not the same.
Even if the servo is powered from an external 5 V supply, the Nano ESP32 still sends only a 3.3 V control signal. Many servos accept that, but not all of them do so reliably.
If it worked for a few days and then stopped, I would also double-check common GND between the ESP32 and the servo power supply, the servo supply voltage under load, and the signal connection.
Then I would probably look again at the electrical side. That is quite a strong digital servo, not a tiny 9 g servo, so current peaks may be much higher than expected.
Even with an external 5 V supply, please make sure that:
servo GND and Nano ESP32 GND are connected together
the servo supply voltage stays stable under load
the servo signal wire is really connected to the intended pin
the servo accepts a 3.3 V control signal reliably
The fact that it worked for a few days does not completely rule out a marginal power or signal-level problem.
Nice picture but since I do not have the parts I cannot relate to it. I did check your motor and found this which tells me you would have problems if connected the way the picture indicates:
Idle:
10–30 mA
Moving, light load:
200–500 mA
Heavy load:
1–2 A
Near stall:
2–3 A peak possible
I think it will peak at about 5A @ 6V when stalled.
Right now that's all there is. I reduced it to the most basic possibility.
What could also be interesting is, that the servo starts flinching as soon as I deconnect the GND of the arduino to the GND of the servo/5V. That is the way I actually should work right?
The GND connection between the ESP32 and the servo power supply must stay connected, otherwise there is no proper reference for the control signal anymore.
I would also try:
much shorter wires between ESP32 and servo
and especially avoid powering the servo through breadboard contacts
That is quite a strong digital servo, so I would connect the servo power directly to the 5 V supply with proper wires instead of routing the current through the breadboard.