Introduction
This post guides you through an aquaponic setup that monitors water level and temperature by coding an Arduino board to give tasks to 4 peripheral devices. Using ultrasonic sensors and a temperature sensor ensures optimal conditions for your plants and aquatic life.
This photo shows how I built a portable setup that allows you to connect the system to any aquarium.
What You’ll Need:
- Arduino IDE
- Proteus 8 Proffisional
- Arduino Mega 2560
- HC-SR04 Ultrasonic Sensor (trig to pin 7/ echo to pin 8 / VCC 5V pin -GND GND pin)
- MAX6675 Thermocouple Sensor (SO pin 11 / CS pin 12 / SCK pin 13 VCC 5V pin -GND GND pin )
- 16×2 LCD with I2C Backpack (SDA to SDA 20 pin / SCL to SCL 21 pin )
- Water pump ( VCC to pin 2 / GND to GND)
- Jumper wires Breadboard
Overview:
Aquaponics combines aquaculture (fish farming) and hydroponics (growing plants in water). It’s an eco-friendly and sustainable way to grow food, but maintaining proper water levels and temperature is crucial for success. This project addresses these challenges by providing real-time monitoring of water level and temperature.
The first step before moving forward with a project on physical devices is to build your project in Proteus 8 Professional. Creating a schematic in Proteus helps visualise and test your circuit virtually, ensuring that all components are connected correctly and functioning as intended. This step saves time and effort by allowing you to troubleshoot and make any necessary adjustments before implementing the project in the real world. I’m making my Proteus project file available to download here, so you can start building your project in Proteus right away. Once you’re confident in your virtual setup, you can proceed with confidence to the physical build.
Tutorial:
Step 1: Setting Up the Hardware
- Connect the HC-SR04 ultrasonic sensor to the Arduino Mega 2560.
- Wire the MAX6675 thermocouple sensor to the Arduino as per the specifications.
- Connect the 16×2 LCD with the I2C backpack to the Arduino.
- Ensure the water pump is connected to the designated pin on the Arduino.
Step 2: Writing the Code
Here is the code I wrote and used for my project:
- Import the necessary libraries: Wire.h, LiquidCrystal_I2C.h, and MAX6675.h.
- Define the pins for the ultrasonic sensor, water pump, and MAX6675 sensor.
- Initialise the LCD and set up the initial display messages.
- In the loop, measure the water level using the ultrasonic sensor and temperature using the MAX6675 sensor.
- Display the readings on the LCD.
- Control the water pump based on the water level. If the water level is below a certain threshold, activate the water pump; otherwise, deactivate it.
Step 3: Uploading the Code
- Upload the code to your Arduino Mega 2560.
Step 4: Observing the Results
- Once the code is uploaded, observe how the LCD displays the water level and temperature readings.
- Test the water pump functionality by adjusting the water level and ensuring the pump turns on/off accordingly.
Next Steps:
This project serves as the foundation for building a smart aquaponic system, and you can expand it further by adding more sensors and automation features.
- pH sensor to monitor water acidity.
- Dissolved oxygen sensor for monitoring oxygen levels in the water. Automated feeding system for fish.