im building this robot with a little difference, i want my robot to move along only a black thick line of 3cm.
as im very new to this programming stuff, i want to know wat kind of programming is required using all the same components, that is using sharp IR sensor.
The Sharp IR sensor is a distance (or proximity) sensor only. It does not detect colours or colour differences. You need something that can “see” brightness of objects. And a little light. And some enclosure so daylight cannot illuminate the object.
Those components are not expensive. One or two IR LEDs plus IR phototransistors will do. But you will have to order them. O course, I assume you already ave a few generic components like transistors, resistors, capacitors. Or you know how to take them from old gadgets.
It would be best to first get a LED to blink. This is the “Hello World” of the robot community. Next, I would move onto building and testing all the parts you will need on a breadboard. Your line follow sensor will have, at a minimum, 2 sensors. You can assemble one of these sensors on a breadboard and do all your testing and coding. When it is time to add it to the actual robot, all the hard work will already be done. This goes the same for the motors, etc.
Again, line following can be as simple or complex as you want to make it. At the core, it is simply:
If the line is too the right, turn left --and-- If the line is to the left, turn right. That’s really it in terms of getting started.
Yes, this will require programming. Programs (code) are not something you can just turn on and they work. You have to know how and why programs work so you can make them work with your robot. There is no fast way of doing this. You need to start with the basics and then move forward. Yes, it is usually a IR led, but I ask you this: How are you going to read the IR phototransistor? You will need to learn how to program your microcontroller to read the value from your phototransistor. This is just one step of many.
First, study what others have done and see how they did it. Google picaxe and arduino and start looking at basic info. Check out the Start Here robot (right at the top of this page) and see what went into it.Google “line follow how to” and see what comes up. Look for FAQ and click on it.
Probably the easiest route is to use a digital reflectance circuit like the ones sold by Pololu. This makes an analog to digital converter (ADC) unnecessary for detecting a black line on a white background. This may make your life easier, but you will still have to learn and understand how to control two motors and program a microcontroller.