Introduction: Smart Tank - Arduino Powered Aquarium

About: Hi Makers! I'm Jack, a Maker, Student and founder of Microcade. If you have any questions, email me at

The Problem: For new fish tank owners:

It can be a daunting experience buying, setting up and maintaining (or even thinking about) a fish tank and if they have the time needed for this hobby to keep their new friends alive. I have recently brought my first Aqurium and i personally went through the thought process of:

  • Have I got enough time for the tank?
  • Have I got enough Knowledge to keep the tank and the fish alive?

And then the user begins to do subtle research on the topic and discover things like diseases, Co2 levels/PH levels, water hardness, the duration for lighting and types of filters. All this new information is like a wall that the user has to overcome to have a functional Aquarium, this wall can turn people away from the enjoyable hobby very quickly. I personally felt I wasn't up to the responsibility of these creatures due to my forgetful nature. On top of that, who will keep care of the fish when they are not there? For a day, a week, a holiday?

The AAS, short for Automatic Aqurium System, is a work in process mighty project that aims to be the step ladder over the wall for new users.

But what about people that have Aquariums:

The market is still there. I know multiple friends who have over 6 tanks that are used for both breeding grounds and to look nice. They too struggle with keeping care of them when they are not there, keeping care of and monitoring all 6 tanks and when they too are busy, ensuring it is maintained.

I definitely believe all levels of Aquarists can benefit from this idea, and I set about to make it.

Step 1: AAS - Solution

The solution:

I am going to split this part into two parts, what I have achieved in the time frame I set out for myself and what I want to make during the summer (this will get updated with the new changes).

I aim to design a product that can control the main parts of an aquarium by itself on using both time and a predicted function.

So what does that mean?

The main parts of an aquarium that i have identified are:

  • Lights
  • Food
  • Co2 system (if they have it)
  • Filter
  • Any other devices the user has

So what functions do I aim for it to have:

  • Turn on and off the components that they have
  • Feed the Fish
  • Be able to record data such as temperature, PH and water levels (ammonia levels and more)
  • For the user to be able to easily understand the results

So how do I set about achieving this?

My thought process:

For this project, I wanted to focus on the core of the project so I could, in the future, build upon it. I decided that the main part of this was to be able to turn on and off the user's devices on a timely base.

How would i do this?

Idea #1: Solder all the components to one main system and control it from there.

Pros:

  • Direct control over all devices
  • Endless amount of devices

Cons

  • The user would need to know how to solder!?
  • The whole device could lack power/current as it would be unevenly distributed.

Conclusion? Horrible idea.

Idea #2: Continuing on from the central system idea, use plug sockets for a more modular design.

Pros:

  • When the devices fail or the user wants to change a device like a filter, it can be easily unplugged or plugged into the system and still work from the same timings before.
  • No skill required on the users end
  • Third-Nature as an extension lead would be used to connect all of the devices to one central place

Cons

  • Can only put a certain amount of devices (due to the number of plug sockets) However, this isn't a major problem.

I went with idea 2 as it was clearly the most convenient, and that was the whole idea of this project.

Step 2: Arduino System / Control Brick

Control Brick

The control brick is simply a really compact Arduino nano, relay module and RTC that has the same footprint as the relay module. The way this was achieved was through the use of Brass PCB Stand-Offs. This allowed for the following to be achieved:

  1. A really small compact brick-like appearance and size that feels solid
  2. The stacking of the stacking of modules
  3. For the RTC to be placed between the Uno and the Relay board
  4. For the brick to be screwed into the case through 4 screws in a vertical system - meaning if something breaks or for future development I can unscrew the screws and take out 'The Brick'

As the whole idea was for an interchangeable design that can be updated with, for example, an Uno with Wifi. The RTC was fitted with a 3D Printed arm that connected to one of the Brass standoff towers. This sat in between the Uno and the Relays.

Parts

Attached is the Schematic for this project and you'll see that I went with:

- Arduino Uno due to the sheer amount of pins it has

- 4 Relay Module as I need to control up to 4 components on the extension lead

- An RTC (Real Time Clock) with a battery to ensure it keeps the correct time.

- In the schematic, It says a Nokia screen however I used a 1.8 SPI 128x160 TFT Module instead as I had it laying around.

After that, the final part to buy was the extension lead that I would be ripping apart.

Step 3: Prototype

With any project, a Prototype is key.

Rip n' Build

After going back out again to get a triangular screwdriver, I was able to open up the extension lead.

Note if you are going to be doing a similar project: 1. Buy a triangular screwdriver - that fits- 2. ensure your extension lead, upon opening, all the sockets, wiring and more are all on one side. Where the other side is simply a cover.

Thankfully the cover for the extension came off with nothing attached and allowed me to firstly desolder the buttons and solder wires in their place, I recommend buying an extension lead with switches as you can rewire the wires for the switch to your relay ( as that is what a relay essentially is: A high voltage switch). I then stripped the wires and got to building the Control brick. Once completed I screwed in the extension switch wires to the Control Brick and uploaded a test code to ensure all the connections were solid.

