Sensors (Arduino Alvik)

Sensors (Arduino Alvik)
Extension Description
Read Arduino Alvik’s onboard touch buttons, infrared line sensors, RGB colour sensor, Time-of-Flight distance sensor, and motion sensors using PictoBlox blocks and Python functions.

Introduction

The Sensors (Arduino Alvik) blocks allow users to interact with the robot’s built-in sensors and respond to changes in its surroundings. Arduino Alvik includes touch buttons, an infrared line-sensor array, an RGB colour sensor, a Time-of-Flight distance sensor, and a six-axis inertial measurement unit (IMU).

Using these blocks, you can:

  • Detect button presses and count user interactions.
  • Read infrared sensor values to identify contrasting surfaces.
  • Detect colours and retrieve colour-related measurements.
  • Measure distances and detect nearby objects.
  • Identify selected robot orientations and physical states.
  • Read motion-sensor measurements along different axes.
  • Reset tracked rotation angles.

These blocks are useful for developing sensor-based automation, obstacle detection, interactive robots, colour recognition, and motion-aware robotics projects.

Alvik Internal Components

Connecting Arduino Alvik with PictoBlox

Before reading sensor data, connect Arduino Alvik to PictoBlox.

Follow the step-by-step instructions in the Arduino Alvik Connection Guide.

CTR of Arduino Alvik Connection Guide

Read More

PictoBlox Blocks

This Boolean block checks whether the selected onboard touch button is currently pressed. It returns True when the specified button is pressed and False otherwise.
This reporter block returns the number of times the selected touch button has been pressed since its counter was last reset. It is useful for creating button-controlled counters and interactive programs.
This block resets the press counter for the selected onboard button to zero. It allows a new sequence of button presses to be counted.
This reporter block reads the reflectivity value from the selected infrared line sensor: left, centre, or right. It can be used to detect differences between light and dark surfaces during line-following activities.
This Boolean block checks whether the onboard colour sensor detects the selected colour, such as red, green, blue, black, white, or yellow. It returns True when the detected colour matches the selected option.
This reporter block returns the selected component of the colour-sensor reading, such as a red, green, or blue channel, or a supported HSV component. It is useful for analysing colour-related measurements and light intensity.
This reporter block returns the detected colour label identified by Arduino Alvik’s onboard colour sensor. It is useful for creating robots that respond differently to coloured surfaces or objects.
This Boolean block checks whether the Time-of-Flight distance sensor detects an object within the specified distance threshold. It returns True when a valid measured distance satisfies the condition and False otherwise.
This reporter block returns the nearest detected object distance from the Time-of-Flight sensor’s supported distance readings. It helps Arduino Alvik identify nearby obstacles and respond to changes in its surroundings.
This Boolean block checks whether Arduino Alvik is in the selected physical state, such as being tilted, lifted, or upside down. It uses onboard motion-sensor information to evaluate the selected condition.
This reporter block returns the selected orientation angle, such as roll, pitch, or yaw, in degrees. It is useful for monitoring the robot’s orientation and detecting changes in tilt.
This reporter block returns the selected motion-sensor measurement along the X, Y, or Z axis. Depending on the chosen option, it can provide supported accelerometer, gyroscope, or rotation-related measurements.
This block resets the tracked rotation angle for the selected axis, allowing a new angular measurement to begin from the current reference.
This reporter block returns the distance measured by the selected Time-of-Flight sensing region or direction in centimetres. It is useful for detecting objects and measuring distances during robot navigation.
All articles loaded
No more articles to load

Python Functions

This function checks whether the colour detected by Arduino Alvik matches the selected predefined colour code. It returns True when the detected colour matches and False otherwise
Syntax: is_color( )
This function checks whether Arduino Alvik detects an upside-down orientation. It returns True when the robot is upside down and False otherwise.
Syntax: is_robot_upside_down( )
This function checks whether Arduino Alvik detects a tilted orientation. It returns True when the tilt condition is detected and False otherwise.
Syntax: is_robot_tilted( )
This function checks whether Arduino Alvik detects that it has been lifted. It returns True when the lifted condition is detected and False otherwise.
Syntax: is_robot_lifted( )
This function resets the accumulated rotation reference for the selected axis. It allows the robot to begin tracking a new rotation measurement.
Syntax: reset_rotated_angle( )
This function returns the accumulated rotation angle around the selected axis. It is useful for monitoring how much Arduino Alvik has rotated relative to its tracked reference.
Syntax: get_rotated_angle( )
This function returns a selected motion or orientation measurement from Arduino Alvik’s inertial measurement unit (IMU). Depending on the sensor type, it can provide acceleration, gyroscope, or orientation-related values along the selected axis.
Syntax: get_imu_value( )
This function checks whether an object is detected within the specified distance threshold. It returns a Boolean value indicating whether the distance condition is satisfied.
Syntax: is_object_in_range( )
This function returns the distance measured by the selected Time-of-Flight sensor region. It is useful for obstacle detection and distance-based navigation.
Syntax: get_distance_value( )
This function checks whether the selected onboard touch button is currently pressed. It returns True when the button is pressed and False otherwise.
Syntax: get_touch_press( )
This function returns the numeric grayscale reading from Arduino Alvik’s colour sensor. It can be used to analyse differences in surface brightness.
Syntax: get_color_grayscale( )
This function returns the colour name detected by Arduino Alvik’s onboard colour sensor as a string. It is useful for developing colour recognition and colour-based sorting projects.
Syntax: get_color_label( )
This function returns the selected RGB or HSV colour-sensor component. It is useful for analysing colour intensity, hue, saturation, and brightness-related measurements.
Syntax: get_color_value( )
This function returns the numeric reading from the selected infrared line sensor. It is useful for detecting contrasting surfaces and developing line-following robots.
Syntax: get_line_sensor( )
This function resets the recorded press count for the selected button to zero.
Syntax: reset_button_press_count( )
This function returns the number of button presses recorded for the selected onboard touch button.
Syntax: get_button_press_count( )
This function checks whether any onboard touch button is currently pressed. It returns True if at least one button is pressed and False otherwise.
Syntax: get_any_button_pressed( )
All articles loaded
No more articles to load
Table of Contents