ESP12E motorshield analogWrite issue when powering DC motor

Hi,

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 - Amazon.com: ARCELI L293D WiFi Motor Drive Expansion Board Shield Module for NodeMCU ESP-12E ESP8266: Electronics

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

DC Motor - ONLYKXY Small Mini 1.5-5V DC Motor 300 with Mounting Bracket and 2 Electronic Wire for Scientific Solar Energy Power Supply Electric Toys Model Parts DIY Accessories(Silver) (4PCS) - - Amazon.com

Here is my code

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

void setup() {
  Serial.begin(9600);
  Serial.println();
  Serial.println("Starting...");


  Serial.println("Preparing motor...");
  pinMode(DIRA, OUTPUT);
  pinMode(PWMA, OUTPUT);
  analogWrite(PWMA,0);
  digitalWrite(DIRA,1);
  delay(5000);

  Serial.println("Starting motor...");
  analogWrite(PWMA,5);
  delay(5000);
  
}

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, Node MCU Motor Shield | Details | Hackaday.io.

Thank you in advance

Arduino DC motor speed and direction control with L293D

@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.

Hi,

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

Thanks... Tom... :slight_smile:


@TomGeorge here is my setup

Thanks!

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!