Planted Aquarium - CO2 Reactor With Sesnor Feedback
Injecting Carbon Dioxide (CO2) into a planted aquarium can promote healthy plant growth, but it requires careful monitoring to avoid harming fish.
Planted Aquarium CO2 Reactor with Sensor Feedback
- Before you start, make sure to setup CircuitPython on your Raspberry Pi and install the Adafruit TCS34725 library as described in the tutorial above.
- Also install Krill Server and setup circuit python so it can use it: https://krillswarm.com/categories/lambdas
- Injecting Carbon Dioxide (CO2) into a planted aquarium can promote healthy plant growth, but it requires careful monitoring to avoid harming fish. By integrating a CO2 sensor with a Krill-controlled solenoid valve, you can create a feedback loop that maintains optimal CO2 levels for your aquatic ecosystem.
Costs can add up so I never liked just letting CO2 run through a diffuser where most escapes out of the tank. Instead, I use a solenoid valve to inject CO2 only when needed. The TCS34725 color sensor can detect changes in water color caused by pH shifts from CO2 absorption, providing an indirect measurement of CO2 levels.
While C02 at the right levels can help plants thrive, too much can be harmful to fish. By using the TCS34725 sensor to monitor water color changes, you can create a feedback loop that adjusts CO2 injection in real-time, ensuring a healthy balance for both plants and fish.
It can also lower pH so it’s important to buffer it with something like crushed coral to prevent harmful swings. With the right setup, you can create a thriving aquatic ecosystem that benefits from CO2 injection without risking the health of your fish.
Since the levels of dKH (degrees of Carbonate Hardness) and pH can vary greatly between tanks, it’s important to calibrate the sensor for your specific setup, reading pH dirrectly can give misleading results, using an indicator with a known dDKH where it’s only exposed to air from the aquarium outgasing can give a more accurate reading of the pH changes caused by CO2 absorption.
Here, I built a custom CO2 reactor using a Raspberry Pi, an Adafruit TCS34725 color sensor, and a solenoid valve. The Krill server runs the control logic, reading sensor data and adjusting the valve to maintain optimal CO2 levels.
CO2 is injected into the first chamber where it’s agitated and sent through the rest of the system so I don’t lose any of it to outgassing. The second chamber diverts a small amount of water from the aquarium and using an air pump, i intentionally outgas air through the water coming directly from the aquarium and send it to a third chamber with indicator solution.
Then the TCS34725 sensor reads the color of the indicator solution, which changes based on the pH level affected by CO2 absorption. The Krill server processes this data and adjusts the solenoid valve accordingly to maintain optimal CO2 levels in the aquarium.
Pi Setup
ssh into your Raspberry Pi and enable I2C:
1
sudo raspi-config
Navigate to “Interfacing Options” → “I2C” and enable it. Then, install the necessary libraries:
sudo apt update
sudo apt install i2c-tools python3-pip
pip3 install adafruit-circuitpython-tcs34725
Last verified: 2026-04-03