5.0 Pixy2 Camera - SwollEngineAF/lipan GitHub Wiki
Welcome to the official wiki for Pixy2-based Object Detection & Robotic Control. This project integrates the Pixy2 CMUcam5 with a Raspberry Pi + Arduino setup to track coloured objects, control a 4-DOF robot arm, and drive a mobile platform.
pixy2/
├── src/
│ └── host/
│ └── libpixyusb2_examples/
│ └── get_blocks_cpp_demo/ # Main vision logic + serial interface
├── arduino/
│ └── robot_arm.ino # Arduino sketch to control servos
│ └── robot_drive.ino # Arduino sketch for DC motor drive
└── README.md
-
Pixy2 tracks colour signatures (Signatures 1–5).
-
Raspberry Pi:
-
Receives object data (x, y, width, height).
-
Maps pixel coordinates to PWM values.
-
Sends serial commands to:
-
Arduino 1: Move servos for arm base, shoulder, elbow, and gripper.
-
Arduino 2: Control differential drive based on object distance.
-
-
-
Arduino:
-
Decodes commands like
B:300
,L:500
,F
,S
,B
for actuation.
-
-
Real-time colour object detection
-
Depth approximation using pixel area
-
Automatic arm control based on target position
-
Motion control: Slow approach, auto-stop, and reverse on proximity
-
Supports 4-DOF arm + DC drive platform
Signature | Object Type | Emoji |
---|---|---|
1 | Unripe Fruit (Red) | 🍅 |
2 | Loose Fruit | 🌰 |
3 | Green Ball | 🟢 |
4 | Ripe Fruit | 🍌 |
5 | Blue Ball | 🔵 |
On Raspberry Pi (Ubuntu 22.04):
cd ~/pixy2/src/host/libpixyusb2_examples/get_blocks_cpp_demo
make
./get_blocks_cpp_demo
Make sure Pixy2 is connected via USB and you've granted access:
sudo chmod 666 /dev/ttyUSB0
sudo chmod 666 /dev/ttyUSB1
[Pi → Arduino] B:340 # Base rotation
[Pi → Arduino] L:450 # Left shoulder
[Pi → Arduino] R:440 # Right shoulder
[Pi → Arduino] A:370 # Arm/gripper
[Pi → Arduino] G:450 # Grip close
[Pi → Arduino] F # Drive forward
-
robot_arm.ino
: Controls servo-based manipulator using mapped PWM -
robot_drive.ino
: Controls 4 DC motors usingAdafruit Motor Shield v1
with speed variation based on object distance
-
Forked from charmedlabs/pixy2
-
Modified and extended by Syahiid Rasidi for ROS-integrated semi-autonomous field robotics
Want me to generate it as a .md
file or add a ROS 2 integration section next?
Welcome to the official wiki for Pixy2-based Object Detection & Robotic Control. This project integrates the [Pixy2 CMUcam5](https://pixycam.com/pixy2/) with a Raspberry Pi + Arduino setup to track coloured objects, control a 4-DOF robot arm, and drive a mobile platform.
pixy2/
├── src/
│ └── host/
│ └── libpixyusb2_examples/
│ └── get_blocks_cpp_demo/ # Main vision logic + serial interface
├── arduino/
│ └── robot_arm.ino # Arduino sketch to control servos
│ └── robot_drive.ino # Arduino sketch for DC motor drive
└── README.md
-
Pixy2 tracks colour signatures (Signatures 1–5).
-
Raspberry Pi:
-
Receives object data (x, y, width, height).
-
Maps pixel coordinates to PWM values.
-
Sends serial commands to:
- Arduino 1: Move servos for arm base, shoulder, elbow, and gripper.
- Arduino 2: Control differential drive based on object distance.
-
-
Arduino:
- Decodes commands like
B:300
,L:500
,F
,S
,B
for actuation.
- Decodes commands like
- Real-time colour object detection
- Depth approximation using pixel area
- Automatic arm control based on target position
- Motion control: Slow approach, auto-stop, and reverse on proximity
- Supports 4-DOF arm + DC drive platform
Signature | Object Type | Emoji |
---|---|---|
1 | Unripe Fruit (Red) | 🍅 |
2 | Loose Fruit | 🌰 |
3 | Green Ball | 🟢 |
4 | Ripe Fruit | 🍌 |
5 | Blue Ball | 🔵 |
On Raspberry Pi (Ubuntu 22.04):
cd ~/pixy2/src/host/libpixyusb2_examples/get_blocks_cpp_demo
make
./get_blocks_cpp_demo
Make sure Pixy2 is connected via USB and you've granted access:
sudo chmod 666 /dev/ttyUSB0
sudo chmod 666 /dev/ttyUSB1
[Pi → Arduino] B:340 # Base rotation
[Pi → Arduino] L:450 # Left shoulder
[Pi → Arduino] R:440 # Right shoulder
[Pi → Arduino] A:370 # Arm/gripper
[Pi → Arduino] G:450 # Grip close
[Pi → Arduino] F # Drive forward
-
robot_arm.ino
: Controls servo-based manipulator using mapped PWM -
robot_drive.ino
: Controls 4 DC motors usingAdafruit Motor Shield v1
with speed variation based on object distance
- [Pixy2 Official Docs](https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:start)
- [LibPixyUSB2](https://github.com/charmedlabs/pixy2/tree/master/src/host/libpixyusb2)
- [CMUcam5 Wiki](https://en.wikipedia.org/wiki/CMUcam)
- Forked from [charmedlabs/pixy2](https://github.com/charmedlabs/pixy2)
- Modified and extended by [Syahiid Rasidi](https://github.com/spbsyahiid) for ROS-integrated semi-autonomous field robotics