Botani-Flow
Northwestern EE 327, Spring 2024
View code on GitHub ↗︎- Embedded Systems
- PCB Design
- Power Electronics
- Sensor & Actuator Integration
- IoT Systems

The problem
Plant parents forget to water on a consistent schedule or neglect individual plant needs. Botani-Flow is an indoor plant-care system that waters up to four plants independently, monitors their environment continuously, and lets a user manage the whole system from a browser.
System architecture
The system uses an ESP32-WROOM-32E and combines sensing, actuation, and web control.

Power and Switching Design
- Five N-MOSFETs
- 11.1V LiPo battery
- DC/DC buck converter
Because the ESP32's GPIOs only source 3.3 V and a few tens of milliamps, they can't switch the 11.1 V pump and valves directly. The design uses five N-channel MOSFETs as the switching stage (one per valve, one for the pump) — with each GPIO driving a gate, drain tied to the actuator's negative terminal, source to ground, and the actuator's positive terminal on the 11.1 V rail. This allows the GPIOs is act as logic-level switches, and the microcontroller does not need to interface directly with the higher power supply.
PCB and 3D Printed Design


A custom two-layer PCB integrated the ESP32, power conversion, and MOSFET switching stage. The board and battery were housed in a 3D-printed enclosure with openings for sensors that needed to sample the surrounding environment.
Software
- ESP32 firmware: C++ / Arduino
- Server: Python / Tornado
- Communication: WebSockets
- State persistence: JSON
- Frontend: HTML, CSS, JavaScript, and Plotly
The website displayed live environmental data, allowed users to configure watering schedules, and could query a plant API for recommended growing conditions.


The firmware logic is as follows:

Debugging
The design worked on the breadboard, but stopped working on the assembled PCB. The pump and valves no longer responded, even though the same control logic had previously worked. With the deadline coming quick, we took the following debug approach:
Step 1: Assess the firmware. I started by checking the control signal at each stage: GPIO output, MOSFET gate voltage, drain behavior, actual actuator response. The ESP32 was driving the gates as expected. This meant the problem was not the firmware.
Step 2: Compare the hardware. The breadboard used through-hole IRL520N MOSFETs, while the PCB used different surface-mount MOSFETs. After reviewing the datasheet, we realized the surface-mount parts had a gate-drive requirement that was incompatible with the ESP32's 3.3 V logic level. They did not turn on fully enough to achieve a sufficiently low on-resistance for the actuators.
To solve the problem without a new board spin, we desoldered the SMT MOSFETs and re-soldered the through-hole MOSFETs that had already worked on the breadboard. After this change, we tested the system again.
Luckily, the actuator began working! That isolated the root cause: a component selection error, rather than a firmware bug. Swapping the transistor was an easy fix.

Verification
Each sensor was individually bench-tested before integration. For the soil-moisture sensors, wet and dry measurements were used to map raw readings to a percentage range.
The actuator stage was also verified at the hardware level by checking:
- Gate voltage
- Drain behavior
- MOSFET switching
- Actual water delivery
Measuring the circuit directly was what ultimately separated the MOSFET issue from a possible firmware or wiring problem.
Results
By the end of the quarter, Botani-Flow reliably streamed live sensor data to the website, watered on user command and on a configurable schedule, displayed status locally on an OLED, and could look up recommended growing conditions for a named plant through an online API.
What I'd do differently
-
Select MOSFETs against the actual gate-drive voltage: For a future revision, I would select MOSFETs specifically for reliable operation at a 3.3 V gate drive rather than adapting a similar-looking part from a reference design.
-
Improve power management: The system currently has no sleep mode or power switch, so the battery must be physically disconnected to turn it off. A future revision would move ESP32-to-server communication to MQTT so the microcontroller could sleep between watering and sensor-reporting cycles.
-
Reorganize the physical layout: The enclosure and PCB layout also need another iteration. The display and DHT11 ended up oriented in a way that prevents the enclosure from standing upright on its own.