Arduino Coffeebots

Arduino Coffeebots

Michael Shiloh

Judy Castro

Contact: teachers@teachmetomake.com

This page can be reached at: bit.ly/coffeebot

Basic Robot

Robot with two light sensors and two motors:

dual_schem

/*
This program makes your robot either seek light or avoid light, depending on how it is wired up.
Try this program first, and then start modifying it to give your robot the personality you desire.
Shine a flashlight, or hold your hand over a light sensor, to change the behaviour.
*/

void setup()
{
  // Set the mode of the digital pins to outputs to drive the motors
  // (the analog inputs are automatically inputs and so don’t need to be set)
  pinMode( 3, OUTPUT ); // motor
  pinMode( 5, OUTPUT ); // motor
}

void loop()
{
  // Compare the two light sensors
  if ( analogRead( 0 ) > analogRead( 2 )  ) // If one light sensor has more light than the other ...
  {
    digitalWrite( 3, LOW ); // turn this motor off ...
    digitalWrite( 5, HIGH ); // and this motor on to turn in one direction
  }

  if ( analogRead( 0 ) < analogRead( 2 )  ) // If the other
  {
    digitalWrite( 3, HIGH ); // turn this motor on
    digitalWrite( 5, LOW ); // and this motor off to turn in the other direction
  }

}

Add an LED

As an example of how to add things to your coffeebot, let’s attach an LED to pin 9.
Remember to use a resistor so that the LED doesn’t burn out:

dualWithLED_schem

And here is how we might use that LED in a program:

/*
This program makes your robot either seek light or avoid light, depending on how it is wired up.
Try this program first, and then start modifying it to give your robot the personality you desire.
Shine a flashlight, or hold your hand over a light sensor, to change the behaviour.

An LED is connected to pin 9; whenever the sensors measure unequal brightness this LED is turned on
*/
void setup()
{
  // Set the mode of the digital pins to outputs to drive the motors
  // (the analog inputs are automatically inputs and so don’t need to be set)
  pinMode( 3, OUTPUT ); // motor
  pinMode( 5, OUTPUT ); // motor
  pinMode( 9, OUTPUT ); // LED
}

void loop()
{
  // Compare the two light sensors
  if ( analogRead( 0 ) > analogRead( 2 )  ) // If one light sensor has more light than the other ...
  {
    digitalWrite( 3, LOW ); // turn this motor off ...
    digitalWrite( 5, HIGH ); // and this motor on to turn in one direction
    digitalWrite( 9, LOW ); // turn off the LED
  }

  if ( analogRead( 0 ) < analogRead( 2 )  ) // If the other
  {
    digitalWrite( 3, HIGH ); // turn this motor on
    digitalWrite( 5, LOW ); // and this motor off to turn in the other direction
    digitalWrite( 9, LOW ); // turn off the LED
  }

if ( analogRead( 0 ) == analogRead( 2 )  ) // If they read the same value
  {
    digitalWrite( 3, HIGH ); // turn this motor on
    digitalWrite( 5, HIGH ); // and this motor too, to go straight
    digitalWrite( 9, HIGH ); // turn on the LED
  }
}

Links that might be useful or interesting:

  1. 123 robotics experiments for the evil genius is available for free via Google Books
  2. Really nice set of robot tutorials at Robotshop.
  3. I really like mailing lists, and there are plenty on the subjects of robots. Two of my favorites are the Dallas Personal Robotics Group and the Portland Area Robotics Society

Parts List

Robot Chassis Parts List

  1. Coffee can or other suitable container for body
  2. Craft sticks or other suitable materials for structural elements and decoration
  3. Wine corks or other suitable items for front and back caster mounts
  4. Water bottle caps or other suitable items for casters
  5. Zip ties for attaching Arduino to chassis

Robot Electronics Parts List

  • N-chanel logic level MOSFET 12N10L
    Jameco Part no. 1071214
    quantity: 2
  • Gear motor and wheel, Solarbotics GM8 with GMPW wheel deal

    http://www.solarbotics.com/product/gmpw_deal/

    quantity: 2

  • LED (any type)
    e.g. Jameco Part no. 2152112
    quantity: 2
  • Resistor for LED, 330 Ohm or so
    Jameco Part no. 690742
    quantity: 2
  • Photoresistor
    Jameco Part no. 120299
    quantity: 2
  • 150K Ohm Resistor for Photoresistor
    Jameco Part no. 691382
    quantity: 2
  • Arduino Uno or Leonardo, or compatible
  • Battery holder with switch and coax power connector
    Maker Shed MSBAT1
  • 9 Volt Battery

Class Consumables Parts List

  • Wire (all the different colors
  • Solder
  • It is often cheaper to buy some parts such as LEDs, resistors, and photoresistors in bulk

Tools

Here are the basic tools that we find useful when constructing CoffeeBots:

1. A soldering iron. A fine tip is essential. Note the pencil size for comparison:

SAMSUNG

SAMSUNG

You can spend well over $100, but this particular model ($17 at Parts Express) is adequate.

2. Third hand:

SAMSUNG

This device has a pair of alligator clips on flexible arms. While not critical, it is extremely useful for holding things while you solder, for example holding the motor while you solder the wires to the motor terminals:

SAMSUNG

3. Hot melt glue gun:

SAMSUNG

4. Wire cutter, wire stripper, and needle nose pliers:

SAMSUNG

Most importantly, you want the wire cutters to have a small, fine tip, for cutting wires that are close to other wires:

SAMSUNG

That’s about it – it is useful to have other tools on hand but these are the only tools necessary

 

4 Responses to “Arduino Coffeebots”

  1. MAKE | Mini Maker Faire Action: Coffeebots in Jerusalem Says:

    [...] is getting underway at the Bloomfield Science Museum. California artists and maker teacher team Teach Me to Make (Michael Shiloh and Judy Castro) traveled to Jerusalem as guests and Maker Faire emissaries and [...]

  2. Mini Maker Faire Action: Coffeebots in Jerusalem - IT Clips Says:

    [...] is getting underway at the Bloomfield Science Museum. California artists and maker teacher team Teach Me to Make (Michael Shiloh and Judy Castro) traveled to Jerusalem as guests and Maker Faire emissaries and [...]

  3. - Kosher Tech Salad Says:

    [...] of the things at the Maker Faire was CoffeeBots, small robots which use Arduino based electronics for easy modification and which were being [...]

  4. The Amazing Jerusalem Mini Maker Faire 2013 - Kosher Tech Salad Says:

    [...] of the things at the Maker Faire was CoffeeBots, small robots which use Arduino based electronics for easy modification and which were being [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


%d bloggers like this: