With circuit and enclosure completed, our physical controller is done. Connect the controller's with American DJ SR P8 power strip using a DB9 cable, Connect DC 12V power source to the controller, and reef-pi should boot up. Next we'll declare all the outlets and equipment required to test our build.
Head to Configuration section of the reef-pi user interface (UI). Under configuration section, click on the connector sub-section. We'll create one outlet for each of the GPIO pins. Make sure the GPIO pin numbers reflect our wiring.
Create one outlet for each of the 8 GPIO pins.
Next we'll create some virtual equipment for testing these outlets.
Test with Equipment
Navigate to the Equipment section and create a virtual equipment, associate it with an outlet.
Declare 8 equipment for each of the 8 outlets.
Once all eight equipment is declared, we can click on the on/off button and reef-pi to turn on/off corresponding AC outlet. You should be able to hear the sound relay latching on/off. Validate each of the AC outlets is indeed turning on/off from the reef-pi equipment UI by plugging in an AC equipment (such as table lamp) to the relevant AC outlet in the power strip.
reef-pi allows showing the current state of equipment (on or off) as a chart in the main dashboard. To enable this, navigate to the Dashboard tab and click on the Configure button on left side. Configure the dashboard to have one row and two columns. The first cell will show health metrics (CPU & memory usage) and the second cell will show the equipment chart. Select the appropriate charts by clicking on the drop-down menu inside individual cells.
Click on the Update button to save the dashboard settings and then click on the Back to dashboard button to go back to dashboard view. You should see the equipment chart in the dashboard now. Each equipment item is represented as a vertical bar, with color indicating their state (red for off and green for on). This chart is refreshed automatically after every 10 seconds, so charts can be at most 10 seconds stale.
At this point, we can use reef-pi to turn on/off any AC equipment on-demand.
Schedule on/off with Timers
reef-pi allows controlling AC equipment periodically using timers. Timers are popular to automate various reef keeping chores (for example light turn on/off at a fixed time every day).
Navigate to the Timers tab and create a timer with following details. reef-pi uses Linux cron like grammar to specify timers.
The above timer tells reef-pi after every 10 seconds, turn on equipment Eq6 and then turn after 2 seconds. In short, Eq6 will be turned on for 2 seconds after every 10 seconds. Cron is a very powerful language that allows a variety of periodicity to be expressed concisely.
The macro feature in reef-pi allows executing a series of steps sequentially on demand. A step can be triggering an action against an equipment or waiting. In short, macro allows users to turn a set of equipment on or off in specific order with a single click of a button. A popular use of this feature is to automate feed mode or weekly water changes, where pumps in reef tanks are turned off during the feeding of corals & fish or to replace tank water with clean saltwater. Following is an example of a macro in reef-pi, it will trigger different actions against different equipment with certain delays in-between them.
Once declared, this macro can be triggered by single click of a button
Although reef-pi is aimed for reef tanks, the power controller feature can be used in any general purpose AC equipment control, like home automation or even making a Christmas lighting controller.
Finally, the power control module is a foundational layer in reef-pi. Other modules, like temperature controller and water level controller, requires the power controller feature.
In our next reef-pi guide we'll be extending this power controller to monitor temperature and turn on/off a heater or cooler to maintain a stable tank temperature.