- Scratch Based Default Extensions
- Artificial Intelligence
- Innovative Extensions
- Machine Learning Environment
- Quarky
- Quarky Intellio I2C Communication
- Quarky Advance Sensors Extension
- Quarky Connect
- Display (Quarky)
- Quarky (Main)
- Robot (Quarky)
- Sensors (Quarky)
- Speaker (Quarky)
- Quarky Ultimate Robots
- Quarky Expansion Board
- Mars Rover
- Humanoid (Quarky)
- Quadruped (Quarky)
- IoT House (Quarky)
- Quarky Mecanum
- Quarky Robotic Arm
- Dabble
- Quarky Advance Line Following
5-CH IR Line Sensor Array
-
Available in: Block Coding, Python Coding
-
Mode: Stage Mode, Upload Mode
-
WiFi Required: Yes
-
Compatible Hardware in Block Coding: Quarky, Quarky Intellio
-
Compatible Hardware in Python: Quarky, Quarky Intellio
-
Object Declaration in Python: intellio = QuarkyIntellio(), quarky = Quarky()
Introduction
The 5-CH IR Line Sensor Array Extension helps Quarky and Quarky Intellio robots follow predefined paths using five infrared sensors positioned across the front of the robot.
Each sensor detects whether a line is present beneath it. By analysing these readings, the robot can determine whether it is moving straight, drifting towards one side, approaching a junction, or losing the line.
The extension provides functions for:
- Reading individual and combined IR sensor values.
- Following lines automatically using predefined motor speeds.
- Adjusting forward and turning speeds.
- Detecting checkpoints along a track.
- Turning left or right at junctions.
- Performing PID-based line following for continuous steering corrections.
The same extension supports Quarky and Quarky Intellio, with the initialisation and hardware connection process adapted to the selected board.
Understanding the 5CH IR Sensor Array
A 5-channel IR sensor array consists of five infrared sensors arranged horizontally to detect the position of a line.
The sensors are named according to their physical positions, from left to right.
| Sensor | Position | Function |
| IR-L | Leftmost | Detects a line towards the far left |
| IR-SL | Slightly Left | Detects a line slightly left of centre |
| IR-C | Centre | Detects a line directly beneath the centre |
| IR-SR | Slightly Right | Detects a line slightly right of centre |
| IR-R | Rightmost | Detects a line towards the far right |
How Does the Sensor Array Work with Quarky Intellio?
When connected to Quarky Intellio, the sensor array communicates through a compatible Mini Expansion Board or Expansion Board.
The selected expansion board provides the I2C interface used to read sensor data and the motor-control interface used to move the robot.
The line-following program reuses the expansion board’s existing I2C object rather than creating a separate I2C bus.
This allows the sensor and motor-control functions to operate through the selected expansion board.
Connecting the 5CH IR Sensor Array with Quarky and Quarky Intellio
The connection process varies depending on whether you are using Quarky or Quarky Intellio.
Step 1: Connect the 5CH IR Sensor Array
For Quarky
Connect the sensor array directly to the Quarky board using the I2C connections.
| 5CH IR Sensor Array | Quarky |
| D1 | D1 (SDA) |
| D2 | D2 (SCL) |
The sensor communicates through Quarky’s configured I2C pins.
For Quarky Intellio
Connect the sensor array to the selected Mini Expansion Board or Expansion Board.
| 5CH IR Sensor Array | Mini Expansion / Expansion Board |
| D1 | SCL |
| D2 | SDA |
Next, connect the Intellio main board to the expansion board.
| Quarky Intellio Pin | Expansion Board Pin |
| A1 / D1 | D1 |
| A2 / D2 | D2 |
This creates a communication path between Intellio, the expansion board, and the sensor array.
Important: The supplied wiring references use different D1/D2 signal-label conventions for Quarky and the expansion-board arrangement. Verify the SDA/SCL labels on the actual hardware before making connections. The tables above preserve the board-specific mappings supplied for this extension.
Step 2: Connect the Motors and Power Supply
For Quarky
- Connect the left and right drive motors to Quarky’s built-in motor outputs.
- Use the supported Quarky power configuration for the robot.
For Quarky Intellio
- Connect the left and right motors to their corresponding motor outputs on the selected Mini Expansion Board or Expansion Board.
- Connect the required external motor power supply directly to the expansion board, following its supported voltage and power specifications.
- Do not connect motor power to the Intellio main board as a substitute for the expansion board’s required supply.
Step 3: Verify the Connections
Before switching on the robot:
- Ensure all signal connections are secure and correctly labelled.
- Confirm that the sensor array and control board have compatible logic levels.
- Ensure all connected devices share the required common ground.
- Check that the motors are connected to the correct outputs.
- Confirm the power supply meets the board’s requirements.
- For Intellio, make sure the selected expansion board matches the program configuration.
Important: Disconnect the power supply before modifying the wiring.
Accessing the 5CH IR Line Sensor Array Extension in PictoBlox
Step 1: Open PictoBlox and select the Block Coding environment.

Step 2: Open the Board menu and select either Quarky or Quarky Intellio, depending on your hardware.


Step 3: Click the Add Extension button at the bottom-left corner of the Blocks Palette.
Step 4: Search for and select 5-CH IR Line Sensor Array.

Step 5: Open the 5-CH IR Line Sensor Array category from the Blocks Palette.

The extension provides blocks for sensor readings, motor speed configuration, junction navigation, standard line following, and PID-based line following.
Note: The extension uses board-specific initialisation blocks. The remaining line-following blocks provide common functionality for Quarky and Quarky Intellio.
Python Function Reference – Quarky and Quarky Intellio
The following table summarises the Python functions associated with the extension blocks.
| Block | Quarky Python | Quarky Intellio Python |
| Initialise Line Follower | LineFollower5IR(scl_pin=19, sda_pin=18) | LineFollower5IR(i2c=mini.i2c, motor_driver=mini) or Expansion equivalent |
| Get Sensor Readings | getirstate() | getirstate() |
| Read All Sensor Readings | getallsensorreadings() | getallsensorreadings() |
| Turn Robot | turnrobot5ir() | turnrobotusingir() |
| Set Turning Speed | setturningspeed() | setturningspeed() |
| Set Forward Coast Delay | setturningforwarddelay() | setturningforwarddelay() |
| Set Line Following Parameters | setlinefollowerparameter5ir() | setlinefollowerparameter5ir() |
| Set Sharp Turn Speed | setSharpTurnParameter5IR() | setSharpTurnParameter5IR() |
| Standard Line Following | followlineuntilcheckpoint() | followlineuntilcheckpoint() |
| Set PID Constants | setpidconstants() | setpidconstants() |
| Set PID Speed Parameters | setpidspeedparameter5ir() | setpidspeedparameter5ir() |
| PID Line Following | followlinepiduntilcheckpoint() | followlinepiduntilcheckpoint() |