How I Build Camera With Esp32-Cam From Scratch

by DsnIndustries in Circuits > Arduino

200 Views, 4 Favorites, 0 Comments

How I Build Camera With Esp32-Cam From Scratch

222.jpg
Building a Gameboy Camera with ESP32-CAM: Complete Guide

Build a $20 DIY Retro Camera! 📸 ESP32-CAM + OLED live preview & SD storage. Game Boy style tech you can make at home!

This guide details the journey of building a DIY Retro Digital Camera using the affordable ESP32-CAM module, inspired by the nostalgic, lo-fi aesthetic of the original Game Boy Camera.

The Story: From Failure to Monochrome Success

The project initially aimed for a high-end portable camera using colorful TFT displays. However, the AI-Thinker ESP32-CAM has limited usable GPIO pins, leading to constant crashes when trying to run a screen, SD card, and shutter button simultaneously over SPI.

Just before abandoning the build, the solution appeared: switching to a monochrome OLED screen. By utilizing I2C communication, the build only requires two wires for the display, leaving enough pins free for the SD card to function correctly. The result is a charming, grayscale "Game Boy" style camera that captures high-resolution photos to an SD card for under $20.

Supplies

Project Components


Core Electronics

  1. ESP32-CAM (AI-Thinker)
  2. 0.96" SSD1306 OLED Display (I2C Version)
  3. 1.69" ST7789 TFT Display
  4. MicroSD Card (Must be formatted to FAT32)
  5. Tactile Pushbutton (Shutter)


Portable Assembly

  1. 3D Printed Case (Designed in Fusion 360)
  2. TP4056 Charging Board & LiPo Battery
  3. Voltage Booster (Must be set to 5V)
  4. On-Off Sliding Switch
  5. TactileButton


Prepare the Firmware

  1. Install Tools: Set up the Arduino IDE with the ESP32 board manager and select AI Thinker ESP32-CAM.

https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

  1. Libraries: Install Adafruit GFX, Adafruit SSD1306, tft_eSPI and JPEGDecoder.

https://github.com/adafruit/Adafruit-GFX-Library

https://github.com/adafruit/Adafruit_SSD1306

https://github.com/Bodmer/TFT_eSPI

https://github.com/Bodmer/JPEGDecoder

  1. Code Customization: In the "DIY Camera" script, you can toggle the internal flash ON or OFF for better lighting.


Uploading the Code

boot wiring.png

The ESP32-CAM requires a specific boot sequence for uploading:

  1. Connect a UART module (CH340) to the board.
  2. Short circuit IO0 to Ground and press Reset to enter boot mode.
  3. Click Upload in the Arduino IDE.


Assembly and Operation

Portable Camere Wiring.jpg
st7789 wiring.jpg
wiring Cam.jpg
  1. Wiring: Follow the I2C wiring for the OLED (Pins 14 and 15) to avoid interfering with the SD card.
  2. Photo Capture: Once powered, the OLED shows a grayscale live preview and a persistent photo counter.
  3. Saving: When the shutter is pressed, the image is processed, the flash fires, and the photo is saved with a unique filename stored in EEPROM (so the counter persists after rebooting).

3D Model : https://cults3d.com/en/3d-model/gadget/diy-esp32-cam-camera-project

Github Repo : https://github.com/derdacavga/DIY-Camera