ESP32 Projects
Start a build
Markdown

ESP32-CAM JPEG Receiver with Flask

Receive captured JPEGs from an ESP32-CAM with a Flask server.

AI Thinker ESP32-CAMPythonIntermediate
Parts and source

Before you start

Match the AI Thinker camera target and OV2640 pin mapping to your board and check the upstream hardware and firmware requirements.

Getting started

  1. Start with the upstream board target, firmware versions and parts list. Verify that the camera initializes before adding the rest of the build.
  2. Start the Flask receiver locally and point the included Arduino sketch to it. Upload one test image and verify that the server saved it.

Upstream README

License

ESP32-cam Flask

A simple flask server for esp32-cam to upload captured image.

1. Server Setup

1.1. Python package installation

$ pip install -r requirements.txt

1.2. Nginx Server

In ubuntu:
$ sudo apt-get install nginx

Setup:

Create a file /etc/nginx/sites-available/esp32 and type the following:

server {  
    location / {  
        proxy_pass http://127.0.0.1:8000;  
    }
}

Create a symbolic link in the sites-enabled directory:
$ ln -s /etc/nginx/sites-available/esp32 /etc/nginx/sites-enabled/esp32

Restart nginx service:
$ sudo service nginx restart

Run Server

$ cd flask_app
$ gunicorn run:app

2. Client

The esp32-cam/client_image_post/client_image_post.ino sketch is based on project ESP32-CAM-Arduino-IDE by Rui Santos.

TODO
  • [ ] Gallery UI to view uploaded images