BaW-Bot Part 2: Build the motor-controller & body

This is the second part of our BaW-Bot (Bells-and-Whistles Bot) build – 5 separate instructables that look into different Arduino-related technologies, combining to create a Bot with all the bells-and-whistles.

Part 1: Build an Arduino on a Board
Part 2: Build the motor-controller & body
Part 3: Adding Sight and Touch
Part 4: Blinging up the BaW-Bot
Part 5: Taking it to the Next Level

In this instructable, we’ll be putting a simple motor-controller together, hooking together a simple body to prototype it on, and connecting it to the Arduino from Part 1 to test it.  This instructable is a simplification of a previous one,  Using the Sparkfun Motor Driver 1A Dual TB6612FNG – a Beginner’s Guide.

Step 1: The Parts

Collect the following parts together.  As this is part 2 in a series, it assumes that you’ll be using the Arduino on a Board from Part 1 – if you’re not, then you’ll need an Arduino Board (I recommend an Uno R3, as the pin count and configuration will match this series)
BaW-Bot Part 2
1 x Sparkfun Motor Driver 1A Dual TB6612FNG
1 x set of Header pins
1 x half-size Breadboard plus connecting wires
8 x 1N4001 rectifier diodes (or similar)
1 x 6V power supply (I used 4x 1.2V NiMH rechargeables in a holder)
2 x DC motors not exceeding the driver’s current and voltage rating (eg. Pololu’s 250:1 micro metal gearmotor)
2 x Mounting brackets and wheels (Pololu’s extended gearmotor brackets and 32×7 wheels)
1 x Castor
1 x Corrugated Card Box for a simple body

Step 2: Solder Connections

If you haven’t already, you’ll need to solder a few connections:

Solder the header pins onto the TB6612FNG

Solder pins onto the battery holder, to allow it to connect to the breadboard.  This battery holder is for the motor power (we need to keep the power for the motors separate from the power that runs the Arduino)

Solder jumper cables onto the motors

Step 3: Prepare your Breadboard

Separate Breadboard?
The motor driver is on a separate half-size breadboard, so that it can stack above the Arduino on a Board.  You could run this off the same board as the Arduino, if you used a full-size board.

Power Layout:
I’m using one power rail on the breadboard to power my motors, and the other power rail to carry the 5V regulated power from the Arduino on a board.  We need to connect the GND from both sources so that we’re working off a common GND – but never the positive supplies!

Place your Motor Driver at one end of the board, giving you space on the rest of the board to place the diodes and other connections.

Connect Arduino Power to your Motor Driver board.  Connect the 5V from the Arduino on a Board to the VCC on the motor driver, and the GND to the GND.  Make sure you are connecting these to the power rail that doesn’t provide power to the motors.

Step 4: Connect the Motor Control Pins

We’re now connecting the motor power and control pins (A01 and A02 / B02 and B02).

The motor driver switches the polarity on the 01 and 02 pairs for motor A and B to control the direction each motor spins.  PWM pulses through the same connectors control the speed of each of the motors.

Connect the A01/A02 & B01/B02 from the motor drive to points on the breadboard.  Space the jumper wires 2 points apart to allow us to connect the diodes in the next step, as well as to keep it compact.

Step 5: Connect the Motors to the Board

Motor Driver Power
Connect the motor power rail (6V separate source) of the breadboard to the motor driver VM pin.

Back EMF Protection
In order to protect the driver and circuit against back EMF, we need to connect 2 rectifier diodes to each connection that the motors make to the breadboard.  This setup provides Back EMF protection regardless of the direction the motor may spin.

One diode connects the motor terminal to Positive, the other diode connects the motor terminal to GND.  It’s important to get the polarity right, so connect as follows:
– Motor Terminal —> Positive: white stripe of diode to the positive power rail
– Motor Terminal —> Ground: white strip of diode to the motor terminal

Then, connect the motor to the breadboard.

Repeat this for each of the 3 remaining motor outputs

Motor Power Source
Finally, connect the Motor Power connector to the Motor power rail

Step 6: Connect the Control Pins

BaW-Bot Part 2 circuit

We’ll now connect the pins on the Arduino that tell the motor driver what to do.

As we’re connecting the Arduino on a Board that we built (and not an Uno etc.), you need to remember that the pin numbers on the ATmega below are the logical, not physical ones.  To remind you, I’ve included the logical pin numbers in a diagram above, the ones in blue square parentheses (eg. logical pin 4 = physical pin 6).

Connect as follows:
– ATmega Pin 5 –> PWMA  (Speed for motor A)
– ATmega Pin 6 –> AIN1 (Direction #1 for Motor A)
– ATmega Pin 7 –> AIN2 (Direction #2 for Motor A)
– ATmega pin 8 –> STBY (Disconnect / Connect Motors)
– ATmega Pin 9 –> PWMB (Speed for motor B)
– ATmega Pin 10 –> BIN2 (Direction #2 for Motor A)
– ATmega Pin 11 –> BIN1 (Direction #1 for Motor B)

 

For more detail: BaW-Bot Part 2: Build the motor-controller & body


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top