Main Content

Pixy2 Vision Sensor

Represent connected CMUcam5 Pixy2 vision sensor and tracks object (color blob)

Since R2023a

Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.

  • Pixy2 Vision Sensor Block Icon

Libraries:
Simulink Support Package for Arduino Hardware / Sensors

Description

Use the Pixy2 Vision Sensor block to read the coordinates of object (color blobs) detected by the Pixy2 vision sensor interfaced with an Arduino® board. You can use either SPI, I2C, or serial communication protocol to connect the Pixy2 vision sensor to an Arduino board.

Functional Modes

Pixy2 Vision Sensor block has four functional modes:

  • Color Signature: Detects object that matches the configured color signature in the PixyMon utility.

  • Color Code Signature: Detects object that matches the configured color-coded signature in the PixyMon utility.

  • Color and Color Code Signature (Mixed): Detects object that matches the configured color and color-coded signature in the PixyMon utility.

  • Line: Detects and tracks the line.

Launch PixyMon

If you have already installed the support package for Arduino hardware and followed the additional hardware setup as mentioned in Install Support for Arduino Hardware, the PixyMon utility will launch automatically.

Ports

Output

expand all

The x-location of the center of the most significant object (color blob) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Signature, Color Code Signature, or Color and Color Code Signature (Mixed).

Data Types: uint16

The y-location of the center of the most significant object (color blob) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Signature, Color Code Signature, or Color and Color Code Signature (Mixed).

Data Types: uint16

The width of the most significant object (color blob) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Signature, Color Code Signature, or Color and Color Code Signature (Mixed).

Data Types: uint16

The height of the most significant object (color blob) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Signature, Color Code Signature, or Color and Color Code Signature (Mixed).

Data Types: uint16

The number of objects (color blobs) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Signature, Color Code Signature, or Color and Color Code Signature (Mixed).

Data Types: uint8

The signature of the color or color-coded objects (color blobs) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to either Color Code Signature or Color and Color Code Signature (Mixed).

Data Types: uint16

The angle of the color or color-coded signature of objects (color blobs) based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to Color and Color Code Signature (Mixed).

Data Types: int16

The starting point of the x-coordinate of the most significant line based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to Line.

Data Types: uint16

The starting point of the y-coordinate of the most significant line based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to Line.

Data Types: uint16

The ending point of the x-coordinate of the most significant line based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to Line.

Data Types: uint16

The ending point of the y-coordinate of the most significant line based on the field of view, as detected by the Pixy2 vision sensor.

Dependencies

  • To enable this port , set the Tracking mode parameter to Line.

Data Types: uint16

The presence of intersecting lines in the field of view of the Pixy2 vision sensor. 1 indicates the presence of intersecting lines.

Dependencies

  • To enable this port , set the Tracking mode parameter to Line.

Data Types: uint8

Parameters

expand all

Select the type of interface on the Arduino board to establish a connection with the Pixy2 vision sensor.

Specify the I2C module on the Arduino hardware to communicate with sensor peripherals. For more information on the Arduino pin mapping and modules that hardware boards support, see Pin Mapping for Arduino Timer Independent Blocks.

Dependencies

To enable this parameter, set Interface to I2C.

To connect a Pixy2 vision sensor to an Arduino board using I2C communication protocol, enter the I2C address of the Arduino board.

Dependencies

To enable this parameter, set Interface to I2C.

Specify the SPI module on the Arduino hardware to communicate with SPI peripherals. For more information on Arduino pin mapping and modules that hardware boards support, see Pin Mapping for Arduino Timer Independent Blocks.

Dependencies

To enable this parameter, set Interface to SPI with CS.

To connect a Pixy2 vision sensor to an Arduino board using SPI communication protocol, enter the chip select pin of the Arduino board. For more information on chip select pins for Arduino boards, see Pin Mapping for Arduino Timer Independent Blocks.

Dependencies

  • To enable this parameter, set Interface to SPI with CS.

To connect a Pixy2 vision sensor to an Arduino board using serial communication, enter the serial port number of the Arduino board. For more information on serial port numbers for Arduino boards, see Pin Mapping for Arduino Timer Independent Blocks.

Dependencies

  • To enable this parameter, set Interface to Serial.

Select the tracking mode to detect the object that matches the configured color or color-coded signature in the PixyMon utility. The xy-coordinates, width, and height of the detected object remain the same for the Color Signature, Color Code Signature, and Color and Color Code Signature (Mixed) tracking modes.

Select the color signature of the object to be tracked as configured in the PixyMon utility. Select ALL to track all the configured color signatures.

Enter the time interval at which the block reads values from the Pixy2 vision sensor.

Version History

Introduced in R2023a