Introduction: Aquarium Design With Automated Control of Basic Parameters

Introduction
Today, marine aquarium care is available to every aquarist. The problem of acquiring an aquarium is not difficult. But for the full life support of the inhabitants, protection from technical failures, easy and quick maintenance and care, it is necessary to create an aquarium based on the principles of autonomous life support. Modern patented technologies allow keeping underwater inhabitants of seas and oceans in artificial conditions - as close as possible to their natural habitat. The automation system controls all life support processes and equipment, provides unprecedented efficiency and ease of management and maintenance of large aquarium complexes and aquariums, high reliability and trouble-free operation , high quality water and, as a result, a long and healthy life of marine animals. There are various general functions for control and automation, such as: automatic light switching, simulating daylight conditions, maintaining the set temperature, better maintaining the natural habitat and enriching the water with oxygen. Aquarium computers and accessories are essential to better support the normal life of marine life. For example, in the absence of an emergency pump and in the event of a breakdown of the main pump, after a few hours, sea animals will begin to die, therefore, thanks to the automation, we can know about the identification of any errors or breakdowns. To configure the described parameters manually, you need to carry out a lot of manipulations, perform tests and adjust the Equipment. Carrying out water analysis by hand is already the last century, today the Marine Aquarium, in the clear water of which marine animals, distinguished by their bright colors and energetic behavior, live, does not require special care.

Step 1: Making a Lid for an Aquarium

Making a lid for the size of the aquarium, the lid was created from organic glass, as it has suitable properties for water and electronics.

First, we measure our aquarium, and according to these dimensions we invent a lid, first we cut the walls of the lid, then glue them with super glue and sprinkle them with soda on top for better stability. Immediately for future ventilation and an automatic feeder, we cut a rectangular hole with a size of 50mm by 50mm.

Step 2: Parsing Components

For the filling, we chose the simplest and cheapest microcontroller Arduino Mega, it will serve as the brains of the whole process, then a servo drive will be used for the automatic feeder, which in turn will be fixed to a cylinder with a hole, for lighting we will take the programming LED strip and program it for sunrise and sunset, when At dawn, brightness will rise, and at sunset, it will gradually decrease. To heat the water, take a regular aquarium water heater and connect it to a relay that will receive information on turning it on and off, to read the temperature, install a temperature sensor. To cool the water, take a fan and install it in the lid of the aquarium, if the temperature exceeds the set temperature, the fan will turn on through a relay. For easy reading of information and setting up the aquarium, we connect the LCD display and buttons to it to set the values of the aquarium. A compressor will also be installed, which will work constantly and will turn off for 5 minutes when the feeder is triggered, so that the food does not spread over the aquarium.

I ordered all the parts on Aliexpress, here is a list and links to components:

Feed on ws2812 - http://ali.pub/1wbuof

Real Time Clock Ds3231- http://ali.pub/1e3pfr

LCD1602 LCD - http: //ali.pub/1yng2u

4-channel relay module - http: //ali.pab/1z8ol3

DS18b20 temperature sensor - http: //ali.pub/1f3f18

Module on IRF520 0-24v - http: //ali.pub/1bnuyz

Buttons - https://aliexpress.ru/item/326921647

Mega2560 platform board - https://aliexpress.ru/item/32640363848.html

Servo - https://aliexpress.com/item/32899792687.html



Step 3: Installation of Project Equipment

We arrange the components as convenient for us and connect them according to the scheme, see the pictures.

We install the ArduinoMega 2560 microcontroller into the previously assembled case. The Arduino Mega can be powered from USB or from an external power source - the type of source is selected automatically.

The external power source (not USB) can be an AC / DC adapter or rechargeable battery / battery. The adapter plug (diameter - 2.1mm, central contact - positive) must be inserted into the corresponding power connector on the board. In case of battery / battery power, its wires must be connected to the Gnd and Vin pins of the POWER connector. The voltage of the external power supply can be in the range from 6 to 20 V. However, a decrease in the supply voltage below 7V leads to a decrease in the voltage at the 5V pin, which can cause unstable operation of the device. Using more than 12V voltage can lead to overheating of the voltage regulator and damage to the board. With this in mind, it is recommended to use a power supply with a voltage in the range of 7 to 12V. We connect power to the microcontroller using a 5V power supply via the GND and 5V pins. Next, we install the relay for ventilation, water heater and compressor (Figure 3.1), they have only 3 contacts, they are connected to Arduino as follows: GND - GND, VCC - + 5V, In - 3. Relay input is inverted, so high level on In turns the coil off, and low turns on.

Next, we mount the LCD display and the real-time clock module, their connection is shown in the diagram.

The SCL pins must be connected to the analog 5-pin connector; SDA pins connect to analog 6-pin sockets. The top rail of the resulting assembly will act as the I2C bus, and the bottom rail will be the power rail. The LCD and RTC module connect to 5-volt contacts. After completing the last step, the technical structure will be ready.

To connect the servo, an IRF520 transistor was taken for quieter servo pulses, the servo was connected through a transistor, and the transistor itself was connected directly to the Arduino

For lighting, a WS2812 LED strip was taken. We connect the + 5V and GND pins to the plus and minus of the power supply, respectively, we connect Din to any digital pin of the Arduino, by default it will be the 6th digital pin, but any other can be used (Figure 3.6). Also, it is advisable to connect the ground of the Arduino to the ground of the power supply. It is undesirable to use the Arduino as a power source, as the + 5V output can only provide 800mA of current. This is enough for no more than 13 pixels of the LED strip. On the other side of the tape there is a Do outlet, it connects to the next tape, allowing the tapes to be cascaded like one. The power connector at the end is also duplicated.

To connect a normally open tact button to the Arduino, you can do the simplest way: connect one free conductor of the button to power or ground, the other to a digital pin

Step 4: Development of a Control Program for Controlling the Main Parameters

Download the sketch for the program http://arduinoprom.ru/download/kontroller-dlya-akvariumaflp.zip

Arduino using the FBD and LAD graphic languages, which are the standard in the field of industrial controller programming.

Description of the FBD language

FBD (Function Block Diagram) is a graphical programming language of the IEC 61131-3 standard. The program is formed from a list of circuits executed sequentially from top to bottom. When programming, sets of library blocks are used. A block (element) is a subroutine, function or function block (AND, OR, NOT, triggers, timers, counters, analog signal processing blocks, mathematical operations, etc.). Each individual chain is an expression composed graphically from individual elements. The next block is connected to the block output, forming a chain. Within the chain, blocks are executed strictly in the order of their connection. The result of the circuit calculation is written to an internal variable or fed to the controller output.

LAD language description

Ladder Diagram (LD, LAD, RKS) is a relay (ladder) logic language. The syntax of the language is convenient for replacing logic circuits made on relay technology. The language is targeted at automation engineers working in industrial plants. Provides an intuitive interface for the logic of the controller, which facilitates not only the tasks of programming and commissioning itself, but also quick troubleshooting in the equipment connected to the controller. The relay logic program has a graphical interface that is intuitive and intuitive for electrical engineers, representing logic operations like an electrical circuit with open and closed contacts. The flow or absence of current in this circuit corresponds to the result of a logical operation (true - if current flows; false - if no current flows). The main elements of the language are contacts, which can be figuratively likened to a pair of relay contacts or a button. A pair of contacts is identified with a boolean variable, and the state of this pair is identified with the value of the variable. A distinction is made between normally closed and normally open contact elements, which can be compared to normally closed and normally open buttons in electrical circuits.

A project in FLProg is a set of boards, on each of which a complete module of the general circuit is assembled. For convenience, each board has a name and comments. Also, each board can be collapsed (to save space on the work area when work on it is finished), and expanded. A red LED in the board name indicates that there are errors in the board schematic.

The circuit of each board is assembled from functional blocks in accordance with the logic of the controller. Most of the function blocks are configurable, with the help of which their operation can be customized in accordance with the requirements in this particular case.

Also for each functional block there is a detailed description, which is available at any time and helps to understand its operation and settings.

When working with the program, the user does not need write code, control the use of inputs and outputs, check the uniqueness of names and consistency of data types. The program monitors all this. She also checks the correctness of the entire project and indicates the presence of errors.

Several auxiliary tools have been created to work with external devices. This is a tool for initializing and setting up a real-time clock, tools for reading device addresses on OneWire and I2C buses, as well as a tool for reading and saving button codes on an IR remote control. All certain data can be saved as a file and later used in the program.

To implement the project, the following servo actuation program was created for the feeder and the controller.

The first block “MenuValue” redirects information to menu block for displaying information on the LCD display about the servo drive status.

In the future, the logical operation "AND" allows you to go further or with the comparison unit “I1 == I2”, that is, the preset number 8 will be the same as on the real-time clock module, then the servo is turned on through the trigger, the same way was done to turn on the servo at 20:00.

For the convenience of self-turning on the servo through a button, the trigger logic function was taken and the button number 4 was intended for it, or the output of information about the calmness of the servo to the menu block to display information on the LCD display.

If a signal appears for the servo to operate, then he goes to the block called “Switch” and at a given angle makes a rotation of the drive and goes to the initial stage through the block “Reset”.

Listing of servo actuation.

The compressor is always on and connected to the relay, when a signal comes through the “Servo On” block, then it goes to the “TOF” timer block and turns off the relay for 15 minutes and transmits information about the state of the relay in the menu.

Listing of the thermostat.

Connect the temperature sensor through the library