Take a picture and Publish it via SMB.
You can access a picture using Windows shared folder.
This project use ESP32 Camera Driver.
This project use SMB2/3 userspace client.
ESP32 development board with OV2640 camera.
If you use other camera, edit sdkconfig.default.
esp-idf v4.4 or later.
For AiThinker ESP32-CAM, You have to use a USB-TTL converter.
ESP-32 | USB-TTL |
---|---|
U0TXD | RXD |
U0RXD | TXD |
GPIO0 | GND |
5V | 5V |
GND | GND |
git clone https://github.com/nopnop2002/esp-idf-smb-camera
cd esp-idf-smb-camera
git clone https://github.com/espressif/esp32-camera components/esp32-camera
git clone https://github.com/sahlberg/libsmb2 components/libsmb2
idf.py set-target esp32
idf.py menuconfig
idf.py flash monitor
git clone https://github.com/nopnop2002/esp-idf-smb-camera
cd esp-idf-smb-camera
git clone https://github.com/espressif/esp32-camera components/esp32-camera
git clone https://github.com/sahlberg/libsmb2 components/libsmb2
vi components/libsmb2/lib/smb3-seal.c
---------------------------------------------------------------
#ifdef ESP_PLATFORM
#include <esp_system.h>
#include <sys/types.h>
//#define random esp_random ---> Remove this
#endif
---------------------------------------------------------------
idf.py set-target esp32
idf.py menuconfig
idf.py flash monitor
For AiThinker ESP32-CAM, Change GPIO0 to open and press the RESET button.
Set the following items using menuconfig.
You can connect using the mDNS hostname instead of the IP address.
You can connect using the mDNS hostname instead of the IP address.
- esp-idf V4.3 or earlier
You will need to manually change the mDNS strict mode according to this instruction. - esp-idf V4.4
If you set CONFIG_MDNS_STRICT_MODE = y in sdkconfig.defaults, the firmware will be built with MDNS_STRICT_MODE.
If MDNS_STRICT_MODE is not set, mDNS name resolution will not be possible after long-term operation. - esp-idf V4.4.1
mDNS component has been updated.
If you set CONFIG_MDNS_STRICT_MODE = y in sdkconfig.defaults, the firmware will be built with MDNS_STRICT_MODE.
Even if MDNS_STRICT_MODE is set, mDNS name resolution will not be possible after long-term operation. - esp-idf V5.0 or later
mDNS component has been updated.
Long-term operation is possible without setting MDNS_STRICT_MODE.
The following lines in sdkconfig.defaults should be removed before menuconfig.
CONFIG_MDNS_STRICT_MODE=y
- CONFIG_ESP_SMB_USER
Username with shared folder permissions. - CONFIG_ESP_NEED_PASSWORD
Shared access requires password. - CONFIG_ESP_SMB_PASSWORD
Password with shared folder permissions. - CONFIG_ESP_SMB_HOST
IP address or mDNS host name of shared host. - CONFIG_ESP_SMB_PATH
Shared path name.
When a password is required to access the shared folder.
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.
- Add FrameSize to Remote file Name
When this is enabled, FrameSize is added to remote file name like this.
20210520-165740_800x600.jpg
Large frame sizes take longer to take a picture.
You can choose one of the following shutter methods
- Shutter is the Enter key on the keyboard
For operation check
-
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 |
- Shutter is TCP Socket
You can use tcp_send.py as shutter.
python3 ./tcp_send.py
- Shutter is UDP Socket
You can use udp_send.py as shutter.
Requires netifaces.
python3 ./udp_send.py
- Shutter is HTTP Request
You can use this command as shutter.
curl "http://esp32-camera.local:8080/take/picture"
ESP32-CAM by AI-Thinker have flash light on GPIO4.
You can check the pictures taken using the built-in WEB server.
Enter the ESP32's IP address and port number in the address bar of your browser.