views:

258

answers:

6

Couple of friends and i will be building simple robot to track a white line on a black surface, we have never done this sort of thing before and i have very high level plan of attack,

Get a mini atx board for all computing needs, a web cam to track the road and 2 electric motors one for propulsion one for direction.

My main concern is, is there a better way to track the road? or does a webcam work for the job?

EDIT:

Follow up on the answers using Photoresistor seems to be the way to go, bu i have one more question there will be signals, to the right of the track telling the robot which way to turn. again white on black. such as i have to make a left on a t-junction. is there a way to handle this without a camera?

+2  A: 

I made a similar robot in school, and made two little sensors, basically just LDR's in a light-proof tube with a circuit to control the threshold of light that made the flip from on to off. It made the logic very simple - is there a black line under this sensor? Yes|No.

Using a web cam might involve quite a lot of visual processing.

In the meantime though, you can work on your other subsystems, ie controlling the motors from the computer, and building the thing itself and figuring out how to power it all.

Andrew M
Bear in mind that robots are complicated and there's a whole lot of things that can happen. Simple is good. Very good. At the very least, get the robot working with the LDRs, so you're not trying to debug everything at the same time.
David Thornley
+5  A: 

A web cam will have no trouble tracking a white line on a black background, and if you do find you have sensitivity issues, it's an easily upgradable piece of the system. (you'd only need to plug in a more expensive cam)

It might interest you to have a look at OpenCV,

(Open Source Computer Vision) is a library of programming functions for real time computer vision.

It may give you some ideas for you implementation, or even be of use to you if you end up using C++

edit: although using LDRs like Andrew M suggested may be a simpler solution :)

Zeus
+~ OpenCV is a good solution if the vision tracking was more complicated. And I agree, the photo-detector suggested elsewhere is the simple solution for this specific problem.
kenny
+11  A: 

It's best to bypass elaborate vision software altogether and use simple electronics. There are devices called phototransistors which are sensitive to light. Point two downwards at each side of the robot, shadowed from light from above. If the bot starts to go right instead of following the line, the left sensor will be activated. If it goes left, the right one will be activated. Use the feedback of these signals to guide the robot (you could possibly apply them almost directly to the motors if you have two motors).

Emilio M Bumachar
A: 

Would suggest you use both motors to drive it, one each side sat in the middle of your chassis and then two castors front and rear (raised off the floor slightly so it can rock on the drive wheels). Then you can drive it like a tank and it can turn on a six pence (or dime if from the US).

Spot the ex-Robot Wars contestant :)

Pete Duncanson
I've typically used 3 for simplicity. Aside from weight balance (on drive wheels) is there a reason to use 2 castors rather than 1? Alignment?
NVRAM
simple is good so if three work then stick to it. Using two means you can have the drive wheels more in the middle of the robot so you can get it to have a tighter turning circle. Depending on the surface you are driving on you can try using a nylon skid or ball bearing in a cup arrangement which means you can really spin perfectly on the spot, castors can kick you out a little as they have to pivot themselves. hope that helps
Pete Duncanson
+1  A: 

Previous comments about using a photo sensor are good suggestions, although they might be harder to find/make something that will plug into a USB port.

If you do go the camera route, I'd suggest you emulate a simple sensor; perhaps take an average of the left and right halves of the input as an indication to drive straight/left/right.

But, if you want to spend less time building the custom pieces, you might check out the LEGO NXT kit. They come with an optical sensor and a graphical programming environment. Even if you don't buy one, you might learn from the community discussions surrounding it.

NVRAM
A: 

If you go with camera you may have to do some simple image processing. Easiest way would probably be adaptive thresholding - take all pixels from camera frame, convert to grayscale (if it's in color), calculate average and use it as threshold - you will have white line on black background. If you still getting small white spots (due to uneven lighting) you can filter them out by separating picture into connected components (with floodfill) and removing small blobs. After that you hopefully would get single white stripe on the black background.

mirror2image