CE432 2020 Fall
Tutorial 2
John Hitti
jdhitti@fortlewis.edu
Tutorial 2 - Take Photos
Introduction
In this tutorial we will be demonstrating the ESP32 CAM's capability to
take photos and interface with multiple different forms of communication. Photos taken will be stored on an SD card, sent via
E-Mail, and even sent via a Telegram bot.
Task 1. Take some photos by itself.
In this task
we will be configuring the ESP to take a photo using the onboard camera
and store that photo onto a micro SD card. We will be using an example
code from the textbook "ESP32-CAM Projects" by Rui Santos
and Sara Santos. This
code will direct the board to take a photo every ten seconds and store
it to the SD card. The code was ran and five photos were saved to the
SD card.
Task 2. Customize photo names.
In this task we take the provided example further by naming the image files taken by the ESP32-CAM. This example code
will use the Wi-Fi capability of the ESP32 and connect to an NTP server
to request the date and time. Once the code is adjusted to convert the
requested time to display GMT. The code was ran and these photos were
saved to the SD card...
Task 3. Take Photos with a pushbutton
In this task
we can take our photo capabilities even further by allowing our ESP32
to only take photos when a button is pressed. By attaching a push
button to the ESP32 we can do just that. The push button is attached to
the ESP according to the diagram below...
(picture from the ESP32-CAM Projects textbook)
Once the pushbutton is connected and the example code
is loaded then the ESP32 will be ready to take photos. It is important
to note that the code must contain a software debounce in order to
prevent unwanted behavior from the ESP32.
When using the pushbutton a lot of pictures are able to be taken.
Task 4. Use a webserver to take pictures
In this task we used the ESP32 to host a webserver where we can capture photos. The example code was loaded and using a browser we can access the "ESP32-CAM last photo" GUI where we can capture photos.
Task 5. Web Server SD Card Photo Manager: Capture, View, and Delete
In this task
we take our webserver a little further and give it the ability to
capture, view, and delete photos on the SD card. Using the example code we are now able to capture photos to the SD card.
If we decide to delete or view a previous photo we now have that ability...
The date desplayed matches to the current time.
Task 6. Take Photos and send notifications
In this task we will be using the example code
to take photos with the ESP32 and use a mail client library to send the
photo via email to another email. Once we have created a new email for
out ESP32 to use and added our login information to the code then the
ESP32 will capture a image after booting and send the image via our new
email address.
Task 7. Take Photos and email photo with webserver
In this task we will be building on the previous task by using the example codeto
add a webserver interface to our mail client function. We will now be
able to display the photos captured before they are sent via email.
Once a picture is taken that we wish to send via email we can click the
"Email Photo" button and the ESP32 will send the photo. We can confirm
that the email was sent through the serial comunication port on the
ESP32.
The photo was sent to and recieved properly!
Task 8. Take and Send Photo to Telegram App
In this task we will use the app "Telegram" along with the example code
to take photos and activate the flash on the ESP. Once the telegram app
is installed we can use the bot function to interface with the ESP.
Using "botfather" we can create a new bot for this. Once this new bot
is set up the bot token along with the chat id can be entered into the
example code. This new bot will now interface with the ESP32 and can
control its various functions.
Discussion
Overall
the ESP32-CAM is capable of interfacing with a wide range of
communication formats. This allows for a versatile device capable of
many different projects and uses. The ability for the ESP32-CAM to take
images further increases its capabilities and uses.