Yet another DIY Reef Controller

TomTheWicked

New member
Okay, so here it goes. I'm almost done building my 40B stand and then I'll be moving on to the DIY reef controller. I'm doing this thread as a build documentary, and also returning the favor since almost everything I've learned about this project, and this hobby, I've learned from threads like this. I'm hoping that some day, someone will be wanting to do their own controller and be able to learn something from my project.

One thing I've noticed is that this hobby is filled with a lot of different people, with a lot of different backgrounds. Some engineers, some custodians, some teachers, some business[wo]man. What's my point? Well, the truly great thing is that ANYONE can do something like this. I don't have a background in electrical engineering, or software development, or structural engineering or anything of the sort (although I do have a Computer Science (degree that I've never used). I put my hands on an Arduino for the first time last night (even though I've owned it for 9-months) and I'm finally ready to give this a shot.

So, what's the purpose of doing your own controller? You get to make it however you want, of course! Here's what I've got so far.

(1) Arduino Mega 2560
(1) 3.2" TFT Touch-screen LCD (probably not going to use, but have it on hand)
(2) 20 x 4 LCD Display Modules
(2) SainSmart 8-channel 5v relay modules
(4) Digital push-button switches
(4) Micro-roller limit switches
(4) Joystick breakout modules
(4) regular float switches
(3) 80mm 4-pin CPU Fans
(2) Waterproof Digital Temp Sensor
(1) RTC I2C DS1307 AT24C32 Real Time Clock Module
(1) Air pressure switch (Don't remember the Part#. I'll look it up later)
Various resistors, LED's, breadboard, transistors, project boxes, etc.

This is what I've bought so far -- not necessarily the quantities of what I'm going to use for the project. Here's my thoughts on how I'm going to use some of these components:

I would like to use the joystick controls (think the Playstation controller type) to control the menu's being displayed on the LCD Modules. One display will be the menu while the other will display current tank info (temp, time, lights, warnings, etc).

I'd like to have a push-button (rather than scrolling through the menu's) mounted on the canopy for a "feed mode" that turns down the circulation pump. I also want an "emergency stop" button that will shut off the return pump and skimmer in the event of an emergency.

The LED's will be controlled on 7 individual channels (10,000K white, 7,500K white, Royal Blue, Cyan, Red, Actinic, and UV). This gives me plenty of flexibility controlling the colors in the tank -- probably a little too much. There's two major adjustments I want; individual channel intensity, and overall intensity. The channel intensity sets per channel. The overall intensity set over all channels. Self explanatory but work with me here.

The circulation pump I'm using will be the Jebao WP25 (I'm not going to discuss your/my opinions on this pump on this forum) since it uses a PWM channel to control its flow. This should allow me to program my own modes (Wave 1, Wave 2, Wave 3, Wave Crest, etc) directly from the Arduino and not have to use the included control box. It will also allow me to turn the pump down/off during "feed mode" for feeding time. I'm also toying with the idea of having a servo-operated door on the canopy that opens with you hit the "feed button" for no other reason than because I can.

I'll also have a temperature sensor mounted in the hood that will control a pair of 80mm CPU fans. Since their 4-pin fans, I plan on having them run constantly, but increasing their speed (and cooling) if the heat in the hood increases.

In the cabinet I'll have a water temperature sensor that will control a redundant set of heaters and a cooling fan. Which heating/cooling device operates will depend on the input of the temperature sensor, obviously.

Since the bottom 6" of my cabinet is sealed and would fill with water during an overflow event, I'm going to install a redundant set of float switches that will shut off the return pumps and skimmer in the event of an actual overflow. Because, safety. And insurance.

Of course, I'll have a refugium light that will be controlled by a timer/clock/schedule on the Arduino so that it can come on at night and turn off during the day. This light will also automatically turn on when I remove the front cover from the cabinet area. Again, just because I want it to, no other reason.

I'm also going to put a float switch in the skimmer collection cup so that I can display a message on the LCD's when it's full or needs attention.

So, you've stuck with me this long? Thank you. Just to clarify, a few things were implied in the previous paragraphs.

1.) Everything that requires power will be plugged into outlets that will be controlled by the Arduino. This gives me full on/off control over everything in/on/under the tank.
2.) There's obviously some parts that I'll need that I haven't purchase or even thougt of yet.

In my opinion, and from my research, there's really nothing in this project that will be overly complicated. Truthfully, I think the hardest hurdle to overcome will be the LED programming. But there's plenty of DIY information out there that I'm sure I'll be able to get everything accomplished that I want to.

So that's it. My project in a big nutshell. I would appreciate feedback by anyone.

P.S. Sorry for my poor English, I'm American.
 
Let me be the first to say this sounds amazing!! I've been slowly learning how to build my own controller with similar functions but the journey seems quite long and tedious when I have little to no experience with micro controllers or coding. Though, give me enough time to learn and I'll make it happen sooner or later, especially with threads like this are a huge help.

I'll be watching for updates!!
 
Wow, that sounds very cool!

You controller sounds a lot more complicated than the one I'm working on so I wish you the best of luck for it.

I'm working on the coding part right now. Getting everything working isn't much of an issue...getting everything working together is a different story. Once I do I'll be posting all the code and libraries here for anyone who wants to copy/improve/etc on it.
 
Let me be the first to say this sounds amazing!! I've been slowly learning how to build my own controller with similar functions but the journey seems quite long and tedious when I have little to no experience with micro controllers or coding. Though, give me enough time to learn and I'll make it happen sooner or later, especially with threads like this are a huge help.

I'll be watching for updates!!

Exactly! All we need is a little determination and a little spare time and we can do some pretty interesting stuff! Good luck on your project!

Wow, that sounds very cool!

You controller sounds a lot more complicated than the one I'm working on so I wish you the best of luck for it.

I'm working on the coding part right now. Getting everything working isn't much of an issue...getting everything working together is a different story. Once I do I'll be posting all the code and libraries here for anyone who wants to copy/improve/etc on it.

Overall I think it's fairly complicated, but I will be working on one piece at a time so I won't get overwhelmed. Good luck on your project as well!

awesome project.. but please dont be a tease... post some pics!!! :)

I'll post pictures as soon as everything I ordered comes it. In the mean time I plan to make some logical drawings and begin to work on some of the programming.

Enjoy, a DIY controller is a GREAT project
I think so too. It's a great opportunity for people to go step-by-step through a unique project and have something pretty unique to show for it.

Thanks guys.
 
I have little to no experience with micro controllers or coding. Though, give me enough time to learn and I'll make it happen sooner or later, especially with threads like this are a huge help.

The micro controller isn't that big of a deal, it's the coding. Decipher a lot of examples and take it one step/part at a time. Arduino has a nice forum with helpful people that can answer questions, too.
 
Cool project - I'm also working on a similar one right now. Instead of the joystick, have you though about a rotary encoder, like this? You can simply turn the knob and then push to select.

Curious as to how you're planning on enclosing and connecting everything? That's actually been the biggest challenge for me.
 
Cool project - I'm also working on a similar one right now. Instead of the joystick, have you though about a rotary encoder, like this? You can simply turn the knob and then push to select.

Curious as to how you're planning on enclosing and connecting everything? That's actually been the biggest challenge for me.

I hadn't thought of a rotary-type controller. Thanks for the idea! I like the idea of having them on the menu, but I'm also thinking of having individual knobs for each of the LED channels. Of course, I'd still be able to change them in the menu, but having a knob to change them would allow quicker adjustments.

As far as enclosing everything; the project boxes I have open at the top and snap on. My plan is to mount (screw/bolt) the bottom of the boxes to the cabinet/hood and use the top as a cover. I haven't really thought much further ahead than that because that's quite a ways away at the moment.

Thanks for the suggestions guys. I appreciate it!
 
The problems/dilemmas I'm working are:
  1. Cables between devices - for things that only need 2 or 3 connections, audio jacks and plugs work well and you can easily find a panel-mount stereo jack. Other things aren't so easy. My display box, for instance, has an LCD that needs 6 digital lines, plus 5V & Gnd, a PWM line to control the contrast, an LED and 2 buttons, that's 12 wires. I'm thinking I'll get an I2C backpack for the LCD display; that will reduce the LCD pins down to 2 + Vcc & Gnd.
  2. Box for the device. A regular plastic Radio Shack project box with some holes cut in it will work, but I'd prefer not to have the wires soldered in place and the only panel mount connectors I've found are the stereo jacks mentioned above and 9 pin serial ports. One solution I came up with was to use a plastic electrical box and use a plate with keystone jacks for RJ45 ethernet connecters. That will allow 8 connectors fairly easily, although it's rather bulky. I haven't figured out a way to easily mount a jack on the device end, so those may be hard-wired.
  3. Electrical outlets - I was debating whether to use SSRs or relays. Kind of like the low-power isolation of the SSRs, and have a 2-SSR board already made, but the Sainsmart relay board like the one you posted is so cheap it's hard to justify not using it. Having the pre-made PC board is nice, too. The bigger question for me is how to enclose the sockets and/or the relay board. I think the Chauvett Relay Pack that d0ughb0y used will probably be the best option. It's kind of a waste to essentially spend $45 for 8 outlets and a box, but the box is a nice size & big enough to house the relay board (& other boards if needed.) Otherwise you end up with a bulky 4-gang electrical box, or trying to run multiple wires carrying 120V between boxes.

    Something else I'd thought of was using an I2C breakout board
    as an interface between the controller and the outlets/relay board. That would allow controlling up to 16 outlets with just 2 wires (plus Vcc/Gnd); and those 2 wires would be shared with other I2C devices (LCD, RTC).
  4. Logging - I haven't' decided I'm going to try to get a WiFi board and run a server, like d0ughb0y used, simply log it to an SD card or skip it all together. It would be nice to log, but I'm not sure how useful it would be. The same goes or having a web server that lets me control things. Really cool, but probably rarely if ever used.

