← All projects
research2022·Academic

Hydroponic System Automation

Senior design thesis — a controller that holds a soil-free growing medium at the right pH, nutrient strength and water level without daily supervision.

  • ESP32
  • ESP8266
  • Raspberry Pi 4
  • pH probe
  • EC / TDS
  • SHT20
  • Dosing pumps
  • PWM
  • B.Sc. design project at Manisa Celal Bayar University, supervised by Doç. Dr. Yücel Koçyiğit
  • Four field nodes reporting to a Raspberry Pi that holds the database and the control logic
  • Closed-loop pH, nutrient and water-level regulation, sequenced so they do not fight each other
  • Simulated before build, then calibrated and installed as a working panel

Hydroponics removes most of the hard parts of growing — it is a closed loop, so water loss is near zero, and being isolated from the outside means no pesticide. What it does not remove is effort. The growing medium has to be held at the right pH, nutrient concentration, temperature and water level, and left alone that is a daily manual chore.

That is a control problem, not an agricultural one. The thesis builds a controller that regulates the medium automatically after installation.

Architecture

Measurement stays at the edge and control lives centrally. Four field nodes — two ESP32s for sensing and actuation, an ESP8266 for lighting, and a fourth for light measurement — report over the LAN to a Raspberry Pi 4 holding the database, the automations and the interface.

The split matters for reliability: a single node dropping off takes out one measurement rather than the whole loop, and the control logic can be changed without reflashing anything in the grow room.

  • Unit 1 — sensing. pH, EC/TDS, air and water temperature and humidity (SHT20 and AM2315 over I²C, waterproof Dallas probes over 1-Wire), ultrasonic and analogue level, flow, leak, turbidity, and an INA226 power meter.
  • Unit 2 — actuation. Relays, dosing pumps for nutrient and pH correction, the main circulation pump, air pump and ventilation fans.
  • Unit 3 — lighting. PWM brightness control through a TIP122 Darlington.
  • Light measurement. VEML6070 for UV, TCS34725 for colour, TSL2561 for illuminance — closing the loop on the light actually delivered rather than the light nominally switched on.

The three control loops

The interesting part of the project is that the three regulation loops interact, and the order they run in is what makes the system stable.

pH is corrected by dosing acid or base, then waiting. Each correction runs the pump for five seconds and then holds for thirty before reading again. Without that settle time the controller reads a tank that has not finished mixing, over-corrects, and oscillates.

Nutrient strength is controlled against electrical conductivity, which rises with dissolved salt content and therefore stands in for concentration. The A and B concentrates are dosed in a fixed ratio and separately — mixed at full strength they precipitate out of solution.

Water level has to be corrected before nutrient strength, never after. Topping the tank up with plain water dilutes everything in it, so a level correction invalidates the EC reading that preceded it. Sequencing these the wrong way round produces a system that chases its own tail.

Cost as a design constraint

The project was explicitly cost-driven, since the target user was a small grower rather than a commercial greenhouse. Plastic parts for the pumps and fittings were modelled and 3D printed rather than bought, and a broad supplier list was built for every sensor and microcontroller so the bill of materials could be re-sourced to whatever was cheapest at production time.

The system was simulated before any hardware was committed, then calibrated against buffer solutions and built into a control panel with the mains and low-voltage sections separated.

Redrawn from the thesis

System diagrams

