Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nopnop2002/esp-idf-smtp-camera

Take a picture and Publish it via SMTP.
https://github.com/nopnop2002/esp-idf-smtp-camera

esp-idf esp32 esp32-cam gmail mail smtp

Last synced: 3 months ago
JSON representation

Take a picture and Publish it via SMTP.

Awesome Lists containing this project

README

        

# esp-idf-smtp-camera
Take a picture and Publish it via SMTP.
This project use [ESP32 Camera Driver](https://components.espressif.com/components/espressif/esp32-camera).

![slide0001](https://user-images.githubusercontent.com/6020549/122657146-caf32300-d19b-11eb-95c0-d053b77599c7.jpg)
![slide0002](https://user-images.githubusercontent.com/6020549/122657145-c9c1f600-d19b-11eb-9049-17dc2d71acdc.jpg)

# 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](https://github.com/nopnop2002/esp-idf-websocket-camera/assets/6020549/38dbef9a-ed85-4df2-8d22-499b2b497278)

# Software requirements
ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.

# Installation
For AiThinker ESP32-CAM, you need to use a USB-TTL converter and connect GPIO0 to GND.

|ESP-32|USB-TTL|
|:-:|:-:|
|U0TXD|RXD|
|U0RXD|TXD|
|GPIO0|GND|
|5V|5V|
|GND|GND|

```
git clone https://github.com/nopnop2002/esp-idf-smtp-camera
cd esp-idf-smtp-camera
chmod 777 getpem.sh
./getpem.sh
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](https://user-images.githubusercontent.com/6020549/121621472-30ae2380-caa7-11eb-8428-1dd5273bd668.jpg)
![config-app](https://user-images.githubusercontent.com/6020549/200573965-a92fad77-7bb7-4519-b123-dd7fad9c7312.jpg)

## Wifi Setting

![config-wifi-1](https://user-images.githubusercontent.com/6020549/121621478-31df5080-caa7-11eb-9ec4-90fc8375cbdb.jpg)

You can connect using the mDNS hostname instead of the IP address.
![config-wifi-2](https://user-images.githubusercontent.com/6020549/121621479-3277e700-caa7-11eb-9afe-27f1a5091c4d.jpg)

You can use static IP.
![config-wifi-3](https://user-images.githubusercontent.com/6020549/121621480-3277e700-caa7-11eb-9280-bd66214bf6a7.jpg)

## SMTP Server Setting

![config-smtp](https://user-images.githubusercontent.com/6020549/98746220-64817780-23f8-11eb-99c1-f5a4dde2e1e8.jpg)

__I've only tested with a Gmail account.__
If you want to use a non-gmail account, you need to change gmail_root_cert.pem according to [this](https://github.com/espressif/esp-idf/issues/7250) instruction.

__Note about Gmail:__
To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.
Due to this change, you can no longer log in to Google from ESP-IDF using only your username and password.
__You will need to generate a special app password as described [here](https://support.google.com/mail/answer/185833).__
An app password is a 16-character code generated by your device.
Use this code as your password.

## Attached File Name Setting

You can select the file name to write to the shared folder 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-filename-1](https://user-images.githubusercontent.com/6020549/200576375-b0b56def-3a56-4635-90d1-f13dacbec858.jpg)
![config-filename-2](https://user-images.githubusercontent.com/6020549/200576396-b82ce9b0-e21f-4b52-9339-ce97044d52a5.jpg)

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

![config-filename-3](https://user-images.githubusercontent.com/6020549/200576466-02a70de9-d3ed-4609-93c6-e0dbcac3c29b.jpg)

## Select Board
![config-board](https://github.com/nopnop2002/esp-idf-smtp-camera/assets/6020549/3b16559b-e8a0-43c7-914f-679cccee3339)

## Select Frame Size
Large frame sizes take longer to take a picture.

![config-framesize-1](https://user-images.githubusercontent.com/6020549/122479721-7ff3d700-d006-11eb-9910-8fd132f7479b.jpg)
![config-framesize-2](https://user-images.githubusercontent.com/6020549/122479725-81bd9a80-d006-11eb-847b-0748bfba75df.jpg)

## Select Shutter

You can choose one of the following shutter methods

- Shutter is the Enter key on the keyboard
For operation check

![config-shutter-1](https://user-images.githubusercontent.com/6020549/100706728-d132d500-33ec-11eb-96e2-22d30b2131f5.jpg)

- 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](https://user-images.githubusercontent.com/6020549/100706729-d2640200-33ec-11eb-8ac5-68abad4d1a0b.jpg)

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

![config-shutter-3](https://user-images.githubusercontent.com/6020549/100706730-d2fc9880-33ec-11eb-80da-80cc8278ae43.jpg)

- Shutter is UDP Socket
You can use udp_send.py as shutter.
Requires netifaces.
`python3 ./udp_send.py`

![config-shutter-4](https://user-images.githubusercontent.com/6020549/100706733-d2fc9880-33ec-11eb-85d2-62b988720d75.jpg)

- Shutter is a MQTT Publish
You can use mosquitto_pub as shutter.
`mosquitto_pub -h broker.emqx.io -t "/take/picture" -m "hello world"`

MQTT broker is specified by one of the following.
- IP address
```192.168.10.20```
- mDNS host name
```mqtt-broker.local```
- Fully Qualified Domain Name
```broker.emqx.io```

![config-shutter-51](https://github.com/nopnop2002/esp-idf-mqtt-camera/assets/6020549/7173762e-dfd4-4f19-a7ce-63a85c69edb4)

Specifies the username and password if the server requires a password when connecting.

![config-shutter-52](https://github.com/nopnop2002/esp-idf-mqtt-camera/assets/6020549/c3cca004-1c19-4d5b-8623-06327ff17ee7)

## Flash Light
ESP32-CAM by AI-Thinker have flash light on GPIO4.

![config-flash](https://user-images.githubusercontent.com/6020549/122479750-8f732000-d006-11eb-9e50-16c91cff1bb3.jpg)

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

![config-psram](https://github.com/nopnop2002/esp-idf-websocket-camera/assets/6020549/ba04f088-c628-46ac-bc5b-2968032753e0)