Question

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?

Was it helpful?

Solution

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).

OTHER TIPS

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 :)

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.

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.

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 :)

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.

I did something similar and wrote it into a module. http://letsmakerobots.com/node/38883#comments

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top