Camera tracking with NodeJS and Arduino

Lately I had some fun using the Arduino micro-controller with NodeJS.

One of my last project is a camera mounted on a Pan&Tilt that can track colors and even faces.


  • Arduino UNO
  • Mini breadboard
  • 2 servos
  • Pan & tilt frame
  • A webcam
  • A computer

This is the schematic

Mount the camera on the pan & tilt module and connect both Arduino and webcam to the PC.

Clone the repository from github

git clone

Install the dependencies

cd arduino-webcam-tracking && npm install

Run the application

node index.js

At this point if you visit the page http://localhost:3000 you should be able to see the webcam page and the application will start tracking your face (default tracking algorithm is face), if you want to change it to colors you need to use a different tracker. In the index.html file you can switch this line:

var tracker = new tracking.ObjectTracker('face');

with this one

var tracker = new tracking.ColorTracker(['magenta', 'cyan', 'yellow']);

Here is a video that show the device running

Some pictures


Davide Andreazzini

Read more posts by this author.