High RPM DC Motors and Motor Controllers

Information
Step 1
Brushed DC motors

In this lesson we will be working with direct current (DC) motors.

These motors have just two states ON or OFF, either they spin at full speed, or they don't move at all.

Information
Step 2
Motor Drivers

However, a motor driver allows us control over our DC motors.

It will let us change the speed and direction of DC motors as well as allow us to power the motors separately from the Arduino.

Planning
Step 3
Understanding the circuit diagram for the driver

You can read about the motor drivers we are using here on pololu's website

Below is the circuit diagram which tells you how to set up the driver to two motors

In the steps below we will go over what each part of this diagram means, and then you will set up your hardware accordingly

Step 4
Orient your board like this

Plug your motor driver into your breadboard and make sure your board is oriented properly with Vcc at the top left

Step 5
Vcc vs Vin

The motor driver has a Voltage Control Circuit (Vcc) pin which controls the logic of the driver.

Additionally the driver has a Vin pin which powers the DC motors.

For now, supply the driver's Vin and Vcc pins with 5V from the Arduino.

Later you'll want to use a battery pack to supply a higher voltage to the driver's Vin pin, instead of using the Arduino's 5V output

Information
Step 6
GPIO

GPIO stands for General Purpose Input/Output

The Arduino's GPIO pins are just the digital pins

Information
Step 7
PWM

PWM stands for Pulse Width Modulation. It is a technique used to turn digital signals (on/off) into analog signals (0-255).

pins capable of PWM output are marked with a tilde (~) on an Uno.
Nano PWM pins include: 3, 5, 6, 9, 10, and 11.

Below is an example of how it works

You can write a PWM value to a digitalpin with

analogWrite(pin, value);

after setting the pinMode to OUTPUT

Step 8
Pick some digital pins to use for these four input

The Enables need to be hooked up to PWM pins.
The Phases canbe attached to any GPOI pins.

Step 9
Record the pins you chose in some integers at the top of your program

This way you'll be able to digitalWrite to aEnable rather than putting in the pin number itself.

Your code will be much easier to read this way.

Step 10
You should supply the MODE pin with HIGH for now

You should use a GPIO pin to supply a value of HIGH.

This puts the driver in PHASE/ENABLE mode.

You can read the reference page later if you would like to try using IN/IN mode

Step 11
Now you can attached the motors to the outputs

The orientation doesn't really matter; if you were to switch OUT1 and OUT2 the motor will simply spin the other direction.

Information
Step 12
Phase/Enable mode control

Let's take a look at the PHASE/ENABLE chart below to see how this driver works:

Phase can either be set to 1 or 0, which corresponds to HIGH or LOW respectively.

PWM is a percentage.

  • We know we can write a value from 0-255 using analogWrite().
  • Thus PWM = ([the value of analogWrite] / 255) * 100%

According to this chart, what happens if we analogWrite a value of 200 and set the Phase pin to HIGH?

Challenge
Step 13
Run two DC motors off your motor controller and control their speeds with the Serial Monitor

This page and the reference manual supply you with enough information to figure out what kinds of signals you need to supply to the driver and motors.

You will complete this challenge when you have written a program which uses the Serial Monitor to:

  • Input values from 0-255 to each motor in order to control their speed.
  • Changes the direction of either motor
Information
Step 14
Motor driver labels

All of the information provided in this lesson can be found on the motor driver's the reference page.

Check out this chart to understand more about the design:

Do not worry about Vmm, we will not be using it

High RPM DC Motors and Motor Controllers Info

Account

MVCode

Created By

jamie

Course:

Feedback Control Systems: Line follower

Access Level

public

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach