Project Tutorial: Plant Bioelectric Signals → Music (ESP32 + AD8232 + Soil Moisture ADC)
1) Purpose
Build a device that reads plant bioelectric signals (via an AD8232 analog front-end) and soil moisture (via a capacitive sensor), then maps these analog readings into musical parameters (pitch/tempo/volume) on a PC (or later, standalone).
This is a training project to teach:
- ADC fundamentals
- analog signal conditioning and noise
- sampling and basic digital filtering
- serial signaling/telemetry
- “sensor → control” mapping
2) Scope
This tutorial covers:
- hardware requirements and wiring
- pinouts (generic ESP32)
- safe bring-up steps
- verification and debugging
- learning outcomes
It does not include full firmware code in this file.
- Firmware code will live in a separate file (see Section 11).
3) Outcome (what the team will deliver)
Hardware deliverables
- Working breadboard prototype
- Stable wiring (strain relief) for plant clips
Software deliverables
- ESP32 firmware that streams:
- AD8232 analog output
- soil moisture analog value
- basic filtered values
- PC-side script/app that converts the stream into audio (MIDI or synth controls)
Documentation deliverables
- photos of wiring
- calibration notes
- short demo video
4) Learning outcomes (what the team should learn)
After completing this project, the team should be able to:
-
ADC basics
- resolution, reference voltage, quantization
- sampling rate vs noise
-
Analog signal challenges
- contact noise, mains hum (50/60Hz), motion artifacts
- grounding, shielding, cable effects
-
Signal processing (lightweight)
- moving average / low-pass filtering
- normalization, clamping, mapping ranges
-
Telemetry/signaling
- serial framing
- timestamps and sample counters
- validating data integrity
-
System thinking
- incremental bring-up
- prove each subsystem before integrating
5) Bill of Materials (what you already ordered)
- AD8232 ECG Measurement Module Kit
- Capacitive Soil Moisture Sensor (analog)
- Double-ended crocodile clip cables (50cm)
6) Additional required items (team must have)
- ESP32 dev board (any ESP32 with ADC; ESP32-WROOM recommended)
- Breadboard + jumper wires (M-M, M-F)
- USB cable for ESP32
- Laptop/PC for serial read + audio generation
Optional but helpful:
- Multimeter
- Oscilloscope / logic analyzer
- Ear-clip electrodes (more stable than crocodile clips)
7) Safety + ethics notes
- AD8232 is an ECG front-end. In this project it is used only as a low-level biosignal amplifier for plants (non-medical).
- Do not attach electrodes to humans for this training project.
8) Module pinouts (typical)
8.1 AD8232 module (common breakout)
Typical pins (labels vary by vendor):
- 3.3V / VCC — power
- GND — ground
- OUTPUT / OUT — analog output (to ESP32 ADC)
- LO+ / LO- — lead-off detect (optional digital signals)
- SDN — shutdown (optional)
Electrode pads (varies):
- RA, LA, RL (right arm / left arm / right leg) on ECG boards
- For plants: treat these as electrode A, electrode B, and reference/ground.
8.2 Capacitive soil moisture sensor (analog)
Typical pins:
- VCC — power (often 3.3–5V)
- GND
- AOUT / AO — analog output (to ESP32 ADC)
9) ESP32 pin selection (generic guidance)
ESP32 ADC pins are not all equal. Recommended:
- Use ADC1 pins (more reliable when Wi‑Fi is enabled).
- Avoid using ADC2 pins if you plan to use Wi‑Fi.
Common ADC1 GPIOs (ESP32-WROOM):
- GPIO32, GPIO33, GPIO34, GPIO35, GPIO36, GPIO39
Notes:
- GPIO34–39 are input-only (fine for ADC).
10) Wiring (recommended prototype)
10.1 Common ground
All modules must share the same ground:
- ESP32 GND ↔ AD8232 GND ↔ Moisture sensor GND
10.2 Power
Recommended to power sensors from 3.3V (ESP32 3V3):
- ESP32 3V3 → AD8232 VCC
- ESP32 3V3 → Moisture sensor VCC
10.3 Signals
- AD8232 OUT → ESP32 ADC pin (ADC1)
- Moisture AO → ESP32 ADC pin (ADC1)
10.4 Text diagram
+-------------------+
| ESP32 |
| |
3V3 ------+ 3V3 GND +------+-------------------+
| | | |
ADC_A <----+ GPIO32 (ADC1) | | |
ADC_B <----+ GPIO33 (ADC1) | | |
+-------------------+ | |
| |
+----------+---------+ +------+----------------+
| AD8232 module | | Capacitive Moisture |
| | | Sensor (Analog) |
| VCC <-------------+--+ VCC |
| GND <-------------+--+ GND |
| OUT ------------->| | AO ---------------->|
+--------------------+ +----------------------+
10.5 Electrode hookup (plant)
Start with 2 clips:
- Clip A → leaf surface (top)
- Clip B → another leaf surface (same plant)
Optional reference clip (if your AD8232 board expects 3-lead):
- Clip Ref (RL) → soil / pot metal / a stable reference (experiment)
Important: don’t pierce the leaf. Clip gently.
11) Bring-up procedure (step-by-step)
Step 1 — Baseline ADC test (no sensors)
Goal: confirm ADC reading works.
- Read one ADC pin with nothing connected.
- Observe noise/random values.
Success:
- You see values changing slightly, not stuck at 0 or max.
Step 2 — Moisture sensor only
Goal: confirm sensor range and stability.
- Wire moisture sensor AO → ADC
- Insert into dry soil, then wet soil
Success:
- Values change meaningfully with moisture.
Step 3 — AD8232 power + OUT sanity check (no plant)
Goal: ensure OUT is not saturating.
- Wire AD8232 OUT → ADC
Success:
- OUT is not pinned at 0 or 4095 (ESP32 12-bit) constantly.
Step 4 — Attach plant electrodes
Goal: observe slow-varying signal and noise characteristics.
Expected:
- Very small changes, lots of noise.
- Movement, touching clips, and nearby power supplies will add artifacts.
Step 5 — Filtering + downsampling
Goal: produce a stable “control signal” for music.
- Add moving average / low-pass
- Add normalization to a 0–1 range
Step 6 — Map to music parameters
Examples:
- Plant amplitude → volume
- Plant rate-of-change → pitch bend
- Moisture → tempo or instrument selection
12) Verification checklist (Definition of Done)
- ESP32 streams CSV (or JSON lines) with timestamp + sample counter
- Moisture sensor shows expected dry/wet difference
- Plant signal reading is non-flat (not stuck), and responds to touch/movement
- Filtered signal is stable enough to drive audio without constant jitter
- Demo: 60–120 seconds of “plant music” recording
13) Troubleshooting
Symptom: ADC always 0 or always max
- Wrong pin (not ADC capable)
- Wiring error
- Power mismatch
Symptom: signal extremely noisy
- Long unshielded leads (expected)
- Poor contact on leaf
- No common ground
- Nearby mains noise / chargers
Fixes:
- shorten leads
- use USB power bank (less noisy)
- add filtering and clamp extremes
Symptom: moisture sensor reads backwards
- Some sensors output higher value when dry; others when wet.
- Fix by inverting mapping.
14) Extensions (optional upgrades)
- Replace crocodile clips with ear-clip electrodes for stable contact.
- Add a simple analog RC low-pass filter before ADC.
- Add OLED to show live values.
- Run audio generation on Raspberry Pi for portability.
15) References
- XDA overview: https://www.xda-developers.com/this-awesome-esp32-project-turns-plant-bioelectric-signals-into-music/
16) Changelog
- 2026-02-12: Initial tutorial template created