Robots are cool. Robots that run around even more... but robots that follow things are awesome!
So, what about making one in a few easy steps?!?!
In the video you can see the whole work, but here I'll describe better each step and share more pictures.
But first, let's list all the needed materials/parts and tools.
- a Makeblock mBot;
- a Pixy CMUcam5 Image Sensor;
- a RJ25 to Dupont Wire (from Makeblock);
- electrical tape;
- a power supply for mBot;
- template for a custom bracket (to attach Pixy to mBot);
- 2mm thick polystyrene sheet (a small piece);
- spray paint.
- USB cables (for mBot and for Pixy);
- utility knife.
You will also need a computer to code the mBot and configure Pixy. After that, you no longer need the computer to play with the object follower robot.
Step 1: Assembling the MBot
Assembling a mBot is quite easy and quick.
If your mBot is not assembled yet, you can follow the steps in the above video. Just skip the assembly of the Ultrasonic Sensor.
If your mBot is already assembled, just remove the Ultrasonic Sensor.
Step 2: Mounting Pixy in MBot
There is no Pixy bracket for mBot on the market. Because of this I made my own with a small piece of 2 mm thick polystyrene sheet.
I used the toner transfer method to transfer the bracket template (available at the attached files) to the polystyrene.
But it can be made even easier by simply gluing the model with stick glue, or by simply drawing it directly into the polystyrene.
I cut with a utility knife and gave a good finish with sandpaper. I finished with spray paint.
With Pixy comes some L-shaped metal brackets and some screws. They are used to attach Pixy to the custom bracket.
And finally, Pixy and the custom bracket should be attached in front of the mBot (where the Ultrasonic Sensor was attached).
Step 3: Electronics
Now it's time for the RJ25 to Dupont Wire.
The Dupont ends must be connected to Pixy, like in the above picture. The two remaining ends (black and white) must be insulated to prevent short circuit.
The RJ25 end can be connected in any of the four mBot ports. It's possible because we will use the I2C interface, and all the ports has the required SCL, SDA, GND and 5V.
Install the power supply for mBot.
Step 4: PixyMon and Arduino IDE
The first application we'll use is the PixyMon. First, connect the correspondent USB cable to Pixy and your computer, and then open the PixyMon application.
Initially, for everything work well, we have to change the interface way to I2C, as follows: File > Configure > Pixy Parameters (saved on Pixy) > Interface > Data out port > I2C.
Next, we're going to teach Pixy an object: Action > Set signature 1 > select the object.
Then, it's time to code. You must have installed the Pixy library for Arduino.
Connect the mBot with the correspondet USB cable to your computer and open the Arduino IDE. Select the right COM port and board (Arduino/Genuino Uno) and upload the code (available at the attached files).
Here you can download PixyMon and Arduino library: http://cmucam.org/projects/cmucam5/wiki/Latest_release