D1 Mini (ESP8266) not enough voltage to power 4.8V servo

I’ve hooked up a SG-90 servo to the 5V pin on a Wemos D1 Mini but it doesn’t power up the servo. I checked the voltage output on the pin using a multimeter and it indicated it was only outputting 4.69V. I’ve also confirmed the servo works by plugging it into a RPi0 I have. Any suggestions on how I can provide enough power to the servo via the D1 Mini? Many thanks.

2 Likes

Hi Tim,

Do you have a link to the board you are using? If the board cant source the current then the servo wont operate, a quick test is trying to turn the servo with the board plugged in and connected up to the multimeter, the voltage should drop pretty significantly, to power it you could use a few batteries (4x AA’s) or use a higher power USB supply(should be above the shutdown threshold)., both directly to the power pin on the servo, just make sure the ground from the servo is connected to both the power supply and MCU

2 Likes

Hi @Liam120347,

Thanks for the info. Here’s a link to the item I purchased on Aliexpress. It’s not a true Wemos D1 Mini but a clone. I recently purchased a Polymer Lithium Ion Battery (LiPo) 3.7V 1100mAh from Core Electronics to power this device. Would this be sufficient enough to power both the D1 Mini and the servo do you think?

3 Likes

Hi Tim
The servo is 4.8V to 6V so 3.7 is not enough anyway.
Whatever battery you use the capacity will depend how long you want to run the servo for between charges (for rechargeable types). Start with that then source a suitable power supply.
Cheers Bob

3 Likes

Checking the schematic and the pinouts; the pin marked 5V on the board simply connects to the USB port 5V. The 3.3V pin is connected to the output of the on board regulator and can only provide up to 50mA maximum. You can use the 5V pin as power input but it needs to be 5V. You cannot use the 3.3V as power in. Whatever you have plugged into the USB port is not providing enough current or too low a voltage to power the servo. Or the PWM signal to the servo is not correct.

The LiPO you purchase will definitely have enough power, but is to low a voltage. You would need a step up voltage regulator to bring it up to 5V. Something like this

The SG-90 has 3 pins, 5V, GND, PWM. The signal out of the D1 Mini is 3.3V, you should really put this through a 3.3V to 5V level convertor to drive the PWM line correctly. But as it works on a RPi0 it should work on the D1 Mini.

It might not be a power issue, it may be the PWM signal is not correct. The servo expects a certain pulse with and frequency. The libraries on the RPi0 have been proved to work many times, I am unfamiliar with what is available for the D1 Mini.

Anyway, without more information it is hard to say why the servo is not working.
Cheers
Jim

2 Likes

Hi @James46717,

Just FYI I’m using ESPHome to deploy the firmware to the d1 mini and here’s my yaml config. I’m fairly confident the PWM signal is correct based on the data specs of the servo (also based on this forum entry).

So I’m back to the voltage issue again. Unfortunately due to my lack of understanding of the basics of electronics I’m still unclear what I need to purchase? If I do purchase the step up voltage regulator, how would I connect it up to the d1 mini?

As an aside, I also purchased a battery shield in order to connect to the LiPO battery.

3 Likes

Hey @Tim122099,

That battery shield you bought has a major bug - don’t solder that current jumper, and don’t use it with anything less than a 1000mAh lipo. Preferably, don’t use it at all without checking the design.

They might’ve just forgotten to update the Charge IC on the schematic…

See my post about that battery shield here:

2 Likes

4.69V is close to the minimum level of the servo. (4.8V).
As far as I can tell from the schematics I find; the 5V pin on the D1 Mini is the same as the 5V USB pin.

You could measure the voltage of the 5V pin on the D1 Mini without the servo attached. If it is still around 4.69V then you should look at what you are connecting to the USB port to power the device.

Most computer USB ports should be around 5V and a drop to 4.69V would mean they are being loaded too much. Rule of thumb is 500mA max from a USB port. The ESP8266 can use up to 250mA when transmitting or maybe more.

Some servos can draw up to 100mA when idle, most are <45mA. Stall current for a servo can be as high as 600mA. When the servo is connected and being driven by the D1 Mini does it resist being turned ?? If is is easy to turn then the PWM signal is not correct or the power or the servo is damaged.

You have established the servo is working ok by connecting it to a RPi0.
What is the voltage on the 5V pin of the RPi0 when the servo is connected ??
Is the power supply to the Rpi0 the same as the D1 Mini ??

If the servo is working in other setups, there is only 2 reasons it would not work with the D1 Mini.
Power supply is not correct voltage or cannot provide enough current.
PWM signal from the D1 Mini is not correct.

You could try using an external power supply for the servo ensuring it is between 4.8V and 6V.
Connect the GND of the D1 Mini and the GND of the external power supply so the ground reference is the same for the PWM signal.

If you can supply a pic of your setup it might help.
Regards
Jim

2 Likes

Hi @James46717,

You could measure the voltage of the 5V pin on the D1 Mini without the servo attached. If it is still around 4.69V.

Yes, it is 4.69V

When the servo is connected and being driven by the D1 Mini does it resist being turned ??

Yes

What is the voltage on the 5V pin of the RPi0 when the servo is connected ??

5.07V

Is the power supply to the Rpi0 the same as the D1 Mini ??

Yes

Please find below photos of my setup. Just in case it’s unclear, on the power adapter it says: Input: 100-240V~0.45A 50-60Hz. Output: 5.1V - 2.1A.


1 Like

Hi Tim,

Do you have a 5V micro like an Arduino lying around? Most people agree that 3.3V should be enough for the signal line of the servo, but that might be tripping up this particular one.

Seems you’ve got it working on a zero, so that rules out 3.3V logic being the problem

Since the 5V line is just a passthrough, I don’t think it’s power that’s the problem, looks like signal. If you had a scope that’d be handy, but failing that, could you post the code you’ve got running?

-James

1 Like

Hi @James,

I’m using ESPHome and my yaml config was posted above. Ta.

1 Like

@James Agree.
(btw I am a different person to @James, I am a customer of Core Electronics)

@Tim122099 The answers you have provided indicate to me the servo is being driven and the voltage is ok even if a little low.

This indicates the servo thinks it is in the right location and hence does not want to move.

This indicates the servo is not loading down the voltage line. Meaning it is working correctly.

The Rpi0 being able to control it indicates it will work with 3.3V signal line, which it should anyway.

So IMHO the PWM signal is the problem. Timing or something like that. The servo needs a pulse width of between 1 & 2ms at a frequency of 20ms. The diagram below is from the datasheet for a SG-90.

Regards
Jim

2 Likes

The code looks ok, although I have not used that system to program anything. I think the ESP8266 can look like an Arduino interface and you could try to see if the Arduino Servo libraries will work.

Unsure where to go from here, not knowing the yaml system at all.
Regards
Jim

1 Like

Hi @James46717! Thanks for clarifying which James you are. Many James round here :joy_cat:. I should clarify that I plugged the signal line from the servo into one of the GPIO ports on the RPi0 but I didn’t actually run any code to run the servo as I’m unsure how to do that (as have just been using ESPHome, which is just for ESP8266/ESP32 devices). So unsure if a 3.3V signal line will run the servo.

And just one other thing to clarify, up until now I’d only tested the voltage on the D1 Mini with the servo attached. I just tested it without the servo attached and the voltage on the 5V pin was indeed 4.69-4.70V.

2 Likes

@Tim122099
You could remove power to the D1 Mini and servo, move the servo arm to middle or somewhere different to where it is when powered. Then power it up and see if the arm moves. (maybe it wont move) This would indicate the yaml code is sending pulses to the servo to move it to a specific location.

But, the fact that it resists movement means pulses are being sent. If it has only power and no signal it wont care where the servo arm is moved to; I just proved this with one of my SG-90 servos. If you remove the signal link you should feel no resistance to movement of the arm. Reconnecting it you should. If this is the case it means the code is sending the frequency and pulse widths the servo recognises.

I had a look through the following link, it may help you in getting it going.
Are you using something like the slider to move the servo ??

cheers
Jim

1 Like

Hi @James46717,

Thanks for that and yes I followed that tutorial to set up my servo. Also, as an aside, my SG-90 is actually a 360 degree rotating one so the earlier data sheet isn’t actually correct. I did some googling just now and found that this datasheet is apparently very similar to my one. So this may in fact be part of the problem. Particularly as I just tried to get this tutorial going and nothing happens on my servo despite it fitting the description in the tutorial.

2 Likes

Hi Tim

I don’t think it will go anywhere if you don’y tell it where to go.
Just a thought.
Cheers Bob

2 Likes

Ah !!! Yes continuous rotation servo is different to a positional servo in the way it treats pulses.
I assumed it was a positional one as are most of the ones I have.

Using the adjust screw you should be able to cause the servo to rotate if you set the mid position away from 1.5ms. .
The tutorial for a RPi is for a positional servo.

I have had a servo which would not move at all, the gearing had locked up, eventually I got it to move by pulling it apart. Another I took back to the supplier, they are made pretty cheap, the metal gear ones are the best, but cost more. If your servo rotates with no power connected this would not be the problem.

The yaml code looks like it is set for positional not continuous.

If you need a positional servo for your project suggest checking the Core Electronics range, just make sure it says positional and not continuous.

Anyway, all the best.
Cheers
Jim

3 Likes

Hi all.
Rotational or positional if the pulse is anything more or less than 1500µsec should move. If 360º it should keep going in one direction or the other.

I have never seen any use for 360º servos. It is no more than a brushed motor in a different guise. I thought at one time it would be an easy way to get direction and speed control with one pot instead of manipulating numbers. The information available suggested this. Direction control yes. Speed, only a little bit with only a small deviation from 1500µsec. When you think about it it is only s “normal” servo with the position feedback pot disabled. Now servo speed is usually rated at X seconds for 60º rotation. It follows then that once the servo is requested a position off centre it will try to get there at this speed. With the feedback pot disabled it thinks it is never getting there so continues to rotate at the quoted speed until the control pulse is returned to 1500µsec. Where is the possibility of speed control with this scenario.

Anyway I don’t bother with them. They may be a bit easier to mount and don’t run very fast but I see no other advantages.
Cheers Bob

3 Likes

You’re not going to believe it. I am now trying to control the servo from the RPi0 using the RPi.GPIO library and it’s not working at all. My code is here.

The servo definitely rotated in the past but I hope I didn’t fry it as I earlier connected the servo to the GND and 5V Power pins and the Signal wire to one of the GPIO pins on the D1 Mini. At the time, the servo just kept on rotating and wouldn’t stop. I now know I should’ve connected the GND from the power supply (in this case the RPi0) and the GND from the D1 Mini together. My next step will be to open up the servo and see if it looks fried.

1 Like