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
- PASCObot (PS-2995) with a //control.Node (PS-3232)
- PASCObot Line Follower Module (PS-3320)
- PASCObot Line Follower Tape (SE-2953)
Install the Line Follower
- Remove the thumbscrew on the top of the bot and remove the top frame of the PASCObot.
- Place the Line Follower module in the front compartment of the PASCObot's bottom frame.
- Install two screws to secure the Line Follower module to the frame. Don't over-tighten them!
- 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.
- 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.
- Replace the top frame on the PASCObot and secure it with the thumbscrew.
Set up the software
- Turn on the //control.Node and connect it to SPARKvue.
- Select Code , then select the PASCO Code Library .
- 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
- Choose a hard, flat surface to run the bot on.
- Place a short strip of tape on the surface for testing.
-
In the Code tool, toggle the Code execution switch to the disabled position.
-
Add four digits displays to the workspace (one for each Line Intensity sensor).
- 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.
- 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 thefollowLine
function. (It's fine to enter an approximation.) - 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 thefollowLine
function. - Click Stop when finished.
Run the program
- Create a line path on your surface using the black or white tape.
- Place the bot on the line path.
- Select Upload Code to upload the code to the //control.Node.
- Select 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?