L9110 Fan Motor Keyes Board

arduino fan2

The Sketch can be downloaded from my GitHub page here and includes the L9110 datasheet.

I came across this somewhat strange board advertised as a Fire Fighter with the claim that the fan was so strong it could be used to put out a flame! With a claim like that I just had to buy one, but I must confess that I have no idea what I will do with it.

The Motor Driver is an L9110 single motor driver that has two inputs INA and INB with two wire out that can drive a small DC motor. It seems to be designed to be used in toys and small robots. INA and INB are driven by logic signals, both inputs set to LOW and the motor is still, with INA HIGH and INB LOW the motor will turn one way and it will turn the other way when INA and INB are reversed.. Two other pins on this board are supplied with  5 volts (Vcc) and Gnd from the Arduino. INA and INB could be supplied with logic signals from any of the digital pins, but the motor speed would not be variable as it would run at full speed in either direction.

PWM can be used to drive the motor at variable speed in either direction and this is what the sketch here does. I found that the lowest stable speed was when the PWM was set to 80, up to the maximum of 255. Below 80 and the speed was a little erratic. I have used a KEYES momentary push button to demonstrate the motor. When the sketch first runs the motor is still. Press the button and the motor rotates, press it again and the motor stops for a brief moment then rotates in the opposite direction. On the third press the motor stops. The short delay when changing direction allows the motor to slow right down first.

The Circuit::l9110 arduino

Circuit diagram

The Sketch::

/*********************************************************
* Fan Driver using L9110 Motor Driver
*
* The L9110 Motor Diver is a simple driver designed for
* toys and robots. It has two inputs INA and INB
* and two outputs to drive a simple DC Motor.
*
* The direction of motor spin can be changed and the speed
* can be controlled using PWM
*
* The device described here is the Keyes Fan Board with
* 4 connections
*
* Connections:
*
* INA to Arduino PIN 5
* INB to Arduino PIN 6
* Vcc to Arduino 5 volts
* GND to Arduino GND
*
* Push Button:
* (the output went LOW on pressing on my unit)
* Gnd to Arduino Gnd
* Vcc to Arduino 5 volts
* S to Adduino PIN 7
*
*******************************************************/
const int INA = 6;
const int INB = 5;
const int pushButton = 7;
const int ledPin = 13; // onboard LED
int action = 0; // 0 = Stop, 1 = Forward, 2 = Reverse

byte speed = 80; // change this to alter speed 0 - 255 although 80 is the minimum for reliable operation

void setup()
{
pinMode(INA,OUTPUT);
pinMode(INB,OUTPUT);
pinMode(pushButton, INPUT);
pinMode(ledPin, OUTPUT); // onboard LED
Serial.begin(9600); // for debug
}

void loop()
{
if (digitalRead(pushButton) == LOW){ // see if button has been pressed
digitalWrite(ledPin, HIGH); // turn on LED
action = action + 1; // increment action
if(action > 2){
action = 0; // keep action in range
}
if (action > 0){
digitalWrite(ledPin, HIGH); // Turn OFF LED if motor stopped
stopFan();
delay(100); // short delay to make direction change easier for motor
}
else digitalWrite(ledPin, LOW); // turn onboard LED OFF
delay(800); // simple switch debounce
}

switch (action){
case 0:
Serial.println("Stop Fan:");
stopFan();
break;

case 1:
Serial.println("Fan Forwards:");
forward();
break;

case 2:
Serial.println("Fan Reverse:");
reverse();
break;
}
}

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

void stopFan(){
digitalWrite(INA,LOW);
digitalWrite(INB,LOW);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s