L9110H motor drive module Arduino small water pump small fan

L9110H motor drive module Arduino UNO small white version

I wrote a detailed analysis of the A4950 driver just the day before writing this article. However, just when I was making an IoT flowerpot, I found this L9110H motor driver module that drives the small water pump. I want to study it briefly and leave a data. For future reference to the younger students, and then I was surprised to find that the L9110H module, and the A4950 driver's operating mode are the same, the difference between the two is that the L9110H does not have an external drive power supply, and it is directly connected to the microcontroller. 5v driver, and then I burned the code I posted in the previous article and changed the two PWM pin numbers, a batch that is easy to use, driving a small water pump, and a small DC motor fan is quite practical.

1. Experiment preparation

1. Arduino UNO microcontroller
2. DC gear motor
3. L9110H motor drive module

2. Introduction to L9110H Motor Drive Module

Insert picture description here
One L9110H motor drive module can drive two motors
The L9110H drive module determines the direction of the motor by comparing the relationship between the output PWM of the
two control pins. The difference between the PWM output of the two control pins determines the motor speed.

Same as A4950 driver module

2.1 Wiring diagram

L9110H pin Corresponding pin
VCC MCU 5V
GND MCU GND
A-1A Control the 1st PWM pin of A motor
A-1B Control the No. 2 PWM pin of A motor
B-1A Control the No. 1 PWM pin of B motor
B-2A Control the No. 2 PWM pin of B motor
ENGINE A Motor A
MOTOR B Motor B

code

unsigned int Motor_A_1A=10;       //控制A电机的PWM引脚  一定改成自己用的
unsigned int Motor_A_1B=11;       
char Motor_Order;                //定义一个字符型变量存储串口输入命令
void setup() 
{
    
    
  Serial.begin(9600);            //打开串口
  Serial.println("/*****开始驱动*****/");
  pinMode(Motor_A_1A,OUTPUT);   //设置两个驱动引脚为输出模式
  pinMode(Motor_A_1B,OUTPUT); 
}

void loop() 
{
    
    
 while(Serial.available()>0)    //检测串口是否有命令
  {
    
    
    Motor_Order=Serial.read();  //将命令存储在变量中
    switch(Motor_Order)
    {
    
    
      //发送字符1电机正转
      case '1' : analogWrite(Motor_A_1A,250); analogWrite(Motor_A_1B,0);Serial.println("/*****电机正传*****/");break;
      //发送字符2电机反转
      case '2' : analogWrite(Motor_A_1A,0); analogWrite(Motor_A_1B,250);Serial.println("/*****电机反转*****/");break;
      //发送其他字符电机停转
      default  : analogWrite(Motor_A_1A,0); analogWrite(Motor_A_1B,0);Serial.println("/*****停转****/");break;
    }
  }
}

Guess you like

Origin blog.csdn.net/chrnhao/article/details/112133088