Skip to content

MartinPavella/BioReactorNode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BioReactorNode

Autonomous Duckweed Cultivator — ESP32 Control Software

This repository contains the firmware used for the two ESP32 microcontrollers that form part of the autonomous duckweed cultivator developed by the iGEM Brno 2025 team.
Each ESP32 board handles a specific subsystem of the bioreactor:

  • The main (lights) board controls lighting, valve actuation, and PROBE optical biomass measurement.
  • The pump board manages nutrient and harvesting pumps, additive mixing, and pH/EC monitoring.

Overview

This single source file can be compiled for either of the two boards depending on the MAIN_BOARD symbol:

  • When MAIN_BOARD is defined, the firmware runs in main board mode — managing the LEDs, valves, and PROBE sensor array.
  • When MAIN_BOARD is not defined, it runs in pump board mode — controlling the peristaltic and harvesting pumps, mixers, and monitoring pH and conductivity sensors.

The ESP32s communicate with a central Raspberry Pi server over Wi-Fi and MQTT, forming a distributed control network for the bioreactor.


Features

🧠 Common to Both Boards

  • Automatic Wi-Fi and MQTT reconnection on startup.
  • Status LED blink patterns:
    • 3 blinks: Wi-Fi connection failed.
    • 5 blinks: MQTT connection failed.
  • MQTT-based command and telemetry exchange with the Raspberry Pi (bioreactor.local).

💡 Main Board (Lights + Valves)

  • Controls 5 electromagnetic valves and 5 LED lights, one per cultivation layer.
  • Reads PROBE optical biomass sensor signals (analog inputs).
  • MQTT Commands:
    • open_valve_<id> / close_valve_<id>
    • light_on_<id> / light_off_<id>
    • all_lights_on / all_lights_off
    • all_valves_on / all_valves_off
    • trigger_probe_measurement
    • get_probe_readings

💧 Pump Board

  • Controls:
    • 4 peristaltic pumps (for nutrient inflow/outflow)
    • 1 harvesting pump (PWM controlled)
    • Additive mixer
    • Reservoir mixing pump
  • Monitors pH and conductivity sensors (analog inputs).
  • MQTT Commands:
    • start_pump:<power%> / stop_pump
    • peristaltic_on:<id> / peristaltic_off:<id>
    • additive_mixing_on / additive_mixing_off
    • reservoir_mixing_on / reservoir_mixing_off
    • trigger_ph_cond_measurement
    • get_ph_cond_reading

Communication Architecture

Component Role Connection
ESP32 (Main Board) Lights, valves, PROBE sensor Wi-Fi → MQTT
ESP32 (Pump Board) Pumps, mixers, pH & EC sensors Wi-Fi → MQTT
Raspberry Pi Central controller + GUI MQTT Broker (bioreactor.local)

MQTT Topics

Direction Topic Description
ESP → Server esp_to_server/rack0 / esp_to_server/pump Sensor data and status updates
Server → ESP server_to_esp/rack0 / server_to_esp/pump Control commands
ESP Client IDs esp/rack0, esp/pump MQTT client identifiers

Setup & Flashing

Requirements

  • Hardware: 2× ESP32 microcontrollers
  • Software:

Configuration

At the top of the file, configure your Wi-Fi and MQTT details:

const char* wifi_network_name = "Nitroduck-BioReactor";
const char* wifi_network_password = "iGEM2025";
const char* mqtt_server_uri = "bioreactor.local";

To select the board mode:

#define MAIN_BOARD 1     // Enable for main (lights) board
// #define MAIN_BOARD 1  // Comment out for pump board

Flashing

  1. Connect the ESP32 to your computer via USB.
  2. Open the file in Arduino IDE or PlatformIO.
  3. Select the correct board and port.
  4. Upload the firmware.

Integration with BioReactorManager

This firmware communicates with the BioReactorManager (Raspberry Pi software) via MQTT.
The corresponding repository can be found here:
👉 BioReactorManager Repository


Hardware Documentation

Detailed hardware design, sensor integration, and system overview are documented on our iGEM wiki:
🔗 iGEM Brno 2025 Hardware Page


License

This project is licensed under the MIT License.
You are free to use, modify, and distribute this code for any purpose with attribution.


Authors

Developed by the iGEM Brno 2025 hardware subteam.
Primary author: Martin Pavella

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages