L9110H IC for DC Motor direction control

Hi,

I have been trying to use a L9110 H IC to control the direction of a DC motor, but I can’t seem to change the direction of the motor unless I physically swap the wires.

I used the following code,

#define IB 10
#define IA 9

void setup() {
  // put your setup code here, to run once:

  pinMode(IB,OUTPUT);
  pinMode(IA,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

  //forward direction 
  digitalWrite(IB,HIGH);
  digitalWrite(IA,LOW);
  delay(3000);
  //Stop for half a second 
  digitalWrite(IB,LOW);
  digitalWrite(IA,LOW);
  delay(500);
  //reverse direction 
  digitalWrite(IB,LOW);
  digitalWrite(IA,HIGH);
  delay(3000);
  //stop for half a second 
  digitalWrite(IB,LOW);
  digitalWrite(IA,LOW);
  delay(500);

Also wiring of the motor was done according to the pinout provided on the L9110 Datasheet.

L9110H H-Bridge Motor Driver for DC Motors - 8 DIP - 2.5V-12V 800mAh | Adafruit ADA4489 | Core Electronics Australia (core-electronics.com.au)

Can someone please let me know if I have missed a step or made an error.

Thanks

It’s not clear why that code would make the motor run at all :worried:

The inputs are Speed and Direction. It seems that which is which doesn’t matter, although I can’t confirm this from the very skimpy datasheet.

Direction will be either high or low.

Speed will be the PWM signal to drive the motor at a particular rate. This is where the sketch you are using goes astray.

With the existing setup, you should be driving IA as a PWM Signal. eg
analogWrite(IA,speed);
where speed is something between 0 and 255. There is probably a minimum that it won’t work below, so use 127 for testing.

You haven’t indicated what MCU you are using, so you need to confirm that the pin used for Speed (IA in this example) supports PWM. Pin 9 is OK for PWM on a UNO.

1 Like

Hi Jeff thanks for your reply and for taking the time. I am using an Arduino UNO. DC Motor is running according to the code even without specifying the PWM value for the speed. Only problem is it doesn’t change the direction.

I tried using the method mentioned below but the same result. Motor is working but not changing the direction.

 Serial.println("Fast foward");
        digitalWrite(MOTOR_DIR,LOW);
        digitalWrite(MOTOR_PWM,LOW);
        delay(DIR_DELAY);
        //Set the motor speed and the direciton
        digitalWrite(MOTOR_DIR,HIGH); //Direction forwad
        analogWrite(MOTOR_PWM, 255);
        inValidInput = true;
        break;
1 Like

What happened when you made the change I suggested to your original code?

void loop() {
  //forward direction 
  digitalWrite(IB,HIGH);
  analogWrite(IA,127);
  delay(3000);
  //Stop for half a second 
  digitalWrite(IB,LOW);
  digitalWrite(IA,LOW);
  delay(500);
  //reverse direction 
  digitalWrite(IB,LOW);
  analogWrite(IA,127);
  delay(3000);
  //stop for half a second 
  digitalWrite(IB,LOW);
  digitalWrite(IA,LOW);
}

What happened when you reversed the inputs? The datasheet implies that speed/direction can be either way around, but does not confirm it. The example here swaps the inputs to reverse the speed.

void reverse(){
  analogWrite(INA,0);
  analogWrite(INB,speed);   
}

void forward(){
  analogWrite(INA,speed);
  analogWrite(INB,0); 
 }

The datasheet does not show either motor or controller wiring, so it would be worth while providing a diagram of your wiring.

1 Like

This chip intrigued me, one of the simplest motor drivers I have seen.

Built the circuit below and loaded the code provided by @Devin80572.
Changed run time to 500ms and to run in setup().
Press reset and it runs again.
VCC provided by 4xNiMH 1.2V AAA cells.

Little hobby motor runs forward then backward.
Hope you get it to work @Devin80572.

Regards
Jim

PS 1k resistors hold the inputs high. EDIT: should be 10k resistors.
Removing the UNO and connecting either input to GND causes the motor to run.
Initially the start up current drain was causing my 5V power supply to trip, rated to 1.5A.
Using the batteries solved this problem.

1 Like

Please check your power supply. Maybe the current and/or voltage is not sufficient for running the motor. You can check the voltage with a multimeter. However, you can also consider a simpler solution, you can use the L293D motor driver.

2 Likes

Hi James
1k is a bit low for a pull up isn’t it ???
Cheers Bob

1 Like

@Robert93820 Agree.
10k would be better and is used on boards that use this device.

I wanted to see if the device would work as per the truth table and the code provided by @Devin80572 and it does.

Cheers
Jim

1 Like