
The Problem: Security Cameras Are Expensive and Complicated
Walk into any electronics store. A basic security camera? 2000-5000 Taka. A decent one with remote viewing? 10,000+. And they all want your data in their cloud.
But here’s what bothered me more: why do I need a computer to see what my camera sees?
Most ESP32 CAM tutorials show you how to stream to a browser. Cool, but then you’re stuck with your laptop open, refreshing the page, hoping it works.
I wanted something different.
Something truly portable. A camera that streams directly to a handheld screen. No PC. No router. No cloud. Just two ESP32s talking to each other.
And I wanted to build it myself.
So here it is: a standalone CCTV system where the ESP32 CAM streams video to a 2.8-inch TFT display – no computer needed, no internet required, just pure DIY goodness.
The Project Concept: Two ESP32s, One Connection
Here’s the simple idea:
| Component | Role | What It Does |
|---|---|---|
| ESP32 CAM | Client | Captures video, sends it wirelessly |
| ESP32 + TFT Display | Server | Receives video, shows it on screen |
| WiFi Access Point | Bridge | Direct connection – no router needed! |
The camera captures JPG images, sends them over WebSocket, and the display decodes and shows them. Latency is surprisingly low.
Why Build This Instead of Buying?
| Reason | Why It Matters |
|---|---|
| No PC needed | Truly portable – take it anywhere |
| No internet required | Works in remote locations |
| No cloud subscription | Your footage stays yours |
| Learn something | Understand how video streaming works |
| Customizable | Add battery, case, night vision – your call |
| Cheaper | ~2000-2500 Taka total |
For a student budget? This is a no-brainer.
What You’ll Need (Complete Parts List)
Camera Side (Client)
| Component | Specs | Notes |
|---|---|---|
| ESP32 CAM Module | AI-Thinker | The main board |
| OV2640 Camera | 2MP | Comes with most ESP32 CAM modules |
| ESP32 CAM-MB Programmer | Micro USB | For programming and power |
| Micro USB Cable | Data-capable | For uploads |

Display Side (Server)
| Component | Specs | Notes |
|---|---|---|
| ESP32 Development Board | Type-C version | Any ESP32 works |
| 2.8″ TFT LCD Display | ST7789 driver | 240×320 resolution |
| Breadboard | 400 points or larger | For connections |
| Jumper Wires | Male-to-female | At least 20 |
| USB-C Cable | Data-capable | For programming and power |

Optional Upgrades
| Item | Why You Might Want It |
|---|---|
| LiPo Battery + TP4056 | Make it truly portable |
| 3D Printed Case | Protect the components |
| IR LEDs | Night vision capability |
Quick Buy Links (Affiliate)
| Component | Where to Find |
|---|---|
| ESP32-CAM + OV2640 | AliExpress |
| ESP32 Development Board | AliExpress |
| 2.8″ TFT Display ST7789 | AliExpress |
| Breadboard + Jumpers Kit | AliExpress |
Display Side (Server)
| Component | Specs | Notes |
|---|---|---|
| ESP32 Development Board | Type-C version | Any ESP32 works |
| 2.8″ TFT LCD Display | ST7789 driver | 240×320 resolution |
| Breadboard | 400 points or larger | For connections |
| Jumper Wires | Male-to-female | At least 20 |
| USB-C Cable | Data-capable | For programming and power |
Optional Upgrades
| Item | Why You Might Want It |
|---|---|
| LiPo Battery + TP4056 | Make it truly portable |
| 3D Printed Case | Protect the components |
| IR LEDs | Night vision capability |
Hardware Assembly: Camera Side (Client)
This part is dead simple.
Step 1: Take the OV2640 camera module. Carefully insert the ribbon cable into the ESP32-CAM slot. The contacts should face down (toward the PCB).
Step 2: Gently press the camera down until it clicks into place. The connector should close fully.
Step 3: Attach the ESP32-CAM to the ESP32-CAM-MB programmer. The pins should align perfectly.
Step 4: Connect the Micro USB cable to the programmer. That’s it for the camera side.
Pro tip: The ESP32-CAM programmer has a small switch. Leave it in the middle position for normal operation.
Hardware Assembly: Display Side (Server)
This is where things get interesting. You’ll be connecting the TFT display to the ESP32 using jumper wires.
Pin Connections (Critical – Get This Right!)
| TFT Display Pin | Connect To (ESP32) | Notes |
|---|---|---|
| VCC | 3.3V | Power for display |
| GND | GND | Common ground |
| SCL | GPIO18 | SPI Clock |
| SDA | GPIO23 | SPI Data (MOSI) |
| RES | GPIO26 | Reset |
| DC | GPIO25 | Data/Command |
| CS | GPIO33 | Chip Select |
| BL (Backlight) | 3.3V | Or use PWM for brightness control |

