Manic's DIY Arduino Reef Controller

Discussion in 'Anything DIY Related' started by Manic, 28 Dec 2011.

  1. Manic

    Manic Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    Hey everyone,

    So I've been thinking about designing a reef controller for a while. This week my temperature controller died on me which finally gave me the inspiration to build my own controller. I've already ordered most of the parts, they should be here before the end of January 2012.

    The controller will be a work in progress and will start off "basic" but because of the modular format I am aiming for it will be easy to add functionality as I go without much effort.

    So lets start with the brains of the controller:

    Arduino Mega 2560

    I will be using the Arduino Mega as the micro-controller for this system. The reason I choose the mega over the uno will become clear later on but it has to do with the number of digital pins the mega has over the uno (54 digital pins for the mega as apposed to 14 for the uno). The mega also has 8 times more memory than the uno which will come in handy if the code files become to big.

    The extra pins and memory do come at a cost as the mega is almost double the price of the uno.

    Some quick stats for the Arduino Mega 2560:

    [​IMG]

    Features:
    • ATmega2560 microcontroller
    • Input voltage - 7-12V
    • 54 Digital I/O Pins (14 PWM outputs)
    • 16 Analog Inputs
    • 256k Flash Memory
    • 16Mhz Clock Speed

    The arduino boards also have the added benefit of having PWM (Pulse width modulation) which can be used to control motor speed and light dimming. This might come in handy for dosing pumps and LED lighting.
     
  2. AdS Guest




    to hide all adverts.
  3. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    The next big component required was a display for the unit. It doesn't help having a controller if you can't see what is going on. I've seen a few controller screens and the ones that looked the best to me had a blue back light with white writing.

    This was probably the most difficult component to decide on. I could have gone with a standard 16 x 3 screen but this would limit me to 16 characters across and 3 down. I decided that this would not be enough to display everything I wanted to. Though it was pretty tempting as the code to display characters on the screen is very simple.

    I finally decided on this screen:

    KS 0108 128x64 GLCD Blue

    [​IMG]

    The display is very nice and looks more professional than a green/black screen. You are able to plot graphics on the screen and it gives me more space to display all the information I need to. I might even plot a temperature graph on the screen.

    The screen needs 19 wires plugged into the Arduino. This is the main reason why I went with the mega because if I went with the uno I wouldn't be able to control anything because there would be no pins left.

    The downside to this screen is that the code is a lot more complicated than non-graphic screens.

    My plans for the display are to show the following information on the screen at all times:

    1. Temperature
    2. pH
    3. Heating/Cooling
    4. Time
    5. Which relays are on/off
    6. RO Tank High/Good/Low
    7. Skimmer Full/Good

    So the above list gives away what my controller will do from the start. I will add on from there.

    Any other suggestions for things to display?
     
    Last edited: 28 Dec 2011
  4. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    The next big thing I purchased was a relay module. I was going to buy individual relays but then I came across this board.

    8-Channel 5V Relay Module for Arduino

    [​IMG]

    This module is amazing. It takes a common ground and 5V voltage source. All it requires is 8 signal wires from the arduino to activate each of the relays. It also has built in resistors, NPN transistors, diodes and indicator LED's. This prevents the relays from damaging the arduino board while switching and also allows the arduino to activate the relays with minimal current usage from the arduino (There is a maximum current output from each pin on the arduino as well as a maximum current output for all the pins combined).

    I bought the 8-unit one but there is also a 1,2,4 and 16 unit one available. Each relay is rated for 250V 10A. This should be enough for most marine equipment.
     
  5. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    Sensors

    This is where it becomes interesting. There are so many choices when it comes to sensors. So we will start with the basics.

    Temperature

    The temperature sensor I have decided on is the LM35. This is a very simple chip that can measure temperature. Once I've nailed this sensor I will move on to the Dallas-one-wire sensors as these sensors allows multiple sensors to be used on a single wire, thus freeing up pins on the arduino.

    [​IMG]

    All this sensors does is take an input voltage and return a micro voltage based on the temperature. This voltage is then converted to a temperature in the software portion of the controller.

    pH

    pH is almost the same as the temperature sensor in the way that works. The only difficulty I'm having at this time is finding cheaper pH probes.

    So if anyone knows where you can find cheaper probes, please let me know.

    Levels

    So I could get complicated here and start using ultrasonic level sensors or infrared proximity sensors to detect water levels (I might go this way at some stage, we'll see), but at this time I'm going to keep it simple as all I really need from the level sensors is the following.

    1) If tank water is low, turn ATU on
    2) If skimmer collection container is full, show warning on controller and turn skimmer off
    3) If RO tank is low, show warning on controller
    4) If RO tank is full, show warning on controller
     
  6. Arries

    Arries

    Joined:
    11 Apr 2010
    Posts:
    521
    Likes Received:
    23
    Location:
    Durbanville,Cape Town
    Tagging along...Sounds VERY intresting...:thumbup:
     
  7. AndreM

    AndreM

    Joined:
    8 Mar 2011
    Posts:
    209
    Likes Received:
    1
    Location:
    Cape Town, Bellville
    Hey Manic,

    I'm also very interested in following along here. I've messed around in the past with PIC micro's (using an LM75 with I2C for a room temperature sensor) , and have been meaning to get back into it.

    If I may ask, where did you source the components (The Arduino and relay board), and what were the prices?
     
    Last edited: 29 Dec 2011
  8. bjakes

    bjakes

    Joined:
    29 Dec 2011
    Posts:
    38
    Likes Received:
    0
    Location:
    JHB
    Good timing

    Hey Manic,

    I'm going to be doing one of these as well so hopefully I can add to your design. For now I just have the arduino board but will be catching up shortly. I have been scouting around for a PH probe and found this to be the most reasonable: Buy pH and Water Analysis Meter Accessories Spare pH probe for wallmount pH monitor Hanna Instruments HI 1286 online from RS for next day delivery.

    It's R500 but let me know if you find any other options. I'm going slightly differently on the temp side and just going to use a thermistor.
     
  9. Toolboysa

    Toolboysa Moderator

    Joined:
    30 Nov 2010
    Posts:
    2,251
    Likes Received:
    134
    Location:
    Wilgeheuwel
    Tagging along

    This is gonna be cool
     
  10. LCornelius

    LCornelius Moderator

    Joined:
    5 Mar 2009
    Posts:
    5,459
    Likes Received:
    124
    Location:
    Durbanville (CPT)
  11. JD167

    JD167

    Joined:
    5 Apr 2008
    Posts:
    1,436
    Likes Received:
    10
    Location:
    Cape Town
    Tagging along. Nice idea and something I've been looking for. Any idea how much the complete unit with probes will cost Manic? Ballpark figure.
     
  12. CW

    CW

    Joined:
    2 Dec 2010
    Posts:
    2,273
    Likes Received:
    44
    Location:
    Vanderbijlpark
    just taging along. Just love DIY stuff
     
  13. lIghty

    lIghty

    Joined:
    3 Nov 2007
    Posts:
    5,053
    Likes Received:
    52
    Location:
    Westville, Durban
    Sounds like an awesome build Manic!

    I would suggest you go straight onto the I2C temperature IC, as the you mentioned, the LM35 is a analog device, so changing the code from from analog to I2C is going to be a total revamp of the temperature code, and doing it twice probably ain't going to be too fun.... also the one wire DS sensors can be quite frustrating at times!
     
  14. RiaanP

    RiaanP Moderator

    Joined:
    11 Aug 2008
    Posts:
    23,142
    Likes Received:
    1,228
    Location:
    Centurion
    Interesting. Interested.
    Manic, what do you estimate the controller will cost you to built?

    I'm looking for something to control at least 5 channels for lights. 4 Lights channels for display, one for refugium. Got 8 T5 tubes, Want to be able to switch 2 at a time.

    And on heating and cooling, I want something that will switch on the first Jaeger heater at 24, another at 23. On the other side, needs to switch on fan at 25.5 and switch off half the lights at 26.5 and all the lights at 27. The final values could be changed, but just to give you an idea. Hailea chillers are between 2.2 and 4.2 Amp, so you can use a chiller on this unit instead of fans. Chiller could be added between fans and switching off the first set of lights.
     
  15. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    Initially I was going to get the components locally but after some research it turned out to expensive. I got the LCD, Relay board, Arduino Mega + Lots of other components (LED's, buttons, resistors etc...) for about R500

    I can get the actual probe for around R300. The main component I am looking for is the pH stamp. This is the circuitry that couples the pH probe to the arduino. Most places sell everything as a kit and at a really high price.

    It is hard to say at this time. Entry level unit around R500. It gets expensive when you start adding conductivity probes, pH probes etc. The main components such as relays, timers and temperature sensors are cheap.

    Didn't even think about re-writing the code. That would get frustrating. Which chip would you suggest because there are thousands available?


    The controller you would require above would be really simple and cheap to build. You would require 8 relays (9 if you have a chiller), temperature probe, arduino uno, small display screen.

    Don't think it would cost more than R350 for this controller. The hidden cost come when you don't want to cut your 220V wires and want to keep plugs on your equipment. Then 220V sockets and fittings are the major cost of the whole system.
     
  16. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
  17. lIghty

    lIghty

    Joined:
    3 Nov 2007
    Posts:
    5,053
    Likes Received:
    52
    Location:
    Westville, Durban
    Not sure which would be suitable offhand, just use RS search tool to narrow it down.
     
  18. RiaanP

    RiaanP Moderator

    Joined:
    11 Aug 2008
    Posts:
    23,142
    Likes Received:
    1,228
    Location:
    Centurion
    Can I place an order?
     
  19. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    Let me get mine up and running and then I will help you build one. What you want to do is really simple. I just need to find a real time clock unit for cheap but the cost wouldn't be more than R400 for the system.
     
  20. RiaanP

    RiaanP Moderator

    Joined:
    11 Aug 2008
    Posts:
    23,142
    Likes Received:
    1,228
    Location:
    Centurion
    Ok, thanks. Will take up that offer.

    Yes, this part will be the expensive portion. I do not want to cut, and want to be able to just plug out and in. Would also allow easier use of double plug where needed.
     
  21. Manic

    Manic Thread Starter Moderator

    Joined:
    12 Mar 2009
    Posts:
    3,313
    Likes Received:
    58
    Location:
    Johannesburg, Edenvale
    Here the controller costs:

    Arduino uno: R100-R200
    Simple LCD: R50-R150
    8 x Relay: R100
    Temp Sensor: R10 - R50
    Real Time Clock: R50 - R100

    It really depends on what deals you can get. If you win bids you can even get the LCD screen for R8.
     
Recent Posts

Loading...
Similar Threads - Manic's Arduino Reef Forum Date
Manic's DIY LED Build Version 2 Anything DIY Related 26 Jul 2012
Manic's Starfire Cube Medium Tanks 20 Jun 2012
Manic's DIY Led Build Anything DIY Related 9 Feb 2012
Manic's Rimless Shallow Reef Medium Tanks 18 Aug 2011
Manic's NeoZeo Reef Medium Tanks 16 Nov 2010
Manic's 550L SPS Cube Large Tanks 9 Mar 2010
Jarduino Aquarium controller v1.2 Test Kits, Controllers, Reactors and Dosers 3 Jan 2016