Project 15 MOTOR BASICS
Project 15 MOTOR BASICS
In this circuit, you will learn the basic concepts behind motor control. Motors require a lot of
current, so you can’t drive them directly from a digital pin on the RedBoard. Instead, you’ll use
what is known as a motor controller or motor driver board to power and spin the motor
accordingly.
Page | 1
Grab the following quantities of each part listed to build this circuit:
NEW COMPONENTS
Specifications
• On-board 2 L9110 motor control chip
• Module can be driven by two dc motors at the same time or one phase 4 line 2 type stepping
motor
• Input voltage: 2.5-12V DC
• Each channel has a continuous output current 800 ma Page | 2
• PCB Size: 29.2mm x 23mm
HOOKUP GUIDE
READY TO START HOOKING EVERYTHING UP? Check out the circuit diagram and
hookup table below to see how everything is connected.
PROJECT 15: MOTOR BASICS
Page | 3
Page | 4
Page | 5
PROJECT 15: MOTOR BASICS
Step 2: Code
Upload the following code to your Arduino.
Page | 6
SOURCE CODE:
void setup() {
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(B1, OUTPUT);
pinMode(B2, OUTPUT);
digitalWrite(A1, LOW);
digitalWrite(A2, LOW);
digitalWrite(B1, LOW);
digitalWrite(B2, LOW);
}
int input = 0;
void loop() {
switch (input) {
case 1: // if input=1 ....... motors turn forward
forward();
break;
case 2: // if input=2 ....... motors turn backward
backward();
break;
case 3: // if input=1 ....... motors turn stop
PROJECT 15: MOTOR BASICS
Stop();
break;
}
delay(200);
input=0;
}
} Page | 7
void forward() { //function of forward
analogWrite(A1, 255);
analogWrite(A2, 0);
analogWrite(B1, 255);
analogWrite(B2, 0);
}