Introduction: Carduino- a Simple Arduino Robotics Platform With Its Own Library

About: I am a human being that enjoys to build things. I also say GNU/Linux instead of just Linux. Yeah, I'm that kind of person.

This is, as the title says, an Arduino-based robotics platform, with its own library. The "standard" model comes with two back motors, two omni-wheels in the front, and a distance sensor mounted on the front. It also has breadboard space on top for adding whatever you want. It is intended to be autonomous, but one can make it remote controlled if they really want to. This instructable will teach how to build it, how to use the library, and it will include some sample projects too.

What is the library?
The library will make controlling your Carduino a little easier. This project is intended for those with little programming experience, and just want to get started with simple robotics. You don't even need to know how to use a motor shield to use it. It's as simple as saying "turn right for 1 second" or "go forward for 3 seconds, and then speed up." The library also contains example code to help you get started.

What exactly is in the library?
Step 13 contains all the important information regarding the library, and all example projects.

Why would you ever want a wooden chassis, and is it fine if I build mine differently?
Of course you can build yours differently! The library will work almost no matter what you do, so you can change the design to whatever you'd like. The only reason why I used a wooden chassis was because it was the only material for this I had, so you can feel free to use whatever else you'd like.

What can this robot do?
It can do just about anything. Even just with the parts on the standard model, there is infinite possibilities. With Arduino and the Carduino library, programming it is incredibly easy, and it can do anything you can imagine. The extra breadboard space allows you to add a variety of sensors, to make it do just what you want.

How much does it cost?
Roughly one hundred dollars, if you're starting out with nothing.  I had almost all the parts before I started, so the price was only about thirty dollars for me. Most all of the parts are very common, and you should have many of them.

Here is a terrible video of it in action:
(due to some issues with the distance sensor, I could not get object-avoidance in the video, but, I assure you, it works)

Step 1: Supplies

1 Arduino Uno http://www.sparkfun.com/products/11021
1 Breadboard http://www.sparkfun.com/products/9567
1 Arduino and breadboard holder http://www.sparkfun.com/products/10059
1 Sharp long range proximity sensor http://www.sparkfun.com/products/8958
2 Micro metal gear motors http://www.sparkfun.com/products/8910
1 Pair of 49x19mm wheels http://www.sparkfun.com/products/8899
1 Pair of motor mounting brackets http://www.sparkfun.com/products/8896
1 Pair of omni-wheels http://www.sparkfun.com/products/320
1 Arduino motor shield http://www.amazon.com/gp/product/B007BHKRVW/ref=oh_details_o00_s00_i00
1 15x10.75cm piece of wood      (check size with the Arduino and breadboard holder)
12 #4 x 3/4" Wood screws
1 9v battery
Some Wire

Step 2: Set Up Various Things

Here some things you need to do before you begin:
Cut wood to correct size
Make Omni-wheels (instructions came with them)
Attach wheels to motors
Insert Arduino and breadboard into the holder.

Step 3: Mount Omni-wheels

Position both of them 0.5" from the front, and 0.5" from either side. Mark holes for mounting, then drill them. Use your #4 x 3/4" wood screws to mount them.

Step 4: Mount Motors

This step is fairly easy. All you do is insert the motors into the mounting brackets, and super glue the brackets onto the corners. You may want to have already solder wires to them though, I ended up needing to remove the motors to solder later on.

Step 5: Mount Arduino & Breadboard

You should begin by centering the Arduino and breadboard holder on the chassis. Remember that the breadboard should be in the front. Next, mark holes to drill. Then Arduino and breadboard holder already has to holes in the center, you should use those. After you marked the holes, you need to drill them, and mount the holder using #4 x 3/4" wood screws.

Step 6: Mount Proximity Sensor

This should be fairly straightforward. Just mark holes, and drill. You should be using the mounting holes on either side of the sensor. It doesn't need to be centered on the front, but if you want it to be, it should be about 1.5" from either side. Use #4 x 3/4" wood screws, yet again. MAKE SURE that when you do this the JST is on top.

Insert your JST wires into the sensor.
Now, put the red wire in the positive thingy in your breadboard, the black wire in the negative, and the yellow can go anywhere in the breadboard.

Step 7: Attach Motor Shield

You should know how to do this, just line it up and stack it onto your Arduino.

Step 8: Solder to Motors

Just solder some wires to you motors. Make sure to remember which are positive, and which are negative.

Step 9: Wire Motors to Motor Shield

This is much more complicated than you would imagine.

Wire positive on the right motor to the negative terminal for motor A.
Wire negative on the right motor to the positive terminal for motor A.

Wire positive on the left motor to the positive terminal for motor B.
Wire negative on the left motor to the negative terminal for motor B.

If anyone believes these are wrong, please notify me. I am quite sure that I'm correct, but there is a chance that I lost track of which wire is which.

Step 10: Wire Breadboard and Sensor

Connect 5v to the positive column thingy in the breadboard. Connect GND to the negative thingy. Connect the yellow sensor thing to analog pin 2.

Step 11: Attach Battery

Just super glue a 9v battery to the back of your Carduino. Then, attach the positive and negative wires (either soldered or with battery clip) to the positive and negative terminals on your Carduino.

Step 12: You're Done Building!

You have finished building the "standard" model of the Carduino. The great thing about the Carduino is any Carduino can run any Carduino code. All of the examples that come with the library will run on your Carduino, without any modifications. Next, I will explain the library, and exactly what's included.

Step 13: The Library

To install the library:
Download Carduino.zip at the bottom of the step. Find /arduino-1.0/libraries. Extract the library to that location. Now, to use it, open up the Arduino IDE, go to sketch -> import library -> Carduino.

Here are the functions in the library:
void mycarduino.begin ()
Starts up the Carduino. Call in setup ().

void mycarduino.goforward(float seconds, int speed)
This function moves the Carduino forward for the specified time and speed. The speed should be any number from 1 to 1023, with 1023 being the fastest.

void mycarduino.goback(float seconds, int speed)
The same as the function above, only backward.

void mycarduino.turnright(int time)
Turns the Carduino right for the specified time, in milliseconds.

void mycarduino.turnleft(int time)
Turns the Carduino left for the specified time, in milliseconds.

int mycarduino.proximity()
Returns the reading of the proximity sensor, in centimeters.

Examples:
Go to      File -> Examples -> Carduino -> [name of your choice]

Blink- Drives the Carduino forward for a second, stops for a second, and repeats. This should be your first "hello world" program.

Object Avoid- Drives forward constantly, until an object comes within 25 centimeters. Then, it chooses a direction (left or right, chosen randomly) and it turns that distance for a random amount of time, between 800 and 2300 milliseconds.

Cautious Driving- Works like object avoid, but if it notices something within 40 centimeters, it slows down.

Spiral- Drives in an outward spiral.

Step 14: Enjoy

You have now finished everything! If you have any questions, comments, or angry rants, you can feel free to post them in the comments, and I'll try to get back to you. Have fun, and happy Carduino-ing!

Robot Challenge

Finalist in the
Robot Challenge