Configuration & Testing

With circuit and housing completed, let's proceed with configuring and calibrating our new dosing system. Power up reef-pi and head to the reef-pi web UI. First, verify you have the doser capability enabled in settings section under configuration tab. Since this is a doser only build, I am disabling the unrelated modules, such as lighting, temperature etc. We'll be using the equipment tab for a trick, I'll discuss that shortly.

Once settings are updated, reload reef-pi from the admin section under configuration

Lights, dosing pump etc are all controlled by PWM pins which are represented as jacks in reef-pi. A jack can have multiple pins. Every dosing pump is associated with one of the pins of a jack. Since we are using Raspberry Pi's hardware PWM (GPIO 18 and 19) , we'll declare two jacks, with rpi as the driver (it can be PCA9685 IC as well). We are using L293D IC which allows us to control the direction of peristaltic pump using two input pins for each of the pumps. If both of these inputs are on or off, the pump is off. If one of them in on and the other is off, then the pump runs. The pumps direction depends upon which of the input pin is on. To simulate this, we'll employ a trick in reef-pi, where we'll create outlets with each of the GPIOs (total 4) controlling the direction of the two peristaltic pumps. We'll create virtual equipment with these GPIOs and then we can control the on/off state of the equipment, which in turn will control the GPIO and thereby the direction of the pumps.

Now with this planned out, let's go ahead and create all the necessary connectors, four outlets and two jacks.

Note, the PWM pins (jacks) are 0 and 1 which represents GPIO 18 and 19. This is because the Linux kernel maps them as 0 and 1

Create two dosing pumps, associate each of them with one of the jack and its pin. Keep the pumps in the disabled state. We'll calibrate them before using them.

Here's the list of pumps in my dosing pumps tab.

Next, switch to the equipment tab and create four virtual equipment items and associate them with the outlets. As per our circuit, GPIO 5 and 22 are controlling the first pump, hence when the equipment associated with them (Pump1-A and Pump1-B) are both on or off, the pump will be off. Same goes for the other pump. In the screenshot below, one of the equipment items associated each pump is on, while the other is off. Which means the pump will run  (as long as there's a PWM output). If we make Pump1-A off and Pump1-B on, that will change the direction of PumpA.

With the pump direction set, let's go back to the dosing pumps tab and start calibrating the pump. Different dosing pumps have different capacity (volume of liquid dispensed in unit time) and should be calibrated before they are used. For calibration, individual dosing pumps in reef-pi must be in disabled state. Click on the calibrate button. Set a PWM or speed value, which ranges from 1-100 and duration in seconds. Make sure you attach silicon tubing to your dosing pump and use some type of liquid (like water) for testing. In this example I am using speed 70 and duration 15 seconds. This will instruct reef-pi to run Pump1 for 15 seconds at 70% speed.

Use a measuring cylinder or similar vessel to measure the amount of liquid dispensed by the pump. Note it down. For me it was 5ml. This is the value that you'll use to decide how long you need to run your dosing pump and at what speed, depending upon your dosing regimen. I dose 2ml of two-part solution (Calcium carbonate and Alakalinity)  every day. So, I went back and scheduled my dosing pump to dose every night at 3 AM for 5 seconds at speed 50. Click on the edit button, set the schedule and enable the dosing pump. That's all, your automatic dosing system is ready for operation. 

I highly recommend calibrating your dosing pumps every two months and use a dosing container with volume indicators/ This will make it easy to check how much liquid has been dispensed by the pumps over a period of time. There are really expensive and precise dosing pumps on the market that will make this much safer, but I rarely found they are necessary unless you are automating titration (we'll get back to this later). For most reef keeping purposes, it's the amount of chemical over a time period that matters, and we can always make a higher dilution and dispense them more frequently at a lower volume, thus reducing our error margin. In most cases, you can use your pH sensor as a feedback mechanism to check the effect of chemicals in the tank.

Thank you for reading through the 7th guide in the reef-pi. I sincerely hope this series will help you automate (or get started with) some of the chores involved in reef keeping, a hard but rewarding hobby.

This guide was first published on Nov 28, 2018. It was last updated on Nov 28, 2018. This page (Configuration & Testing) was last updated on Sep 18, 2019.