I'm currently working on things with an Arduino Uno board and a 16x2 LCD and have written the code to scroll various messages on the LCD because of the limited space. I may upgrade to a 20x4 LCD to get some extra room.

I was planning on upgrading to a Arduino Mega for the extra pins, but if I can make use of the I2c boards mentioned above, I may be able to do everything with an Uno.

Another potential issue was current/power draw on the board. The uno is limited to 40mA per digital pin (recommended 20mA), 400mA for the Gnd pins (200 each,) and 200mA for the 5V pin. Since all the devices could potentially go over that, I was planning on having a separate 5V power supply to run a power bus for the external devices. Something like this may also work to take power from the 9V power supply that powers the Arduino board without loading the Arduino voltage regulator.
 
Don't know if that's for me or the OP, but for me, it's partially cost and partially the enjoyment of doing it myself, although I know the cost savings would likely be much less than one would think by the time all is said and done. It just seems like less when you get stuff $10 at a time!

I'm also considering building my on LED lights in the future and wasn't sure if a commercial unit would interface with them, but that's less of an issue.
 
Cables between devices - for things that only need 2 or 3 connections, audio jacks and plugs work well and you can easily find a panel-mount stereo jack. Other things aren't so easy. My display box, for instance, has an LCD that needs 6 digital lines, plus 5V & Gnd, a PWM line to control the contrast, an LED and 2 buttons, that's 12 wires. I'm thinking I'll get an I2C backpack for the LCD display; that will reduce the LCD pins down to 2 + Vcc & Gnd.

If I decide to use the LCD screen, it's going to be mounted with the Arduino so I don't have to worry about this. Unfortunately, I haven't been able to find an elegant solution to remotely mounting the screen. It's too many cables I think.

Box for the device. A regular plastic Radio Shack project box with some holes cut in it will work, but I'd prefer not to have the wires soldered in place and the only panel mount connectors I've found are the stereo jacks mentioned above and 9 pin serial ports. One solution I came up with was to use a plastic electrical box and use a plate with keystone jacks for RJ45 ethernet connecters. That will allow 8 connectors fairly easily, although it's rather bulky. I haven't figured out a way to easily mount a jack on the device end, so those may be hard-wired.

I plan on running CAT-5 to everything and terminating in RJ-45 MAGJACK's like this one. It uses an RJ-45 plug, but it's not as bulky as Keystone jack. The only problem I'm having is trying to find a way to secure it to the project box. I'm debating on whether or not I could potentially have custom boards made solely for the reason of solving this problem.

Electrical outlets - I was debating whether to use SSRs or relays. Kind of like the low-power isolation of the SSRs, and have a 2-SSR board already made, but the Sainsmart relay board like the one you posted is so cheap it's hard to justify not using it. Having the pre-made PC board is nice, too. The bigger question for me is how to enclose the sockets and/or the relay board. I think the Chauvett Relay Pack that d0ughb0y used will probably be the best option. It's kind of a waste to essentially spend $45 for 8 outlets and a box, but the box is a nice size & big enough to house the relay board (& other boards if needed.) Otherwise you end up with a bulky 4-gang electrical box, or trying to run multiple wires carrying 120V between boxes.

Something else I'd thought of was using an I2C breakout board
as an interface between the controller and the outlets/relay board. That would allow controlling up to 16 outlets with just 2 wires (plus Vcc/Gnd); and those 2 wires would be shared with other I2C devices (LCD, RTC).
For the electrical boxes, I've got two fairly large (7.9"x6.3"x2.6") boxes I'm going to try and see if I have squeeze 6-8 outlets it. If I can't, my "Plan B" is to buy a couple of old UPS's (the small personal types) from the local Goodwill for $10/ea and remove the batteries. There's plent of room in them to mount anything we need.

