DIY 5" or 7" Arduino All-In-One Aquarium Controller
Planted Tank Forums
Your Tanks Image Hosting *Tank Tracker * Plant Profiles Fish Profiles Planted Tank Guide Photo Gallery Articles

Go Back   The Planted Tank Forum > Specific Aspects of a Planted Tank > DIY


Reply
 
Thread Tools Display Modes
Old 12-25-2014, 11:33 AM   #1
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

DIY 5" or 7" Arduino All-In-One Aquarium Controller


Hi, a couple months ago I came across a thread you are all probably familiar with, the iAqua Aquarium Controller by AnotherHobby. At that time I had no idea what arduinos where and was very impressed with what AnotherHobby had done, he has inspired me to get into the arduino world and I'm loving it.

I wanted to build one for myself but was looking at one of my phones which has the 3.2" screen and figured that's to small so decided I would resize it to fit a 5" or 7" screen, they both use the same resolution 800x480. So instead of ordering a 3.2" I ordered the 5" and just last week I hooked it up to my tank and its now running the lights full time.

Once I dug into resizing, the type of person I am, I wanted more and better. So I've been working on this thing none stop for over 2 months now, I've become obsessed with this thing, lol.

Everything has been redone, I had to recreate all the images from scratch as upsizing doesn't work, now I have them all in vector format if it ever grows to a 22" screen. I still have some features to add, waiting on parts, but I'm expecting to be finished in a month or so. I also plan to create custom enclosures which can be 3D printed.

My goal is to have this enjoyable to use and presentable. I going to try and have it so there is only 1 cable coming out of the main controller and all the accessories are plugged into the power bar. This way the power bar can be tucked away and the mess of wires is hidden.

If anyone is good with programming arduinos I could use some help getting the serial communication going.

I attached some images of the current build and here's some videos showing where I'm at.

http://youtu.be/-W7oT-zXVug GUI as of Dec 25, 2014

http://youtu.be/Ns5XBKjyC-0 Lightning Show

http://youtu.be/St9E90HXSeE Working controller as of Jan 28, 2015

https://youtu.be/wLefU24qxbI Display now working on the Due video Mar 18, 2015

If anyone has any suggestions please let me know.













































This is the power bar.

Attached Thumbnails
Click image for larger version

Name:	CAM00551-Optimized.jpg
Views:	230
Size:	74.0 KB
ID:	407626  

Click image for larger version

Name:	CAM00549-Optimized.jpg
Views:	196
Size:	82.5 KB
ID:	407634  

Click image for larger version

Name:	CAM00567-Optimized.jpg
Views:	207
Size:	76.3 KB
ID:	407642  

Click image for larger version

Name:	CAM00641-Optimized.jpg
Views:	137
Size:	85.9 KB
ID:	413642  

Click image for larger version

Name:	CAM00642-Optimized.jpg
Views:	134
Size:	79.6 KB
ID:	413650  

Click image for larger version

Name:	CAM00635-Optimized.jpg
Views:	151
Size:	111.0 KB
ID:	413658  


Last edited by robsworld78; 03-19-2015 at 07:27 PM.. Reason: Mar 19, 2015: Added Video
robsworld78 is online now   Reply With Quote Quick reply to this message
Sponsored Links
Advertisement
 
Old 12-25-2014, 02:42 PM   #2
saiko
Algae Grower
 
PTrader: (0/0%)
Join Date: Mar 2007
Location: Ind
Posts: 87
Thumbs up

you guys are freaking awesome, one better than other!!!
3:21 WOW part of whole vid.

I can try a bit, so what help do you need with the serial thing?
saiko is offline   Reply With Quote Quick reply to this message
Old 12-25-2014, 03:58 PM   #3
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: "The Land of Fruits & Nuts"
Posts: 769
Default

Absolutely awesome work!
__________________
225 Gal, Glass "Reef Ready" w/ twin Iwaki Pumps & 2 Ocean Clear inline filters. Custom 320 watt LED Lighting system utilizing a 6' Maker's Heat Sink, 12 BridgeLux Vero 18's,3 purpose built 5 channel A6211 Led driver/Controllers,iAqua Aquarium Controller , and a 20lb CO2 system w/ Milwaukee Ph Controller.
O2surplus is offline   Reply With Quote Quick reply to this message
Old 12-26-2014, 04:53 AM   #4
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

Thanks guys. On the serial communication I'll post something in a day or 2.

Here's a video of a night time lightning storm. For the sake of the video the lightning strikes often, normally I wouldn't have it like that. The durations will be changeable in the GUI. I tried to record a daytime lightning storm as well but it looks horrible on a phone camera, the night turned out, looks better in person though.

http://youtu.be/Ns5XBKjyC-0

Question for people with multi-color LED channels. When all your channels are dimmed down to around 5% brightness and all set at the same level, do they look ok? Or does the color look bad?

Last edited by robsworld78; 12-26-2014 at 06:57 AM.. Reason: ...
robsworld78 is online now   Reply With Quote Quick reply to this message
Old 12-27-2014, 01:44 PM   #5
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

Here's how I would like to handle the serial communications, simplified version.

pArduino = power bar arduino
dArduino = display arduino

I want the pArduino to always be looking for numbers coming from the dArduino. The pArduino will have a large switchcase function will all the commands.

For example, I press a button on the display and the dArduino sends number 24 through the serial to the pArduino. The pArduino then says hey I just received 24 so I'm going to execute case 24 of the switchcase function.

That's all I need, if anyone has a way to do this I would love to hear it. Code would be appreciated.

Last edited by robsworld78; 12-27-2014 at 02:44 PM.. Reason: .
robsworld78 is online now   Reply With Quote Quick reply to this message
Old 12-27-2014, 04:13 PM   #6
PhysicsDude55
Planted Member
 
PhysicsDude55's Avatar
 
PTrader: (0/0%)
Join Date: Oct 2011
Location: Dallas, TX
Posts: 242
Default

There's some I2C libraries to make arduino-arduino communications where one arduino is the master and one is slave. I've never done it before, but there's lots of info online about it.

Another solution is to use I/O expander chips. I've used them before with good success. $2.95 for 16 extra digital I/O ports. They're I2C and addressible, so you can use multiple of them. You could keep the "display arduino" by the screen, run an I2C line down to your power strip, and have 2 MCP23017s in there that control all the I/Os. They also sell similar chips with PWM controls.

http://www.adafruit.com/products/732
__________________
PhysicsDude55 is offline   Reply With Quote Quick reply to this message
Old 12-27-2014, 04:37 PM   #7
mistergreen
No more Bow ties
 
mistergreen's Avatar
 
PTrader: (13/100%)
Join Date: Dec 2006
Location: Cincinnati
Posts: 14,687
Default

Serial comm is flexible if you need to send large strings.

If you're sending only numbers, i2c will work. It's up to you.

i2c
http://arduino.cc/en/Tutorial/MasterWriter

serial
http://robotic-controls.com/learn/ar...-communication
mistergreen is offline   Reply With Quote Quick reply to this message
Old 12-27-2014, 05:16 PM   #8
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

I don't think I'll go the i2c route as that looks like lots of work for coding. I'm almost done and don't want to redo it all again. That tutorial looks nice, I'll give it a try. The one I was using sent random numbers and I couldn't get it to send a single number that I choose.
robsworld78 is online now   Reply With Quote Quick reply to this message
Old 12-28-2014, 12:10 AM   #9
mistergreen
No more Bow ties
 
mistergreen's Avatar
 
PTrader: (13/100%)
Join Date: Dec 2006
Location: Cincinnati
Posts: 14,687
Default

I think there is a wire length restriction to i2c as well. Beyond a few feet, the data has a hard time getting there.
mistergreen is offline   Reply With Quote Quick reply to this message
Old 12-28-2014, 12:43 AM   #10
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: "The Land of Fruits & Nuts"
Posts: 769
Default

Quote:
Originally Posted by mistergreen View Post
I think there is a wire length restriction to i2c as well. Beyond a few feet, the data has a hard time getting there.
Yep- I2C was developed for chip to chip communication on the printed circuit board level. Data transmission eventually fails at just a couple of feet, due to the added capacitance of the wires.
__________________
225 Gal, Glass "Reef Ready" w/ twin Iwaki Pumps & 2 Ocean Clear inline filters. Custom 320 watt LED Lighting system utilizing a 6' Maker's Heat Sink, 12 BridgeLux Vero 18's,3 purpose built 5 channel A6211 Led driver/Controllers,iAqua Aquarium Controller , and a 20lb CO2 system w/ Milwaukee Ph Controller.
O2surplus is offline   Reply With Quote Quick reply to this message
Old 12-28-2014, 01:40 PM   #11
mistergreen
No more Bow ties
 
mistergreen's Avatar
 
PTrader: (13/100%)
Join Date: Dec 2006
Location: Cincinnati
Posts: 14,687
Default

You might want to start building your own arduino too.
If you need a slave, a simple diy UNO will do and will cost around $8-10 with all the parts, maybe cheaper if you mass produce. It's actually pretty easy once you do it. I thought it'll too much for a non engineer.

You can make it smaller too to fit in your box.
mistergreen is offline   Reply With Quote Quick reply to this message
Old 12-28-2014, 02:18 PM   #12
saiko
Algae Grower
 
PTrader: (0/0%)
Join Date: Mar 2007
Location: Ind
Posts: 87
Default

you can very well use the below for 1m+ easily. Run and tested by me for a DIY pH meter.


This is the code at Arduino on pH PCB
Code:
#include <EasyTransfer.h>


//The pins 2=Rx,3=Tx


//create object
EasyTransfer ET; 
struct SEND_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  int val_ph_a;
  int val_ph_b;
};

//give a name to the group 
SEND_DATA_STRUCTURE mydata;

int analogPin = 5;     // potentiometer wiper (middle terminal) connected to analog pin 3
                       // outside leads to ground and +5V
int val = 0;           // variable to store the analog value read

float val_ph=0;        //store the float multipled value
int i=0,j;

float val_ph_array[5]={0,0,0,0,0};
void setup()
{
  Serial.begin(9600);          //  setup serial
  //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
  ET.begin(details(mydata), &Serial);
  
 
  
  for(j=0; j<20;j++)//run a few times before sending over serial, so that array is not blank
  {
  val = analogRead(analogPin);    // read the input pin
  if (i>4)
  i=0;
  val_ph_array[i]=val * 0.02;// calculate WRT voltage
  val_ph=float (val_ph_array[0] + val_ph_array[1] + val_ph_array[2] + val_ph_array[3] + val_ph_array[4])/5;//normalizing any of the error data
  i++;
  }
  

}
void loop()
{  

  val = analogRead(analogPin);    // read the input pin
  
  if (i>4)
  i=0;
  val_ph_array[i]=val * 0.02;// calculate WRT voltage
  val_ph=float (val_ph_array[0] + val_ph_array[1] + val_ph_array[2] + val_ph_array[3] + val_ph_array[4])/5;//normalizing any of the error data
  i++;
  
  mydata.val_ph_a=val_ph;
  mydata.val_ph_b=(val_ph- mydata.val_ph_a)*100;  
  Serial.println(val);     // debug value 
  ET.sendData(); 
  delay(1000); //send pH every 1sec to mother Arduino
}
This is the code at the mother Arduino
Code:
#include <SoftEasyTransfer.h>

/*   For Arduino 1.0 and newer, do this:   */
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); //RX TX hard coded, not the main UARTs

/*   For Arduino 22 and older, do this:   */
//#include <NewSoftSerial.h>
//NewSoftSerial mySerial(2, 3);


//create object
SoftEasyTransfer ET; 

struct RECEIVE_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to receive
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  int tens_part;
  int deci_part;
};

//give a name to the group of data
RECEIVE_DATA_STRUCTURE mydata;

void setup(){
  mySerial.begin(9600);
  Serial.begin(9600);
  //start the library, pass in the data details and the name of the serial port.
  ET.begin(details(mydata), &mySerial);
  
  pinMode(13, OUTPUT);
  Serial.println("sjklads ghewre");
}

