Coder Social home page Coder Social logo

esp-idf-ftp-camera's Introduction

esp-idf-ftp-camera

Take a picture and Publish it via FTP.
This project use ESP32 Camera Driver.
This project use ESP32-FTP-Client.

slide1 slide2 slide3

Hardware requirements

ESP32 development board with OV2640 camera.
If you use other camera, edit sdkconfig.default.
From the left:

  • Aithinker ESP32-CAM
  • Freenove ESP32-WROVER CAM
  • UICPAL ESPS3 CAM
  • Freenove ESP32S3-WROVER CAM (Clone)

es32-camera

Software requirements

esp-idf v4.4/v5.0.

Installation

For AiThinker ESP32-CAM, You have to use a USB-TTL converter.

ESP-32 USB-TTL
U0TXD RXD
U0RXD TXD
GPIO0 GND
5V 5V
GND GND
git clone https://github.com/nopnop2002/esp-idf-ftp-camera
cd esp-idf-ftp-camera
idf.py set-target {esp32/esp32s3}
idf.py menuconfig
idf.py flash monitor

Start firmware

For AiThinker ESP32-CAM, Change GPIO0 to open and press the RESET button.

Configuration

Set the following items using menuconfig.

config-main config-app

Wifi Setting

config-wifi-1

You can connect using the mDNS hostname instead of the IP address.
config-wifi-2

You can use static IP.
config-wifi-3

Using mDNS hostname

You can connect using the mDNS hostname instead of the IP address.

  • esp-idf V4.3 or earlier
    You will need to manually change the mDNS strict mode according to this instruction.
  • esp-idf V4.4
    If you set CONFIG_MDNS_STRICT_MODE = y in sdkconfig.defaults, the firmware will be built with MDNS_STRICT_MODE.
    If MDNS_STRICT_MODE is not set, mDNS name resolution will not be possible after long-term operation.
  • esp-idf V4.4.1
    mDNS component has been updated.
    If you set CONFIG_MDNS_STRICT_MODE = y in sdkconfig.defaults, the firmware will be built with MDNS_STRICT_MODE.
    Even if MDNS_STRICT_MODE is set, mDNS name resolution will not be possible after long-term operation.
  • esp-idf V5.0 or later
    mDNS component has been updated.
    Long-term operation is possible without setting MDNS_STRICT_MODE.
    The following lines in sdkconfig.defaults should be removed before menuconfig.
    CONFIG_MDNS_STRICT_MODE=y

FTP server Setting

You can specify mDNS hostname for the FTP server.
config-ftpserver-1

Store pictures in FTP Server subdirectories.
config-ftpserver-2

Create index.html on FTP Server.
When your FTP server acts as an HTTP server, You can view picture using browser.
config-ftpserver-3

You can specify the rotation of the image.
config-ftpserver-4

My FTP server acts as an HTTP server.
rotate-000 rotete-090

Remote File Name Setting

You can choose the file name on the FTP server side from the following.

  • Always the same file name
  • File name based on date and time
    When you choose date and time file name, you will need an NTP server.
    The file name will be YYYYMMDD-hhmmss.jpg.

config-remote-file-1 config-remote-file-2

  • Add FrameSize to Remote file Name
    When this is enabled, FrameSize is added to remote file name like this.
    20210520-165740_800x600.jpg

config-remote-file-3

Select Board

config-board

Select Frame Size

Large frame sizes take longer to take a picture.
config-framesize-1 config-framesize-2

Select Shutter

You can choose one of the following as shutter

config-shutter-0

  • Shutter is the Enter key on the keyboard
    For operation check.
    When using the USB port provided by the USB Serial/JTAG Controller Console, you need to enable the following line in sdkconfig.
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

config-shutter-1

  • Shutter is a GPIO toggle

    • Initial Sate is PULLDOWN
      The shutter is prepared when it is turned from OFF to ON, and a picture is taken when it is turned from ON to OFF.

    • Initial Sate is PULLUP
      The shutter is prepared when it is turned from ON to OFF, and a picture is taken when it is turned from OFF to ON.

I confirmed that the following GPIO can be used.

GPIO PullDown PullUp
GPIO12 OK NG
GPIO13 OK OK
GPIO14 OK OK
GPIO15 OK OK
GPIO16 NG NG

config-shutter-2

  • Shutter is TCP Socket
    You can use tcp_send.py as shutter.
    python3 ./tcp_send.py

config-shutter-3

  • Shutter is UDP Socket
    You can use this command as shutter.
    echo "take" | socat - UDP-DATAGRAM:255.255.255.255:9876,broadcast
    You can use udp_send.py as shutter.
    Requires netifaces.
    python3 ./udp_send.py

config-shutter-4

  • Shutter is HTTP Request
    You can use this command as shutter.
    curl "http://esp32-camera.local:8080/take/picture"

config-shutter-5

  • Shutter is MQTT Subscribe
    You can use this command as shutter.
    mosquitto_pub -h broker.emqx.io -p 1883 -t "/take/picture" -m "take picture"
    The firmware can be restarted when disconnected from the MQTT server.

config-shutter-mqtt-1 config-shutter-mqtt-2 config-shutter-mqtt-3

  • Shutter is Remote file polling
    Take a picture if there is a file on the FTP server.
    Check if the file exists at 10 second intervals.

config-shutter-61

You can choose to create a file or delete a file.
If you use Android, deleting files is easier.
config-shutter-62

Flash Light

ESP32-CAM by AI-Thinker has a flash light on GPIO4.

config-flash

PSRAM

When you use ESP32S3-WROVER CAM, you need to set the PSRAM type.

config-psram

Take picture using flask application

You can use flask application.
read this.

View picture using Built-in WEB Server

ESP32 works as a web server.
You can view the pictures taken using the built-in WEB server.
Enter the ESP32's IP address and port number in the address bar of your browser.
You can connect using mDNS hostname instead of IP address.

browser

Take pictures using Android

I use API Tester: HTTP Client app.
You can download from Google Play.
This app can easily issue HTTP requests.
You can easily take pictures by setting HTTP Request to shutter.
However, on Android, name resolution by mDNS is not possible.

api-tester

Take & view pictures using Android

I use X-plore File Manager app.
You can download from Google Play.
This app can easily view the files on the FTP server.
This app can easily delete files on FTP server.
It's much easier to delete a file than to create a new one.
You can easily take pictures by setting remote file deletion to shutter.
You can operate the ESP32 with just your fingertips.
If you use a rental server, you can take pictures of London from New York.
Very Good!!

X-plore-1 X-plore-2

slide5

References

https://github.com/nopnop2002/esp-idf-ftpServer

https://github.com/nopnop2002/esp-idf-ftpClient

esp-idf-ftp-camera's People

Contributors

nopnop2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esp-idf-ftp-camera's Issues

Build project failed

Hi,

I got some errors as below picture when try to build your project:
image
Seem the project on your Github missing a Makefile?
Please let me know what is wrong ?
Thanks !

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.