Carduino- a Simple Arduino Robotics Platform With Its Own Library




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
1 Breadboard
1 Arduino and breadboard holder
1 Sharp long range proximity sensor
2 Micro metal gear motors
1 Pair of 49x19mm wheels
1 Pair of motor mounting brackets
1 Pair of omni-wheels
1 Arduino motor shield
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 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.

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

1 Person Made This Project!


  • Eggs Challenge

    Eggs Challenge
  • Backyard Contest

    Backyard Contest
  • First Time Author Contest

    First Time Author Contest



7 years ago

very nice' but can we use a ultrasonic sensor in place of the SHARP sensor????????????


8 years ago on Introduction

I'm having trouble installing the library.

I downloaded the zip file and imported the library, but when I put it in the sketch it only shows the .h file and gives me the error message:

core.a(main.cpp.o): In function `main':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard... undefined reference to `setup'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard... undefined reference to `loop'

The four "example" files show up in the sketchbook, but each opens in a new window. They individually verify, but when copy/pasting them together I get error messages.

I can't seem to import the .cpp file at all, and when I try to drag and drop it I get the same error message.


8 years ago

does arduino uno r3 work

my brother would approve of your username, he has the same problem with his name.


9 years ago on Introduction

Very nice tutorial. Simple and to-the-point. Thanks!


9 years ago on Introduction

I take you code, but theres an error.

I put this on the Arduinoprogram:

void mycarduino.begin () Call in setup ().

void mycarduino.goforward(float 4, int 12)

void mycarduino.goback(float 4, int 12)

void mycarduino.turnright(int 2)

void mycarduino.turnleft(int 2)

int mycarduino.proximity()


Reply 9 years ago on Introduction

Have you tried running any of the example programs from File -> Examples -> Carduino? Make sure that when you call a function, you just call it with the numbers like "goforward(4, 12)" not "goforward(float 4, int 12).

What exactly did the error say?


9 years ago on Introduction

Hello Guys!

Could i use Motorshields from this Collection?

?? I cannot buy the Motorshield R3 on Amazon.US, because i dont have VISA or a Mastercard.


10 years ago on Introduction

add a bluetooth slave to this to make it even better! cheap remote control car your android phone! I need to spend more time getting the ultrasonic sensor to work on my code.
Use BlueTerm from google play to control it.

#include //motor shield
#include //Software Serial Port
#include // android link bluetooth
#define RxD 6 // BT com these are backwards on the shield
#define TxD 2 //BT com backwards on BT shield, jumpers
#define trigPin A4 //sensor trig to analog 4
#define echoPin A5 //sensor echo to analog 5
#define objLED A3 // set obsticle indicator led to analog 3

AF_DCMotor lmotor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor rmotor(1, MOTOR12_64KHZ); // sets the left motor to port 1

SoftwareSerial blueToothSerial(RxD,TxD);

void setup()
Serial.begin(38400); // set up Serial library at 9600 bps
pinMode(RxD, INPUT); //set pin 6 to BT in
pinMode(TxD, OUTPUT); //set pin 2 to BT out
pinMode(trigPin, OUTPUT); //sets ultrasonic sensor
pinMode(echoPin, INPUT);
pinMode(objLED, OUTPUT);
setupBlueToothConnection(); //
rmotor.setSpeed(200); // set the RIGHT motot speed to 220 from 0 to 255
lmotor.setSpeed(200); // set the Left motor speed to 200 from 0 to 255

void loop()
//get distance before collision
float duration, distance;
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
//end distance

//recieve and execute comands via bluetooth
char recvChar;

if(blueToothSerial.available())//check if there's any data sent from the remote bluetooth shield
recvChar =;
case 'w': //forward
if(distance <= 10 && distance >=1) // stop motor if distance is less than or equal to 10 cm

case 's': //backwards

case 'e': // stop

case 'a': // turn left
blueToothSerial.println("turning left");;;

case 'd': //turn right
blueToothSerial.println("turning right");;;

}//end switch case

} // end BT com
} // end loop

void avoidObject()


void setupBlueToothConnection()
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println("The slave bluetooth is inquirable!");
delay(2000); // This delay is required.

Higgs Boson
Higgs Boson

10 years ago on Introduction

The motor shield you are using has a relativly high current demand. One standard nine volt battery cannot supply that current. With my shield, I was needing power supplys with at leaste 800ma, and settled on using a 1600mah battery for all projects using that shield. Did the 9v battery actually drive the shield?

Higgs Boson
Higgs Boson

Reply 10 years ago on Introduction

Interesting. Your motors must not have a very large current consumption then.


10 years ago on Introduction

Great tutorial, and just at the right time for me. My next project is to be a robot just like this. Thanks for the helping hand


10 years ago on Introduction

(If you're going to glue your battery in place, best make sure it's rechargeable...?)


Reply 10 years ago on Introduction

I didn't think that through very much, thanks for pointing that out. I think even if they were rechargeable, it would be difficult to recharge them while they're glued on. I suppose velcro, or some sort of holder would the best way to solve that problem.