Obstacle Avoidance Project Information
Introduction to Robotics
Computer Science 479/679
Spring 2012


In this project you will modify a remote controlled car so that, rather than being remote controlled, it is under the control of the BrainStem micro-controller. Your modified car will sense and avoid obstacles using a single IR ranging sensor.

There are two main tasks in this project:

The sections below provide details on these tasks.

Replacing the RC circuitry

After removing the outer shell of the car by removing the four screws at the extreme corners on the underside of the chassis, you'll see the RC circuit mounted on top of the chassis. You'll remove this and replace it with a circuit of your own design. To make this as easy as possible, you'll construct your circuit on a breadboard that I'll provide rather than soldering the parts together. See this link for information on breadboards.

Note that the control mechanism for the car is simple. There's one DC motor to drive the rear wheels, and another for steering. They RC control can put the motors in one of three states - unpowered, full power in the forward direction, full power in the reverse direction. You'll need to use the BrainStem to fulfill this function. Earlier in the semester we discussed the use of H-bridges for this kind of control. See this article for a nice discussion of H-bridges. The specific H-bridge you'll get is resold by Acroname. Here is the Acroname web page, and here is the manufacturer's data sheet.

Note that you'll need to use the digital outputs on the Brainstem to supply control signals to the H-bridge. Also, you'll need one H-bridge for each of the motors (drive and steering).


Adding an IR sensor

Once you've got code running that can control the motion of the car, you'll want to connect the IR range sensor to the BrainStem and use the output of that sensor to provide information about the location of obstacles. This information should be used to allow the car to explore without crashing into things.

We're going to use a Sharp IR sensor. They make a number of sensors that are commonly used in mobile robotics applications. The Sharp part number is GP2Y0A02YK. This sensor can return range information for objects between 8 and 60 inches away. The Acroname page for this sensor can be found here, and the manufacturer's data sheet can be found here.

You'll need the following items for this part of the project, all of which I'll give you:

Note that there is a notch on the JST connector housing that forces it to be oriented a particular way before it can be plugged into the Sharp unit to ensure that power and ground are attached to the proper pins.

Read the section entitled Connector Assembly in the Acroname document I handed out in class (pages 2 - 4). I suggest the following approach to ensure that the connector assembly is done correctly.

  1. Put the Sharp unit on a table oriented with the lenses up and the connector pointing toward you (see the figure on the top of page 3 in the Acroname document).
  2. Now lay the JST connector housing on the table so that the notch is pointing up.
  3. Plug the crimp on the yellow wire (Vo, the output voltage) into the leftmost slot of the JST. The crimp should slide in fairly easily and "snap" into place. If it doesn't slide in easily, turn it (the wire and crimp) over and try again.
  4. Now connect the black (GND) wire to the middle slot of the JST, and the red (Vcc, input voltage) wire to the rightmost slot.
  5. Finally, connect the JST to the Sharp unit.
Connecting the Sharp unit to the BrainStem is easy. Connect the wires from the JST to the wires on a 3-pin connector (like the servo connectors) and plug it in to one of the analog ports. Be sure to refer to the pinout diagram in the BrainStem reference to ensure that the power, ground, and analog output connections to the BrainStem are done correctly. Follow the link above, click on "Hardware" and then "GP 1.0 Module", and then "Pinout Diagram".

Now, turn on the BrainStem, run the GP application, and watch the analog outputs. If you wave your hand in front of the sensor you should see the levels change. Before writing code that uses the output of the A/D converter for the sensor, you should read this article on how to linearize the output. It might be useful.