reef-pi :: An opensource reef tank controller based on Raspberry Pi.

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Welcome to the development thread of reef-pi, an open-source, affordable, modular DIY reef-tank controller based on Raspberry Pi.

aio.jpg

If you are trying to build a reef-pi controller, please check out the build guides linked below. You can use this thread to seek help and to stay updated with the latest development.

Screen Shot 2018-11-04 at 8.38.50 PM.png



reef-pi provides following functionalities:
  • Equipment control or automated power strip (including digital timers to switch on/off equipment at periodic intervals)
  • LED light control (24 hour cycle), diurnal cycle, fixed dimmig
  • Auto Top Off (based on photoelectric water level sensor or float switch)
  • Temperature monitoring and control (switch on/off heater & chiller)
  • pH monitoring
  • Dosing automation
  • Macro (feed mode etc)
  • And several other features like camera controls (periodic image capture and upload on google drive), telemetry (dashboard and alerting based on sensor values using adafruit.io), mobile friendly UI etc.
A beginner friendly list of reef-pi build guides are available on adafruit.io, if you are planning to build a reef-pi controller start with them.
  1. Setup and installation
  2. Power controller
  3. Temperature controller
  4. Auto Top Off
  5. Light controller
  6. pH monitor
Since reef-pi is modular and customizable, the cost of individual builds varies. In our experience reef-pi controller are almost always cheaper than the commercial alternatives and costs anywhere between 100 to 550 USD. An example bill of materials can be found here as amazon list. If you are building a reef-pi controller, I highly encorage you start a build thread and tag it with #reefpi to seek help with your build


--------------------------- Original thread start ---------------------
Hello friends,
I am starting a master thread for a DIY reef tank controller that is based on all opensource software and hardware. I had started with this project with following goals:
- Build an opensource software and hardware based reeftank controller that anyone can use and hack
- Keep the controller well tested against a set of standard equipment I use, while make it possible for other equipment to be used
- Maintain my own tank build threads and their evolution, backed by this controller.
- Learn electronics and reef keeping along the way (I am biologist by education & software engineer by occupation)

Following are the details of what I have developed & tested till now:
Controller software:
- The main controller software is called reef-pi. It is written in go, its fast and performant. It used embd for hardware communication. It also runs a little web server which provides the UI for the controller. UI is written in React , and can be accessed from anything that has web browser. As of now, the reef-pi supports following things:
- AC 110/220 V socket on/off (uses optocoupled relays underneath). This is used to remotely switch on/off return pump, LED bulb, heater etc.
- 0-20 Volt DC PWM. This is used to control things like dimmable LEDs, DC pumps. I use it to control my Kessil A80, A360. As well as a 5V DC pump (i use it as wave maker in one of my pico with SPS). PWM is done using PCA9685 breakout board from adafruit. This board supports 16 channels. I am using only 5 at max, as of now.
- Analog sensor support using MCP3008 analog to digital converter. This supports 8 channels. i.e. I can use up to 8 sensors/probes. As of now, I have only tested temperature sensor with it.
Other than the following basic hardware/equipment support, the controller software provides following additional features:
- Setting up daily/weekly/monthly scheduled jobs. Like turning on/off certain equipment. I use this feature to run my AC20 HOB filter nightly.
- Setting up dusk-to-dawn like lighting using PWM. The UI gives 12 vertical slider based 0-24 hours (each slider representing 2 hours gaps). I combine two of these two control the kessil LEDs.
- Authentication using Google OAuth. Since the whole controller runs on raspberry pi and provides an web frontend, security of one of my concern. To mitigate this, I have added google authentication support, which when configured will allow only certain users to log in (email specified in the configuration value).

This is the summary of the core controller software and what features it has as of now. I am constantly writing/improving things around it. As of now, I have two reef tank powered by this. I 'll have seperate threads on the individual builds that will include the housing and ancillary hardware in nano-reef.com, as my tank build threads are there, but I'll share all the controller specific common bits here, including UI screen shots, and tank pics :)

20161115_081550.jpg
 
Last edited:
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
The one in the above image is the very first version of the controller. Its using a wooden handmade housing (Im really bad at wood works), it powers one of my pico (fluval spec III). Here are some details:
- Main controller board: raspberry pi 2
- 8 channel sain smart relay, two of them are connected to two perstaltic pumps (mounted at right side of the housing), they are used of dosing/ATO
- There are 6 110V AC outlet mounted at the bottom. Return, powerhead (coralia pico evolution), stock LED, heater all are connected to the AC sockets.
- In the front, it has a 7" LCD screen (from Adafruit), can be switch on/off using the controller UI.

