Week 6 – 2019 – Sara

Hello…

This time at robotics me and Tamsin got challenged to make a 2 Sensor Line Follower. First we watched a YouTube video, which took quite awhile to find, but when we finally did find it we watched it. It explained a lot about 2 Sensor Line-Followers and truth tables. A truth table is basically writing that tells you what will happen when the robot does or detects something.

Here’s an example…

If right sensor and left sensor are on white then move forward. If right sensor is on black then turn right,if left sensor is on black then turn left. When both sensors are on white again move forward.

Tamsin and I wrote different codes but with the same goal (to make a 2 Sensor Line-Follower). On my first try the code actually worked, it followed straight lines the curves and the sharp curves. The only problem was that it was wiggling a lot. When I tried to fix that problem I just made it worse, after that the robot wouldn’t even follow straight lines (there were times when it would just go round round in circles). Near the end of the session I finally got the robot to follow straight lines again (the main problem was that I was only using the right sensor and I completely forgot to use the left one). The robot actually worked pretty well after that, it followed straight lines and even some curves not the sharp ones though.

This was the code I ended with…

Two sensor line follower

Here’s some explanation for the code. Using the right sensor the robot will look for reflected light (that is how much light reflects back, self explanatory right.) If the amount is greater than fifty, suggesting it’s white, it will move forward with a speed of 45. The next block tells the robot that is it’s less than 40, suggesting its black (but it could be any dark colour really), then it should turn right 75 degrees. Then the next to blocks are pretty much the same thing but for the left sensor, the only thing that changes is than if the left sensor sees black then it should turn left not right.

Usually a 2 Sensor Line-Following code works better and smother than 1 Sensor, but last week Rich showed us a 1 Sensor code that worked well and smoothly. We even thought it was using 2 Sensors.

Here’s my one Sensor code compared to my 2sensor unfinished code which is up there… ( just a few scrolls up actually)

1 Sensor Line-Follower

I think next time I will have to change the aggressiveness of the turn to make the other code work. But for now this is ok.

Bye…