Let's test reef-pi's equipment module with some prototype electronics. For this, we'll make an LED blink on-demand and then using timers with reef-pi. Power off reef-pi and prepare the following circuit.
Connect Raspberry Pi GPIO pin 24 to the positive end of a common LED using a jumper wire. Negative end of the LED should be connected to any of the Raspberry Pi's GND pin via a 470-ohm resistor.
Once the prototype circuit is in place, power up reef-pi and head over to configuration tab, under the connectors section. Create an outlet with GPIO pin 24.
Next, head over to the equipment tab and create an equipment with the outlet:
Once the test equipment is created, you can click on the on/off toggle switch and the LED should turn on/off accordingly.
In reef-pi, jacks refer to PWM output pins. They are used in dimming lights or controlling dosing pumps etc. reef-pi supports native Raspberry Pi hardware timer-based PWM or PCA9685 board based PWM. In this guide, we'll use Raspberry Pi based PWM.
A Raspberry Pi provides two hardware-based timers and, by default, they are on GPIO pins 18 and 19. The Linux kernel uses these two pins to provide two PWM channels, which it calls 0 and 1. Thus in reef-p, jacks numbers 0 and 1 represent Raspberry Pi GPIO 18 or 19 based PWM output pins.
Let's create a jack with pin 0 and type rpi. Make sure to choose rpi as the driver from the dropdown.
Next, create a light and associate the jack with it.
Once the new light is available, click on it, edit it and change set the profile to manual. Set the slider to 50% and click on update.
You should notice the LED wired to GPIO 18 turn on. You can verify the LED is being dimmed as you update the light's value in reef-pi using the slider and click save. We'll use the same circuit with appropriate transistors to make a full blown light controller in a later guide.
Equipment and light prototype circuit on a breadboard:
Next, we'll configure reef-pi to send email alerts when something bad happens (for example, a temperature sensor returning higher than expected readings). Alert configuration is specified in the configuration tab under the telemetry section. It's highly recommended you use an app specific password instead of your main email password. User's email should always be protected by two factor authentication. For gmail users, app passwords can be generated here. Similar things exist for Hotmail, Yahoo, and most other online email users.
After all the email configuration is saved, click on the update button and reload reef-pi. Once reef-pi is reloaded, click on the "send test message" button. You should receive a test email within a minute or so.
reef-pi can be configured to send alerts as text messages by configuring the To address with appropriate SMS gateway email address. For example, in the US, T-Mobile users can use <Phone number>@tmomail.net email address to send text messages using emails.
We covered all the basic features for a reef-pi controller. This will serve as a foundation for the next set of guides that will incorporate ancillary electronics to control actual equipment and sensors.
reef-pi stores all its data in the file /var/lib/reef-pi/reef-pi.db. This file, along with the specific version of reef-pi which created the database file, can always recreate a reef-pi controller. Older reef-pi versions are available in github. Thus, users only have to make a backup of the database file periodically to backup their controller.