Servo rotates 180 degrees with UNO, but only about 80 degrees with D1 Mini Pro (esp8266)

I ran into a problem with servo rotation. I used the "Servo Sweep" program to test the servo's rotation (Futaba S3003), when connected to the UNO it rotates 180 degrees without any problem, but when connected to the D1 Mini Pro (esp8266) it only rotates approximately 80 degrees.

I need to get the 180 degree rotation out of this servo for my project I am working on.
Is the timings of the PWM (servo.h) different between the UNO and D1 Mini Pro?

Any information is greatly appreciated!!!!

/* Sweep
This example code is in the public domain.

modified 8 Nov 2013
by Scott Fitzgerald

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(2); // attaches the servo on pin 9 on Arduino Uno to the servo object

void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position

The code looks good. Therefore I ask for schematics, not a Fritzing painting.
Is the powering in order?......

Sorry for the poor quality of the drawing. But as you can see, this is extremely simple and only the Arduino Uno is swapped out with the D1 Mini Pro, everything else stayed the same.

Oops. Don't ever feed motors of any kind from the controller 5 volt pin!
That puts the tiny copper strips on the board in danger of being burned down.
However I can't say for sure that this is the reason. I don't know the mini pro. Only used UNOs...

I believe your ESP8266 has Vcc = 3.3v

The servo may need its input to be > 3.3v

Please use code tags as requested in

The Wemos D1 Mini runs faster than the UNO, so its PWM timing will be different. The servo on the Uno works fine with the default PWM range from the servo library.

You need to calibrate your servo PWM range for the Wemos D1 Mini.

I just did one, literally five minutes ago. A Hitec HS-645MG servo on a Wemos D1 Mini. I wound up with this calibration:
myservo.attach(servoPin, 500, 2250); //PWM range.

Yes, I hooked up an oscilloscope to the signal and on the UNO I get 0.5ms to 2.5ms while on the D1 Mini Pro (esp8266) I get 1ms to 2ms. That explains a lot. Never knew that.

After googling this problem ad nauseam I found the "Servo - attach()" or might try `analogWriteFreq(new_frequency) to change the frequency from approximately 1Khz down to 500Hz, and see if that corrects the problem.

Thank you!

Bingo! Mystery solved!

Think you will find the Futaba S3003 is a pretty standard old run of the mill servo and more than likely won't like high frequencies. Even 500 probably out of range.
Also if it is a Chinese knockoff even moreso.
Pays to remember servos are a mechanical device and take time to respond to changes.
// waits 15ms for the servo to reach the position

Just write a short sketch to swing from 0° to 180° with a couple of seconds delay between swings. Adjust the parameters in the .attach function until you have a 180° range.


Between seeing the timing on the oscilloscope and using either "servo.attach(pin, min, max)" or "analogWriteFreq(freq)", I was able to get the servo to swing 180 degrees.

Thank you for your guidance!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.