Go Down

Topic: ESP12E motorshield analogWrite issue when powering DC motor (Read 310 times) previous topic - next topic



I am relatively new to adruino and this whole space. I am currently trying to power a DC motor using an ESP12E motor shield and an ESP8266 Module

Motor Shield - https://www.amazon.com/gp/product/B078CPZDW1/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

ESP8266 - https://www.amazon.com/gp/product/B010O1G1ES/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

DC Motor - https://www.amazon.com/gp/product/B07MTT7B88/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Here is my code

Code: [Select]

#define DIRA 0
#define PWMA 5
#define LED 2

void setup() {

  Serial.println("Preparing motor...");
  pinMode(DIRA, OUTPUT);
  pinMode(PWMA, OUTPUT);

  Serial.println("Starting motor...");

void loop() {

I am expecting the motor to start once I upload this code but nothing is happening. If I change the analogWrite to digitalWrite, the motor runs but I want to be able to control the speed, rather than just having it run at one speed.

I have tested using analogWrite by changing the intensity of an LED and it was working, although the output pin was not the same as the one I use for the motor.

Would greatly appreciate any help as I have already gone through pages of google searches without any luck. I have been using this example as a reference, https://hackaday.io/project/8856-incubator-controller/log/29291-node-mcu-motor-shield.

Thank you in advance


Please avoid private messages, your question may be someone's answer in the future!


@rtek1000 Thank you for the link but I'm not sure what to be looking, could you please give me a hint.
I am trying to relate what is shown in the link to my setup but having some difficulty.

Thank you!


A PWM value of 5 may not be enough to start the motor, start with 60 or so, then slow it down.


@JCA34F I have tried setting the PWM to 100 and still nothing.



Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks... Tom... :)
Everything runs on smoke, let the smoke out, it stops running....



Turns out I wasn't providing a large enough value for analogWrite. Once I updated it to something more than 250 I was able to get the motors to rotate. Thank you to everyone for their help!

Go Up