The original diagrams were drawn in Turkish. These are redrawn in English, and are live SVG rather than screenshots — so they stay sharp at any zoom and follow the page theme.

  1. Figure 1 — System architectureUnit 1Sensing · ESP32Unit 2Actuation · ESP32Unit 3Lighting · ESP8266Light MeasurementESP8266RouterWANMain ControllerRaspberry Pi 4LANDatabaseAutomationspH balancingA&B nutrient dosingWater level top-upLeak detectionEnclosure temperatureLighting scheduleUser interface

    Figure 1

    System architecture

    Four field nodes report over the LAN to a Raspberry Pi 4 that holds the database, the automations and the interface. Measurement lives at the edge and control lives centrally, so a single node dropping off costs one measurement rather than the whole loop — and the control logic can be changed without reflashing anything in the grow room.

  2. Figure 3 — Unit 1, sensingMain controllerWater levelminWater levelmaxTemperatureUltrasonicwater levelWater flowrateControl panellid switchCurrent clampINA226current · voltagepHTDSWater turbidityWater leak1 & 2AM2315temp & humiditySHT20temp & humidityESP32

    Figure 3

    Unit 1 — sensing

    Everything the controller measures. Water level by both float switches and ultrasonic ranging, flow rate, pH, TDS, turbidity, two leak detectors, and two separate temperature and humidity sensors over I²C. The lid switch matters more than it looks: it tells the system when someone has the enclosure open.

  3. Figure 6 — Unit 2, actuationMain controllerAir pumpVentilation fanHV relayHV relayBuzzerBME280temp & pressureINA226current · voltagepH up pumppH down pumpNutrient A pumpNutrient B pumpMain water pumpCirculation pumpSolenoid watervalveLV relayESP32

    Figure 6

    Unit 2 — actuation

    Everything the controller can move. Four dosing pumps handle pH up, pH down and the two nutrient concentrates; the main and circulation pumps move water; the solenoid valve tops the tank up from mains. High- and low-voltage relays are kept on separate banks.

  4. Figure 7 — Unit 3, lightingMain controllerControl panel lampvia TIP122Grow lampvia TIP122INA226current · voltageESP8266

    Figure 7

    Unit 3 — lighting

    Grow and panel lamps dimmed by PWM through TIP122 Darlingtons. Driving the lights on a duty cycle rather than switching them fully on gives control over delivered light without burning the difference off as heat in a series resistor.

  5. Figure 8 — Light measurementMain controllerINA226current · voltageUV radiationVEML6070TSL2561illuminanceTCS34725RGB · colour tempESP8266

    Figure 8

    Light measurement

    A separate node measuring what actually reaches the canopy — ultraviolet, illuminance, and colour temperature. This is what closes the loop on Unit 3: without it the system knows the lamp is on, but not what the plants are receiving.

From the thesis

Hardware and results

Photographs, control-flow charts and simulation output from the thesis, with the captions rewritten in English.

  1. Figure 2

    Types of hydroponic system

    The six growing methods surveyed before choosing one — nutrient film, deep water culture, ebb and flow, drip, aeroponics and the conventional variant. Each places different demands on the controller.

  2. Figure 4

    Dallas temperature sensor

    The waterproof 1-Wire probe used for water temperature. 1-Wire lets several probes share a single data line, which matters when sensors are spread across a tank, a feed line and the air above the crop.

  3. Figure 5

    Turbidity sensor — voltage against cloudiness

    The sensor's transfer curve. Turbidity indicates algae growth or particulate contamination in the nutrient solution, both of which foul the pumps.

  4. Figure 9

    Hydroponic growing pipe

    The growing channel itself, with the net-pot spacing that sets how many plants a run supports and how much root mass the flow has to feed.

  5. Figure 10

    pH solutions, A&B nutrient and dosing pumps

    The correction chemistry: pH-up and pH-down solutions plus the two-part A&B nutrient concentrate, each on its own dosing pump. A and B must be dosed separately — mixed at concentration they precipitate out of solution.

  6. Figure 11

    pH regulation algorithm

    The control loop for pH, implemented as a state machine. If the reading sits outside the configured window the matching pump runs for five seconds, then the loop waits thirty before reading again. That settle time is the whole design: dosing faster than the tank mixes is exactly how a pH controller ends up oscillating between over-corrections.

  7. Figure 12

    A&B nutrient regulation algorithm

    Nutrient strength is controlled against electrical conductivity: EC rises as dissolved salts increase, so it stands in for concentration. A and B are dosed in a fixed ratio and the loop waits for the reading to settle.

  8. Figure 13

    Tank water level regulation algorithm

    Level control, and the reason nutrient dosing is sequenced after it: topping up with plain water dilutes the solution, so EC has to be corrected after the level is right, never before.

  9. Figure 15

    Simulation — view 1

    The system modelled before hardware was committed, to check that the control loops behave at realistic tank volumes and dosing rates.

  10. Figure 16

    Simulation — view 2

    A second simulation view covering the interaction between level, EC and pH regulation running together.

  11. Figure 17

    pH sensor calibration

    Calibration against buffer solutions. A pH probe drifts as its glass membrane ages, so periodic recalibration is a maintenance requirement, not a one-off setup step.

  12. Figure 18

    Control panel — interior

    The assembled controller: supplies, relays and terminal blocks, with low-voltage signal wiring kept away from the switched mains side.

  13. Figure 19

    Control panel — inner cover

    The inner cover, which keeps the mains section out of reach while the low-voltage side is being worked on.

  14. Figure 20

    Control panel — exterior

    The finished enclosure as installed.

  15. Figure 21

    Light measurement hardware

    The light sensing head as built, positioned at canopy height where the measurement is actually meaningful.

  16. Figure 22

    Water tank and measurement instruments

    The tank with the pH, EC and level instrumentation installed in the circulation path.