Skip to content

Getting started with the Line Follower

Set up the PASCObot to follow a black or white line using a program provided in the PASCO Code Library. Use the code as-is or as a starting point for coding a more complex program.

What you need

Install the Line Follower

  1. Remove the thumbscrew on the top of the bot and remove the top frame of the PASCObot.
  2. Place the Line Follower module in the front compartment of the PASCObot's bottom frame.
  3. Install two screws to secure the Line Follower module to the frame. Don't over-tighten them!
  4. Connect the Line Follower to the //control.Node's Sensor port using the cable included with the Line Follower. Push the cable plugs into each port until you hear a click.
  5. Insert two nuts (included with the PASCObot) in each of the bot's front compartments. This makes the bot front-heavy to help keep the Line Follower sensors close to the surface.
  6. Replace the top frame on the PASCObot and secure it with the thumbscrew.

Set up the software

  1. Turn on the //control.Node and connect it to SPARKvue.
  2. Select Code, then click the PASCO Code Library .
  3. Select PASCObot in the menu, select Follow Line, and click OK.

You will now see the Follow Line code in the Code tool workspace. The code includes a function called followLine with two parameters:

  • Line intensity (%)

    This parameter indicates the approximate intensity measured by a Line Follower sensor when placed over the line.

  • Surface intensity (%)

    This parameter indicates the approximate intensity measured by a Line Follower sensor when placed over the surface it's moving on (such as a floor or table).

Calibrate the Line Follower program

  1. Choose a hard, flat surface to run the bot on.
  2. Place a short strip of tape on the surface for testing.
  3. In the Code tool, toggle the Code execution switch to the disabled position.

  4. Add four digits displays to the workspace (one for each Line Intensity sensor).

  5. In one of the displays, click Select Measurement, then select Line Intensity 1. Repeat this step for the other three Line Intensity sensors, adding each one to its own digits display as shown in the above image.
  6. Click Start . Place all four sensors on the surface and observe the intensity. Enter the average of the four values in the Surface intensity (%) parameter in the followLine function. (It's fine to enter an approximation.)
  7. Slowly move each sensor over the tape strip. If using black tape, observe the minimum value read by each sensor. If using white tape, observe the maximum value read by each sensor. Enter the approximate average value observed in the Line intensity (%) parameter in the followLine function.
  8. Click Stop when finished.

Run the program

  1. Create a line path on your surface using the black or white tape.
  2. Place the bot on the line path.
  3. Click Upload code to upload the code to the //control.Node.
  4. Click Run code to start the program.

Go further

The code provided in the followLine function works well for most applications. However, you may find some cases where it doesn't work well. Find flaws in the program and modify the code to improve it! Can you create a program that uses both the black and white tape on the same track?