SunFounder ESP32 Starter Kit
(continued from previous page)
Serial.println("Failed to open file in writing mode");
} else {
file.write(fb->buf, fb->len); // payload (image), payload length
Serial.printf("Saved file to path: %s\n", path.c_str());
EEPROM.write(0, pictureNumber);
EEPROM.commit();
}
file.close();
esp_camera_fb_return(fb);
– Finally, the onboard LED (flash) is turned off and the ESP32-CAM goes into deep sleep.
pinMode(4, 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");
delay(2000);
esp_deep_sleep_start();
Serial.println("This will never be printed");
• Loop Function: The loop() function is empty because after the setup process, the ESP32-CAM immediately
goes into deep sleep.
Note that for this code to work, you need to ensure that GPIO 0 is connected to GND when uploading the sketch, and
you might have to press the on-board RESET button to put your board into flashing mode. Also, remember to replace
“/picture” with your own file name. The size of the EEPROM is set to 1, which means it can store values from 0 to
255. If you plan to take more than 255 pictures, you’ll need to increase the EEPROM size and adjust how you store
and read the pictureNumber.
8. Bluetooth&SD Card&Camera&Speaker
1.44 8.1 Real-time Weather From @OpenWeatherMap
The IoT Open Weather Display project utilizes the ESP32 board and an I2C LCD1602 module to create a weather
information display that retrieves data from the OpenWeatherMap API.
This project serves as an excellent introduction to working with APIs, Wi-Fi connectivity, and data display on an LCD
module using the ESP32 board. With the IoT Open Weather Display, you can conveniently access real-time weather
updates at a glance, making it an ideal solution for home or office environments.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name ITEMS IN THIS KIT LINK
ESP32 Starter Kit 320+
1.44. 8.1 Real-time Weather From @OpenWeatherMap 165