Running DC Motor

Trying to run a tiny dc motor from esp8266. (runs on 3v pin)

Does this make sense to anyone?

I connected DC motor with a driver from my esp8266 and it runs with control pins both set low. the LED blinks for below code, but motor nothing

oid setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  delay(3000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  delay(3000);                       // wait for a second
}

So I removed the driver and plugged the motor negative to a pin and positive to a pin and try doing it that way and it still didn't work

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(D2, HIGH);
  digitalWrite(D3, LOW);
  delay(3000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(D2, LOW);
  digitalWrite(D3, HIGH);
  delay(3000);                       // wait for a second
}

Then I plug negative in the grounds and positive into a pin and still no luck

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(D3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(D3, LOW);
  delay(3000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(D3, HIGH);
  delay(3000);                       // wait for a second
}

lastly I plugged the negative in the ground and the positive into the 3 volt source and it runs.

I also tried it on my Arduino Uno with the same results.

I know you can run it from the pins because I double checked on YouTube

Any advice?

Not enough current without a driver.

That's . . . optimistic

What are the two things on the left of the picture?

You definitely shouldn't be trying to run the motor directly from the ESP pins... ever.

Using the driver board is the way to go, even then should probably not be powering it via the ESP.

How is the driver board connected exactly? Can you post a link to the data sheet? and one for the motor also?

Did you mean to say...
I know you can run it from the pins because I double checked the datasheets of all the components?

1 Like

Tiny motors consume current. Never power motors from the controller pins The physical size of a motor is not interesting.

Nobody verifies whether videos are made by ignorant amateurs or professional people.
Youtube contains lots of bad designs.

Advice: Get separate power supplies for things like motors, transmitters.....

Hi,
Do you have a DMM?
Do you have some LEDs and series resistors for them?

If you have LEDs, then connect a LED to each of the 8266 outputs you are using, so you can see the outputs working.

I see you have press buttons fitted, but not using them in your code, that is okay.

You need to draw a circuit diagram, the Fritzy does not lend its self to trouble shooting analysis.
Please post an image of a hand drawn schematic, indicating power supplies, component names and pin labels.

Can you please post link to data/spec of your motor driver module?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

buttons for future implementation to stop motor when window touches it

how so? are you guessing ? do pin outs have less current than 3v pin? the pin outs work fine in this video Control DC motor without motor driver Arduino - YouTube

driver is connected like

L9110_2_CHANNEL_MOTOR_DRIVER.pdf (ncut.edu.tw)

I tried powering it via separate source also.

best I could find for motor
Microsoft Word - Document5 (digikey.com)

no lol. I'm not really familiar with datasheets. I'll try figuring out what they mean

working on diagram. what is DMM. Also I'm paralyzed. is there a circuit drawing software you can recommend

DMM - Digital Multi Meter, $10-$200 and up.

Hopefully this is good enough for you. going to test with leds
image
image
image

Datasheets are the source of truth...

From the documents you posted...

This is how much current the motor draws... your 8266 can provide about 12mA ! ... so not even close if you are trying to drive it directly.

So you MUST use the driver. I suspect you need to connect the GND of the ESP and the GND of the driver.

From an online tutorial ...

So in your original code...

  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);

...this will do nothing.

Thanks, I do have one question though. In my circuit diagram set up 4 that I just uploaded above, the motor did work. So what does that pin have more current than the other pins?

And I know you're not supposed to run it this way

You are running it from the ESP's power supply... so it passes through the onboard 3.3v voltage regulator (that has limited capacity). It can supply a lot more than the digital pins directly, and can be used for things that don't draw a lot of current, but generally for something like a motor you are much better off to power it completely separately.

1 Like


im a novice so can you explain when stalled.

motor won't draw over 1.1 amps when shaft held still?

Yep. Stall current is also starting current. So your power system has to have enough reserve to start the motor even though the run current is a fraction.