Advice on my project

I am completely new to robotics and mechatronics. To try and get a grounding in the subjects, I am attempting to build a line following robot. I have an Arduino Uno board, LED's, an LDR, the programming (more or less, give or take a few numeric constants). My next stage is choosing what type of motor I'm going to use. Currently I'm stuck between servo motors and standard DC motors.

What would people recommend?

BTW in terms of motor shields, I was going to buy an Arduino one.

I used the 2 wheeled platform from Make.
It came with motors that seem fine for your project.
http://www.robotliving.com/building-robots/two-wheeled-robot-2/

If you use RC servos modified for continuous rotation then you won't need a motor shield.

If you use RC servos modified for continuous rotation

I'm building a similar simple robot right now. I'm using these servos that are already made to run in continuous-rotation mode and have an accessible trim pot to set the "neutral/stop" point: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=130

These servos are strong! Click on "large image" to see the specs...

There are also less powerful servos for half the price.. http://arduino-direct.com/sunshop/index.php?l=product_list&c=10

I get these directly from the factory in China, and the workmanship is very good.

DISCLAIMER: Mentioned stuff from my own shop... But you can find these on Ebay and pololu.com in usa etc...

Thanks everyone for your input, especially Pauly because you link to the program really helped. The next bit of advice I would like is on my programming. With a bit of help from my father, I was able to create a program that makes my robot search for a line and follow it. Here’s the program:

#define LED 13 //pin connected to LED
#define LDR 14 //pin connected to LDR
#define BUTTON 9 //pin connected to BUTTON

#define DG_TURN90 99 //no. of milliseconds it takes for the robot to turn 90 degrees
#define DG_TURN180 198 //no. of milliseconds it takes for the robot to turn 180 degrees
#define ON_THE_LINE 20 //voltage LDR recieves when on the line
#define TRUE 1 //define logical TRUE as the value 1
#define FALSE 0 //define logical FALSE as the value 0

int val = 0; //I have setup an integer variale known as val

#include <AFMotor.h> //include motor shield’s functions and definitions (using DC MOTORS)
AF_DCMotor left_motor (1, MOTOR12_8KHZ);
AF_DCMotor right_motor (2, MOTOR12_8KHZ);

void setup () //initial setup function (called once).
{
Serial.begin(9600);
pinMode (LED, OUTPUT); //Arduino board now recognises LED pin as output
pinMode (LDR, INPUT); //Arduino board now recognises LDR pin as input
pinMode (BUTTON, INPUT);

left_motor.setSpeed (200);
right_motor.setSpeed (200);

digitalWrite (LED, HIGH); //turn on sensor LED
}

void loop () //core programming executed repeatedly
{
val = digitalRead (BUTTON); //The current state of the button, on (1) or off (0), is now stored as val.

if (val == HIGH) // If the button has been pressed begin searching for the line, if not stop.
{
if (on_the_line()) //If you are on the line, call forward function. If not, search for the line.

{
forward();
}

else

{
searchforline();
}
}

else
{
return;
}
}

void forward () //makes robot go forward
{
left_motor.run (FORWARD);
right_motor.run (FORWARD);
}

void searchforline () //search for line protocol. If the line isn’t found, the robot stops
{
unsigned long startTime = 0; //start the clock

stop_motor(); //stop motors

left_motor.run (FORWARD); //Start turning left.

startTime = millis (); //remembers the time the robot started turning left

while (!on_the_line() && (millis() - startTime) < DG_TURN90) //while not on the line and turned less than 90 degrees, keep turning left.
{
;
}

stop_motor(); //stop motors

if (on_the_line()) // If on the line, return to loop function
{
return;
}

right_motor.run (FORWARD); //start turning right

startTime = millis (); //remembers the time the robot started turning right

while (!on_the_line() && (millis() - startTime) < DG_TURN180) //while the robot is not on the line and has turned less than 180 degrees, keep turning right.
{
;
}

if (!on_the_line()) //If the line still hasn’t been found, stop.
{
stop_motor();
}

}

void stop_motor () //stop motors
{
left_motor.run (RELEASE);
right_motor.run (RELEASE);
}

int on_the_line () //Determines if robot is on the line. TRUE = on line, FALSE = not on line
{
int val = 0;
val = analogRead (LDR);

if (val >= ON_THE_LINE) //Read LDR and comapre with ON-THE-LINE constant. Is it greater than or equal to the constant ON-THE-LINE?
{
return TRUE;
}

else

{
return FALSE;
}
}

However, I currently a problem with the program. I think I’m missing a few bits of code, but I can’t tell where.

However, I currently a problem with the program

Care to share?

In some versions of programs used to drive motors they use commands like serial.print ln(tock) and I don't know whether I need them or not. The IDE seems to like the program every since I downloaded the Adafruit shield library a few minutes, but I can't help but think thatI've made a mistake in the programming.

No, what I meant was "can you describe the problem".
Just saying you've got a problem doesn't describe what you observe happening and what you expect to happen, and how the two differ.

It's difficult to describe the problem because I don't know if there's a problem there in the first place. :sweat_smile:

Sorry, can't help with psychosomatic bugs.

Sorry to bother you with it. it's my first time working with Arduino so i want everything to go smoothly. :sweat_smile:

For my line following robot, I decided that I would use and LED and a LDR to find the line. I did look at ultrasonic sensors, Infra Red sesnors and camera-like sensors as other possibilities. Once I’ve completed this generation of the project, what would people reccomend that I attach on next time so that I could improve it while at the same time make it interesting to actually do?

A wave shield and speaker to make the robot talk. If it would be used outdoors you could add a GPS.