How to control and power two DC Gearmotor with encoders by using arduino?

Hello guys, I'm trying to control two DC Gearmotors with encoders by using Arduino Motor Shield coupled to Arduino UNO, but I don't know what's the code and if I'm right about how to power it. I'm using the following components:

https://www.pololu.com/product/2827 "two DC Gearmotors with encoder (with enough torque for my project)"
Arduino UNO Arduino Uno Rev3 — Arduino Official Store
Arduino Motor Shield Arduino Motor Shield Rev3 — Arduino Official Store
Two 4 AA battery holders (to power the DC Gearmotors with encoder (12[V]))
A 9[V] battery with it adapter for Arduino UNO

How should I connect this?, and is it right?

I know that Arduino UNO must be powered between 7-12[V] and the DC Gearmotors to 12[V], but according to that website, the blue wire operates between 3.5-20[V], so I'm kind of confused.

Thanks in advance :slight_smile:

Have you tried Googling "Arduino Motor Shield Example" I get a lot of hits including tutorials on Arduino.cc.

I think your power scheme should work. You can power the Uno from 12V no problems (20V maximum IIRC), but there's nothing wrong with using a separate power supply. It will be less noisy.

The motor shield is pretty straight forward. Give it a PWM and direction and it should drive the motor. Worry about braking and current sensing later.

The motor shield doesn't use the encoder feedback. You will count pulses or measure frequency separately in your program. There are lots of examples either by polling the pin (reading continuously and looking for changes) or using interrupts.

The motor shield you have chosen uses the quite ancient and very inefficient L298 technology and can't handle the 5 Ampere startup/stall current required by that motor.

You should be using a modern motor driver, like those from Pololu. See their recommendations on the motor product page.

sdturner:
Have you tried Googling "Arduino Motor Shield Example" I get a lot of hits including tutorials on Arduino.cc.

I think your power scheme should work. You can power the Uno from 12V no problems (20V maximum IIRC), but there's nothing wrong with using a separate power supply. It will be less noisy.

The motor shield is pretty straight forward. Give it a PWM and direction and it should drive the motor. Worry about braking and current sensing later.

The motor shield doesn't use the encoder feedback. You will count pulses or measure frequency separately in your program. There are lots of examples either by polling the pin (reading continuously and looking for changes) or using interrupts.

Thanks man. I'm going to use 2 lipo batteries, and by the moment interrupts for the shield.