Below is the image of internals of the housing, Note: I have gutted a 6 port extension to repurpose its surge protection electronics. It also had two 5V 1 A USB outlets, which i use to power the raspberry Pi as well as the display. The ancillary breadboard on front panel hosts a MCP3008 and an L293D IC for sensor and high voltage PWM controls
20170101_161629.jpg
20170101_161633.jpg
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Following are two images of the newer Pico tank (imagitarium 3.7 G), initially it was powered by ABI 12 W Tuna blue LED bulb, controlled using AC 100V relay, scheduled daily 10 AM -> 6 PM.
20170111_110108.jpg


And then later upgraded to Kessil A80 and controlled by PWM (from PCA9685, then boosted using ULN2803A)..


20170122_155410.jpg
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Following are the screen shots of the reef-pi UI (user interface). It is a single page web application. The very first tab represents summary infomation of the tank & controller. Things like since how long the tank is running, tank temperature. Controller information (IP, CPU temperature etc)
Dashboard.png


The second tab represents electronics. Things like outlets AC 110V electrical sockets (for return pump, power head, heater etc) , BNC connectors (for probes), 3.5 mm female audio jacks (for kessil) are configure here.
electronics.png

The third tab represents equipments. Individual equipments are configured here. Like heater is connected to AC110 V etc. Once added, equipments can be on/off from this tab, PWM based devices (DC pump, LED light ) intensity can be controlled here as well, on-demand.

equipment.png


The fourth tab, is used to create Jobs. which are periodic or scheduled tasks. This tab allows selecting an equipment and controlling them in automated fashion. For example, I use a job to turn on the LED bulb (ABI 12W Tuna blue) at 8 AM and another job to turn off at 4 PM. For PWM based devices you can specify the intensity as well. Another use case will be to control multi channel, non-dimmable lights. You can use this to create a poor man's wave maker as well (like control 2 hydor power head, alternatively turning them on-off after every 1 min).
job.png

The last tab is for lighting. Currently it allows selecting a PWM equipment (like LED lights) and specifying its intensity after every 2 hours interval. I use two of settings to control Kessil A360 intensity and spectrum. This creates the dusk to dawn effect.

lighting.png


This is the very basic functionality from user interface perspective. I'll add another post on how to install the software and configure it inside raspberry pi. Stay tuned, and thanks for reading :) . All feedback are welcome
 

5ergio

New Member
View Badges
Joined
Feb 7, 2017
Messages
5
Reaction score
13
Rating - 0%
0   0   0
Hello Ranjib, this project is very interesting, I am very interested, I have a cube 35 gals and I want to have it controlled and monitored, since as you know, in this type of aquarium with corals, it is essential to control temperature, light cycles, water filling , PH measurement, etc .....
I will follow your progress very wax .... Success!
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thank for the props. I am building the sensor gears slowly. In terms of electronics, I think its fairly done (MCP3008) integration. I have to incrementally test out pH and ORP probe and twek software if need be. I am already using the temperature probe, and thats fairly stable.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Thanks for the follow. I'll update summary of individual builds (for nano, pico). But the details around them will likely be on nano-reef, since the tank journals are there.. This thread will house all software and common logs, images, not focused on individual builds (I'll have three builds at least).
 

5ergio

New Member
View Badges
Joined
Feb 7, 2017
Messages
5
Reaction score
13
Rating - 0%
0   0   0
Hi, again...I am very attracted to the subject because, like everyone, we want to have our tank in top condition. I consider myself a passionate about the technology applied to this hobby, however we are seeing your project already armed and running, at least the basics. I do not know what others think but it would be very useful and a great help step by step how you have built it, both hardware and software ... It is my humble opinion regards
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
@5ergio there are three parts of the controller build
1) Build electronics (raspberry pi and ancillary boards, relays etc) for the controller.
2) Build housing for the electronics and electrical outlets, sensor points (BNC connectors, 3.5mm female audio jack etc)
3) Installing and configuring reef-pi software on the controller hardware.
I dont get enough time during the weekdeys . I'l:-( . l'll write details of each of these three parts, Bill of Materials and images of my current controllers over next coming days.
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
I am covering the end to end controller build process in three parts. In the first part, I am detailing the electronics build part. reef-pi is built and tested on this electronics. Electronics allows reef-pi control all the physical equipment(like pumps, lights, sensors etc) that are used in conventional reef keeping. Electronics are housed in a fixture or box (will discuss that in part two). I am sharing a bill of material with amazon/adafruit website link that you can use to get these electronics. All the adafruit component has associated on line tutorial for wiring and how they work. For anyone interested in learning more, I'll highly recomend going through those. I myself learned electronics using them :)

