Table of Contents

Calibrate IR

Description

Using this block, the robot will move forward and reverse for a specific duration while collecting sample data from the IR sensor on both white and black lines.

Note:

  • During calibration, ensure that the robot’s IR sensor passes over both the white and black surfaces to gather accurate reference data.
  • Calibrate the IR sensor block to ensure accurate line following. This process will automatically set the threshold value based on the readings from the black and white surfaces.
  • If the automatic calibration does not yield the desired results, you can manually adjust the threshold value yourself for optimal performance.

Calibration Process

  • Calibrating Quarky’s Internal (in-built) IR Sensors
      1. Prerequisite: Ensure the “initialize block” has been used before starting.
      2. Procedure: Position the Quarky Robot a few steps before the checkpoint. Begin the calibration. The robot must traverse the checkpoint and the adjacent white space (covering both black and white areas) a total of three times.
      3. Optimal Setup: It is recommended to perform this on a straight line in the arena that includes a single checkpoint.
      4. The threshold values for the left and right IR sensors will be shown on the Pictoblox screen immediately following calibration.

  • Calibrating Quarky’s External IR Sensors (Pins A1, A2, or A3)
    • This procedure details the steps for calibrating external IR sensors connected to Quarky’s pins A1, A2, or A3.
  • Prerequisites (Block Setup Order):
    • Start with the “initialize block.”
    • Designate the pins for the external sensors using the “change left IR to A1 pin” and “change right IR to A2 pin” blocks (use A3 if needed).
    • Only after the initial and pin-assignment blocks are set, trigger the “Calibrate IR” block.

Note: Failure to follow this exact sequence will result in the system displaying calibration values for the internal sensors instead of the connected external ones.

  • Calibration Procedure:
    1. Placement: Position the Quarky Robot a short distance before the designated checkpoint on the line-following arena.
    2. Movement: Start the calibration. The robot must move back and forth, successfully traversing the checkpoint and the adjacent white area (covering both black and white surfaces) a total of three times.
  • Optimal Physical Setup:
  1. Ensure both external sensors are mounted at a consistent, low height.
  2. The calibration should be performed on a straight section of the arena that includes one distinct, clear checkpoint to ensure accurate data sampling.

Result:

The resulting threshold values for the selected external pins (e.g., A1 and A2) will be displayed on the Pictoblox screen immediately after the calibration is complete.

 

Example

Learn how to program the Wizbot Neo robot to autonomously follow a black line on the floor using IR sensors and perform a special forward movement at checkpoints using PictoBlox Blocks.

 Introduction

In this project, you will program a robot to autonomously follow a line on the floor using its IR (infrared) sensors. The robot continuously tracks the line and, upon reaching a checkpoint, performs a special forward movement before resuming line-following. This project introduces key robotics concepts such as sensor calibration, conditional logic, and the use of custom robot blocks in PictoBlox.

Prerequisites

  • Wizbot Neo robot (fully charged).
  • A computer with PictoBlox installed and Bluetooth enabled.
  • Track Arena (line following).

Connecting your Wizzbot to Pictoblox Blocks

  1. Wizbot needs to be turned on; slide the 3-way power switch towards Picto coding. When you slide to PictoBlox Coding, a blue light will glow on the back side with a ‘troo-tooi’ sound.
  2. Click on the Board tab on the top navigation bar and select Wizbot Neo.
  3. Now, click on connect and choose Bluetooth.
  4. Your Wizbot has a unique code mentioned on it. Select your Wizbot from the list and click on Connect.
  5. Wizbot plays a confirmation sound on connecting.
  6. Voila! Your wizbot is now connected to PictoBlox!
  7. Remove the Tobi sprite.

Block-by-Block Explanation

These blocks run once when the green flag is clicked to configure the robot before any movement begins.

  1. Go to the Events palette and drag the “when green flag clicked” block into the scripting area.
  2. Add set parameters F (30), T1 (25), and T2 (20) block from Wizbot . Configures three internal parameters used by the line-following algorithm. F (30) sets the base forward speed, and T1 (25) and T2 (20) set the left/right correction thresholds that determine how aggressively the robot steers to stay on the line.
  3. Add ‘do line following’ block from Wizbot. It activates the built-in line-following behaviour immediately after parameters are set, so the Wizbot starts tracking before entering the main loop.

Forever Loop — Checkpoint Detection

After initialisation, the script enters a ‘forever’ loop that runs continuously for the duration of the program.

  1. Add the ‘forever’ block from the Wizbot block; it creates an infinite loop. All blocks placed inside will repeat indefinitely until the stop button is clicked from the stage.

Inside forever block,

  1. Add if <> then from the Controls palette, add ‘has reached checkpoint?’ Block Wizbot’s palette inside the if block. Checks the wizbot’s checkpoint sensor (typically an additional IR sensor or a specific line pattern detector) on every loop iteration. If a checkpoint is detected, the indented blocks below execute.

  1. From Wizbot palette, go forward at (50)% speed for (1000) ms Inside the if-block, it drives the Wizbot straight forward at 50% of its maximum speed for 1000 milliseconds (1 second). This is the checkpoint response action, e.g., crossing an intersection or pausing at a station.
  2. Add the ‘do line following block from the Wizbot palette.  After the forward movement, re-engage the line-following algorithm so the robot picks the line back up and continues tracking.
  3. Add wait (1) seconds  block from the control palette; it pauses for 1 second after resuming the following line. This gives the Wizbot time to stabilise the line before the loop checks for another checkpoint.

Calibration Block (Separate Script)

This block appears below the main script and is run independently before starting the main programme.

  1. Add calibrate IR threshold block from the Wizbot palette. It triggers an automatic calibration routine that scans the IR sensor readings over the current surface. The Wizbot typically needs to be moved back and forth over the line during calibration so it can determine the correct black/white threshold values. Always run this routine before the main script if the surface or lighting conditions have changed.

Output

 

Conclusion 

In this project, we learned how to program the Wizbot Neo to autonomously follow a line using IR sensors in PictoBlox Blocks. We required a Wizbot Neo robot, a Bluetooth-enabled computer, and a black line track. We used the set parameter block to configure speed and steering thresholds, the do line following block to activate autonomous tracking, and a forever loop with checkpoint detection to handle intersections. We also ran the IR calibration script before the main programme to ensure accurate sensor readings. With this project, kids and learners will have a better understanding of sensor-driven robotics, conditional logic, and how real-world autonomous robots navigate their environment.

Read More
All articles loaded
No more articles to load