Note: If you build a 'brick' system like this and you DONT solder the wires to the Uno, the connections from the pins: 1. Must be bent 2, Can break the pins (on the male ended wires) 3. Will give a poor connection.

Regarding testing, I had a couple of connection issues but once fixed I was able to turn off and on anything plugged in.

Step 4: Idea for Control

For the control system, I wanted to experiment with a menu system through the use of functions with the TFT Screen. In the pictures, you can see the test program I wrote that tests the following with a potentiometer and a button (added to the schematic):

  • Switching items
  • Selecting the switched item (EG if L is highlighted, print L at the bottom(
  • Get a smooth transition
  • Get used to drawing on an SPI Screen (As you have to use Grid coordinates to draw to the screen)

All were successful and I was happy to show my followers on Instagram (@JackDalyDesigns ;) )

In the near future, I am going to build a system around this that allows for a user to view the settings and change it. Eg, change the timing.

Step 5: Designing and Printing the Case

The case was designed in Fusion 360 and was created with the intent to be worked on, improved and to be modular. I achieved this through the use of standard holes at the top of the case that allowed for either a simple cover to go on or a new cover with the screen to be fitted on. These can be easily switched out. Allowing for a variety of features and styles to be implemented at the user's will. An example is shown in the renders, the flat top and the screen top. (the see-through block is a stand-in for the extension lead).

The design consists of 3 main parts:

  1. The Base: This is the main link between the extension lead and the Control Brick. This and the support feet were intended to be screwed on but ended up being hot glued on. The base also consists of 4 countersunk holes that will be used to screw the rest together
  2. The Box: This was designed to be the correct fit for the Control Brick to ensure that I didn't waste material. This has 4 receiving holes underneath so the 4 screws can screw together the: Base, Box and Control Brick using the Brass PCB Stand off's as 'nuts'.
  3. The Top: This part varies, but they all have 4 3d printed extruded circles that slide comfortably into the base, this gives it a nice fit and an easy take out for maintenance or swapping.

The Box was printed on my own Zone star 3D printer that I built 2 years back. The print took about 5 hours with 25% infill. Thankfully there was only a small bit support material but other than that the finish was very good considering.

Step 6: Assemble and Some Extra Prints

Assembly: Quick and Easy

Due to the design, only 4 screws were needed for the whole project. This meant that once all parts were in place, all I had to do was screw the screws in, which was very easy.

Extra Parts

I did, however, have to print off extra parts, including mini mounts for the RTC, as mentioned before, so It can be screwed into the Brass PCB Stand-Offs. This was also going to include two 3d printed feet for each side of the extension lead however I had two failed prints and failed to print them in time.

Step 7: Code

The code for this is simple enough to understand and is split into 2 main aspects:

1. The initial set up of all of the pins and variables.

Apart from the usual setup with connecting the relay to the pins and setting up the RTC, I also created an array with all of the timings I wanted it to run for, this would hopefully aid me in the algorithm that I made for this.

2. The Algorithm

Below is a snippet from the code, this shows the Algorithms that I ended up using. The whole idea was that I could turn it on and off and it would check every hour if it is meant to be on, if it is, then it will turn on the relays. If not then it will turn them off. I do this through searching for the current hour in the array and if it's in the array then it will turn the relays on. The count feature was used to repeat this checking process and can be changed. I will be expanding on this code but the full, current, code is attached.

if ((now.minute() == 1)) {
temphour = true;

} else { temphour = false; count = 0; } Serial.print(temphour); Serial.print(count); if (temphour == 1 && count < 1) { count++; for (int i = 0; i < numberOfElements; i++) { Serial.println(i); if (now.hour() == light_ON[i] ) { digitalWrite(Relay_1, HIGH); digitalWrite(Relay_3, LOW); Serial.print("Found"); break; // can stop searching now that we've found it } else { digitalWrite(Relay_1, LOW); digitalWrite(Relay_3, HIGH); Serial.print("no"); }
    }

Step 8: Testing

It Works!

I initially tested it using minutes, and it worked brilliantly, I then moved onto text it with the required hours and it worked.

There is a video which shows how easy it is to upload a new sketch to the system. The way I set the time on for the RTC was simply in reference to my time on my computer.

As you can see it sits comfortably next to my fish tank and has more than enough slots for all of my devices. I will definitely be updating it with: a screen, wifi and more relays to control the whole extension lead - if needed.

My review:

I have been successfully using this system for about a week now and after having some issues beforehand with too much algae growth due to extended lighting periods, I can say that because of this system, the water clarity has increased. And my water is not green anymore!

Step 9: Final Comments

My plan for the future and I hope I can publish the new features on this document, are:

  • Wifi - enable control over wifi, et updates on what is happening and the integration of Google assistant
  • Screen + Control - This is actually in the making as I write this, I am designing the CAD files and will update you on this in the future, we saw a glimpse of this in the start of the Instructables tutorial.
  • Make the overall look more aesthetic and work on safety.

Overall I am super happy with the way this came out, if you have any questions or are thinking about making a similar system, please email me or write your comment below! If you need urgent contact or a fast reply, my Instagram is the best place to go:

Arduino Contest 2019

Participated in the
Arduino Contest 2019

IoT Challenge

Participated in the
IoT Challenge