This Instructable will guide you through the building of an automated aquarium.
Our system allows you to have an easier watch on different parameters such as water temperature, pH level and day light. The control of the water temperature is performed thanks to a heat resistance and a cooling fans.
Here is the video that presents the project:
Step 1: Main Components
- Temperature sensors (IPT100 - DS18B20 3M) 11.28€ : https://www.amazon.fr/AZDelivery-temp%C3%A9rature-...
- Raspberry Pi 3 Model B+ 36.63€ : https://www.amazon.fr/Raspberry-Pi-3-Mod%C3%A8le-B...
- Raspberry wires (x40 20cm) 3.95€ : https://www.amazon.fr/dp/B01LWAXJJS/ref=twister_B0...
- Raspberry Pi relay module 9.99€ : https://www.amazon.fr/KEYESTUDIO-Canaux-Optocouple...
- Raspberry Pi power supply 10.98€ : https://www.amazon.fr/BERLS-Alimentation-Raspberry...
- Arduino Uno REV3 20.56€ : https://www.amazon.fr/Arduino-A000066-Mémoire-flas...
- Arduino pH sensor module 32.90€ : https://www.gotronic.fr/art-sonde-ph-interface-sen...
- Switches (x4) 0.5€/pcs
- Breadboard 9.99€ : (x3) https://www.amazon.fr/Elegoo-Breadboard-dExpérimen...
- Female plug (x4) 2.70€/pcs : https://www.bricodepot.fr/catalogue/fiche-femelle-...
- Male plug (x4) 3€/pcs + 1 for power supply
- 4-way grounded plug block 50€ : https://www.leroymerlin.fr/v3/p/produits/bloc-4-pr...
- Wood box (MDF) (500*400*100mm)(tickness 18mm) 10€
- Resistances 4.7k Ohms (x20) 0.55€ : https://www.amazon.fr/20x-Résistances-métal-¼W-59r...
Step 2: Building the Model
First of all, we advise you to watch the video of 'building the model' on the following link:
- About the box building, you can choose the size and dimensions that you would suit the best for you. Nevertheless, keep in mind that all components have to fit in. In addition, the power part has to be well separated from the command part (Picture 1).
- Please set correctly and securely all the electronic components such as the Arduino, Raspberry Pi, breadboard, etc. with appropriate screws (Picture 2) to avoid any damage.
- Create holes to accommodate switches (Picture 3).
Step 3: Wiring the Electronic Components
- DS18B20 temperature sensor:
For this part, you need two temperature sensors and a 4.7k-ohm resistance. Follow the picture 1 to realise the wiring and cabling it on the raspberry pi.
- pH sensor:
As it is very simple to wire, please refer to the picture 2 to carry it out.
The Arduino to Raspberry Pi:
The communication between both is made by USB series that is used in everyday life. Refer to the picture 3 to visualize it.
- The relay to the Raspberry Pi:
The picture 4 shows how to achieve the wiring between the Raspberry Pi and the relay module.
Electrical design of the power part is shown on picture 5.
Step 4: Programming the Raspberry Pi & Arduino
This part of the Instructable is dedicated to the software. It will explain to you how to install the Raspbian OS and put the program in it. It will also explain how to send the program in the Arduino and how to set the temperature sensors.
- HOW TO INSTALL THE RASPBERRY PI OS:
- Download the Raspbian OS : https://www.raspberrypi.org/downloads/
- Download Etcher and install it : https://www.raspberrypi.org/downloads/
- Connect an empty SD card to your computer,
- Open Etcher and select the Raspbian file,
- Select on the SD card where you want to install this OS,
- Select the "Flash" button,
- When the installation is completed, insert the SD card in the Raspberry Pi.
- HOW TO CONFIG TEMPERATURE SENSORS:
- Connect two temperature sensors to the Raspberry Pi,
- Open LX Terminal,
- Enter: "sudo nano /boot /config.txt",
- Add the following line at the end of the file: "dtoverlay=w1-gpio",
- Save and quit the file,
- Reboot the Raspberry Pi by entering: "sudo reboot",
- Open LX Terminal,
- Enter: "sudo modprobe w1-gpio",
- Enter: "sudo modprobe w1-therm",
- Enter: "cd /sys/bus/w1/devices",
- Enter: "ls",
- Collect the two adresses (28-*****************).
- Paste them in the Raspberry Pi code line 140 and 149.
- HOW TO CHANGE THE START TIME OF THE LIGHTING:
- Go on line 27 of our code and change the start time of lighting,
- After this manipulation, be sure to have connected the Raspberry correctly to the wifi in order to synchronize its internal clock.
- HOW TO PUT THE ARDUINO CODE TO THE ARDUINO:
- Download Arduino IDE : https://www.arduino.cc/en/Main/Software
- Connect the Arduino with a USB cable,
- Open our code with Arduino IDE,
- Choose the right port on your computer: Tools -> Port,
- Click on 'Upload' to put the code on the Arduino.
==> In the WinRaR file, you will find the two separate codes. For the Raspberry code, you just have to put this code on the user interface and run it.
Step 5: Interface
Here is the monitoring screen displayed by your program. You have to:
- Enter your desired water temperature,
- The light exposition
- The pH.
When it is done, you can click on the “Compute” button to start the regulation.
Measured and set values will be displayed below in real time, with a warning signal if the pH value measured is different from the desired one. Moreover, each actuator state is shown as well.
Step 6: Comments
Please make sure to calibrate the pH probe with solutions of pH 4, 7 and 9 and record the voltage obtained. You will find an Excel to calculate the regression line.
The values of the resulting equation are to be modified in the arduino code:
- #define Offset -10.399
- pHValue = 8.8576*voltage+Offset