GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsA small camera inside the porch looking at the doorstep, with the PIR beside it, photographs every delivery. Good for proving a parcel was left, or spotting somebody who rings and runs.
Tell people that a camera is there, and do not point it at neighbours' windows, bathrooms or the road. Follow your local privacy rules.
Tick anything you already have and the total updates.
Passive infrared sensor that detects the body heat of moving people or animals up to about 7 m away.
Follow the colours: red is power, dark grey is ground, blue is a signal.
esp32_cam_letterbox_camera.inoVerify & upload in Electrolark// Letterbox and doorstep delivery camera
// Geekobot project library · board: ESP32-CAM
// Wiring diagram, parts list and build steps: Geekobot project page "esp32-cam-letterbox-camera"
#include "esp_camera.h"
#include "FS.h"
#include "SD_MMC.h"
// ---- pins ----
const uint8_t PIR_PIN = 13;
// ---- latest readings ----
bool motion = false;
int photoCount = 0;
unsigned long lastShot = 0;
const unsigned long GAP_MS = 5000; // at most one photo every 5 s
bool initCamera() {
camera_config_t cfg = {};
cfg.ledc_channel = LEDC_CHANNEL_0; cfg.ledc_timer = LEDC_TIMER_0;
cfg.pin_d0 = 5; cfg.pin_d1 = 18; cfg.pin_d2 = 19; cfg.pin_d3 = 21; cfg.pin_d4 = 36; cfg.pin_d5 = 39; cfg.pin_d6 = 34; cfg.pin_d7 = 35;
cfg.pin_xclk = 0; cfg.pin_pclk = 22; cfg.pin_vsync = 25; cfg.pin_href = 23;
cfg.pin_sccb_sda = 26; cfg.pin_sccb_scl = 27; cfg.pin_pwdn = 32; cfg.pin_reset = -1;
cfg.xclk_freq_hz = 20000000; cfg.pixel_format = PIXFORMAT_JPEG;
cfg.frame_size = FRAMESIZE_SVGA; cfg.jpeg_quality = 10; cfg.fb_count = 1;
cfg.fb_location = psramFound() ? CAMERA_FB_IN_PSRAM : CAMERA_FB_IN_DRAM;
return esp_camera_init(&cfg) == ESP_OK;
}
void takePhoto() {
camera_fb_t* fb = esp_camera_fb_get();
if (!fb) { Serial.println(F("Capture failed")); return; }
char name[24];
snprintf(name, sizeof(name), "/motion_%04d.jpg", ++photoCount);
File f = SD_MMC.open(name, FILE_WRITE);
if (f) { f.write(fb->buf, fb->len); f.close(); Serial.print(F("Saved ")); Serial.println(name); }
else Serial.println(F("SD write failed"));
esp_camera_fb_return(fb);
}
void setup() {
Serial.begin(115200);
pinMode(PIR_PIN, INPUT);
if (!initCamera()) Serial.println(F("Camera init failed"));
if (!SD_MMC.begin("/sdcard", true)) Serial.println(F("microSD not found (1-bit mode)")); // 1-bit mode leaves GPIO 4 free
else { File root = SD_MMC.open("/"); File f; while ((f = root.openNextFile())) { photoCount++; f.close(); } Serial.print(photoCount); Serial.println(F(" photos already on the card")); }
delay(1000);
}
void loop() {
motion = digitalRead(PIR_PIN) == HIGH;
if (motion && millis() - lastShot > GAP_MS) { lastShot = millis(); takePhoto(); }
delay(100);
}
The sketch above runs here on a simulated ESP32-CAM. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Give it a minute to settle after power-up and keep it away from heaters, windows and fans.
Turn the sensitivity (Sx) pot clockwise and check the module has 5 V on VCC.
Format the card as FAT32 (32 GB or smaller) and push it fully in. The sketch uses 1-bit mode so GPIO 13 stays free for the PIR.
Give the camera more light, wipe the lens and keep the PIR and camera steady on a fixed mount.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Use a 5 V USB phone charger or a power bank into the board's USB port.
4 parts: ESP32 S-CAM-CH340 Development Board with OV2640 Camera, HC-SR501 PIR Motion Detector Sensor Module, Official Raspberry Pi 32GB A2 Class Micro SD Card and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 7 steps.
No. This page has the complete, tested code (esp32_cam_letterbox_camera.ino).
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹1,559 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Digital inputs and sensor hold time.
Tell people that a camera is there, and do not point it at neighbours' windows, bathrooms or the road. Follow your local privacy rules.
Ideas that reuse this build: Porch parcel camera and Mailbox letter arrival alert. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.
0 photos already on the card
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.