Welcome to the sixth guide in reef-pi aquarium monitoring project series. In this part, we'll learn how to use reef-pi to monitor aquarium pH. Corals are sensitive to pH, and most tropical corals thrive in pH range of 7.6 to 8.4. Due to the high CO2 in the indoor air and various other biological factors in the aquariums, maintaining stable pH is one of the main concerns in reef keeping. Stony corals require calcium and alkalinity additives for their skeletal growth. But it is relatively hard to increase alkalinity without decreasing pH. Hence pH is monitored closely and use as an indicator to decide how much calcium and alkalinity supplement is safe. 

For example, Acropora (a type of stony coral ) is one of the most popular coral in the reef keeping community. They are relatively harder to keep due to their strict requirements (precise water chemistry, strong flow, strong light), but once provided with the appropriate environment can grow rapidly and shows a myriad of color morphs. pH monitoring and automated dosing (covered in next guide) are two useful equipment in the husbandry of hard to keep corals such as Acropora.

We are building a simple standalone pH monitor, with only pi zero and pH probe circuit from atlas scientific is used. A small clear case housing is used to mount all the electronics. This build will monitor a reef aquarium water pH continuously. This will allow us to visualize the daily pH cycle and alert when it goes out of range.

I am listing all the electronics component required for the build, excluding pH probe and calibration solutions. pH probes can be found either in Atlas Scientific website or any of the popular marine aquarium vendor website such as Bulk Reef Supply or Marine Depot most pH probes are interchangeable (as long as they use BNC connector), just make sure to get a saltwater friendly probe.

1 x Raspberry Pi
Raspberry Pi zero
1 x Perma Proto board
Mint tin size perma proto board
1 x Male header pins
Male header pin
1 x Female headers
Female headers
1 x EZO pH circuit
Atlas Scientific EZO pH circuit
1 x BNC Connector and carrier board
BNC connector and carrier board
1 x 5V power adapter
Power adapter
1 x Barrel jack
Panel mount barrel jack
1 x Enclosure
Plastic enclosure for the build
1 x Female-Female jumper wire
Female female jumper wire
1 x Nylon standoffs
Nylon standoffs
AtlasScientific EZO board for pH sensors

A pH monitoring circuit is one of the simplest circuits to construct in reef-pi. Here is a general overview of the connections: Raspberry Pi's I2C pins (SDA and SCL) is connected to the EZO circuit, along with power (5V) and GND connection. You can find more details in official Atlas Scientific wiring guide

It is recommended to use two 4.7K pull up resistor for SDA and SCL connections. We'll use a Mint tin size Perma Proto board to create 5V and GND rails and to mount male/female headers where Pi, EZO and input power will be connected. Here is a Fritzing breadboard view of the entire setup

I am using yellow solid core wire to denote SDA pin and green solid core wire to denote SCL pin. Female header pins are soldered to mount the EZO board and BNC connector.

Ignore the red solid core wire at the bottom, it was soldered by mistake. Also, there are four female headers at the bottom to connect BNC connector, but only the three rightmost ones are used.

EZO board attached to the female headers

And the entire circuit, including BNC connector. Note: I am using just BNC connector here, but I recommend using the ones with carrier board for voltage isolation (linked in the parts list)

That's it, next we'll move on to fabricating the enclosure

We are using a small clear top plastic enclosure to house the entire circuit including the Raspberry Pi. Start with drilling holes for mounting the BNC connector and barrel jack (for input power supply) on the bottom side of the enclosure

Mark and drill holes to mount the Perma Proto board and Raspberry Pi Zero. The Raspberry Pi Zero will be mounted on the top panel, while the Perma Proto board will be mounted in the center. Use nylon standoffs to mount the Raspberry Pi and the Perma Proto boards.

Raspberry Pi mounted

Next mount the Perma Proto board and BNC connector.

Next mount the barrel jack (make sure to tin it and solder female jumper wires). 

After that, connect all the components with female-female jumper wire. There will be four wires for the Pi Zero, 5V, GND, SDA and SCL.

The build is complete at this point, screw on the top panel and proceed to configuration and testing.

Once the housing and circuit is completed, plug in the pH probe in BNC connector and power up reef-pi and head over to the UI. If you are not familiar with reef-pi installation and UI, refer to the first guide in this series for details.

Navigate to the pH tab, and create a new probe by clicking the "+" sign. By default EZO circuit has I2C address of 0x99, unless you are changing it, keep it as it is. Add the probe in disable state.

Before using pH probe, we have to calibrate it. Depending upon what calibration solutions you are using choose the appropriate value and hit "Run". reef-pi allows one, two or three point calibration. Calibration is not an absolute requirement, but a highly recommended step before usage.

Once calibrated, enable the probe and reef-pi will start monitoring your tank pH. The readings can be viewed in the reef-pi dashboard directly. If you have enabled adafruit.io, reef-pi will send the same data there as well and you can create dashboard there. Here is an example of my reef aquariums pH cycle.

Now our reef-pi pH monitor is calibrated and operational. In next guide, we'll build a dosing system, and use the pH monitor as our guiding force to deduce the appropriate dosing amount of different chemical additives. Thank you and see you in the next part in this series

This guide was first published on Nov 07, 2018. It was last updated on Nov 07, 2018.