Application Note #13 - ESP32-CAM Web Server - with platformIO

INCOMPLETE…

Objectives

  • connect and program an ESP32-CAM as a streaming video server using the platformIO IDE using these instructions : Reference 0: instructions for using esp32 cam with platformIO
  • to that end
    • choose and purchase an ESP32-CAM dev board
    • download documentation
    • connect the FTDI programmer
    • program the ESP32-CAM with the web server as described in the Kee Yees documentation (tutorial)

Description

  • create an ESP32-CAM based video streaming server
  • this duplicates Application Note 9 except it uses platformIO not the arduino IDE

    Platform

  • CentOS Stream release 8
  • Platformio IDE

=============================================================================

References

  1. Reference 0: ESP32-CAM with PlatformIO: Video streaming and face recognition
  2. Reference 1 : Kee Yees ESP32-CAM on Amazon…
  3. Reference 2 : Amazon Order…
  4. Reference 3 : KeeYees ESP32-CAM product web page…
  5. Reference 4 : KeeYees ESP32-CAM Tutorial (my gdrive copy of ESP32-CAM.zip downloaded from Reference 2)…
  6. Reference 5 : ESP32-CAM-KIT-English.pdf extracted from Reference 3…
  7. Reference 6 : Espressifs github repo for camera web app software…
  8. Reference 7 : Comprehensive ESP32 Reference……
  9. Reference 8 : Camera web server and home assistant…
  10. Reference 9 : Howto use the built in LED…
  11. Reference 10 : ESP32 Cam + node-red + home assistant…
  12. $10 DIY Wireless IP Security Camera for 3D Printers & Home…

Procedures

Step 1

Choose an ESP32-CAM dev board

  • I chose the Kee Yees ESP32-CAM dev board shown in Reference 1… because it was an Amazon Choice, good reviews, it was cheap and documentation was available on the web site (Reference 3… and Reference 4…).

Step 2

Purchase the device

  • (see Reference 2…). Ordered form Amazon.ca, May 24, 2020 for 22.99$

Step 3

Get documentation

Step 4

Install software

  • Install requisite software in CentOS
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # Install python3 and python2 
    sudo dnf install python2
    # See : (https://linuxize.com/post/how-to-install-python-on-centos-8/)
    sudo dnf install python3
    # use python2
    sudo alternatives --set python /usr/bin/python2
    # install pyserial
    sudo pip2 install pyserial
    # set permissions on /dev/ttyUSB0
    # https://www.arduino.cc/en/guide/linux#toc6
    ls -l /dev/ttyUSB0
    sudo usermod -a -G dialout fcarella
    # logout/log back in
  • General Instructions to Install Platform IO

Step 5

Program the ESP32-CAM

Connect the ftdi (see Reference 5, Page 11…)

Setup PlatformIO IDE for ESP32 programming

  • following notes are based on Reference 0.

  • Download and install VSCode and then install the Platform IO extension if you dont have it already (Refernce 0 has details)

  • Clone the Github repository containing the source code for CameraWebServer.

    1
    2
    cd ~/
    git clone https://github.com/espressif/arduino-esp32.git
  • import the Arduino Project

  • open the folder we just downloaded in the previous step (~/arduino-esp32/libraries/ESP32/examples/Camera/CameraWebServer) and choose AI Thinker ESP32-CAM and check the “use libraries installed by Arduino IDE” checkbox. This will download all the necessary sdk’s and frameworks for working the ESP32 CAM in platformio

  • Open CameraWebServer.ino using PlatformIO and modify the code as shown below:
    Uncomment this line

    1
    #define CAMERA_MODEL_AI_THINKER // Has PSRAM

    and edit your credentials

    1
    2
    const char* ssid = "your_wifi_ssid";
    const char* password = "your_wifi_password";
  • build/compile the app

  • upload the app to the ESP32 CAM

    NOTE** make sure ESP32 is in programming mode () pins IO0 is shorted to GND and ESP32 is reset)

NOTE** did it work?

-Make sure the config file, platformio.ini has the right baud rate configured to the serial monitor
(monitor_speed=115200)

platformio.ini–>

1
2
3
4
5
6
[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
monitor_speed = 115200
  • take the ESP32 out of programming mode (disconnect pin IO0 from gnd and reset the ESP32)

  • open the serial monitor and reset the ESP32. Note the ESP32 output showing the URL of the video stream…

  • point your browser to the URL and confirm video streaming works…

back to Series…