Two-Wheeled Robot

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 projects@manylabs.org.

Materials

You can get started with the motor shield using the following materials:

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

Steps

Here's how to set up the hardware:

  1. Attach the shield to the Arduino.

  2. Attach one motor to the M1+/M1- screw terminal. Attach the other motor to the M2+/M2- screw terminal.

  3. 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.)

  4. Connect the power supply to the VS/GND screw terminal. Double check the voltage with a voltmeter.

  5. 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.

Troubleshooting