Object Follower Robot (with MBot + Pixy)




Introduction: Object Follower Robot (with MBot + Pixy)

I like to build stuff (specially Arduino robots) with simple materials using DIY techniques and sim…

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);
  • sandpaper;
  • spray paint.


  • USB cables (for mBot and for Pixy);
  • screwdriver;
  • 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

Step 5: Just Have Fun!

Robotics Contest 2017

Participated in the
Robotics Contest 2017

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Be the First to Share


    • Chocolate Challenge

      Chocolate Challenge
    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Go Big Challenge

      Go Big Challenge



    Question 3 years ago

    Hola, tengo problemas con el codigo, podrias ayudarme [??

    problema mblock.jpg

    4 years ago

    Neat project, love the easy to use camera, Pixy cam was so easy to set up and use, got the mBot on sale for 40 bucks on Amazon only issue was ordering the Rj25 to dupont wire, which I ended up making. Really a great project thanks for the tutorial, it satisfied a my dream as a kid to have my own robot following me around.


    5 years ago

    Great work! My dog likes to make mess when im not around, but she lost interest for my robot vacuum cleaner pretty fast. Your robot seems like a perfect solution to follow pets. Put another wifi ip cam with 2way audio. Ever tried if it follows a dog? Maybe with qr tags on collar? I can save a few books from death)