Close
0%
0%

ESP32-CAM emails picture

ESP32-CAM sends email with a pic attached every half hour while we are away and if it's bright enough.

Similar projects worth following
Added another $8 ESP32-CAM to remote monitor the birdfeeder when we are away. It sends an email with a 1600X1200 picture of the birdfeeder attached every 1/2 hr when it's bright enough to a dedicated email. Can view the pic from anywhere.

Includes a photoresistor in a voltage divider circuit so it only sends pics when it's bright enough.

I could also send the exact time to it from another controller that has a RTC connected using ESP-NOW so the emails are sent on the hour and half hour if bright enough. ESP-NOW means only one controller needs a RTC. It can send date and time data to all the others. No I/O needed for date and time on the receiving microcontrollers.

I was thinking of sticking it on top of a servo to get various angles every few minutes for a security system.

Project added to this one: https://hackaday.io/project/175937-the-ultimate-birdfeeder

The original ESP32 Cam board doesn't have a micro USB socket for programming so many temporary connections are needed to program it. 

Program it using an Arduino Uno or a FTDI board. Correct wiring is at 1:00.

Or get a ESP32 Cam shield with a micro USB socket.

 https://randomnerdtutorials.com/upload-code-esp32-cam-mb-usb/

This doesn't easily allow access to the I/O when connected though.

Some newer ESP32 Cam boards do have integrated CH340 USB built in like other microcontrollers. May have to load CH340 drivers if needed. I will use these from now on. Much easier.

https://www.ebay.ca/itm/203287736123  See note about holding the Flash button to program.

Also make sure and update your ESP32 software within Arduino IDE. New software recognizes OV5640.

1. Under Preferences, Additional Boards Manager URLs add a comma after existing URL then https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

2. Tools, Board, Boards Manager, search ESP32 and reload. Adds many files.

3. File, Examples, ESP32, Camera, CameraWebServer to load a new version of the software

https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls

Setup Arduinio IDE: 

There are a lot of YouTube videos about the ESP32 Cam board. Including pan and tilt with servos.

I will also try a much higher quality camera the OV5640 to replace the OV2640. 2592x1944 max resolution.

So far I cannot get good results from the OV5640 as shown in the video below. Much worse than OV2640.

***SOLVED***  under camera_config change: config.xclk_freq_hz = 6000000; // was 20000000

This also reduces the frame rate.

Still not sure if the 5M higher res and wide angle is worth upgrading from OV2640 to OV5640.

At 1:30 he puts the OV5640 onto a standard ESP32 Cam board. You can buy the OV5640 separately. There is even an auto focus version that can be used like a microscope. 

There is a way to get wireless OTA programming on ESP32 boards as well but the default doesn't work. I use OTA programming for all the other NodeMCU microcontrollers. It looks like OTA won't work with ESP32 Cam boards.

The email ESP32 Cam was sometimes sending only a partial or no pic so also added a SPIFFS format statement in the setup to correct this. Sends photo every 1/2 hr if bright enough. Removes photo from SPIFFS after email sent.

Code added to example from : https://randomnerdtutorials.com/esp32-cam-send-photos-email/#comment-715842

bool formatted = SPIFFS.format(); //formats SPIFFS if corrupt and only partial picture

void loop() {

    if (digitalRead(2) == LOW) digitalWrite(33, LOW); // turn on built-in red LED if dark        

 if (digitalRead(2) == HIGH) {      digitalWrite(33, HIGH);  // if bright enough turn off red LED and send photo

 capturePhotoSaveSpiffs();      sendPhoto();      

SPIFFS.remove("FILE_PHOTO"); // remove photo after email sent     

delay (1800000); // wait 1/2 hour    

   }     

 }

  • 1 × ESP32 Cam - get one with USB built in https://www.ebay.ca/itm/203287736123
  • 1 × USB charger
  • 1 × Micro USB cable
  • 1 × Photoresistor optional
  • 1 × 4.7K resistor optional

View all 7 components

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates