Raspberry+Arduino CamTracker

Easy and Fun: Track objects with a Raspberry Pi, a camera and an Arduino in less than an hour!

Similar projects worth following
a one hour level beginner project to implement visual object detection on a stock raspberry pi.

My project is a very easy implementation of computer vision on raspberry pi; feature tracking.

Most people who had buy a Raspberry Pi camera module or similar (from here and thereafter Raspicam) is somehow thinking about computer vision, but the complexity of the implementation of layers and layers of software and code in the examples is a strong entry barrier.

I hope this project will help with that; if you have a raspberry and a raspicam you should try it... it only takes one hour ;)


Wolfram Mathematica Notebook with the whole code.

nb - 5.40 kB - 02/03/2019 at 22:44


Arduino INO file with the Arduino code

Zip Archive - 852.00 bytes - 02/03/2019 at 22:44


  • 1 × Raspberry Pi (the newest the best)
  • 1 × Raspberry Pi Camera Module (Raspicam)
  • 1 × Raspberry Kit SD, keyboard, mouse and power source
  • 1 × Arduino Uno or Nano tested on this boards, should work in anyone.
  • 1 × Camera mount with servos

View all 7 components

  • tracked!!

    Marcelo Valeria02/05/2019 at 17:26 0 comments

    we have finished the project!!

    here is the code, the steps and a short video of the machine working.


  • A new project!

    Marcelo Valeria02/03/2019 at 23:04 0 comments

    We are going to learn how to do tracking of objects with the camera!

    but first i suggest to try my first project Raspberry Pi Object Identification. there you'll find all the steps from connecting the camera and the pi to the voice synthesis that speaks what it saw and it only takes 30 minutes.

    i'll be writing step by step during the week, greetings!

View all 2 project logs

  • 1
    Get the components ready!

    we will continue using the raspberry from the last project, so first if you have not hack the first project yet please go and check the instructions to configure the Raspberry Pi and the camera.

  • 2
    What are we building?

    The goal is to find an object in a picture and then target the camera to center the object.

    For that we will use an Arduino. The Pi have pins too but cannot control by itself a servo. An Arduino can control servos without additional hardware and we can control the arduino from Mathematica.

    here we can see the raspberry (in a case), the camera mount (fixed on the case with two-sided adhesive tape) connected to the arduino (each servo is 5V, GND and Signal) and the camera taped to a fitting block. Load the sketch from the files section to the Arduino (follow this instructions if you are unfamiliar) and connect the data cable from the horizontal (X) servo to PIN 9 and the vertical (Y) servo data cable to PIN 10. 

    If everything is OK with the arduino and the servos from the camera mount after powering the arduino the mount should stay more or less vertical (as in the picture) so if yours is too misaligned try other values for posY on the line 8 and 50

    int posY = 130; 
    posY = 130;

    if you open the serial monitor in the Arduino IDE 

    you can test the camera mount sending the characters a, d, w, s 

      a ☩ d

    and taking a few pictures typing

    raspistill -v -o test.jpg

    in the terminal as we learned in the last project.

    Next: The target

  • 3
    The Target

    for the target i used a few cubes for testing calibration of 3D printers that i grabbed from the recycle bin and a skewer with a few drops of instant adhesive.

    you can use a small ball or a few lego cubes. the point is to try to have something that could be easy to recognize from the background...

    yeah, you understand ;)

    Next and final step: Control everything from Mathematica!

View all 4 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates