This project describes how to use the Grove Motor Shield to drive a pair of motors. It includes a sample Arduino sketch. Later we'll expand this project include building a simple sonar-based or line-following robot.
If you're interested in helping to develop this project, contact us at email@example.com.
You can get started with the motor shield using the following materials:
- Arduino Uno
- Grove Motor Shield
- 6V power supply
- Two 6V DC motors
- USB cable
If you'd like to build a robot, you can add:
- robot chassis (includes wheels and motors)
- Grove shield for Arduino
- 2 x sonar sensors or 4 x IR reflective sensors
- 2 x light sensors (analog)
- 2 x buttons
- 2 x knobs (potentiometers)
- 2 x green LEDs
- 6 AA battery pack and 6 AA batteries
- sensor mounting hardware
- connector cables
Here's how to set up the hardware:
Attach the shield to the Arduino.
Attach one motor to the M1+/M1- screw terminal. Attach the other motor to the M2+/M2- screw terminal.
Remove the power jumper (labelled VCC/5V); we'll be powering the Arduino with the USB cable for now. (After you have programmed the Arduino, you can unplug the USB cable and re-connect the jumper in order to run the Arduino off the batteries or power supply that is connected to the shield.)
Connect the power supply to the VS/GND screw terminal. Double check the voltage with a voltmeter.
Send the Motor Shield sketch to your Arduino. Look at the comments in the code to understand what the sketch does.
Note: if you are, for example, running a 6V motor with a 12V supply, make sure the speed never goes above 50% (127). Check the motor voltage with a voltmeter.