Step-by-step:
Step 1: Place the ESP32 and TFT display on a breadboard (or two breadboards for more space).
Step 2: Start with power and ground. Connect VCC → 3.3V and GND → GND.
Step 3: Connect the SPI pins (SCL, SDA, RES, DC, CS) according to the table above.
Step 4: Connect the backlight (BL) to 3.3V for full brightness.
Step 5: Double-check every connection. One wrong pin and the display won’t work.

Software Setup: Arduino IDE Configuration
Before writing any code, we need to install the right libraries.
Required Libraries
| Library | Where to Find | Purpose |
|---|---|---|
| TFT_eSPI | Library Manager | Drives the TFT display |
| Arduino WebSockets | Library Manager | Handles real-time data transfer |
| TJPG_Decoder | Library Manager | Decodes JPG images |
| WiFi | Built-in | Networking |
| ESP32 CAM Libraries | Board Manager | For camera side |
Install ESP32 Board Support
-
Open Arduino IDE
-
File → Preferences
-
Add this URL to Additional Board Manager URLs:
texthttps://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
-
Tools → Board → Boards Manager
-
Search “ESP32” and install
Install Libraries
-
Tools → Manage Libraries
-
Search and install:
-
TFT_eSPI by Bodmer
-
Arduino WebSockets by Markus Sattler
-
TJPG_Decoder by Bodmer
-
Critical Step: Configuring TFT_eSPI
The TFT_eSPI library needs to know what display you’re using. This is where most beginners get stuck.
Step 1: Find the TFT_eSPI library folder on your computer:
-
Windows:
Documents/Arduino/libraries/TFT_eSPI -
Mac:
~/Documents/Arduino/libraries/TFT_eSPI -
Linux:
~/Arduino/libraries/TFT_eSPI
Step 2: Open the User_Setup.h file (or rename User_Setup_Select.h to point to it).
Step 3: Comment out the generic setup line. Find:
// #include <User_Setup.h>
Uncomment it (remove the //).
Step 4: Configure your display. Find the ST7789 section and uncomment:
#define ST7789_DRIVER // Configure all registers
Step 5: Set the correct dimensions:
#define TFT_WIDTH 240 #define TFT_HEIGHT 320
Step 6: Define your pin connections (match what you wired):
#define TFT_CS 33 #define TFT_DC 25 #define TFT_RST 26 #define TFT_MOSI 23 #define TFT_SCLK 18
Step 7: Save the file.
Step 8: Test the display. Upload the “GraphicTest” example from TFT_eSPI. If you see colorful shapes, you’re good to go!
Server-Side Code (The Display)
This code makes the ESP32 act as a WiFi Access Point and WebSocket server.
Complete Server Code
Client-Side Code (The Camera)
This code runs on the ESP32 CAM. It captures images and sends them to the server.
Complete Camera Code
Upgrades and Improvements
1. Make It Portable
Add a 18650 battery + TP4056 charger. Mount everything in a 3D printed case. Now you have a truly wireless CCTV system.
2. Add Recording
Save footage to an SD card. The ESP32 CAM has an SD slot – add code to record when motion is detected.
3. Night Vision
Add IR LEDs and remove the IR filter from the camera. Now it works in complete darkness.
4. Multiple Cameras
Modify the code to switch between multiple camera streams. One display, many views.
5. Battery Level Indicator
Add a voltage divider to read battery voltage. Show the level on the TFT screen.
6. Motion Detection
Use pixel difference detection. When something moves, trigger an alert or start recording.
Cost Breakdown (USD)
| Component | Approx Price (USD) |
|---|---|
| ESP32 CAM + OV2640 | $10.00 – $12.50 |
| ESP32 Development Board | $5.00 – $6.67 |
| 2.8″ TFT Display (ST7789) | $4.17 – $5.83 |
| Breadboard + Jumpers | $1.25 – $1.67 |
| USB Cables | $1.67 – $2.50 |
| Total | $22.09 – $29.17 |
For a functional CCTV system with no cloud fees? That’s incredible value.
Your Turn
Have you built this project? Got it working? Stuck somewhere? Drop a comment and let me know.
And if you add upgrades (battery, case, night vision) – tag me. I want to see what you come up with.
What’s Next?
I’m planning to:
-
Add a battery and make it truly portable
-
Design a 3D printed case
-
Add motion detection with buzzer alert
-
Maybe add a second camera and switch between feeds
If you build this project, let me know. Share your mods, your upgrades, your fails. That’s how we all learn.
FAQ's
Affiliate Disclosure
Some links in this post are affiliate links. If you purchase through them, I may earn a small commission at no extra cost to you. This helps support Roborear. Thanks!