I plan on building 2 boxes - one for the hood (LED's, wavemaker, etc) and another for the cabinet (Return pump, heater, etc). I plan on using a shift register to control both boxes so each box will only need 5 (including Vcc/Gnd) wires to control all 16 outlets. And this method can be programmed the same way any other standard digital pin can.

Logging - I haven't' decided I'm going to try to get a WiFi board and run a server, like d0ughb0y used, simply log it to an SD card or skip it all together. It would be nice to log, but I'm not sure how useful it would be. The same goes or having a web server that lets me control things. Really cool, but probably rarely if ever used.
I'm with you there. I think the only thing I would use logging for is to display a graph of temperature, light intensities, and other not-very-useful-to-me things. Same with the web server. It's not really something I want/need since I'm just starting out. If I'm nearing the end of the project and it seems like something I want, I'll add it. But not right now.

I'm currently working on things with an Arduino Uno board and a 16x2 LCD and have written the code to scroll various messages on the LCD because of the limited space. I may upgrade to a 20x4 LCD to get some extra room.

I was planning on upgrading to a Arduino Mega for the extra pins, but if I can make use of the I2c boards mentioned above, I may be able to do everything with an Uno.
I almost went with the 16x2 LCD's but figured tha for an extra $0.60 I could use the extra two lines.

One of the "work-arounds" I've seen when using the UNO is using a shift-register to give you more pins, and essentially everywhere you have a "module/project box" gets connected via a shift-register.

Since your going with arduino why not just get a reef angel?
For no better reason than "just because" I want to be able say I built every thing in my system. And I enjoy learning/building from the ground up.

thanks guys
 
If there is one thing I learned so far... It's to use I2C any where possible, not only will it save on wires it makes "upgrading" much easier.

Whether or not you decide to make a SSR power strip or go with the pre-fab relay board. The I2C breakout is an excellent choice and if you do, I'd recommend using a IC relay driver aka: transistor array, I found a couple I may choose to use but it's just preference really. These are 8ch arrays FYI - ULN2803AN, ULN2801A, NTE2018 to name a few.

I think my main goal with my controller is give the expandability of future upgrades and modules if and when it comes time. By saying that I2C and serial breakouts are a MUST have IMO. Though I do have minimal experience so my choice's might not be accurate. Although I think I'm on the right track.
 
If I decide to use the LCD screen, it's going to be mounted with the Arduino so I don't have to worry about this. Unfortunately, I haven't been able to find an elegant solution to remotely mounting the screen. It's too many cables I think.

I plan on running CAT-5 to everything and terminating in RJ-45 MAGJACK's like this one. It uses an RJ-45 plug, but it's not as bulky as Keystone jack. The only problem I'm having is trying to find a way to secure it to the project box. I'm debating on whether or not I could potentially have custom boards made solely for the reason of solving this problem.

Yes, this is exactly what I ran into. You could use an outlet plate insert like this and just mount the insert part on the box. Otherwise I didn't find much. By switching to an I2C interface for the LCD, you can dramatically cut the number of pins/wires used. I'm thinking I can get by with a 9-pin serial connector this way. Those connectors and cables are readily available and fairly cheap.

I plan on using a shift register to control both boxes so each box will only need 5 (including Vcc/Gnd) wires to control all 16 outlets. And this method can be programmed the same way any other standard digital pin can.

One of the "work-arounds" I've seen when using the UNO is using a shift-register to give you more pins, and essentially everywhere you have a "module/project box" gets connected via a shift-register.

Not sure whether it would be better to use shift registers or the I2c interface. I'm thinking I'll play around with I2c and see how it goes.

If there is one thing I learned so far... It's to use I2C any where possible, not only will it save on wires it makes "upgrading" much easier.

Whether or not you decide to make a SSR power strip or go with the pre-fab relay board. The I2C breakout is an excellent choice and if you do, I'd recommend using a IC relay driver aka: transistor array, I found a couple I may choose to use but it's just preference really. These are 8ch arrays FYI - ULN2803AN, ULN2801A, NTE2018 to name a few.

Yes, I2c is nice. Those chips you mentioned are just darlington pairs, right? I think the sainsmart board actually already uses them, or something similar. Looking at the specs, each input is listed at 15-20ma, so maybe not. Either way, you're right; you need to watch the total current draw on the pins and the board on a whole so you don't overload the power supply & voltage regulator. That's one nice thing about SSRs - they have a lower current draw.
 
One of the problems with these projects is packaging and connecting the packages; having a bunch of individual wires running all over the place is not only unsightly, but also flimsy, prone to failure and potentially dangerous. I did a bit of searching and came up with the list below of connectors that are at least somewhat readily available:

Pins Panel PCB Comments
2.1 mm 2 Y Y Std power connector
RCA 2 Y Y Cheap, easy, cables readily available
BNC 2 Y Y "
Mini stereo 3 Y Y ", 4 conductor available but uncommon
USB 4 Y Y "
RJ11(Tel) 4 ? Y "
Midi 5 Y Y "
DIN (6) 6 Y Y Available in 3-8 connectors, DIY cables
chassis 6 Y ? DIY cables
DIN (7) 7 Y Y DIY cables
RJ45(cat5) 8 ? Y Panel mount problematic
9-pin D 9 Y Y
VGA 15 Y Y
25 pin D 25 Y Y Gets pretty clunky

I started out planning on using ethernet cables, but the lack of a good panel mount jack makes them more difficult to use. I'm thinking I'll use some of the other options instead.
 
Back
Top