Interfacing the LEGO MINDSTORMS NXT and Android Phone: Camera Line Follower

Now that we're on break, I had some time to do another demo in the series; this video shows a robot using the Android phone's camera to locate the line and follow it. The connection is based on Bluetooth, and all that is sent is the line's distance from "the center" of the received image. Around near 0:57, you can see the yellow dash that marks the position of the line. This is subtracted from the center of the screen (width/2) and sent to the NXT, which adjusts the motor speeds proportionally using the steering function. The bright light that creates a glare in the screen is actually the flash on the camera, which I turned on in order to eliminate outside lighting conditions. The phone is almost as good, if not better, as a light sensor!

Enjoy, and happy building!


Xander Soldaat said…
Hey there, nice work! Do you have plans to release the source code so others can learn from it?

Laurens Valk said…
Hey Richard,

Looks good! I'm also interested to hear how you did it :)

Robolab 2.9 said…
Hi Xander and Laurens, yes! You can find code here:
The rest of the site is still kind of rough, but you can at least see the code. Enjoy!

sakhan said…
This comment has been removed by the author.
Very Interesting!
malu said…
i just tried the code with samsung galaxy note. but it didnt the code complete. if note plz send me the code
Unknown said…
i have some run time error
but,your code seems enough to run
i miss something?

Popular Posts