This week I put some love into my 300 litre saltwater reef aquarium by upgrading the controller with new features. Now it turns on the new cabinet lights automatically and controls the T5 bulb fixture I installed a few weeks ago.
Maintenance is keep to a healthy reef tank. Opening the cabinet under the tank, refiling dosing containers, cleaning filter socks, and refilling the carbon filter periodically are important. Making this process easy means it happens more often and the fish and coral thrive.
Cabinet lights enable quick and efficient maintenance. But plugging something in or flipping a switch every time to turn them on? No that won’t do. So connecting them to the controller was a must.
Hacking on the controller I found out about reed switches. A fascinating technology that uses magnetic fields to control the flow of electricity through an element. A few Euros and an AliExpress order later, I had a few reed switches and a LED strip to play with.
I cam up with this simple circuit combine a reed switch + pull-down resistor with the controller.
Now there is a magnet on the door. When it comes close to the reed switch, mounted inside the cabinet, it connects a pin on the microcontroller to +3V. The software picks up this change and using a relay turns off the outlet the LED strip is plugged into.
With this design I put some simple hardware concepts into practice. To prevent the microcontroller pin from entering floating state where it can’t be determined if the door is open or closed I use a pull-down resistor to pull the signal low when the switch is open.
The hardest part was not the design. Once I soldered everything together I was still getting floating states! 🥺. For an entire evening I was reassembling the controller trying to debug this issue. In the end simply taking a razor blade around all my solder joints and rubbing everything with alcohol solved the problem. Lesson learned for next time. Always clean your circuits!
Eventually, to the benefit of my nervous system, it started working smoothly. Now it is a pleasure to opening the cabinet door and have the lights come on automatically.
On the software side the changes are straight forward. Here is the commit that enables the cabinet light. Again I take advantage of the adafruit_debouncer library and the existing pub sub pattern in the code to start a new module. The new Lights module, combines the cabinet_light and refigium_light leaving room to expand with t5_lights.
A few weeks ago I purchased a Giesemann Steller T5 light fixture. As a hybrid fixture it combines my existing LEDs with 4x T5 bulbs. The goal is to increase the light input into my tank to improve growth and support keeping some of the harder SPS coral like Acropora that require high PAR levels. In order to not shock the corals with this additional light intensity it’s important to acclimate them. Again the controller automates this.
Thanks to some clever coding in collaboration with my wife the controller now does an acclimation period. Using the current date and time from the Real Time Clock module the software determines exactly how long the light should be on each day. July 9th was the start and it will run longer and longer over 90 days until its on a full sever hours a day. Here is the commit.
Now the lights are one less thing to worry about as I continue to maintain the tank. Thanks for reading this update. I hope to bring more as the aquarium continues to thrive.