Drv8838 + esp8266

Hi,
I am new to using NodeMCU and DRV8838 for DC motor control.
Would you please help me to understand how to use the two components and move the motor in either direction?

The following link shows the connection between the NodeMCU and DRV8838:
https://drive.google.com/open?id=1xMqtWcxsi9QCTVzz63NEgNeS-12kCP-u

and here is the complete Arduino code which I used form the forum:


int enablePin = D1;
int phasePin = D2;

void setup()
{
  pinMode(enablePin, INPUT);
  pinMode(phasePin, OUTPUT);
}
void loop()
{ 
  
  digitalWrite(enablePin, HIGH);
  digitalWrite(phasePin, HIGH);
  delay(100);
  digitalWrite(enablePin, LOW);
  digitalWrite(phasePin, LOW);
  delay(500);
  digitalWrite(enablePin, HIGH);
  digitalWrite(phasePin, LOW);
  delay(100);
  digitalWrite(enablePin, LOW);
  digitalWrite(phasePin, LOW);
  delay(500);
}

Thanks in advance for your help.
Warm regards,
Pay

When programming those boards using the ESP core in Arduino IDE, the GPIO numbers are used instead of the silkscreen numbers that are printed on the PCB. So, you should probably make the top couple lines of your code:

int enablePin = 5;
int phasePin = 4;

You can find a diagram that shows which GPIO numbers correspond to which silkscreen numbers on this web page.

Also, although your system might work by setting enablePin as an INPUT, whether or not it does depends on a few characteristics of your NodeMCU (e.g. the logic voltage of the microcontroller and the value of the pull-up resistor used when enablePin is connected to logic high). I recommend setting enablePin to OUTPUT, so we can more obviously expect that pin to work.

-Jon

Hi Jonathan,
Appreciated very much your response.

Best Regards,
Pay

Hi Jon,

I appreciate your responses to everyone’s postings in the forum. I am using the ESP01 as my MCU and following the DRV8838 diagram to wire my project (pictures included). However, I’m having trouble programming the ESP01 to control the DRV8838. Am I missing something or do I need to change my pin connections? Currently, enablePin is set to 2 and phasePin is set to 3. Let me know if you have any questions.

Thanks,
Aaron