void loop(){
  //check and see if a data packet has come in. 
  if(ET.receiveData())
    {
      //this is how you access the variables. [name of the group].[variable name]
    //since we have data, we will blink it out. 
    /*for(int i = mydata.blinks; i>0; i--){
      digitalWrite(13, HIGH);
      delay(mydata.pause * 100);
      digitalWrite(13, LOW);
      delay(mydata.pause * 100);
    }*/
    
    Serial.print(mydata.tens_part);
    Serial.print(".");
    Serial.print(mydata.deci_part);
    Serial.println("");
  }
  //you should make this delay shorter then your transmit delay or else messages could be lost
  delay(250);
}
http://www.plantedtank.net/forums/sh...5&postcount=17

you can get the library from
https://github.com/madsci1016/Arduin...ftEasyTransfer

as everyone says, i2c ll just make it complex.


Cheers!
saiko is offline   Reply With Quote Quick reply to this message
Old 12-28-2014, 03:22 PM   #13
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

I don't think I want to start building arduinos, The time it would take to put together makes it cost more than one assembled. I was hoping once finished I could use the nano for one of the units they are like $5 or something.

Thanks for the code saiko but I wouldn't know where to start with that, it looks more complicated than I need. All I want to do is send a non floating number and receive it on the other end. I'll check out the library.

Bump: Last night I added the settings for the lightning storm, this is what it looks like.
Attached Thumbnails
Click image for larger version

Name:	weather_settings.png
Views:	92
Size:	26.5 KB
ID:	408273  

robsworld78 is online now   Reply With Quote Quick reply to this message
Old 12-28-2014, 04:46 PM   #14
O2surplus
Planted Tank Enthusiast
 
O2surplus's Avatar
 
PTrader: (4/100%)
Join Date: Jan 2010
Location: "The Land of Fruits & Nuts"
Posts: 769
Default

Nice! But why only 8 channels? I thought you had 12 channels?
__________________
225 Gal, Glass "Reef Ready" w/ twin Iwaki Pumps & 2 Ocean Clear inline filters. Custom 320 watt LED Lighting system utilizing a 6' Maker's Heat Sink, 12 BridgeLux Vero 18's,3 purpose built 5 channel A6211 Led driver/Controllers,iAqua Aquarium Controller , and a 20lb CO2 system w/ Milwaukee Ph Controller.
O2surplus is offline   Reply With Quote Quick reply to this message
Old 12-28-2014, 05:31 PM   #15
robsworld78
Planted Tank Enthusiast
 
PTrader: (0/0%)
Join Date: Aug 2014
Location: Edmonton, Alberta, Canada
Posts: 573
Default

I know that's disappointing, I would like to have all 16 channels, kind of wasting the 12-bit board.

There were many complications implementing that 12-bit board. First the ramp fading was to slow and to ramp all 4096 values the ramp had to be a minimum of 7-8min long and not check temps other wise it would jump intervals and not be smooth. I was able to bring it down to 5min ramp without checking temps which is still long. I set it so if a person has 5 minutes or less set for a ramp time it doesn't check temps as that takes time. If you try to fade from 0 to 4096 under 5 minutes its not going to be smooth. This board is more suited for the Due IMO. Even with an empty sketch and only a single fade it took the mega around 3 minutes to increment one at a time, I was disappointed.

Also because there are 4096 values there is no accuracy with a 1.5" slider, when trying to set at really low values it was impossible so really it was pointless having 12-bit. So I made it that there is a high and low end on the sliders. If on the low end you can adjust from 0-255 giving precision and when on high end it goes from 0-4095 in 16 step increments.

Doing that greatly increased the code size as changes had to be done throughout the program, the system always has to look to see what mode the slider was in when it set the value otherwise it doesn't work. If I knew object oriented programming I could have done it like a library but I'm lucky I got it working the way I want.

So yeah I'm pushing the mega to its limits, I hit the limit on flash memory and managed to bring that down but now I'm just about to hit the limit on dynamic memory for variables and I'm not sure how I'm going to handle that, turns out images use memory and I have lots of those. Now that I'm adding that second board it might bring everthing down and maybe I'll be able to get more channels. I can add them fairly easily just need more room. The hardest part would be deciding colors for the sliders.
robsworld78 is online now   Reply With Quote Quick reply to this message
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright Planted Tank LLC 2012