From Zero to Smart Greenhouse and Recon Drone: How Arduino, ESP32, and IoT Prompts Replaced an Engineering Degree in 30 Days

From Zero to Smart Greenhouse and Recon Drone: How Arduino, ESP32, and IoT Prompts Replaced an Engineering Degree in 30 Days

Two months ago I could not tell I2C from SPI. I had a soldering iron, a vague idea about "smart gardening," and a copy of Arduino IDE that kept throwing errors I did not understand. What I did not have was an engineering degree, a mentor, or $2,000 for a robotics course. What I did have was access to ChatGPT and Claude — and the stubbornness to treat them as a lab partner rather than a magic answer machine.

Thirty days later I had a working greenhouse that waters itself based on soil moisture, logs data to Home Assistant over MQTT, and a small ESP32-based drone that flies a preprogrammed recon path and streams telemetry back. This is not a story about AI doing the work for me. It is a story about prompts that compressed the learning curve — the same prompts I am handing you below, ready to copy.

The reality of embedded systems in 2026: the bottleneck is rarely the code itself. It is the datasheet you cannot parse, the sensor that returns 0xFF forever, the brownout reset you cannot explain. A good prompt does not write your sketch — it teaches you to read the error like an engineer. That distinction is the whole game.

Why prompting works for embedded systems (and where it fails)

Embedded work has a property that makes it unusually well-suited to LLM assistance: the ground truth is verifiable. A datasheet is public. A register map is documented. If the AI hallucinates a pinout, the hardware simply does not respond — you get immediate, unambiguous feedback. Compare that to, say, legal advice, where a wrong answer can sit undetected for months.

What LLMs are genuinely good at here:

  • Translating datasheet prose into initialization code (I2C addresses, SPI modes, timing requirements)
  • Explaining compiler and linker errors in plain language
  • Generating boilerplate for well-documented protocols (MQTT, HTTP, WebSocket)
  • Reviewing your wiring logic against the symptoms you describe

What they are bad at: inventing library APIs that do not exist, guessing pin mappings for your specific board revision, and reasoning about analog signal integrity. Always cross-check against the official source — for ESP32 that is docs.espressif.com, for Arduino docs.arduino.cc, and for protocol specs the IETF RFC index at rfc-editor.org (MQTT is standardized as OASIS MQTT 3.1.1/5.0, not an RFC — a detail worth knowing before you cite it).

Task AI handles well Verify manually
I2C/SPI init code ✅ Address + bus speed
Pin mapping ⚠️ partial Against board schematic
MQTT topics ✅ Broker config
Power/brownout issues ⚠️ Multimeter + datasheet
Library API calls ❌ risk Official library docs

The 14 prompts that built the greenhouse and the drone

Each prompt below is copy-paste ready. Replace the bracketed parts with your specifics.

1. Datasheet-to-code translator

For: turning a sensor datasheet into working initialization code without reading 40 pages.

You are an embedded engineer. I have a [BME280] sensor connected via I2C
at address [0x76] on an [ESP32]. Based on the official datasheet,
write the minimal initialization sequence in Arduino C++ using the
[Adafruit_BME280] library. Explain each register write in a comment.
Do not invent library methods — only use documented ones.

Example result: It produced a clean begin() call plus a note that the BME280 address is 0x76 or 0x77 depending on the SDO pin — a detail I had missed and would have debugged for an hour.

2. The I2C scanner and interpreter

For: when your sensor returns nothing and you suspect the bus.

Write an Arduino I2C scanner sketch for ESP32 using Wire.h that
prints every responding address in hex. Then explain: if my sensor
should be at 0x76 but the scan shows nothing, list the 5 most likely
causes in order of probability, with the diagnostic step for each.

This one prompt saved my first weekend. The scan returned nothing; the AI's ordered list put "missing pull-up resistors" third and "SDA/SCL swapped" first. It was swapped wires.

3. SPI mode detective

For: SPI devices that return garbage because of CPOL/CPHA mismatch.

My [MCP3008] ADC over SPI returns garbage. Explain SPI modes
0-3 in terms of CPOL and CPHA, tell me which mode this chip uses
per its datasheet, and show the correct SPISettings() call for
an ESP32 at [1 MHz]. Include a loopback test I can run to confirm
the bus works before blaming the chip.

4. Brownout / reset-loop debugger

For: the ESP32 that reboots every few seconds.

My ESP32 reboots randomly and the serial log shows "Brownout detector
was triggered." Explain what this means physically, list the causes
(power supply, capacitor, USB cable resistance, WiFi current spikes),
and give me a test procedure to isolate which one it is using only
a multimeter.

5. Home Assistant MQTT auto-discovery

For: making your sensor appear in Home Assistant without YAML hell.

Generate an Arduino sketch for an ESP32 that publishes [soil moisture]
readings to MQTT every [60] seconds and uses Home Assistant MQTT
discovery. Provide the exact discovery topic and JSON payload
following the official HA MQTT discovery format. Use PubSubClient.

The discovery topic format (homeassistant/sensor/<node>/<object>/config) is documented on home-assistant.io — the AI got it right, but I verified it. Always verify.

6. Servo motion without jitter

For: the servo that twitches or buzzes.

My [SG90] servo jitters and draws too much current on an ESP32.
Explain why sharing the 5V rail with the MCU causes this, show me
a sketch using ESP32 LEDC PWM instead of the Servo library,
and give the correct external power wiring diagram in text form.

7. PID for a real control loop

For: greenhouse vent or drone altitude hold.

I need a PID controller in Arduino C++ for [greenhouse temperature]
controlling a [fan via PWM]. Explain P, I, D intuitively, give me
tuning starting values for a slow thermal system, and show how to
log the setpoint and output to serial for plotting.

8. Telemetry over WiFi for the drone

For: streaming sensor data from an ESP32 to your laptop.

Write an ESP32 sketch that runs a WebSocket server on port [81]
and pushes [IMU + altitude] telemetry at [20] Hz as JSON.
Include a minimal Python client using the websockets library
that prints the data as a live table.

9. The wiring sanity-check prompt

For: before you power anything on. This one is underrated.

Here is my planned wiring in text: [ESP32 GPIO21 -> SDA of BME280,
GPIO22 -> SCL, 3.3V -> VCC, GND -> GND, plus a 10k pull-up on each
line to 3.3V]. Review it as an embedded engineer. Flag any voltage
mismatch, missing pull-ups, or GPIOs that are input-only or
reserved on the ESP32. Cite the ESP32 pinout constraints.

10. Compiler error translator

For: every cryptic error you will meet.

Explain this Arduino compiler error in plain language, tell me the
actual root cause (not the symptom), and give the corrected code:
[error text]

11. Library reality check

For: avoiding hallucinated APIs. Essential.

I want to [read a DS18B20 temperature sensor on ESP32]. List only
libraries that actually exist and are maintained as of 2026, with
their Arduino Library Manager names and a one-line note on
differences. Do not invent methods — if unsure, say so.

12. Power budget calculator

For: the drone flight time you keep overestimating.

Help me build a power budget for an ESP32 drone: MCU [240 mA avg],
WiFi [120 mA], 4 motors at [1.5 A] each. Battery is [2S 1000 mAh].
Compute realistic flight time, explain the efficiency losses,
and tell me the weakest link in this design.

13. Deep-sleep for battery life

For: the greenhouse node that must run on a battery for weeks.

Rewrite my ESP32 sensor sketch to use deep sleep with a [10] minute
interval, waking via timer. Explain what state is lost on wake,
how to persist the WiFi config in RTC memory, and the realistic
current draw in sleep mode per the datasheet.

14. Flight path as code

For: the drone's recon route.

Generate a waypoint-following routine in Arduino C++ for an ESP32
drone using [GPS + barometer]. The path is a square of [10] m sides
at [2] m altitude. Include a safety hover if GPS fix is lost,
and log every waypoint reached to serial.

What actually took the time

The prompts above compressed the coding. They did not compress the physical reality. Soldering took three evenings. The first greenhouse prototype leaked because I trusted a float sensor over a capacitive one. The drone crashed twice before I understood that my PID gains were tuned for a thermal system, not a flight controller — prompt #7 works for both, but the numbers do not transfer.

Phase Days What AI did What I did
Sensor bring-up 1–7 Init code, I2C debug Wiring, multimeter
Home Assistant link 8–14 MQTT discovery Broker setup, verify
Greenhouse control 15–22 PID, deep sleep Mechanical build
Drone telemetry 23–30 WebSocket, waypoints Frame, tuning, crashes

Where to verify everything

The single habit that kept me from wasting weeks: treat every AI answer as a hypothesis, not a fact. The official sources below are the ones I actually used, and checking them is not optional.

  • docs.espressif.com — ESP32 pinouts, deep sleep current, LEDC PWM
  • docs.arduino.cc — core language reference and library APIs
  • home-assistant.io/docs/mqtt/discovery — the exact discovery payload format
  • rfc-editor.org and the OASIS MQTT spec — protocol-level truth
  • Sensor datasheets from the manufacturer (Bosch, Texas Instruments, etc.)

One caution on statistics: you will see flashy claims like "X% of IoT projects fail." I am not going to repeat a number I cannot trace to a primary source. What I can tell you from my own month is simpler and more useful — the failures were almost never the code. They were power, wiring, and assumptions.

Start with one sensor, not a drone

The temptation is to begin where I ended — with a flying machine. Resist it. Buy one ESP32, one I2C sensor, and one breadboard. Run prompt #1, then #2, then #9. When your sensor reliably appears in Home Assistant, you have crossed the hardest line in embedded work: you have closed the loop between code and physical reality. Everything after that — servos, PID, drones, deep sleep — is the same loop with more variables.

The prompts in this article are not a shortcut around engineering. They are a shortcut around the loneliness of learning it alone at 2 a.m. with a sensor that returns 0xFF. Copy them, but verify them. The datasheet is still the teacher; the AI is just the translator who never gets tired of your questions.

← All posts

Comments