Part 1: Building electronics

reef-pi is almost exclusively tested on open hardware. The main controller board is a Raspberry Pi 3(Pi 2 works as well, but pi 3 has on-board wifi which gives much better performance, Pi 3 has more cpu & memory as well). This is the minimum electronics required run reef-pi. Raspberry Pi runs linux, and we reef-pi runs on linux. I'll cover all about software in last part.
You'll also need a power supply for the Raspberry Pi. I'll recommend getting a 5 V, 2.4 A power supply, it is ample to power all 5V based electronics.

In all likely hood, for reef-pi to control day to day reef keeping equipment you'll need some additional electronics. Following are the main ones:

Relays: relays allow reef-pi to switch on / off AC 110V based equipment. This includes heaters, return pumps, lights (MH, LED).. everything that we connect to a standard wall socket (Asia & Europe uses 220V..) can be switch on/off using relays. Common relay boards are available for a number of channels, where each channel represent 1 controllable AC 110/220 V connection. Number of channels in a relay will limit the number of AC 110V equipment reef-pi can control. I used an 8 channel relay in the first build. 6 of these were controlling AC 100 V sockets, 2 DC 12V connection (for dosing pumps). I used that build to maintain a nano tank. For the second build, which I use to maintain a pico, I went for a 4 channel relay since I need to control less equipment.
With relay reef-pi can switch on/off equipment remotely using the web based UI. reef-pi can also automate equipment on/off periodically. Like switch on/off refugium light every night.

Dimming ( PCA9685 and LD293D/ULN2003A ): Dimming is used for controlling speed of DC pumps (wave makers) or LED based lights. reef-pi uses PCA9685 breakout board from adafruit for PWM based dimming. PCA9685 is a 5 volt channel IC, which means we can control 16 connection, each 5 Volt. I use two channels to control Kessil LED lights. Kessil LED lights uses a 3.5 mm audio jacks, with 2 10V controlling two channels in kessil, one for intensity other for color (blue to white). Because Kessil expects 10V signal and the output of PCA9685 is 5V, I used a L293D IC to convert 5V pwm signal to 10V. A 10 V DC adapter provide out power fo the l293d chip. You have consider what equipment you are trying to control, check its expected voltage and get adapter for that voltage. l293d supports almost 30v.. I can use ULN20003A IC as well.

Sensors (MCP3008): Sensors involves equipment like digital thermometer, ph probe, ORP probe etc. Sensors emit data in anaolog signal, reef-pi uses mcp3008 chip to read from seach devices. MCP3008 supports 8 channels, which means for each of this chip you can use up to 8 sensors. As of now, I have only used temperature probes. I plan to use ph & ORP probes from atlas scientific or BRS, as and when I can save up for those :)

Display: I have used a 7" LCD based display screen from adafruit to show the dashboard of reef-pi on my first controller. On the second one I went with official Pi display. First build of reef-pi predates the official pi display. I would recommend official pi display. It has touch support, it will always be best supported on raspberry pi, and likely to be based on open hardware. Having display makes troubleshooting easy as well (otherwise, the controller will need an HDMI display device, like TV to troubleshoot).

Wiring: Adafruit website has wiring details of each of these ICs individually. On the first build, I had used a bread board & jumper wires to connect these components and hot glue the breadboard on housing. On the second build, I used a perf board and used standoffs to fix them inside housing. I'll discuss more around these in second part.

Bill of Material:
- Raspberry Pi 3
- Power adapters (5V 2.4A DC, 10V 1A DC)
- PCA9645 breakout board
- MCP3008 IC
- L293D IC
- Display
- Sainsmart 4 channel relay

The very first reef-pi based controller. It has a plywood based housing, with 6 AC 100V outlets on bottom, two peristaltic pumps (dosing) on the right end, an 3.5 mm female audio jack on the left (used to control kessil A360).
20161115_081555.jpg



Electronics inside was added over time.. This is an image in the very begnning, when I was building reef-pi, with all chips on a bread board, without any housing of any sort.
20161229_005429.jpg

Other than the obvious raspberry pi 3 board, you can observe pca9685 break out board on top middle. L293D and mcp3008 IC are below , somewhat on the right side.

Once bread board based prototype was working, and software/UI was sorted I fixed the whole circuit on piece of plywood.



20161231_112642.jpg


This whole circuit along with the display is attached to the lid of the controller housing.
20170101_161633.jpg

Notice, display is connected to Raspberry Pi using HDMI, also the wirings for power.

