Giter Site home page Giter Site logo

esp32cam's Introduction

ESP32-CAM

Arduino projects with the ESP32-CAM

Introduction

Prerequisites

You need

  • Hardware ESP32-CAM I would advise having an external antenna. Both my boards have trouble connection to WiFi with the on-PCB antenna.
  • The schematics.
  • The ESP32-CAM does not have a USB-to-serial adapter. So either get a stand-alone one, or get a dedicated board ESP32-CAM-MB. I like the dedicated board because that has the "flash" button integrated on the PCB. This means no more fiddling with buttons on every upload from Arduino. There is now even an integration of the CAM and the MB board ESP32-CAM-CH340; ordered it but did not yet try.
  • Wiring instructions are here - do NOT connect 5V from FTDI to 3V3 of ESP32.
  • The Espressif camera library.

Getting started

The easiest way to start - assuming you have a standard board - is probably to use Arduino with the built-in camera example.

  • First chose your board, e.g. Tools > Board > ESP32 Arduino > AI Thinker ESP32-CAM.
  • Next load the example, e.g. File > Example > Examples for AI Thinker ESP32-CAM > ESP32 > camera > CameraWebServer.
  • Important Select the camera model at the top of the ino file in the example, e.g. #define CAMERA_MODEL_AI_THINKER.

My experiments

Serial connection and reset.

I had some problems communicating with (transferring data, programming, resetting) the ESP32-CAM. See this section for details.

Focus

You can change the focal length of the camera, by turning the cap, see focus page.

Hardware mods

I applied two hardware mods: adding a low-power LED and an adapter board. I later realized that the ESP32 has multiple PWM channels and that you can map that to any pin, also the LED pin. So I undid my low-power LED mod, and used PWM on the high-power LED.

Bring-up

The first project, esp32cam-ascii, captures an (gray-scale QVGA) image, sub-samples that (5x horizontal and vertical) and renders the results as ASCII art over serial. This is the output while waving at the camera.

Screenshot

Collecting images

The second project, esp32cam-cmd, consists of two parts. The Arduino sketch captures an image and sends it to the host over serial (over USB). A PC/Python program converts the serial dump to a png image.

Captured png

There is a second Python pogram that periodically sends capture commands to the Arduino Sketch, and automatically converts and saves the incoming bytes as an image.

Note In the mean time I no longer hex-dump an image over serial and use a Python script to convert to png. Instead I dump the image (still text over serial) in the pgm format with magic number is P2. You can copy and paste that to notepad, save it as pgm file and then open it, e.g. using IrfanView.

My real projects

Rock paper scissors

My first real project is to use machine learning to distinguish rock, paper, scissors, shot with an ESP32-CAM. The inference is also supposed to run on the ESP32. This ESP32-CAM side of the project

  • The training sketch is about capturing the training images (with the ESP32-CAM)
  • After training I had a model. The predict sketch uses that model to film a hand and make a prediction (rock/paper/scissors).

The training aspect is in a separate Python machine learning project repo. It does the training (based on the footage generated by the training sketch) generates the model, and convert it to TensorFlow Lite. That is linked in the the predict sketch.

You can see the result in action in this video

TFLcam

In my second real project I have converted the rock-paper-scissors cam in a generic ESP32 TensorFlow Lite cam. It has its own repo. This allows one to save any (small enough) TensorFlow Lite model on an SD card, slide it in the ESP32-CAM, and get predictions over serial.

TFLcam

(end)

esp32cam's People

Contributors

maarten-pennings avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.