Introduction: Making a Robot Play Fetch
Use the new Pixy2 and a DFRobot ESP32 FireBeetle to create a robot that can find and retrieve items!
Step 1: Parts
Step 2: Robot Platform
Pixy recently came out with their next version of their Pixy Camera, which can recognize objects and track them. DFRobot sent me one, so I decided to create a robot that can grab an item and then bring it back.
I used a MiniQ robot chassis from DFRobot as the platform that the robot would be built upon. It comes with multiple mounting holes, so I designed a battery riser using Fusion 360 that attaches to a set of holes. Then I mounted the gripper to the front.
Step 3: Pixy Camera Setup
The makers of the Pixy Camera provide a software called PixyMon, which shows what the camera "sees" and lets users adjust parameters, set interfaces, and create color codes. I downloaded and installed PixyMon from their website here. Then I connected the Pixy2 to my PC via USB and went to the File menu and selected Configure.
First, I set the interface to I2C, as I will be using a non-Arduino board.
Next, I tuned some miscellaneous settings in the expert menu, as seen in the image.
Finally, I got out the block I wanted to use and clicked "Set signature 1" under the Action menu. This sets what the Pixy looks for.
Step 4: Wiring
Since I setup the Pixy to use the I2C mode, only 4 wires are needed to connect it to the ESP32 FireBeetle. Just connect SDA, SCL, 5V, and GND. Then I wired up the L293D dual H-bridge DC motor driver to pins IO26, IO27, IO9, and IO10, along with power and output, as seen in this image.
Step 5: Creating the Program
The program "flow" goes as follows:
Find target block
Get width and position
Adjust robot position based on where the block is
Move forward until it gets close enough
Step 6: Using the Robot
I first put up a piece of white paper for the background to prevent other objects from being accidentally detected. Then, I reset the ESP32 and watched it drive towards the object, grab it, and then return it, as seen in the video.