Bult of the housing is occupied by the 3 double outlet AC 110 V sockets, peristaltic pumps and the gutted AC 110V extension (which also provides the surge protection circuit)
20161115_081611.jpg

Notice the gutted AC 100V circuit is connected to the relay board. Relay board uses 6 channels for 6 electrical sockets, other two for controlling the dc peristaltic pumps. In this image, they are not wired yet.
 
Last edited:
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Part 2: Building the housing

reef-pi controller housings that I have built till now, is intended to provide an enclosure for the electronics, electrical outlets/inlets and a display for dashboards. I am really a novice at wood work, but this is the best I could think of during the first build..

First, calculate the minimum required dimension of housing. For my very first build, it was almost 1foot wide, 6" height, and 3" thick. I wanted ample place to play with different adapters & circuits inside. It was also due to 6 home electrical sockets, bolted in the bottom of the housing. Once you have the dimension sorted (you can go for much smaller housing if choose relay with less channel/ less electrical socket, as well as no display (they are 7" wide), cut the main sides. I choose to keep AC 100V outlets on bottom, BNC and 3.5 mm female connector mounted on right-bottom side. Couple of peristaltic pumps mounted on right-top side. Left side of the housing only has through hole, to pass the main AC input power supply. The front panel has only LCD screen mounted.
All of the electrical sockets are screwed in straight on the plywood. BNC connector and 3.5 mm female audio is mounted directly, they have groves already, I used a tap/drill tool to create the holes.
I used dremel rotary tool (3000) to cut out the spaces necessary to fit electrical outlets on the bottom, and peristaltic pumps on the right side.
Raspberry pi and pca9685 board is screwed on the back side of the front panel, with stand-offs in between. I have a small breadboard which holds the MCP3008 & L293D ICs, which is hot glued straight next to the pca9645 board. Couple of DC power adapters (5V for pi, and 10V for LED light) are directly screwed in (or ziptied) inside the housing.
Here are some reference images.
Front view of the housing.
20170215_203047.jpg

Electrical sockets in the bottom (6 of them)
20170215_203136.jpg

These sockets come in pairs, with hot & neutral ends connected in every pair. I break the hot end junction so that each socket can be controlled independently (I am pretty sure there is an elegant solution for this).
Wiring electrical sockets:
20170215_203131.jpg

Peristaltic pumps & 3.5mm female audio jack on right side of the controller
20170215_203154.jpg


Electronics, inside a fully functional reef-pi controller
20170215_203125.jpg

Notice the two DC power adapters, one one top left corner, another right next to the peristaltic pumps (right side).

Tools:
- Soldering iron
- Dremel saw and rotary tool (you can use anything you prefer to work with wood)
- Plyer
- Hot glue gun,
- Tap/drill set (to fix BNC connector, 3.5 mm female audio jacks)
20170212_201748.jpg


Bill of Materials
- Plywood
- standoffs
- 3.5 mm female audio jacks
- Female BNC connectors
- AC 110V Electrical sockets
- 14 gauge wires (green, black, white ) for AC 110V electrical sockets
- 16/18 gauge wires for DC 5v, 10v PWM (LED control, DC pump control)
- 20 gauge wires to connect sensors with MCP2008 (BNC connectors based sensors)
 

5ergio

New Member
View Badges
Joined
Feb 7, 2017
Messages
5
Reaction score
13
Rating - 0%
0   0   0
Hi...I'm seeing a lot of progress of your project, the 3.5 mm jack is for the connection of the temperature sensor, right?
Are you considering adding more probes like PH, salinity ORP? If so, why use the IC MCP3008?
For the control of the DC pumps do you use the PCA9685 and L293?
 
OP
OP
Ranjib

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,848
Reaction score
17,081
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
3.5 mm female audio jack is to control the kessil lights. Standard kessil controller adapter & kessil lights uses this. They are connected to l293d (10V DC), l293d feeds on pca9685 5 v PWM output. I am planning to use ULN2003A transistor instead of l293d in the next build to convert pca9685's 5v pwm output.
MCP3008 is there for reading additional probe data. pH, orp etc (have to check atlas scientific or brs)
 

TOP 10 Trending Threads

HAVE YOU EVER FRAGGED CORAL? SHARE YOUR FRAGGING TIPS IN THE COMMENTS!

  • Yes, I do it often!

    Votes: 5 38.5%
  • Yes, but I don't do it often.

    Votes: 5 38.5%
  • Yes, and I'll never do it again.

    Votes: 0 0.0%
  • No, but I'd like to learn how to!

    Votes: 3 23.1%
  • No, and I don't care to try.

    Votes: 0 0.0%
  • Other (please explain).

    Votes: 0 0.0%
Back
Top