HD DashCam ESP32-Cam

Electronics and Programming tutorials and projects

HD DashCam ESP32-Cam

HD DashCam ESP32-Cam

Introduction

This project is “WiFi HD DashCam ESP32-Cam” firmware (arduino source code – .ino files) with an IP-based web application. With this project, you can record video during driving, or use for the other purposes.

The DashCam project uses the “AI Thinker ESP32-CAM” module which has a 2MP Camera (OV2640), 10 I/O pins, an on-chip LED, an on-chip flash light and one MicroSD slot to store the videos. With its tiny sized camera and 240MHz CPU is able to provide a fair quality images and video frames.

This project can either record real time videos:

Or time lapse videos:

The source code contains the following files:

  1. ESP32DashCam.ino (Main handler file)
  2. user_global.h – Project global variables and definitions file.
  3. user_init.ino – Project initial script file.
  4. user_loop.ino – This file has a “userLoop()” function which calls repeatedly (like arduino “loop()” function).
  5. user_settings.ino – Project settings file.
  6. user_main.ino – Online video stream handler script.
  7. user_sub.ino – Network handler script.
  8. user_global.ino – This file has global functions.
  9. Webapp.h – This file contains the DashCam WebApp’s script.

Uploading the WiFi HD DashCam ESP32-Cam project

First open one of the files with Arduino program, then set the settings (Board and CPU Frequency).

Then turn on the ESP32 module in the “download mode” (GPIO0–>GND) and upload the program with using an USB2Serial module.

  • It’s suggested to install (or upgrade/downgrade to) “ESP32 Boards rev 3.2.0”. This revision is more compatible with the project.
  • The “Board” must be set on the compatible ESP32 Modules (Ai Thinker ESP32-Cam) before doing anything.
  • The start-up CPU speed has been set to 240MHz.
  • For the “download mode”, use a jumper for connecting “IO 0” to the GND.
  • It’s suggested to remove the whole data in the ESP flash memory before the first upload.

Preparing The ESP32 DashCam

The “Ai Thinker ESP32-Cam” module is a prepared device. You only need a standard 5V power source (e.g. a USB cable) and a record switch.

Also you can stick a heat sink to the module’s regulator. It’s not necessary but recommended.

  • The onboard ESP32 module must only receive 3.3v. Higher voltage will hurt the module.
  • Do not use higher voltage for the 5V and 3.3V input pins.

The schematic is so simple. All you need is a USB cable (or 12v to 5v regulator) as the power source, a two states (on/off) 3-pin record switch is needed to connect to the 3.3V, GND and U0R (Center pin of the switch with a 470 Ohm load resistor).

Then you can place it in a suitable place (e.g. somewhere behind of the center mirror).

When the switch is on (connected to the GND), the recording is enabled and WiFi is disabled and when the switch is off (connected to the 3.3v), WiFi is enabled.

HD DashCam ESP32-Cam behind mirror

The WiFi HD DashCam ESP32-Cam Web Application

Plug the power and turn on the circuit and the module in “normal mode” with record switch in the off state.

Then the LED will blink once (in case of everything is ok). Then you’ll be able to see the module’s hot spot ssid via the WiFi networks in your PC or smart phone.

The default SSID is WiCardDashCam and the default password is 12345678. Connect and go to 192.168.4.1 with a PC, car multimedia or smart phone web browser (Chrome or Firefox).

The Web Application is divided to 4 menus. The menus can be selected by click on the menu button:

  1. Online Stream: Shows the main page and online video stream.
  2. File manager: access to the files which are saved in the memory card.
  3. Settings: WiFi and system configuration.

WiFi HD DashCam Online Stream

This is the default page and you can see the online video stream in this page.

HD DashCam ESP32-Cam stream

A few seconds after loading the page, the module starts online streaming automatically.

By tap on the video image, the image will scale to full with and original size.

There are two buttons under the stream screen, with “CAPTURE”, the app will take and save a screenshot and with tap or click on the “LIGHT” button, the on-chip flash LED will turn on and off.

WiFi HD DashCam ESP32-Cam File Manager

There’s a file manager menu in the application which shows the files in the root directory of the memory card. Each file can be downloaded by click on the download button.

The supported files (.jpg .jp4 .jp4 .wav .mp3) can be selected and played in the web application.

The .jp4 and .jp5 files can be exported as .avi file by click on the export button. You can open the .avi file with “BS Player”, “VLC”, “KM Player” or any other standard multimedia software. Also the files can be edited by standard video makers like “Video Match”.

You can remove any file by click on the remove button.

By click on the play button (middle of the JP5 file image), the video will be downloaded and played along with the audio and you can pause the video by tap or click on the image.

  • Downloading or exporting the videos may take a while, it depends on the video length and the WiFi signal strength.
  • You can access directly to the network page by http://ip#filemanager link (ip is the module’s IP).

DashCam ESP32-Cam Settings

The web application’s settings menu has been divided to 5 parts:

  1. Modem Configuration
    In this section you can see the available access points, the connection status, the device MAC address and the DHCP IP.
    Also in this section you can set the SSID and password of the modem’s access point.
  2. Hotspot config
    In this section you can set your module’s hotspot SSID and password.
    The secure link is a string which will be added at the end of your module’s IP address. For example if you set it “123”, the IP address of the WebApp of your module will be 192.168.4.1/123 instead 192.168.4.1
    Hidden HotSpot will set the HotSpot hidden.
    Temporary HotSpot will disable the HotSpot right after the module is connected to the modem or joined to the network (For the last device in the network).
  3. Camera Config
    In this section:
  • The “Quality” of online stream and recording which can be 225p, 360p, 450p or 720p (1280*720 HD) and the fps may be vary between 10 fps to almost 60 fps.
  • The “Record Time” can be 10Sec, 30Sec, 1Min, 2Min or 4Minutes.
  • The “Auto Recorder” includes “Motion Detector Sensitivity” which is the internal image processing sensitivity for motion detecting and can be Off, Low, Medium or High, Always and the “Time lapse” feature. The time lapse takes a photo and saves it in a .jp4 time in every selected time (between 5 seconds to 24 hours). The output video is 10FPS, so a 10 second video with 5 seconds time lapse, takes 500 seconds.
  • The “24MHz” switch speeds up the camera performance.
  • The “Flash Light” switch turns on and off the on-chip power LED during the recording.
  • The internal image processing sensitivity also depends on the scene light and objects.
  • The recording will be enable only if you turn the physical recording switch on and the time lapse is only available when the recording switch is turned off.
  • If you open any page of the module, the recording and time lapse will be stopped.
  • You can directly access to the settings menu with http://ip#settings link (e.g. 192.168.4.1#settings). 

The WiFi HD DashCam ESP32-Cam project is available in the following:

 

Leave a Reply

Your email address will not be published. Required fields are marked *

14 − 4 =