From the investigation of light sensor, I did project called "Line Tracking".
This project is to make the robot to trace the line automatically by using light sensor.
In this project, I made the robot to trace black tape, which is pasted on the white floor.
First, I attached light sensor in front of the my robot.
Second, I made the program for my robot to be able to trace the black line.
Actually, there are no forward motor actions included in the program.
This program is just with 'wait for light', 'turn right', 'turn left', and 'repeat infinitely'.
About light sensor, I first set up the threshold for the sensor. Threshold is for to separate two lights, light and dark, and able for my robot to be able to sense two different lights. I took the average of measurement of black line and white floor. And let's say threshold is 50.
When the threshold is set, I made the robot to do specific action depend on what sensor senses. I made my robot to turn left when the light sensor senses dark light (black tape). Then, I made my robot to turn right when the light sensor senses bright light (white floor). This makes the robot to be able to trace the line. When the light sensor senses dark light, then the robot will turn left, which means that the light sensor will be out of black line, and now sense white floor. Then the robot will turn right, as the sensor senses bright color. Then, then sensor will be back on the black tape, and turn left again.
I made this turning right and left, to repeat infinitely, so that the robot can trace the line. When the robot is turning right and left, the robot is actually going forward bit by bit. Therefore, when the robot's action is repeated, the robot is tracing the line, and actually going forward.
Moreover, I am able to change the rate (speed) of robot of tracking the line. When I do the default (first) one in very fast mode (100%), then the robot will totally go wrong direction and not able to track the line properly. (maximum speed for default setting of robot is about 30... very slow) When the robot is tracking a line in fast mode, the swing of the sensor gets wider, and the robot is actually going over the black line without sensing the dark color. In order to make the robot to track the line in fast rate, I most shrink the swing, so that the light sensor will not go over black line and not sense it.
In order to solve this problem, I changed the location of the sensor. I attached the light sensor behind the robot. When the light sensor is attached near wheels, the swing of the light sensor will decrease. So, now I can make the robot to track the line in full 100% speed. In addition, I made the whole program to go backward (just change the motor's direction), so the light sensor will be the front of the robot, when tracking the line (going forward).
PS:
First picture shows my robot with light sensor attached on back side.
Second picture show the program for my final robot, which robot is going backward (in a way forward).
Final Class Blog
-
Robotics has come to an end after a semester of hard work and programming.
I have learned many new things such as robot construction, programming the
NXT, ...
15 years ago
Nice Post.
ReplyDeleteA lot of information which is good as people can reenact the experiment with great ease.
Even though I've done the experiment myself, I believe I have learned even more from reading your post.
Excellent, No mistakes (i think so)
Nash.