4.6Exp6: Following Lines

Share for us

Game instruction 

The game is to make Rollman follow the line through reading the voltage converted by 6 infrared sensors’ reflection towards the white line and black line with the IIC communication protocol. It can be achieved through the automatic adjustment of the motor’s rotating speed based on the PID algorithm. Now let’s get started!

Experimental steps

  1. Connect the two motors to port M1 and M2 of the mainboard respectively with the connecting lines. Similar to the previous games, M1 is connected to the left motor and M2 to the right one. Plug the power source into P1. Mount the infrared sensor and connect it to port S3 of the main board.
  • Upload Exp6_Rollman_LineFollowing.ino under Rollman\Arduino Code\Exp6_Rollman_LineFollowing to the Rollman.
  • Before removing the USB cable, it’s necessary to adjust the line follower module’s sensitivity, or the Rollman may fail to follow the line.

Open the file LineFollowing.ino, click Serial Monitor on the upper right, and then you can see the real-time data of all the IR sensors on the window. Calibrate the module indoor (where natural light evenly spreads). Place the car on the map, ensure the detector 3 and 4 are on the black line, while others on the white area. Then adjust the potentiometer and check data in the window until detector 3 and 4 output 1 (Flag[3]:1;Flag[4]:1) while others output 0. Then the module calibration is done.

Note: Detector 0 and 7 are not used in this program, so just ignore their output values.

  • Remove the USB cable, switch on the power. Place the map (included in the kit) on the flat floor. You can also use the black tape to paste a curved path on a white paper or board or other surfaces (refer to the guide card included in the kit).

Extension

Set an obstacle on the path. When Rollman detects the obstacle, it will bypass it automatically. Try it yourself!