CONTENTS 1 ESP32 WROOM 32E 2 ESP32 Camera Extension 3 Battery 4 Camera 5 Related Projects 6 FAQ 7 Copyright Notice...
Page 5
Thanks for choosing our ESP32 Camera Pro Kit. This ESP32 Camera Pro kit is designed to empower a variety of projects, from robotics to IoT and Bluetooth applica- tions. It features the powerful ESP32 WROOM 32E module, paired with an expansion board that supports easy experi- mentation and connectivity.
CHAPTER ESP32 WROOM 32E The ESP32 WROOM-32E is a versatile and powerful module built around Espressif’s ESP32 chipset. It offers dual-core processing, integrated Wi-Fi and Bluetooth connectivity, and boasts a wide range of peripheral interfaces. Known for its low-power consumption, the module is ideal for IoT applications, enabling smart connectivity and robust performance in compact form factors.
Page 8
1.1 Pinout Diagram The ESP32 has some pin usage limitations due to various functionalities sharing certain pins. When designing a project, it’s a good practice to carefully plan the pin usage and cross-check for potential conflicts to ensure proper functioning and avoid issues.
Page 9
Defaults to pull-down, IO0 and IO2 will make ESP32 enter download mode. IO12(MTDI) Defaults to pull-down, if pulled high, ESP32 will fail to boot up normally. IO15(MTDO) Defaults to pull-up, if pulled low, debug log will not be visible. Additionally, the voltage level of IO5 and IO15 affects the Timing of SDIO Slave.
Page 10
• Firmware can configure register bits to change the settings of “Voltage of Internal LDO (VDD_SDIO)” and “Timing of SDIO Slave”, after booting. • The module integrates a 3.3 V SPI flash, so the pin MTDI cannot be set to 1 when the module is powered up. Chapter 1. ESP32 WROOM 32E...
We have designed an expansion board that enables you to fully utilize the camera and SD card functionalities of the ESP32 WROOM 32E. By combining the OV2640 camera, Micro SD, and ESP32 WROOM 32E, you get an all-in-one expansion board.
Page 12
– Provides power to both the ESP32 WROOM 32E and ESP32 Camera Extension. • ESP32 Pin Headers – Intended for the ESP32 WROOM 32E module. Pay close attention to its orientation; ensure both Micro USB ports face the same side to avoid incorrect placement.
Page 13
Pinout Diagram. However, when the ESP32 WROOM 32E is inserted into the extension board, some of its pins may also be used to drive the Micro SD card or a camera. Consequently, pull-up or pull-down resistors have be added to these pins. If you’re using these pins as inputs, it’s crucial to account for these resistors as they can affect input levels.
Page 14
• IO33 is connected to a 4.7K pull-up resistor and a filtering capacitor, which prevents it from driving the WS2812 RGB Strip. 2.3 Interface Insertion Guide Upload Code When you need to upload code to the ESP32 WROOM 32E, connect it to your computer using a Micro USB cable. Chapter 2. ESP32 Camera Extension...
Page 15
SunFounder ESP32 Starter Kit Inserting the Micro SD Card Gently push in the Micro SD card to secure it in place. Pushing it again will eject it. 2.3. Interface Insertion Guide...
Page 16
If the terminal is pushed up, it’s okay as long as the pins are not broken; you can simply press it back into position. If the battery is drained, plug in a 5V Micro USB to charge it. Chapter 2. ESP32 Camera Extension...
CHAPTER THREE BATTERY This is an 18650 type lithium-ion battery featuring a voltage of 3.7V and a capacity of 800mAh. It is equipped with a 15CM long 22AWG wire, with the positive lead in white and the negative in black, and a white PH2.0 2P terminal. Features •...
CHAPTER FOUR CAMERA The OV2640 camera module is compact, measuring just 21mm in length. It is equipped with a 1/4-inch lens and an aperture of f/2.4, offering a broad field of view of 68 degrees. This module delivers high-resolution images with a pixel count of 2 million and a maximum resolution of 1600x1200.
WiFi.Capture and process images with a camera module for visual applications.Store and retrieve data efficiently using a MicroSD card.These projects not only illustrate the versatile capabilities of the ESP32 but also equip you with the knowledge and skills to implement complex systems in your future endeavors.
Page 24
SunFounder ESP32 Starter Kit 5.1.2 Download the Arduino IDE 2.0 1. Vist . 2. Download the IDE for your OS version. 5.1.3 Installation Windows 1. Double click the arduino-ide_xxxx.exe file to run the downloaded file. 2. Read the License Agreement and agree it.
Page 25
SunFounder ESP32 Starter Kit 3. Choose installation options. 4. Choose install location. It is recommended that the software be installed on a drive other than the system drive. 5.1. 1.1 Install Arduino IDE(Important)
Page 26
SunFounder ESP32 Starter Kit 5. Then Finish. Chapter 5. Related Projects...
Page 27
SunFounder ESP32 Starter Kit macOS Double click on the downloaded arduino_ide_xxxx.dmg file and follow the instructions to copy the Arduino IDE.app to the Applications folder, you will see the Arduino IDE installed successfully after a few seconds. Linux For the tutorial on installing the Arduino IDE 2.0 on a Linux system, please refer to: https://docs.arduino.cc/software/...
Page 28
SunFounder ESP32 Starter Kit 2. In addition, your firewall or security center may pop up a few times asking you if you want to install some device driver. Please install all of them. 3. Now your Arduino IDE is ready! Note: In the event that some installations didn’t work due to network issues or other reasons, you...
Page 29
SunFounder ESP32 Starter Kit 5.2 1.2 Introduce of Arduino IDE 1. Verify: Compile your code. Any syntax problem will be prompted with errors. 2. Upload: Upload the code to your board. When you click the button, the RX and TX LEDs on the board will flicker fast and won’t stop until the upload is done.
Page 30
20. Search: Search the codes from your sketches. 5.3 1.3 Install the ESP32 Board(Important) To program the ESP32 microcontroller, we need to install the ESP32 board package in the Arduino IDE. Follow the step-by-step guide below: Install the ESP32 Board 1.
Page 31
This URL points to the package index file for the ESP32 boards. Click the OK button to save the changes. 4. In the Boards Manager window, type ESP32 in the search bar. Click the Install button to start the installation 5.3. 1.3 Install the ESP32 Board(Important)
Page 32
5. Congratulations! You have successfully installed the ESP32 board package in the Arduino IDE. Upload the Code 1. Now, connect the ESP32 WROOM 32E to your computer using a Micro USB cable. 2. Then select the correct board, ESP32 Dev Module, by clicking on Tools -> Board -> esp32. Chapter 5. Related Projects...
Page 33
Select other board and port. 5. In the search box, type ESP32 Dev Module and select it when it appears. Then, choose the correct port and click 5.3. 1.3 Install the ESP32 Board(Important)
Page 34
6. Afterward, you can select it through this quick access window. Note that during subsequent use, there may be times when ESP32 is not available in the quick access window, and you will need to repeat the above two steps.
Page 35
SunFounder ESP32 Starter Kit 5.4 1.4 Install libraries (Important) A library is a collection of pre-written code or functions that extend the capabilities of the Arduino IDE. Libraries provide ready-to-use code for various functionalities, allowing you to save time and effort in coding complex features.
Page 36
• ESP8266Audio 2. Open the Arduino IDE and go to Sketch -> Include Library -> Add .ZIP Library. 3. Navigate to the directory where the library files are located, and select the desired library file, like ESP32-A2DP. zip. Then, click Open.
Page 37
SunFounder ESP32 Starter Kit 4. After a short while, you will receive a notification indicating a successful installation. 5. Repeat the same process to add the ESP8266Audio.zip library. Note: The libraries installed using either of the above methods can be found in the default library directory of the Arduino IDE, which is usually located at C:\Users\xxx\Documents\Arduino\libraries.
Page 38
Among the many microcontroller development boards, the ESP32 stands out for its high performance and versatility. This project will show you how to use the digital output pins of the ESP32 board to control an external device—in this case, lighting up an LED. This serves as a foundation for learning ESP32 programming and an entry point into exploring IoT applications.
Page 39
SunFounder ESP32 Starter Kit COMPONENT INTRODUCTION PURCHASE LINK ESP32 WROOM 32E ESP32 Camera Extension Breadboard Several Jump Wires Resistor Schematic This circuit works on a simple principle, and the current direction is shown in the figure. The LED will light up after the 220ohm current limiting resistor when pin26 outputs high level.
Page 40
1. Download this code or copy this code to the Arduino IDE directly. Note: • Always displaying “Unknown COMxx”? 2. Then connect the ESP32 WROOM 32E to your computer using a Micro USB cable. • Always displaying “Unknown COMxx”? Chapter 5. Related Projects...
Page 41
SunFounder ESP32 Starter Kit 3. Select the board (ESP32 Dev Module) and the appropriate port. 4. Now, click the Upload button to upload the code to the ESP32 board. 5. After the code is uploaded successfully, you will see the LED blinking.
Page 42
LED gradually brightening and dimming, simulating a breathing effect. By using the PWM capabilities of the ESP32 WROOM 32E, we can achieve smooth and precise control over the LED’s brightness. This breathing effect adds a dynamic and visually appealing element to your projects, creating an eye-catching display or ambiance.
Page 43
SunFounder ESP32 Starter Kit Here is a list of available pins on the ESP32 board for this project. Available Pins IO13, IO12, IO14, IO27, IO26, IO25, IO33, IO32, IO15, IO2, IO0, IO4, IO5, IO18, IO19, IO21, IO22, IO23 Required Components In this project, we need the following components.
Page 44
SunFounder ESP32 Starter Kit Code 1. Download this code or copy this code to the Arduino IDE directly. Note: • Always displaying “Unknown COMxx”? After the code is uploaded successfully, you can see the LED breathing. How it works 1. Define constants and variables...
Page 45
SunFounder ESP32 Starter Kit void setup() { ledcSetup(0, 5000, 8); // Configure the PWM channel (0) with 5000Hz␣ frequency and 8-bit resolution ledcAttachPin(ledPin, 0); // Attach the LED pin to the PWM channel Here we use the (LED control) peripheral which is primarly designed to control the intensity of LEDs, although it can also be used to generate PWM signals for other purposes.
Page 46
This project not only introduces basic electronic concepts but also sets the stage for more complex control systems involving multiple inputs and outputs. Available Pins • Available Pins Here is a list of available pins on the ESP32 board for this project. For Input IO14, IO25, I35, I34, I39, I36, IO18, IO19, IO21, IO22, IO23 For Output...
Page 47
SunFounder ESP32 Starter Kit COMPONENT INTRODUCTION PURCHASE LINK ESP32 WROOM 32E ESP32 Camera Extension Breadboard Several Jump Wires Resistor Button Schematic To ensure proper functionality, connect one side of the button pin to 3.3V and the other side to IO14. When the button is pressed, IO14 will be set to high, causing the LED to light up.
Page 48
SunFounder ESP32 Starter Kit A four-pin button is designed in an H shape. When the button is not pressed, the left and right pins are Note: disconnected, and current cannot flow between them. However, when the button is pressed, the left and right pins are connected, creating a pathway for current to flow.
Page 49
The previous projects all involved outputting signals, either in the form of digital or PWM signals. This project involves receiving input signals from external component to the ESP32 board. You can view the input signal through the Serial Monitor in Arduino IDE.
Page 50
IO14, IO25, I35, I34, I39, I36 • Strapping Pins The following pins are strapping pins, which affect the startup process of the ESP32 during power on or reset. However, once the ESP32 is booted up successfully, they can be used as regular pins.
Page 51
SunFounder ESP32 Starter Kit COMPONENT INTRODUCTION PURCHASE LINK ESP32 WROOM 32E ESP32 Camera Extension Breadboard Several Jump Wires Resistor Potentiometer Schematic When you rotate the potentiometer, the value of I35 will change. By programming, you can use the value of I35 to control the brightness of the LED.
Page 52
SunFounder ESP32 Starter Kit change accordingly. Wiring Code Download this code or copy this code to the Arduino IDE directly. Note: • Always displaying “Unknown COMxx”? After the code is uploaded successfully, rotate the potentiometer and you will see the brightness of the LED change accordingly.
Page 53
In this lesson, we’ll delve into the capabilities of the I2C interface, a cornerstone for communication between micro- controllers and various peripherals. Our focus will be on utilizing the ESP32’s I2C interface to drive an LCD1602 module for character display.You will learn how to initialize the LCD module, configure display parameters, and send text data to be shown on the screen.
Page 54
SunFounder ESP32 Starter Kit Here is a list of available pins on the ESP32 board for this project. Available Pins Usage Description IO21 IO22 Required Components In this project, we need the following components. COMPONENT INTRODUCTION PURCHASE LINK ESP32 WROOM 32E...
Page 55
• The LiquidCrystal I2C library is used here, you can install it from the Library Manager. When this program is uploaded, the I2C LCD1602 will display the welcome message, “Hello, Sunfounder!”, for 3 seconds. After that, the screen will show a “COUNT:” label and the count value, which increments every second.
Page 56
SunFounder ESP32 Starter Kit void init() • Turn the (optional) backlight on. void backlight() • Turn the (optional) backlight off. void nobacklight() • Turn the LCD display on. void display() • Turn the LCD display off quickly. void nodisplay() • Clear display, set cursor position to zero.
Page 57
DC Motor L293D Motor Driver Available Pins Here is a list of available pins on the ESP32 board for this project. Available Pins IO13, IO14, IO27, IO26, IO25, IO33, IO32, IO15, IO2, IO0, IO4, IO5, IO18, IO19, IO21, IO22, IO23...
Page 58
(PWM) on the control pin, as shown below. Note: • Open the 4.1_motor_pwm.ino file under the path of esp32-starter-kit-main\c\codes\4.1_motor_pwm. • After selecting the board (ESP32 Dev Module) and the appropriate port, click the Upload button. • Always displaying “Unknown COMxx”? The previous code directly sets the two pins of the motor to high or low voltage levels to control the motor’s rotation...
Page 59
Several Jump Wires Servo Available Pins Here is a list of available pins on the ESP32 board for this project. Available Pins IO13, IO12, IO14, IO27, IO26, IO25, IO33, IO32, IO15, IO2, IO0, IO4, IO5, IO18, IO19, IO21, IO22, IO23 Schematic 5.11.
Page 60
SunFounder ESP32 Starter Kit Wiring • Orange wire is signal and connected to IO25. • Red wire is VCC and connected to 5V. • Brown wire is GND and connected to GND. Code Download this code or copy this code to the Arduino IDE directly.
Page 61
SunFounder ESP32 Starter Kit Once you finish uploading the code, you can see the servo arm rotating in the range 0°~180°. How it works? 1. Include the library: This line imports the ESP32Servo library, which is required to control the servo motor.
Page 62
BLE is a low-power wireless communication protocol that is designed for short-range communication. This document will cover the steps to set up the ESP32 to act as a BLE server and communicate with a BLE client over a serial connection.
Page 63
Bluetooth, enabling serial communication with other Bluetooth devices. To use the Bluetooth function of the ESP32 WROOM 32E, you need to program it using an appropriate software development kit (SDK) or using the Arduino IDE with the ESP32 BLE library. The ESP32 BLE library provides a high-level interface for working with BLE.
Page 64
SunFounder ESP32 Starter Kit 4. Select the correct board and port, then click the Upload button. Chapter 5. Related Projects...
Page 65
5. After the code has been successfully uploaded, turn on Bluetooth on your mobile device and open the LightBlue app. 6. On the Scan page, find ESP32-Bluetooth and click CONNECT. If you don’t see it, try refreshing the page a few times. When “Connected to device!” appears, the Bluetooth connection is successful. Scroll down to see the three UUIDs set in the code.
Page 66
SunFounder ESP32 Starter Kit 8. Go back to the Arduino IDE, open the Serial Monitor, set the baud rate to 115200, then type “welcome” and press Enter. Chapter 5. Related Projects...
Page 67
SunFounder ESP32 Starter Kit 9. You should now see the “welcome” message in the LightBlue app. 10. To send information from the mobile device to the Serial Monitor, click the Send UUID, set the data format to “UTF-8 String”, and write a message.
Page 68
SunFounder ESP32 Starter Kit 11. You should see the message in the Serial Monitor. How it works? This Arduino code is written for the ESP32 microcontroller and sets it up to communicate with a Bluetooth Low Energy (BLE) device. Chapter 5. Related Projects...
Page 69
SunFounder ESP32 Starter Kit The following is a brief summary of the code: • Include necessary libraries: The code begins by including necessary libraries for working with Bluetooth Low Energy (BLE) on the ESP32. #include "BLEDevice.h" #include "BLEServer.h" #include "BLEUtils.h"...
Page 70
(connected or disconnected) of the BLE server. MyCharacteristicCallbacks is used to handle write events on the BLE characteristic, i.e., when a connected device sends a string to the ESP32 over BLE, it’s captured and stored in receivedText, and the current time is recorded in lastMessageTime.
Page 71
DAC. When using the internal DAC of the ESP32, it is important to note that the output voltage level is limited to 1.1V. Therefore, it is recommended to use an external amplifier to boost the output voltage level to the desired level. It is also important to ensure that the audio data is in the correct format and sample rate to prevent distortion or noise during playback.
Page 72
SunFounder ESP32 Starter Kit In this project, we need the following components. COMPONENT INTRODUCTION PURCHASE LINK ESP32 WROOM 32E ESP32 Camera Extension Breadboard Several Jump Wires Resistor Speaker Operating Steps 1. Build the circuit. As this is a mono amplifier, you can connect IO25 to the L or R pin of the audio amplifier module.
Page 73
4. Once the code is uploaded successfully, turn on the Bluetooth-enabled device and search for available devices, then connect to the ESP32_Bluetooth. 5. Play audio on the device and the audio should be played through the speaker connected to the ESP32. Code Explanation 1.
Page 74
5.14 2.10 SD Card Write and Read This project demonstrates the core capabilities of using an SD card with the ESP32 microcontroller. It showcases essential operations such as mounting the SD card, creating a file, writing data to the file, and listing all files within the root directory.
Page 75
SunFounder ESP32 Starter Kit 2. Connect ESP32-WROOM-32E to the computer using the USB cable. 3. Select the appropriate port and board in the Arduino IDE and upload the code to your ESP32. Note: • Always displaying “Unknown COMxx”? 4. After the code is uploaded successfully, you will see a prompt indicating the successful file write, along with a list of all the filenames and sizes on the SD card.
Page 76
How it works? The purpose of this project is to demonstrate the usage of the SD card with the ESP32 board. The ESP32’s built-in SDMMC host peripheral is used to connect with the SD card. The project begins by initializing the serial communication and then attempts to mount the SD card. If the SD card fails to mount successfully, the program will print an error message and exit the setup function.
Page 77
SunFounder ESP32 Starter Kit File file SD_MMC.open("/test.txt", FILE_WRITE); (!file) { Serial.println("Failed to open file for writing"); // Print error␣ message if file failed to open return; • Write data to the file Write the text “Test file write” to the file. If the write operation is successful, it prints “File write successful”;...
Page 78
5.15 2.11 MP3 Player with SD Card Support Welcome to the exciting world of music with your ESP32! This project brings the power of audio processing to your fingertips, making your ESP32 not just an amazing microcontroller for computing but also your personalized music player.
Page 79
If your SD card’s music is already soft, you can remove or replace the resistor with a smaller value. 5. Connect ESP32-WROOM-32E to the computer using the USB cable. 5.15. 2.11 MP3 Player with SD Card Support...
Page 80
Manual Installation • ESP8266Audio 7. Select the appropriate port and board in the Arduino IDE and upload the code to your ESP32. 8. After successfully uploading the code, you will hear your favorite music playing. How it works? •...
Page 81
5.16 2.12 Take Photo SD This document describes a project that involves taking a photo using the ESP32-CAM and saving it to an SD card. The aim of the project is to provide a simple solution for capturing images using the ESP32-CAM and storing them on an SD card.
Page 82
Related Precautions When using the ESP32-CAM, it is important to note that the GPIO 0 pin must be connected to GND to upload a sketch. Additionally, after connecting GPIO 0 to GND, the ESP32-CAM onboard RESET button must be pressed to put the board in flashing mode.
Page 83
SunFounder ESP32 Starter Kit 5. Download this code or copy this code to the Arduino IDE directly. Note: • Always displaying “Unknown COMxx”? 6. Now, enable PSRAM. 5.16. 2.12 Take Photo SD...
Page 84
7. Set the partition scheme to Huge APP (3MB No OTA/1MB SPIFFS). 8. Select the appropriate port and board in the Arduino IDE and upload the code to your ESP32. 9. After the successful upload of the code, press the Reset button to take a photo. Additionally, you can check the...
Page 85
How it works? This code operates an AI Thinker ESP32-CAM to take a photo, save it to an SD card, and then put the ESP32-CAM into deep sleep. Here is a breakdown of the key parts: •...
Page 86
SD card. pictureNumber • Setup Function: In the setup() function, several tasks are accomplished: – First, the brown-out detector is disabled to prevent the ESP32-CAM from resetting during high current draws (like when the camera is operating). WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);...
Page 87
SunFounder ESP32 Starter Kit (continued from previous page) config.pin_sscb_scl SIOC_GPIO_NUM; config.pin_pwdn PWDN_GPIO_NUM; config.pin_reset RESET_GPIO_NUM; config.xclk_freq_hz 20000000; config.pixel_format PIXFORMAT_JPEG; – The camera is then initialized with the configuration, and if it fails, an error message is printed. esp_err_t err esp_camera_init(&config); (err ESP_OK) { Serial.printf("Camera init failed with error...
Page 88
OUTPUT); digitalWrite(4, LOW); rtc_gpio_hold_en(GPIO_NUM_4); – Sleep Mode: The ESP32-CAM goes into deep sleep after taking each photo to conserve power. It can be woken up by a reset or by a signal on specific pins. delay(2000); Serial.println("Going to sleep now");...
Page 89
SunFounder ESP32 Starter Kit How to do? 1. First plug in the camera. 2. Then, connect ESP32-WROOM-32E to the computer using the USB cable. 3. Download this code or copy this code to the Arduino IDE directly. Note: • Always displaying “Unknown COMxx”? 4.
Page 90
6. Set the partition scheme to Huge APP (3MB No OTA/1MB SPIFFS). 7. After selecting the correct board (ESP32 Dev Module) and port, click the “Upload” button. 8. You will see a successful WiFi connection message and the assigned IP address in the Serial Monitor.
Page 91
SunFounder ESP32 Starter Kit ..WiFi connected Starting web server on port: Starting stream server on port: Camera Ready! Use http://192.168.18.77 to connect 9. Enter the IP address in your web browser. You will see a web interface where you can click Start Stream to view the camera feed.
Page 92
SunFounder ESP32 Starter Kit Note: • This ESP32 module supports Face Detection. To enable it, set the resolution to 240x240 and toggle the Face Detection option at the bottom of the interface. • This ESP32 module does not support Face Recognition.
Page 93
SunFounder ESP32 Starter Kit How to do? 1. First plug in the camera. 2. Build the circuit. 3. Then, connect ESP32-WROOM-32E to the computer using the USB cable. 5.18. 2.14 Custom Video Streaming Web Server...
Page 94
"<PASSWORD>"; 6. After selecting the correct board (ESP32 Dev Module) and port, click the Upload button. 7. You will see a successful WiFi connection message and the assigned IP address in the Serial Monitor. WiFi connected Camera Stream Ready! Go to: http://192.168.18.77 8.
Page 95
SunFounder ESP32 Starter Kit 9. Insert a battery into the expansion board and remove the USB cable. Now you can place the device anywhere you desire within the Wi-Fi range. 5.18. 2.14 Custom Video Streaming Web Server...
Page 96
SunFounder ESP32 Starter Kit 5.19 2.15 Blynk-based Intrusion Notification System This project demonstrate a simple home intrusion detection system using a PIR motion sensor (HC-SR501). When the system is set to “Away” mode through the Blynk app, the PIR sensor monitors for motion. Any detected movement triggers a notification on the Blynk app, alerting the user of potential intrusion.
Page 98
SunFounder ESP32 Starter Kit 2. Enter your email to initiate the registration process. 3. Confirm your registration through your email. Chapter 5. Related Projects...
Page 99
SunFounder ESP32 Starter Kit 4. After confirmation, Blynk Tour will appear. It is recommended to select “Skip”. If Quick Start also appears, consider skipping it as well. 2.2 Template Creation 1. First, create a template in Blynk. Follow the subsequent instructions to create the Intrusion Alert System template.
Page 100
SunFounder ESP32 Starter Kit 2. Assign a name to the template, select ESP32 Hardware, and select Connection Type as WiFi, then select Done. 2.3 Datastream Generation Open the template you just set up, let’s create two datastreams. 1. Click New Datastream.
Page 101
SunFounder ESP32 Starter Kit 2. In the popup, choose Virtual Pin. 3. Name the Virtual Pin V0 as AwayMode. Set the DATA TYPE as Integer with MIN and MAX values as 0 and 5.19. 2.15 Blynk-based Intrusion Notification System...
Page 102
SunFounder ESP32 Starter Kit 4. Similarly, create another Virtual Pin datastream. Name it Current Status and set the DATA TYPE to String. 2.4 Setting Up an Event Next, we’ll set up an event that sends an email notification if an intrusion is detected.
Page 103
SunFounder ESP32 Starter Kit 1. Click Add New Event. 2. Define the event’s name and its specific code. For TYPE, choose Warning and write a short description for the email to be sent when the event happens. You can also adjust how often you get notified.
Page 104
SunFounder ESP32 Starter Kit 3. Go to the Notifications section to turn on notifications and set up email details. 2.5 Fine-Tuning the Web Dashboard Making sure the Web Dashboard interacts perfectly with the Intrusion Alert System is vital. 1. Simply drag and place both the Switch widget and the Label widget onto the Web Dashboard.
Page 105
SunFounder ESP32 Starter Kit 2. When you hover over a widget, three icons will appear. Use the settings icon to adjust the widget’s properties. 3. In the Switch widget settings, select Datastream as AwayMode(V0). Set ONLABEL and OFFLABEL to display “away” and “home”, respectively.
Page 106
SunFounder ESP32 Starter Kit 4. In the Label widget settings, select Datastream as Current Status(V1). 2.6 Saving the Template Lastly, don’t forget to save your template. Chapter 5. Related Projects...
Page 107
SunFounder ESP32 Starter Kit 2.7 Making a Device 1. It’s time to create a new device. 2. Click on From template to start with a new setup. 5.19. 2.15 Blynk-based Intrusion Notification System...
Page 108
3. Then, pick the Intrusion Alert System template and click on Create. 4. Here, you’ll see the Template ID, Device Name, and AuthToken. You need to copy these into your code so the ESP32 can work with Blynk. Chapter 5. Related Projects...
Page 109
#define BLYNK_AUTH_TOKEN "xxxxxxxxxxxxx" 4. You also need to enter your WiFi network’s ssid and password. char ssid[] "your_ssid"; char pass[] "your_password"; 5. Choose the correct board (ESP32 Dev Module) and port, then click the Upload button. 5.19. 2.15 Blynk-based Intrusion Notification System...
Page 110
SunFounder ESP32 Starter Kit 6. Open the Serial monitor (set baud rate to 115200) and wait for a successful connection message. 7. After a successful connection, activating the switch in Blynk will start the PIR module’s surveillance. When motion is detected (state of 1), it will say, “Somebody here!” and send an alert to your email.
Page 111
SunFounder ESP32 Starter Kit 5.19.4 4. Code explanation 1. Configuration & Libraries Here, you set up the Blynk constants and credentials. You also include the necessary libraries for the ESP32 and Blynk. /* Comment this out to disable prints and save space */ #define BLYNK_PRINT Serial #define BLYNK_TEMPLATE_ID "xxxxxxxxxxx"...
Page 112
SunFounder ESP32 Starter Kit The loop function continuously runs Blynk and the Blynk timer functions. void loop() { Blynk.run(); timer.run(); 6. Blynk App Interaction These functions are called when the device connects to Blynk and when there’s a change in the state of the virtual pin V0 on the Blynk app.
CHAPTER 6.1 How to use Blynk on mobile device? Note: As datastreams can only be created in Blynk on the web, you will need to reference different projects to create datastreams on the web, then follow the tutorial below to create widgets in Blynk on your mobile device. 1.
Page 116
SunFounder ESP32 Starter Kit 7. Now you will see a Joystick widget appear in the blank area, click on it. 8. Joystick Settings will appear, select the Xvalue and Yvalue datastreams you just set in the web page. Note that each widget corresponds to a different datastream in each project.
Page 117
SunFounder ESP32 Starter Kit 6.2 How to format the SD card? The steps to ensure your SD card is formatted correctly may vary depending on your operating system. Here are simple steps on how to format an SD card in Windows, MacOS, and Linux: Windows 1.
Page 118
SunFounder ESP32 Starter Kit MacOS 1. Insert your SD card into the computer. Open the “Disk Utility” application (can be found in the “Utilities” folder). 2. Select your SD card from the list on the left and then click “Erase”.
Page 119
SunFounder ESP32 Starter Kit 4. Finally, wait for the formatting to complete. Linux • First, insert your SD card and then open a terminal. • Type lsblk and find your SD card’s name in the device list (e.g., it may be sdb).
Page 120
When plugging the ESP32 into the computer, the Arduino IDE often displays Unknown COMxx. Why does this happen? This is because the USB driver for ESP32 is different from the regular Arduino Boards. The Arduino IDE can’t automatically recognize this board.
Page 121
SunFounder ESP32 Starter Kit 3. Now, you should be able to see your board and port in this quick view window. 6.3. Always displaying “Unknown COMxx”?
SEVEN COPYRIGHT NOTICE All contents including but not limited to texts, images, and code in this manual are owned by the SunFounder Company. You should only use it for personal study, investigation, enjoyment, or other non-commercial or nonprofit purposes, under the related regulations and copyrights laws, without infringing the legal rights of the author and relevant right holders.
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers