STEAM Documentation of Lego Robot

In my last post, I talked about using the ultrasonic sensor to sense an object in its way, in which it would stop.  However, my team and I were given the challenge that all robots would be in a single track, sort of a race.  Our goal was to make our robot follow the black line of the track and stop when it was out of the line.  Our robot should avoid structures, follow a set path, and turn in the right direction.We tweaked our color sensor, later the robot showed it could follow the black line and needed no further tweaking.   

Later in our next class we needed to know the limits of our robot.  We tested how small of an object it can sense, we also tested all our sensors including the ultrasonic sensor.  This is what we found out: 

  • It can detect a distance of 255cm  
  • Th closet it can detect an object is 3.1cm 
  • It can detect an object between 60 to 110 degrees 
  • It can detect an object with a width of 1cm 
  • It can detect an object with a height of 3.4cm 

And for the color sensor 

  • Can detect black at 1 and color at 6 
  • Reflected light intensity: detects black at 4 and table color at 12-15 
  • Ambient light intensity: detects black at 4.5 and table color 9.5 

On our next class, we noticed that that the line following code had worked perfectly.  However, the motion was very jagged and too slow in a realistic situation.  The first code that we tried with the red color sensor had an issue as it did not properly detect the light.  We then decided to switch the reflexive light intensity because that was the most viable option that could ensure stability.  We changed the code according to our limitations (see above) which showed that the color sensor detects black at 4, and other non-black colors at 12-15.  We used those numbers and implemented it in our code which proved to be a success.  The code we used was based off an online tutorial on YouTube.   

We focused our attention to the motors.  We increased the motor speed to 35 instead of 20 and the travel speed became faster.  The jaggedness can be explained by the fact that the color sensor is trying to detect the black line, therefore, it was continuedly moving left and right.  To make sure the robot is following the right path, we found out that the jaggedness wasn’t a serious issue, as it does not affect the accuracy of the sensors and does not throw itself off the track by more 1-2 cm. 

Going back to the challenge, 

  1. The robot should safely navigate on the roads 
  1. The wheels can’t touch the black lines 
  1. The robot should stay inside the line 


On our next class, we tried to use two color sensors to see if it hit the line it should’ve moved on the opposite side to get back in the line.  We also used the color sensor to improve the jagged movement.  Our problem was that the angle of the two-color sensors was different, so to make the robot move consistently we made the sensor stabilized to the robot.

Leave a Reply

Your email address will not be published. Required fields are marked *