Build a Throwable Spy-Cam Ball Robot
Toss it like a cricket ball. It lands, pops open, raises its camera, and streams live video — all powered by an ESP32-CAM, a servo, and a few LEDs. Here's how to build your own, step by step.
Mission Overview
How does a throwable camera ball actually work?
The idea is simple: a tough little ball you can toss into a bush, over a wall, or across a field. The moment it stops rolling, it wakes itself up and shows you what's around it on a screen.
Toss the ball into the area you want to see.
A simple sensor feels the impact and bounce.
The servo motor opens the shell like a flower.
The ESP32-CAM lifts up and starts streaming.
Shopping List
Parts you'll need
Everything on this list is beginner-friendly and easy to find online or at a local electronics shop.
Build Log
Step-by-step build instructions
Prepare the ball shell
Cut a lightweight hollow ball into 4 hinged petals that can fold inward and spring open. Foam balls or 3D-printed shells both work well.
Mount the ESP32-CAM
Fix the ESP32-CAM at the centre of the ball on a small platform, lens facing upward, so it points outward once the mast rises.
Attach the servo and mast
Connect the servo horn to a small rod (the "mast"). When the servo turns, the mast should push the camera up through the open petals.
Wire the LEDs and sensor
Connect the LEDs (through resistors) and the tilt/vibration sensor to the ESP32-CAM's GPIO pins, following the circuit diagram above.
Add the battery
Tuck the small LiPo battery into the base of the shell and connect it to the ESP32-CAM's 5V and GND pins.
Upload the code
Connect the ESP32-CAM to your computer using the FTDI programmer and upload the code from the next section using the Arduino IDE.
Test before you throw!
Place the ball on a soft surface first, tap it gently to trigger the sensor, and check that the shell opens and the video stream appears on your phone or laptop.
Code Room
Arduino code for the ESP32-CAM
This sketch waits for the "landing" sensor to trigger, then opens the shell, turns on the lights, and starts the live video stream.
// Portable Spy-Cam Ball — main sketch // Board: AI-Thinker ESP32-CAM #include "esp_camera.h" #include <WiFi.h> #include <ESP32Servo.h> // ---- Wi-Fi details ---- const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; // ---- Pin setup ---- #define LED_PIN 4 #define SERVO_PIN 12 #define SENSOR_PIN 13 Servo lidServo; bool hasLanded = false; // starts the camera's video streaming server void startCameraServer(); void setup() { Serial.begin(115200); pinMode(LED_PIN, OUTPUT); pinMode(SENSOR_PIN, INPUT); lidServo.attach(SERVO_PIN); lidServo.write(0); // shell starts closed // ---- Camera configuration ---- camera_config_t config; config.pin_d0 = 5; config.pin_d1 = 18; config.pin_d2 = 19; config.pin_d3 = 21; config.pin_d4 = 36; config.pin_d5 = 39; config.pin_d6 = 34; config.pin_d7 = 35; config.pin_xclk = 0; config.pin_pclk = 22; config.pin_vsync = 25; config.pin_href = 23; config.pin_sscb_sda = 26; config.pin_sscb_scl = 27; config.pin_pwdn = 32; config.pin_reset = -1; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; config.frame_size = FRAMESIZE_VGA; config.jpeg_quality = 12; config.fb_count = 1; esp_camera_init(&config); // ---- Connect to Wi-Fi ---- WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(400); Serial.print("."); } Serial.println("\nWi-Fi connected!"); Serial.println(WiFi.localIP()); } void loop() { // ---- Wait until the ball lands ---- if (!hasLanded && digitalRead(SENSOR_PIN) == HIGH) { Serial.println("Impact detected — unfolding!"); delay(300); // let it settle for a moment digitalWrite(LED_PIN, HIGH); // lights on lidServo.write(90); // open the shell & raise the mast delay(600); startCameraServer(); // begin streaming video hasLanded = true; } }
The startCameraServer() function comes straight from the official ESP32-CAM "CameraWebServer" example that ships with the Arduino ESP32 board package — once it runs, you can view the live video by opening the ESP32-CAM's IP address in a web browser.
Important Notes
Safety and good practice
Adult supervision required. Soldering, wiring batteries, and cutting the ball shell should always be done with a parent, teacher, or mentor nearby.
Use it responsibly. This is a hobby robotics project best used for things like search-and-rescue practice, wildlife watching, backyard games, or checking a hidden spot before entering it (like a cave or a den) — always with the permission of anyone whose space you're filming, and never to spy on people without their knowledge.
Battery care. Only use a proper LiPo charger, never puncture or overcharge the battery, and store it somewhere cool and dry.
Quick Answers
Frequently asked questions
What is an ESP32-CAM used for?
The ESP32-CAM is a small, low-cost Wi-Fi module with a built-in camera. It's popular in robotics and DIY electronics for projects like smart doorbells, robot vision, wildlife cameras, and — like here — a throwable streaming camera ball.
Is this project okay for beginners?
Yes! It uses common, beginner-friendly parts and free, well-documented example code. Kids new to robotics should build it together with an adult, especially for the soldering and battery steps.
Do I need to know how to code to build this?
Not really — the code above is based on the standard example that comes with the ESP32 Arduino library, so you mostly just need to fill in your Wi-Fi name and password and upload it.
Can the servo really make the ball "unfold"?
Yes. A single micro servo can rotate a simple hinge or push-rod mechanism enough to spring open a lightweight foam shell and lift a small camera mast a few centimetres — plenty to clear the top of the ball.
What else can I build with an ESP32-CAM and a servo?
The same core parts can become a pan-tilt security camera, a robot car with a moving camera head, a smart peephole viewer, or a remote-controlled periscope.

Comments
Post a Comment