HerrRiebmann / ESP32-SquirrelCam

ESP32 Cam Modul as a Squirrel camera trap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESP32-SquirrelCam

ESP32 Cam Modul as a Squirrel camera trap

A PIR detects movement and takes a picture. This will be stored onto the SD-Card. Afterwards, it will be transferred to a Telegram Bot. This Bot also can control the ESP32.

⚠️ Attention: The Cam does not work properly with the ESP32 Firmware above 2.0.X!!! Streaming reboots the ESP, image is blue and blurry, connection is not reliable. Use 1.0.6 instead.

Description

Some squirrels were walking over my balcony, the other day. So my first intention was to make friends with and feed them. So I bought a feeding house, which should prevent the nuts from being eaten by birds:

SquirrelHouse

Then I wanted to know when a squirrel appeard. Already got a ESP32 Cam and the idea was born! TelegramBot

The next idea was, how can I actively be notified, when something happens? Push-Notifications were not that easy. You need an app, a subscription or some complicated tooling. Or use a simple messenger! A Telegram-Bot can do everything I need!

TelegramBot

Commands will be received by the ESP32 on every wakeup. With them, it´s possible to skipt the deepsleep, take a picture, start/stop the webserver and so on.

The last thing was to have a web interface, to control some settings, see or delete images and make updates.

WebinterfaceGif

Upload takes any file and put it onto the root of the SD-Card. If the file ends with *.html, *.js or *.css it automatically be routed into the /web/ -folder.

*.bin-Files make an OTA Update and resets the ESP afterwards. The website should refresh automatically.

Installation

  • Prepare the Arduino IDE for ESP32 Boards (not latest, better below 2.X).
  • Copy the /web/-Folder onto the SD-Card.
  • Open ESP32_Squirrel_Cam.ino
  • Install missing Libraries (see below)
  • Create an own Library (see below)
  • Select Board "ESP32 Dev Module" => With PSRAM active (Needed to use OTA, which won´t work with AI Thinker ESP32-CAM Board)
  • Upload it onto the ESP32 Cam (with a programmer or the Cam-Board you can purchase with the Cam-Module)

Hardware

Components

  • AI Thinker ESP32-CAM
  • HC-SR501 (PIR-Sensor)
  • ESP32-CAM Board (Programmer Board)
  • Powersupply

Wiring

ESP 32 Powersupply
5V VCC
GND GND
ESP 32 PIR
5V VCC
PIN12 OUT
GND GND

Libraries

CustomLibrary

To prevent me from uploading my credentials to this repository, I´ve created a Library with just my personal informations:

Sketches\libraries\Credentials\Credentials.h

#pragma once

#define WIFI_SSID "MyWiFiName"
#define WIFI_PASSWORD "MyWiFiP4$$w0rd"

//Telegram Squirrel Bot
#define BOT_TOKEN "0123456789:AbCdEfGhIjKlMnOpQrStUvWxYz"
#define MY_CHAT_ID "9876543210"

OTA (Over the Air Update)

You should see the ESP32 in Arduino IDE under Tools -> Port -> Network-Interfaces (ESP32 Squirrel Cam at IP-Adress) For more information see RandomNerdTutorials

Telegram Bot

To create a Telegram Bot, you need to follow some steps:

  1. Search for the so called "BotFather" and write /start
  2. Then you will see all possible commands and select or write /newbot
  3. Now enter the name, which must contain "Bot", like MyVeryPersonalBot
  4. At last, add a username.

Afterwards, you receive a Token, which must be stored. And the Bot-URL. You can add the Bot to a Chat by following this URL. Ensure to setup the Bot to not be added by groups and set some security settings! Your Bot can be found public, but since you only process and send to/from your own personal chat id, no strangers can interact. It´s also recommended to also set the command-list with the BotFather. Then you will have a menu with command buttons within your chat. I can recommend to follow this RandomNerdTutorial

ToDo

  • Order Gallery
  • Do not load all images at once in gallery
  • Chat Id management to allow others to see images
  • Prevent sunlight to trigger (by optimizing PIR or on software side)
  • Etag webfiles / Immutable photo

About

ESP32 Cam Modul as a Squirrel camera trap

License:GNU General Public License v3.0


Languages

Language:C++ 58.6%Language:JavaScript 21.4%Language:HTML 9.9%Language:CSS 7.5%Language:C 2.5%