From zero to a 4 cm flying camera
Six versions, each one teaching you the next layer. Every idea is explained in plain words first, maths second. Every number is either checked against a source or clearly marked as an estimate for you to replace with your own measurement.
0Start here
This page is your project's home base. It's a plain file in your project folder, with no internet needed except for links. Your ticked boxes in the plan are saved in this browser.
- Today: read sections 1–4 (about 40 minutes). They tell you what we're building, why in this order, and what's possible.
- Every day: open §6 The build plan. Work through 3-day blocks and tick them off. Put your real start date in and every date updates.
- When a block says "read §5.x": read that part of §5. It's the textbook, so don't try to read it all upfront.
- When a block says "order": go to §7.
The coloured boxes mean different things:
Numbers with "≈" are estimates. Things marked weigh it have no published figure. Your 0.01 g scale (first order, §7) becomes the source of truth. Hardware always surprises you. When something here turns out wrong, tell me and we'll update the plan.
1What we agreed
Your answers, and what each one changes in the plan:
| Topic | You said | What it means for the plan |
|---|---|---|
| Size | Two stages: learn at ~6.5 cm, then true 4 cm | v1–v3 are 7–8.5 cm overall, where flying is forgiving. v5 "Queen" targets a 40 × 40 mm box including propellers. Your original limit was "4 or 5 cm", so up to 50 mm is acceptable if the physics demands it. |
| Where it flies | Indoors → calm outdoors → high outdoors on a map | v1–v3 indoors, v4 "Forager" outdoors. It's bigger, because wind beats tiny drones (§5.1). |
| Camera | Live view, SD recording, FPV goggles, easiest first | v2: live view + SD recording. v4: optional analog FPV (near-zero delay). v5: camera at bee size. |
| Control | Phone, laptop + gamepad, RC radio, own remote | v1: phone web page + laptop gamepad. v3: your own ESP-NOW remote. v4: ExpressLRS RC radio, where long range matters. Moving the RC radio to v4 is a budget choice (§7). |
| Flight code | Your own, plus a safety net | You write the flight controller with me, and you'll understand every module's logic. An open-source firmware (ESP-Drone family) stays flashable so you can always ask "is it my code or my hardware?" |
| Features | Everything, by the last version | All of it is in the ladder (§3). Honest physics: a 4 cm drone can't carry everything at once, so the Queen uses swappable "backpacks" (flow sensor / GPS / payload), like Bitcraze's decks. |
| Budget | ₹15k–35k | The cheapest path to v6 is ≈ ₹30–35k. A comfortable path is ≈ ₹46–52k. §7 shows exactly where the money goes and what to cut. |
| Time | 35+ hours a week | ≈ 3 weeks of bench + simulator, first free flight ≈ week 6, v6 ≈ 32 weeks from start. |
| Skills | Starting from zero | v0 starts with fundamentals. Every firmware module gets a "logic card" (§5.10) so you understand what and why without memorising syntax. |
| Phone | iPhone and Android both | Phone control is a web page served by the drone, so it works on both with no app store. Android is also used for the cheap analog-FPV USB receiver. |
| Look | Function first, bee later | Bare boards while learning. A printed bee shell arrives in v5. |
| Explanations | Plain words first, then maths | That's how all of §5 is written. |
2Gemini's plan, reviewed
Gemini got the direction right: a quadcopter (not flapping wings), an ESP32-S3 brain, and heavy AI on the laptop. Several specifics were wrong or risky, though. Here's each claim checked:
| Gemini said | Verdict | Why | What we do instead |
|---|---|---|---|
| Flapping wings can't carry a battery + camera at 4–5 cm. Build a quad. | Right | Correct. Even Harvard's RoboBee flies tethered. | Quadcopter. |
| A 45–48 mm PCB with 716 motors and 31 mm props is a "4–5 cm" drone. | Wrong | The props stick out past the board. Motor spacing ≈ 41 mm + one 31 mm prop ≈ 72 mm overall. Geometry fact: a square box of side B fits four non-overlapping props of diameter at most B/2 (§5.1). A real 4 cm drone has ≤ 20 mm props. | Be honest about size. v1 ≈ 7 cm overall. v5 is designed for the 4 cm box from scratch. |
| Total weight 17–19 g with the custom PCB | Optimistic | Seeed's own ESP-FLY (XIAO ESP32-S3, 46 mm frame, 615 motors) weighs 25 g with its 250 mAh battery, and that's before a camera or position sensors. | Weight calculator (§5.1) + weigh every part. |
| XIAO + camera ≈ 2.5 g | Unverified | Seeed publishes no weight, and retail listings include packaging. | Weigh it the day it arrives. |
| MPU6050 IMU | Partly | DigiKey lists the MPU-6050 as obsolete, and cheap clones vary. But the safety-net firmware supports it out of the box, which helps a lot early on. | Use it for bench + v1–v4 breakouts. From v5's custom board: ICM-42688-P on SPI (the IMU used in current FPV flight controllers). |
| Pin plan: D8 = magnet, D9 = battery sensing | Wrong | On the XIAO ESP32S3 Sense, D8/D9/D10 are the microSD card's wires. That plan breaks recording. Also, the XIAO can't read its own battery voltage, so you need a divider on an ADC-capable pin. | Proper pin plans per version (§5.7). |
| SI2302 MOSFETs | Works | OK, but the AO3400A is better: 48 mΩ vs 75 mΩ at 2.5 V gate, and a 5.7 A vs ~2.7 A rating. Stalled motors have killed Si2302s. | AO3400A. |
| 470 µF electrolytic capacitor | Heavy | It works, but it's big and tall for a micro. | Ceramic capacitors + low-battery landing in firmware. On custom boards: a buck-boost regulator for rock-solid 3.3 V. |
| One angle-PID loop | Simplified | Real flight controllers use two loops: angle → rotation-rate (gyro). The inner rate loop is what makes them feel locked-in. | Cascaded loops from v1 (§5.5). |
| ORB-SLAM3 visual mapping from the stream | Very hard | SLAM needs clean, well-timed frames. A compressed, laggy Wi-Fi stream from a tiny sensor is the opposite. | Markers first (robust), optical flow onboard, SLAM as a stretch experiment. |
| LionCircuits: ₹799 for 5 PCBs, 5–6 days | Right | Checked against their site. | We use them for hand-solderable boards. |
| Complete 6-week timeline | Unrealistic | Too fast for someone starting from zero, and it's moot now there's no deadline. | ≈ 32 weeks, with checkpoints. |
| OV2640 camera | Outdated | Discontinued. Seeed now ships the Sense with an OV3660 or OV5640. The same driver supports all of them. | Use whatever arrives. |
| (missing) | Gaps | No simulator (your biggest advantage), no thrust testing before choosing motors, no flight logging, no LiPo safety, no Indian drone law, no "learn to fly". | All added. |
3The big picture
A quadcopter is four fans and a very fast reflex. It can't stay level by itself, and no two motors are identical, so it would flip in under a second. A tiny computer checks its tilt about 500 times a second and nudges the four fan speeds to correct it. That reflex is the whole trick. Everything else (camera, GPS, AI, maps) sits on top of it.
The version ladder
Each version adds one hard new thing. You never change the size, the electronics and the software all at once. That's how you always know what broke.
| Version | Size (overall) | Flies | New hardware | New abilities | ≈ Weeks |
|---|---|---|---|---|---|
| v0 Egg | — (desk) | Nowhere | XIAO ESP32S3, IMU breakout, one motor + MOSFET, thrust stand | Your simulator, reading sensors, knowing "which way is up", spinning a motor, measuring thrust, designing your first PCB | 3 |
| v1 Larva | ≈ 7 cm | Indoors | Your first custom PCB (hand-soldered), 4 coreless motors, 1S LiPos | Your own flight code, stable manual flight, phone + gamepad control, telemetry, failsafes | 4 |
| v2 Worker | ≈ 7–8.5 cm | Indoors | PCB #2, camera (Sense), height laser, optical-flow sensor, payload magnet | Hovers by itself, live video to phone/laptop, SD recording, grab & drop | 5 |
| v3 Scout | same as v2 | Indoors | Printed markers, your own remote (ESP32 + joysticks) | Knows its 3D position in the room, flies routes, follow-me AI, gestures & voice, perch & watch, room map, Kalman filter | 4.5 |
| v4 Forager | ≈ 12–14 cm | Calm outdoors → high | PCB #3, bigger motors, barometer, GPS + compass, ExpressLRS RC radio, optional FPV camera | Altitude by air pressure, GPS position on a map, tap-to-fly missions, return-home, geofence, long-range control | 5.5 |
| v5 Queen | 4 cm (≤ 5) | Indoors + calm hops | Chip-level custom board (factory assembled), tiny motors, swappable backpacks | Everything from v2–v3 at bee size, a GPS backpack for calm days, bee shell, on-board AI experiment | 7 |
| v6 Hive | 2–3 Queens + dock | Indoors | Extra Queens (same PCB batch), landing/charging dock | Swarm formation flight, auto-dock & recharge, full mission loop, open-source release | 4 |
Why this order?
- v0 before anything flies: the simulator and bench tests catch about 80% of first-flight disasters (wrong motor direction, wrong sign in a formula, a noisy sensor) on the desk, where they cost nothing.
- v1–v3 at an easy size: all the software (estimator, controllers, autonomy, AI) gets written and proven where there's spare thrust.
- v4 bigger, outdoors: wind doesn't care about your dreams. A 15 g drone can't fight a breeze, but a ~50 g one can handle calm days. GPS and map work gets learned here.
- v5 shrinks proven software: only the hardware is new, and it's the hardest hardware (chip-level, factory-assembled).
- v6 multiplies it: the same PCB batch from v5 gives you the swarm.
What's inside (v2 shown)
Your timeline
Computed from the start date in §6 (default 25 Oct 2026). Each segment = one version. Expect slips: parts arrive late and things break. That's normal.
4Everything it could do
You asked for every possibility, so here's the full menu. The chip shows which version it lands in. "stretch" means a bonus experiment once the core works.
Flying
- Self-levelling: let go of the sticks and it levels out v1
- Holds its height, auto take-off & landing v2
- Hands-off hover (holds position) v2
- Flips & "acro" mode, just for fun v2
- Throw-to-launch: toss it and it catches itself mid-air v3
- "Headless" mode: sticks move it relative to you, not its nose v3
Seeing
- Live video to phone and laptop v2
- Record video / snap photos to microSD v2
- Zero-lag analog FPV with goggles or an Android receiver v4
- Face detection running on the drone itself (Espressif ESP-WHO runs on the S3) v5
- "Heat vision" backpack (tiny thermal sensor) to spot warm bodies stretch
Knowing where it is
- Height by laser (indoors) and air pressure (outdoors) v2 v4
- Speed over the floor with optical flow v2
- Exact 3D room position from printed markers v3
- Draws a map of your room from its flights v3
- GPS position + compass heading on a real map v4
- Visual SLAM: mapping without markers stretch
- UWB / "Lighthouse" positioning for centimetre accuracy indoors stretch
Doing things by itself
- Flies routes you draw on the room map v3 or GPS map v4
- Follow-me: a person, face or coloured ball v3
- Precision landing on a marked pad v3
- Perch & watch: lands on a ledge, motors off, keeps streaming v3
- Return-home, invisible fence, lands itself on low battery v4
- Stops before walls (tiny forward laser) v3
Talking to it
- Phone web-page joystick (iPhone and Android) v1
- Laptop + gamepad ground station v1
- Your own handheld remote v3
- ExpressLRS RC radio, with battery and GPS shown on the radio's screen v4
- Hand gestures and voice commands v3
- "Land on my palm" v5
Carrying things
- Magnet grab & drop (1–5 g on v2, ~10 g on v4, ~1–2 g on the Queen) v2
- Plant a tiny Bluetooth beacon somewhere and fly away v5
- Light painting: LEDs + long-exposure photos make art in the air v2
- "Bee nose": an air-quality sensor that maps a room's air stretch
Teams
- Swarm formation flight (2–3 Queens) v6
- Hive dock: lands on metal contacts and recharges itself v6
- "Waggle dance": one bee finds a target and tells the others where v6
- Radio relay: one bee extends another's range stretch
Maths & Computing specials
- Extended Kalman filter fusing every sensor v3
- System identification: measure your drone's real physics and make the sim match v1
- Digital twin: replay any flight in 3D from its log v3
- Best "flower tour": visit N markers in the shortest order (travelling salesman) v3
- Model Predictive Control: a controller that plans ahead stretch
- Reinforcement learning: train a controller in your sim, then fly it for real stretch
- Wind: the Queen is an indoor creature. The Forager handles calm days, not breezy ones.
- Flight time: ≈ 3–4 min for the Queen, ≈ 5 min for v1/v2, ≈ 8–10 min for the Forager (estimates).
- Video delay: Wi-Fi video is 0.1–0.3 s behind reality. That's fine for watching and for AI, but never for keeping the drone level.
- Range: Wi-Fi ≈ tens of metres. ExpressLRS control reaches much further, but you must keep the drone in sight and inside the law (§8).
5How it works inside
This is the textbook. Each part starts in plain words, then gives the maths. The build plan tells you when to read each one.
5.1 Why it flies, and why tiny is hard
A propeller is a spinning wing that throws air downward, and the air pushes back up. Spin it twice as fast and you get about four times the push. The drone hovers when the four pushes add up exactly to its weight.
Moving a lot of air slowly is cheap. Moving a little air fast is expensive. Big props hover efficiently. Tiny props burn the battery fast. That one fact explains why tiny drones fly for only 3–5 minutes.
Thrust grows with the square of rotor speed, and hover means total thrust = weight:
Momentum theory (the classic helicopter result) gives the minimum power to hover. A is the total propeller disc area, ρ ≈ 1.2 kg/m³ is air density, and η (efficiency, ≈ 0.18–0.3 for tiny brushed drones, an estimate) covers motor and prop losses:
Power ∝ 1/√A ∝ 1/D for the same weight. Going from 31 mm props to 20 mm props costs 31/20 ≈ 1.55× more power. That's the price of tiny.
The 4 cm box rule
Put four props in a square box of side B. Each prop must stay inside the box and not touch its neighbours.
Motor centres at (±s, ±s), prop radius r:
A 40 mm box allows props of ≤ 20 mm. A 50 mm box allows ≤ 25 mm, with 56% more disc area (≈ 25% less hover power).
Thrust-to-weight and hover throttle
Thrust ∝ ω², and on a brushed motor ω is roughly proportional to throttle u (0–1). So:
At 2:1 that's ≈ 71%, and at 3:1 ≈ 58%. Your thrust-stand test in block 5 will show how true this is for your motors.
5.2 The four moves & the mixer
Diagonal motors spin the same way: two clockwise, two counter-clockwise. Each spinning prop also twists the body the opposite way, like how your chair spins when you swing your arms. With the two directions balanced, the twists cancel. Then:
- Throttle: all four faster means up.
- Roll: left pair faster tips it right, and it slides right.
- Pitch: back pair faster tips the nose down, and it moves forward.
- Yaw: the clockwise pair faster makes the body twist counter-clockwise. Total lift stays the same, so it just turns on the spot.
The mixer is a tiny piece of code that turns "a bit more throttle, roll right a little" into four exact motor numbers.
| Motor | Spin | Throttle | Roll right | Pitch up | Yaw right |
|---|---|---|---|---|---|
| M1 front-left | CW | + | + | + | − |
| M2 front-right | CCW | + | − | + | + |
| M3 rear-right | CW | + | − | − | − |
| M4 rear-left | CCW | + | + | − | + |
"+" means the motor speeds up to make that move. Read a column: to roll right, the left motors (M1, M4) speed up. CW/CCW props are mirror-shaped, and one on the wrong motor blows air upward.
We use x forward, y right, z down. Positive roll is right-side-down, positive pitch is nose-up, and positive yaw is nose-right. Arm offset is a, and c is the torque-to-thrust ratio of the props:
The mixer is this matrix's inverse. The columns are orthogonal, so the inverse is easy. With t = T/4, r = τx/4a, p = τy/4a, y = τz/4c:
When a motor would need more than 100% or less than 0%, you must squeeze the corrections. Keeping the drone level matters more than holding the exact throttle. You'll handle this "saturation" in v1.
5.3 Which way is up? (sensor fusion)
The IMU chip has two sensors:
- Gyroscope: measures how fast it's rotating. Smooth and instant, but tiny errors pile up, so it slowly drifts. It's like counting your steps with your eyes closed.
- Accelerometer: feels gravity, so when still it knows exactly which way is down. But every vibration and every speed-up fools it. It's like a pendulum on a bumpy bus.
The trick: trust the gyro for quick changes, and let the accelerometer slowly pull out the drift. That blend is called sensor fusion.
Step 1, complementary filter (roll shown; pitch is the same). Integrate the gyro, then nudge toward the accelerometer's angle:
With Δt = 2 ms and α = 0.98, the time constant τ ≈ 0.1 s. Signs depend on how the chip is mounted, so you'll verify them by tilting by hand.
Step 2, quaternions. Angles break near 90° ("gimbal lock"). A quaternion q (4 numbers) represents any orientation and updates cheaply from the gyro rate ω:
That's the Mahony filter. e is the cross product between the gravity direction the accelerometer measures and the one the quaternion predicts. It's a PI controller that steers the estimate toward reality. Madgwick does the same job with gradient descent. Both are about 50 lines of code.
Step 3 (v3), the Extended Kalman Filter: the "proper" way to fuse many sensors with different noise and timing. See §5.6.
5.4 PID, the reflex
Think of balancing a stick on your palm:
- P (proportional): the further it leans, the harder you push back. Too much and you over-correct back and forth.
- D (derivative): the brake. You see it swinging back fast and ease off before it overshoots. This kills the wobble.
- I (integral): the patience. If it keeps leaning slightly one way (say the camera makes the nose heavy), I slowly builds up extra push until the lean is gone.
In code, every Δt:
Three professional tricks:
- Derivative on measurement (the −y term above, not +e) avoids a "kick" when you suddenly change the target.
- Anti-windup: clamp the integral so it can't grow huge while the drone sits on the ground.
- Low-pass filter the D term, because D amplifies noise.
- Ki = Kd = 0. Raise Kp until it starts to oscillate, then back off 30–50%.
- Raise Kd until the oscillation dies and taps feel like hitting thick honey. Stop before motors sound rough.
- Add a small Ki to remove leans.
- Tune the inner rate loop first, then the angle loop (§5.5).
5.5 Loops inside loops (cascaded control)
Controllers work better when you give them a good first guess. For altitude, start from the measured hover throttle and let the PID fix only the difference. A brushed motor's speed also drops as the battery sags, so scale throttle by battery voltage:
5.6 Knowing where it is
"Where am I?" gets answered in layers, from the cheapest and most local to the most global:
| Question | Sensor | How it works (plain) | Good to know | Version |
|---|---|---|---|---|
| How high? | Laser time-of-flight (VL53L1X) | Fires invisible light at the floor and times the echo | Up to ~4 m in the dark, only ≈0.7–1.3 m in strong ambient light. Minimum 4 cm. Breakout ≈0.5 g. | v2 |
| How high, outdoors? | Barometer (BMP390 / DPS310) | Air pressure drops as you climb | BMP390 relative accuracy ≈ ±25 cm. Prop wash fools it, so cover it with foam. | v4 |
| Am I sliding? | Optical flow (PMW3901 / PAA3905) | A tiny camera like a computer mouse that watches the floor slide past | Works from ~8 cm up. Needs light and floor texture. Bitcraze's Flow deck (flow + laser) weighs 1.6 g. | v2 |
| Where in the room? | Camera + printed markers (ArUco / AprilTag) | Knows each marker's size and position, so its shape in the image gives the drone's position | Runs on the laptop. Centimetre-level near markers. Arrives 0.1–0.3 s late. | v3 |
| Where on Earth? | GPS (+ compass) | Times signals from satellites | A few metres accurate, outdoors only. Tiny modules: Flywoo GM10 Nano 2.2 g, HGLRC M100 Mini ≈2.7 g. | v4 |
Height with tilt correction: the laser points along the body, so when tilted it measures a slanted distance d:
Speed from optical flow: the floor's apparent angular speed times height gives ground speed. But tilting also makes the floor "move", so subtract the gyro's rotation:
Position from a marker (Perspective-n-Point): a 3D point X on a marker lands on pixel (u, v) through the camera matrix K (found by calibration) and the unknown pose (R, t):
OpenCV's solvePnP finds R and t from the four corners of each marker.
Fusing everything: the Extended Kalman Filter. Keep a state x (position, velocity, tilt…) and its uncertainty P. Predict with the IMU every step, and correct whenever any sensor reports:
In plain words: K is a "trust dial". If a sensor is noisy (big R) it barely moves the estimate, and if you're unsure of the estimate (big P) the sensor gets a bigger say. Crazyflie's firmware has a well-documented EKF to study (§10).
5.7 Electronics & pins
The battery
| Fact | Number | Why it matters |
|---|---|---|
| Land when loaded voltage reaches | ≈ 3.3–3.4 V | Lower than that hurts the cell, and the ESP32's 3.3 V supply starts to sag. |
| Store at | ≈ 3.8 V | Full or empty LiPos age fast in storage. |
| Never below | 3.0 V | Permanent damage. A puffed cell means retire it safely. |
| PH2.0 connector | ≈ 4.5 A | Four motors can pull 4–6 A. Too small. |
| BT2.0 connector | ≈ 9 A continuous | Use this. Batteries and charger must match. |
| 250 / 300 mAh whoop pack | ≈ 7.1 / 8.3 g | The heaviest single part of v1. Pick capacity with the calculator. |
One motor channel (×4)
- MOSFET (AO3400A): an electronic tap. A tiny 3.3 V signal on its gate lets several amps flow through the motor.
- Schottky diode across the motor: a pressure-relief valve. When the tap shuts, the motor's coil tries to keep current flowing and spikes the voltage. The diode gives that current a safe loop. Without it you get resets or dead parts.
- 100 Ω gate resistor: softens the switching a little and stops ringing.
- 10 kΩ pull-down: keeps the motor OFF while the chip boots, when pins float. This is a real safety part.
- PWM: flicking the tap on/off ~20,000 times a second (above human hearing). The motor feels the average, so 60% on-time gives roughly 60% power.
- Motor current goes battery → motor → MOSFET → ground on short, wide copper (≥ 1 mm traces or copper pours). It must never pass through the XIAO.
- Ceramic capacitors (10–22 µF) near the XIAO's power pad and near the motors act as small local reservoirs for sudden current gulps.
- IMU in the centre of the board, the Wi-Fi antenna away from motors and battery, and a solid ground plane underneath.
The four "languages" chips speak
| Bus | Wires | Plain words | Used for |
|---|---|---|---|
| I²C | 2 (SDA, SCL) | A party line: many chips share two wires, each answers to its own address | IMU (v1), height laser, barometer, compass, GPIO expander |
| SPI | 3 shared + 1 "select" per chip | Faster. The brain points at one chip at a time with its select wire | Optical flow, microSD, IMU on custom boards |
| UART | 2 (TX, RX) | A plain serial chat between exactly two devices | GPS, ExpressLRS receiver |
| ADC | 1 | Measures a voltage | Battery voltage (through a divider that halves it) |
The pin wall
v1 XIAO, no camera
| D0 GPIO1 | Motor 1 FL |
| D1 GPIO2 | Motor 2 FR |
| D2 GPIO3 | Motor 3 RR |
| D3 GPIO4 | Motor 4 RL |
| D4 GPIO5 | I²C SDA (IMU) |
| D5 GPIO6 | I²C SCL |
| D6 GPIO43 | spare (UART TX) |
| D7 GPIO44 | spare (UART RX) |
| D8 GPIO7 | status LED |
| D9 GPIO8 | spare |
| D10 GPIO9 | battery (ADC) |
v2 Sense: camera + SD
| D0–D3 | Motors 1–4 |
| D4 GPIO5 | battery (ADC) |
| D5 GPIO6 | flow sensor select |
| D6 GPIO43 | I²C SDA (IMU, laser, expander) |
| D7 GPIO44 | I²C SCL |
| D8–D10 | SPI: microSD and flow sensor share it |
| internal | camera, mic, SD select (GPIO21) |
| no pins left | payload magnet + LEDs go through an I²C GPIO expander |
v4 XIAO, outdoor
| D0–D3 | Motors 1–4 |
| D4/D5 | I²C: IMU, barometer, compass |
| D6/D7 | GPS (UART) |
| D8 GPIO7 | ELRS receiver → drone |
| D9 GPIO8 | drone → ELRS (telemetry) |
| D10 GPIO9 | battery (ADC) |
| All 11 used. Video comes from an optional analog FPV camera, which needs power only. | |
The motor pins match the spin layout in §5.2. On v1, D8–D10 are free because the Sense board isn't attached. Fitting the Sense later turns them into SD-card lines, which is exactly Gemini's mistake.
5.8 Talking to it
| Link | Talks to | Plain words | Range (rough) | Version |
|---|---|---|---|---|
| Wi-Fi (drone makes its own network) | Phone, laptop | Your phone joins the drone's Wi-Fi and opens a web page the drone serves | tens of metres | v1 |
| ESP-NOW | Your own remote | ESP32-to-ESP32 messages with no router. Very low delay | similar to Wi-Fi | v3 |
| ExpressLRS 2.4 GHz (CRSF) | RC radio | A hobby-grade long-range control link. A 0.45 g receiver sends 16 channels to the drone over UART | far beyond line of sight (stay legal, §8) | v4 |
| Analog 5.8 GHz video | Goggles / Android USB receiver | Old-school TV-style video with almost no delay | hundreds of metres | v4 |
192.168.4.1. The page shows two touch joysticks, an arm button, battery % and live video. Stick positions go out ~50 times a second over a WebSocket. It works on iPhone and Android with no app store. Outdoors (v4), you flip it around: the drone joins your phone's hotspot, so the phone keeps internet for map tiles.- Priority: RC radio / your remote > phone / laptop > autonomy. Touching the sticks always takes over.
- Arming: motors can only start with throttle at zero plus a deliberate arm action. A power-up never spins props.
- Link lost for 0.3 s → hold position or descend. Lost for 1 s → land. Tilt over 60° → motors off (it crashed). Low battery → land.
- A kill switch on every controller.
5.9 Camera & video
| Fact | Detail |
|---|---|
| Which camera arrives | Seeed now ships the Sense with an OV3660 or OV5640 (the OV2640 is discontinued). Espressif's camera driver supports all three. |
| What people have achieved | The ESP32-CAM_MJPEG2SD project: 25 fps from the camera and 20 fps to SD at VGA/SVGA, with streaming and recording together possible ("may stutter"). The hx-esp32-cam-fpv project on the same XIAO Sense + OV5640: 30 fps from 640×360 up to 1280×720 with 90–110 ms delay, recording 720p30 onboard. |
| Power | Seeed measured ≈ 155 mA average and ≈ 366 mA peak for its webcam demo. |
| Recording choices | On the drone's SD: best quality, independent of Wi-Fi. On the laptop: zero weight, but every Wi-Fi hiccup shows. |
| Analog FPV (v4) | An all-in-one camera + transmitter like the BetaFPV H02 (3.6 g, 25 mW, runs on 2.9–5.5 V, so straight off 1S). Watch it in goggles (near-zero delay) or on Android with a USB receiver (Eachine ROTG02: Android only, ≈ 100 ms). |
5.10 Firmware map: logic cards
You said you want to understand the code by its logic, not word by word. So every module gets a card: what it's for, what goes in and out, how often it runs, and how you prove it works. If you can explain every card to a friend without notes, you understand your drone.
| Module | Its job (plain) | In → Out | How often | How you test it |
|---|---|---|---|---|
| Arming state machine | Decides whether motors may spin at all | buttons, link health, tilt, battery → DISARMED / ARMED / FLYING / FAILSAFE | every loop | Try to arm with throttle up. It must refuse. |
| Sensor drivers | Talk to each chip and turn raw bytes into real units | bus bytes → °/s, g, metres | IMU 500–1000 Hz, others 10–100 Hz | Board flat = 1 g down. Ruler = laser reading. |
| Estimator | Works out tilt, then height, speed, position | sensor values → attitude (quaternion), height, velocity | 500 Hz | 3D cube viewer, hand-carry tests |
| Commander | Picks who's in charge and produces one target | radio / phone / laptop / autonomy → setpoint | 50–100 Hz | Switch a source off. The next one takes over, or failsafe. |
| Controllers | The reflexes: rate, angle, altitude, velocity, position | target + estimate → corrections | 50–1000 Hz | Tilt test, tethered steps, logs |
| Mixer | Turns corrections into 4 motor numbers | throttle, roll, pitch, yaw → M1–M4 | 500 Hz | Check against the §5.2 table by hand |
| Motor output | Makes the PWM signals | 0–1 → duty cycle | 500 Hz | Spin test, props off |
| Comms | Radio in and out | packets ↔ commands, telemetry | 50–100 Hz | Latency test, unplug test |
| Blackbox logger | Records everything for later plots | all variables → laptop / SD | 50–500 Hz | Plot a flight in Python |
| Safety supervisor | Watches for trouble and triggers failsafes | tilt, link age, battery, sensor health → actions | 100 Hz | Failsafe test matrix (block 27) |
| Camera task | Captures, streams and records | frames → Wi-Fi / SD | 15–30 fps | fps + delay test (film a stopwatch) |
Project folder layout
micro-drone/ firmware/ flight code (PlatformIO) sim/ Python simulator ground/ laptop ground station web/ phone control page hardware/ KiCad boards cad/ 3D-printed parts log/ build log + flight logs docs/ this plan, notes
Tools on your Mac
- VS Code + PlatformIO, using the Arduino framework at first: friendly, and it still gives you FreeRTOS and ESP-IDF calls when you need them.
- ESP-IDF, only to build the safety-net firmware (and maybe v5).
- Python 3: numpy, matplotlib, pygame, opencv-contrib-python, later ultralytics + mediapipe.
- KiCad 10 for PCBs. Onshape or Fusion for 3D parts.
- Git + GitHub: commit every working step.
6The build plan
76 blocks of 3 days each. Every block has Learn (what to understand first), Do (what to build) and Done when (a test you can pass or fail, with no "kind of works"). Later versions are less detailed on purpose. We'll re-plan each one with what you learn on the way.
Loading plan…
- Write 5 lines in your build log at the end of each day: what worked, what broke, what you learned, numbers you measured, next step.
- Commit to Git every time something works.
- Props off for every bench test. Safety glasses for every powered test.
- If a block takes longer, that's fine. Don't skip its "Done when" test.
7Shopping & budget
Order A: today (bench + v1)
| Item | Why | Qty | ≈ ₹ |
|---|---|---|---|
| Tools & consumables (you keep these forever) | |||
| 0.01 g digital scale (jewellery scale) | Weigh every part. Your most important tool. | 1 | 350–600 |
| No-clean flux (paste or gel) | Makes solder flow. SMD soldering is impossible without it. | 1 | 200–400 |
| Solder wire 0.5–0.6 mm, 63/37 leaded | Easiest for beginners (ventilate, wash hands) | 1 | 200–400 |
| Desoldering wick | Fixes mistakes | 1 | 100–200 |
| Fine tweezers (straight + curved) | Placing tiny parts | 1 set | 200–400 |
| SMD soldering practice kit | 20 practice joints before your real board | 1 | 150–350 |
| Kapton tape, IPA 99% + old toothbrush | Heat-proof masking; cleaning flux off | 1 each | 300–600 |
| Safety glasses | Props and snipped leads go for your eyes | 1 | 100–250 |
| LiPo safety bag | Charge and store batteries inside it | 1 | 300–600 |
| 1S LiPo charger, multi-port, BT2.0 | Must match the battery connector | 1 | 600–1,500 |
| Breadboard, jumper wires, header pins | Bench prototyping | 1 set | 200–350 |
| Silicone wire 26–28 AWG (red + black) | Battery leads, motor fixes | 1 m each | 100–250 |
| Electronics | |||
| Seeed XIAO ESP32S3 Sense | The brain + camera (camera used from v2) | 1 | 1,300–2,600 |
| Seeed XIAO ESP32S3 (plain) | Flies v1 so the Sense stays safe. Later becomes your remote's brain. | 1 | 800–1,200 |
| MPU-6050 breakout (GY-521) | IMU for bench + v1. Matches the safety-net firmware. | 2 | 150–300 |
| AO3400A MOSFET (SOT-23) | Motor switches (+ spares) | 20 | 100–200 |
| Schottky diode, SOD-123 (e.g. 1N5819W / B5819W) | Flyback protection | 20 | 100–200 |
| 0805 resistors: 100 Ω, 10 kΩ, 100 kΩ | Gate, pull-down, battery divider | 20 each | 100–300 |
| Ceramic capacitors 0805/1206: 100 nF, 10 µF, 22 µF | Local power reservoirs | 10 each | 100–300 |
| 0716 coreless motors, 2 CW + 2 CCW | v1 motors (+ a full spare set) | 2 sets | 800–1,600 |
| 31 mm props matching the motor shaft (check 0.8 vs 1.0 mm) | They break, so buy plenty | 3 sets | 200–500 |
| 1S LiPo 250–300 mAh, ≥ 30C, BT2.0 | ~5 min each. 4 means continuous testing. | 4 | 1,200–2,400 |
| BT2.0 male pigtails | Battery lead on the drone | 3 | 150–300 |
| 0805 LEDs | Status lights | 10 | 50–100 |
| Fabrication (in block 7) | |||
| v1 PCB × 5 (LionCircuits) | Your first board, ₹799 for 5, 5–6 days | 5 | 800–1,000 |
| 3D-printing filament (PLA/PETG) | Thrust stand, motor clips, test frame | — | 0–800 |
| Order A total | ≈ 8,650–17,700 | ||
Later orders
| Order | When | What | ≈ ₹ |
|---|---|---|---|
| B · v2 | block 17 | VL53L1X laser (400–800), PMW3901 flow sensor (1,200–2,500), I²C GPIO expander (100–300), magnets / tiny electromagnet (100–300), v2 PCB ×5 (800–1,000), spare motors + props (500–1,000), 2 more LiPos (600–1,200). Only if thrust tests say so: 0720 motors + 40 mm props (600–1,200). | 4,300–8,300 |
| C · v3 | block 29 | Your remote: 2 thumb joysticks, 0.96" OLED, small LiPo, switch, perfboard (uses the plain XIAO). Printed markers + checkerboard. | 550–1,200 |
| D · v4 | block 39 | ExpressLRS radio: BetaFPV LiteRadio 3 (US$32.99 official) or Radiomaster Pocket (US$71.50) (3,500–8,000). ELRS 2.4 GHz receiver (1,000–1,800). Mini GPS + compass (1,800–3,000). Barometer breakout (400–900). 8520 motors ×2 sets + 55–65 mm props (800–1,600). 1S 450–600 mAh LiPos ×3 (900–1,800). v4 PCB ×5 (800–1,000). | 9,200–18,100 |
| D+ optional | block 50 | Analog FPV: AIO camera like the BetaFPV H02 + Android USB receiver (ROTG02) or cheap goggles | 4,000–6,500 |
| E · v5 | block 52 | 2–3 candidate tiny motor/prop sets (1,000–2,000). 1S 100–150 mAh LiPos ×4 (800–1,600). Factory-assembled Queen boards ×5 incl. shipping and duty (3,000–6,000). New backpack sensors if not reusing v2's (0–2,500). | 4,800–12,100 |
| F · v6 | block 68 | Motors, props and batteries for Queens #2 and #3 (their boards come from Order E's batch). Dock: contacts + small charger module. | 2,300–5,000 |
Budget summary
| Path | Through v3 | Through v4 | All the way (v6) |
|---|---|---|---|
| Cheapest (low end of every range, no FPV) | ≈ ₹13.5k | ≈ ₹22.7k | ≈ ₹30k |
| Comfortable (mid-range parts, spares, FPV) | ≈ ₹20k | ≈ ₹34–39k | ≈ ₹46–52k |
- Skip analog FPV (saves ₹4–6.5k).
- Use the LiteRadio 3, not the Pocket, or fly v4 with your own remote and skip the RC radio (saves ₹4.5–10k).
- Reuse v2's laser + flow sensor on the Queen's backpack.
- Buy the 5 Queen boards in one factory order, which gives you the swarm boards for free.
- Bundle orders so you pass free-shipping limits.
Where to buy
Inside India
- General electronics: Robu.in, Evelta, Thingbits, Probots, Robocraze, Quartz Components
- Whoop / FPV parts (tiny motors, 1S packs, chargers, ELRS): whoopmastersindia.com, uavstore.in, quadkart.in, fioparts.com, thefpvproject.com. I haven't checked their stock.
- XIAO ESP32S3 Sense: stock is patchy. Check Robocraze, ElectronicsComp, Hubtronics and element14 India.
- PCBs: LionCircuits (₹799 for 5, 5–6 days, also does assembly), PCB Power (fab + assembly)
International (for chips & v5)
- DigiKey India: free delivery from ₹7,000, with duty and GST paid on delivery (≈ 4 days)
- Mouser India, element14 India, LCSC (LCSC needs ID/KYC for DHL)
- JLCPCB: cheap factory assembly. India has no duty-free limit, so you pay import duty plus KYC.
- AliExpress doesn't sell to India.
8Safety & the law
Safety rules (from day 1)
LiPo batteries
- Charge inside the LiPo bag, on a non-flammable surface, never unattended, never overnight.
- Never charge or fly a puffed, dented or hot cell.
- Battery leads must never touch: a short means instant heat and possibly fire.
- Unplug the battery before soldering anything.
- Store at ≈ 3.8 V. Keep a bucket of sand nearby.
Props, soldering, power-up
- Props off for all bench and code tests. Safety glasses whenever props are on.
- First flights tethered, then over a bed or foam mat, away from faces and pets.
- Ventilate flux fumes, wash hands after leaded solder, and keep the iron in its stand.
- Before the first power-up: multimeter check that battery+ isn't shorted to ground. First power from USB, with no motors attached.
The law in India (what the rule text says)
I'm not a lawyer. This is what the published rule texts say as of October 2026 (sources in §10). Check DGCA's Digital Sky platform yourself before any outdoor flight.
| Topic | What the rules say | What it means for you |
|---|---|---|
| Category | Drone Rules 2021: nano = up to 250 g | Every version you'll build is nano (Forager ≈ 50 g). |
| Pilot certificate, type certificate, insurance | Not required for nano | Good news. |
| Registration (UIN) | Rule 14: no flying without Digital Sky registration + UIN "unless exempted", and the text has no nano exemption. The popular "nano needs no UIN, fly up to 50 ft" claim comes from the old 2018 rules, which were repealed. | Unclear for home-built nanos in practice. Sort this out before v4's outdoor flights. |
| Where outdoors | Green zone: up to 120 m (400 ft) with no permission (60 m in the 8–12 km band around airports). Yellow: ATC permission. Red: central government only. Check the Digital Sky map before every flight. Fines up to ₹1 lakh. | Your v4 geofence caps height well below the legal limit. |
| R&D exemption | Rule 42: recognised educational institutions / R&D bodies can fly on their own premises in green zones without UIN or permissions. | If you're still enrolled, ask your department whether v4 can fly on campus under the college's R&D umbrella. |
| Coming changes | The draft Civil Drone Bill 2025 would require registration for every drone. It appears to still be a draft. | Re-check when v4 starts. |
| Indoors | The rules are written for outdoor airspace. | Your own room or hall is the practical safe zone for v1–v3 and v5–v6. |
| Radio | 2.4 GHz is licence-exempt. 5.725–5.875 GHz is licence-exempt. The 865–868 MHz rules need ≥ 58 hop channels and a low duty cycle. | Use 2.4 GHz ExpressLRS, not the 866 MHz version (it doesn't meet those rules). For FPV, only Raceband channels R3–R6 (5732–5843 MHz) are inside the exempt band. |
| Imports | Complete drones and kits are banned. Components are free. | Buy parts (§7). |
9Learning with AI, without depending on it
The loop for every module
- Spec: you write 3–5 lines in plain words: what it does, what goes in and out, how you'll test it.
- Predict: roughly what steps should the code take?
- Build: I write it in small, commented functions.
- Explain back: you walk me through it as its logic card (§5.10), and I point out gaps.
- Change one thing yourself: a gain, a threshold, a rate. Predict the effect, then run it.
- Test: pass the block's "Done when".
- Log: 5 lines and a Git commit.
Rules
- Never keep code you can't explain at logic-card level.
- When debugging, write your guess first, then ask.
- Ask "why this number?" about every magic number.
- Once per version, rebuild one small module with no AI (for example the complementary filter) as a self-test.
Things to say to me
- "Here's my spec for ___. Build it in small functions, then quiz me."
- "Explain this file as a logic card."
- "I think the bug is ___ because ___. What test would prove it?"
- "Review my schematic PDF against the v1 checklist."
- "Give me 5 questions to check I really understand ___."
10Resources
Links checked on 24 Oct 2026. The block numbers say when each one becomes useful.
Flight control from scratch
- Carbon Aeronautics manual + videos: a quad built from zero, explained step by step (blocks 2–16)
- dRehmFlight: very readable flight-controller code (blocks 8–13)
- Joop Brokking YMFC-AL: the classic Arduino quad series
- MATLAB Tech Talks: Drone Simulation and Control (5 short videos, blocks 2 and 9)
- Bitcraze docs: controllers · state estimators
- ESP-Drone (docs) and Seeed ESP-FLY: your safety net and reference design
Maths, estimation, simulation
- Kalman and Bayesian Filters in Python (Roger Labbe): free interactive book (block 31)
- Madgwick's report + the Fusion library (block 4)
- Beard & McLain, Small Unmanned Aircraft: free draft book + simulators
- gym-pybullet-drones: Crazyflie simulation, and RL later
Electronics & PCB
- KiCad: Getting Started (blocks 6–7)
- DigiKey: An Intro to KiCad
- Phil's Lab: Flight Control System Design · KiCad STM32 full tutorial · HadesFCS files (block 53)
- EEVblog's soldering tutorial series (search YouTube): watch before block 3
- Micro battery connector tests (Oscar Liang)
ESP32-S3, camera, radio
- Seeed wiki: XIAO ESP32S3 · camera · SD card (pins)
- esp32-camera driver · ESP32-CAM_MJPEG2SD · hx-esp32-cam-fpv (block 19)
- ESP-WHO: on-chip face detection (block 66)
- ESP32-S3-PICO-1 datasheet (block 53)
- ExpressLRS: receiver → flight controller (block 40)
Coding basics
- Official Python tutorial
- learncpp.com: C++ at your own pace
- Random Nerd Tutorials: ESP32 how-tos
- PlatformIO · Ultralytics YOLO · MediaPipe · OpenCV ArUco
Datasheets & law
- AO3400A · ICM-42688-P · VL53L1X breakout · BMP390 · TPS63802
- MPU-6050 at DigiKey (obsolete)
- Reference drones: Crazyflie 2.1+ · Flow deck v2
- India: Drone Rules 2021 · 2022 amendment · Draft Drone Bill 2025
11Glossary
- 1S
- One lithium cell in the battery (3.7 V nominal). 2S = two in series, and so on.
- ADC
- Analog-to-digital converter: lets the chip measure a voltage.
- Arming
- The deliberate act of allowing the motors to spin. Disarmed = motors can't run.
- ArUco / AprilTag
- Printed black-and-white square markers a camera can find and measure precisely.
- Blackbox
- A flight recorder: logs every sensor and controller value so you can plot what happened.
- Brushed / brushless
- Brushed (coreless) motors are simple and run straight from a MOSFET. Brushless are stronger but need an ESC.
- BT2.0 / PH2.0
- Tiny battery connectors. BT2.0 handles much more current.
- C-rating
- How fast a battery can safely discharge, as a multiple of its capacity.
- Cascade
- Control loops stacked inside each other: position → velocity → angle → rate.
- Complementary filter
- Blends gyro (fast, drifts) with accelerometer (slow, noisy) to estimate tilt.
- Coreless motor
- A tiny brushed motor with no iron core. Light and fast to respond. "0716" = 7 mm × 16 mm.
- CRSF
- The serial protocol ExpressLRS receivers use to send stick values to the flight controller.
- CW / CCW
- Clockwise / counter-clockwise (seen from above). Props come in mirrored pairs.
- DLPF
- Digital low-pass filter: smooths out fast vibration from a sensor's readings.
- EKF
- Extended Kalman filter: the standard way to fuse many sensors with different noise and timing.
- ELRS (ExpressLRS)
- Open-source long-range radio control system used by most hobbyists.
- ESC
- Electronic speed controller: drives brushless motors.
- ESP-NOW
- Espressif's direct chip-to-chip radio messages: no router, low delay.
- ESP32-S3
- The microcontroller brain: two cores, Wi-Fi + Bluetooth, a camera interface.
- Failsafe
- What the drone does automatically when something goes wrong (lost link, low battery).
- Feed-forward
- Giving a controller a good first guess (like hover throttle) so it only corrects the difference.
- Firmware
- The program that runs on the drone's chip.
- Flyback diode
- Gives a motor coil's current a safe path when the switch turns off.
- FPV
- First-person view: flying by watching the drone's live camera.
- FreeRTOS
- The small operating system inside the ESP32 that runs several tasks at once.
- Gerber
- The files a PCB factory needs to make your board.
- GPIO
- A general-purpose pin the chip can read or drive.
- Gyroscope
- Measures rotation speed (°/s).
- I²C, SPI, UART
- Ways chips talk to each other (§5.7).
- IMU
- Inertial measurement unit: a gyro + accelerometer chip.
- KiCad
- Free software to design circuit boards.
- LiPo
- Lithium-polymer battery: light and powerful, and must be treated with care.
- mAh
- Battery capacity. 250 mAh ≈ 0.25 A for one hour.
- Mixer
- Turns throttle / roll / pitch / yaw into four motor commands.
- MOSFET
- An electronic switch. A small voltage on its gate controls a large current.
- Optical flow
- Measuring motion by watching how the image of the floor slides.
- PCB / PCBA
- Printed circuit board / one that the factory has already assembled with parts.
- PID
- Proportional-integral-derivative controller: the reflex (§5.4).
- PnP
- Perspective-n-point: finding the camera's pose from known points in an image.
- PSRAM
- Extra memory on the ESP32 module, used for camera frames.
- PWM
- Pulse-width modulation: fast on/off switching whose average sets motor power.
- Quaternion
- Four numbers that represent orientation without the 90° glitch that angles have.
- Rate / angle mode
- Angle mode self-levels (easy). Rate ("acro") mode holds rotation speed (for flips).
- Schottky diode
- A fast diode with a low voltage drop.
- Setpoint
- The target value a controller tries to reach.
- SLAM
- Simultaneous localisation and mapping: building a map while working out where you are in it.
- SMD
- Surface-mount device: tiny parts soldered flat onto pads.
- Telemetry
- Data the drone sends back: battery, attitude, position.
- Thrust-to-weight
- Max thrust ÷ weight. Aim for 2:1 or more.
- ToF
- Time-of-flight laser distance sensor.
- UIN
- Unique identification number for a registered drone in India.
- VTX
- Video transmitter (analog FPV).
- Wheelbase
- Diagonal distance between motor centres. "65 mm whoop" refers to this.
- Whoop
- A tiny ducted indoor drone class.
Made for your Project Bee, 24 Oct 2026. When reality disagrees with this plan, reality wins. Tell me and we'll update it.