After months of work I’m pleased to announce I installed my DIY reef controller today!
The Сева (Sewa) Controller replaces a rats nets of outlet timers and manual processes with a micro-controller plus relay power system. It brings a more complex flow simulation, automated feed mode, and refugium light schedule to my 300 liter reef aquarium.
Designed after my i300C Dive Computer the user interface consists primarily of two buttons. One button advances modes and the other activates the mode. Beside that is an override switch. The available modes are:
As water swooshes between the crevices of the rockscape and around the tank it does a number of important biological processes:
Besides modes the controller does simulation / scheduling in the background to enable more varied water flow. Previously I had both circulation pumps on a timer where they were on for two and a half hours then off a half hour. Building off that idea with the controller I broke every three hours into 30 min chunks, then applied a one of the following flow patterns:
It’s very fulfilling to sit next to the tank in home-office and hear it every 30min change flow patterns.
On the hardware side the controller is made up of the following parts, starting from top left and going down:
Bring these parts together was a process of trial and error. Sometimes setting it down in frustration for weeks. Originally I wanted to have 10 controlled outlets with individual override switches for each. A grand plan, but it was simply to much to pull off and I had to tape over the extra holes in the case. In the end I reduced the inputs and limited the number of controlled outlets to eight. Of the eight I’m only using four at the moment.
The program I wrote for the micro-controller is available on sourcehut. It is entirely in CircuitPython so development is straightforward and much easier for me then C++. I designed the logic around a simple publisher subscriber event system. Example:
A timer fires every 15 seconds triggering the RTC module to read the current time from the RTC chip. The current time is then published and a verity of other modules make calculations. The flow simulation module takes this time and determines which of the flow patterns should be running and publishes messages to turn on/off the needed pumps. The power module gets this requests to turn on a pump, checking priority to ensure things like feed mode are not interrupted, and then supplies power to the correct pin which then gets logic shifted to 5v and the relay board magnetizes a corresponding relay and power flow to the pump.
When real world things happen in responce to this programmed event system it super exciting! Another example is pressing the adv button twice followed by sel button once:
Input events are published and the mode module navigates the mode tree, in this case to the feed mode. As modes change the various other modules take responsibility and publish rendering events with text. The rendering events are processed by the display module who actually takes care of the I2C communication to the LCD. Pressing the sel button in this cases counts as a ‘click’ on feed mode, so the feed mode module activates and sends messages to turn off all pumps and starts a timer to turn them back on after five/ten minuets.
This might sound complex but now that it is installed everything happens as it should without the need to remember much. Just having the pumps turn back on after feed mode could have saved my corals a stressful time that had last week when I forgot the circulation pumps for 12 hours.
Enough sitting back and enjoying the controller do it’s work, time to plan next steps. I’ve ordered two more circulation pumps and when they arrive will program them to achieve circular flow patterns. In total I’ve four more controlled outlets to fill. Come summer I’m planning on adding a T5 bulb light which will become part of the system. Also time to start on a separate internet connected sensor project for the tank. Look forward to more hobby-electronics + reef aquarium posts.
This project has been a steep learning curve for me. I hope other can learn from it.