Esp32cam Pan And Tilt Using Facial Tracking

About the project

I wanted to post this project because its really easy and rewarding to make. I'll just tell you how to modify the Espressif example, by adding some lines of code in the right places. In the end you will be able to perform computer vision, facial tracking, and pan and tilt without computer support.

Project info

Difficulty: Moderate

Platforms: ArduinoEspressif

Estimated time: 4 hours

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

ESP32-CAM Development Board ESP32-CAM Development Board x 1
Micro Servo Micro Servo x 2
lm7805 5 volt regulators lm7805 5 volt regulators x 2
Mini Bread Board Self Adhesive Mini Bread Board Self Adhesive x 1
2.54mm header pins 2.54mm header pins x 1
jumperwires jumperwires x 10
2s lipo battery 2s lipo battery or an 5 volt power supply x 1

Software apps and online services

Arduino IDE Arduino IDE

Hand tools and fabrication machines

small drill small drill x 1
glue gun glue gun x 1
small Phillips screwdriver small Phillips screwdriver x 1

Story

   I wanted to post this project because its really easy and rewarding to make.  The ESP32Cam has an example project where it allows the user to detect faces, recognise faces, and stream the camera through a nice web page. You can find this library on your Arduino IDE under:


 File-->examples-->esp32-->camera-->CameraWebServer


    Its worth taking some time to get to know this example.  You can adjust the video feed, detect faces, and train the program to recognise specific faces too.  I think Espressif really pushed the boundaries of computer vision with this code.  Most computer vision or machine learning programs require large operating systems, compilers, and libraries to process video as data.  This is so stream-lined and embedded into a RISC-V instruction set, they must have pre-trained the tensors and used a quantisation/approximation.  There aren't many edge products that can do computer vision so well on a tiny ESP32 processor.

    I really went down a rabbit hole with this code, but I'll just tell you how to modify their program by adding some lines of code in the right places.  In the end you will be able to perform computer vision, facial tracking, pan and tilt, and possible modify it for even self driving cars or robots.  Lets start.

Schematics, diagrams and documents

Electronics

CAD, enclosures and custom parts

Pan and tilt .stl files for micro servos

This will link you to thingiverse and the pan and tilt design I used, but any others ones will also work fine.

Go to download

Code

Cut and paste this code into the Expressif ESP32cam example file shown below.

This code needs to be pasted into the 'app_httpd.cpp' file of the camera example code found at: File-->examples-->esp32-->camera-->CameraWebServer More detail on where to put the code, and some explanation, can be found on my blog: departedmessenger.blogspot.com

Credits

Photo of departedmessenger

departedmessenger

I am a maker who enjoys sharing with the community. My interests :Biometric robots, AI, wifi-vision, and fanart.

   

Leave your feedback...