Prerequisites
Before setting up Aqua-IoT, ensure you have the following hardware and software ready:Hardware Requirements
Microcontroller
- Arduino board (Uno, Mega, or compatible)
- USB cable for programming and serial communication
Edge Device
- Raspberry Pi (any model with USB and network connectivity)
- MicroSD card (8GB minimum) with Raspbian OS
Sensors
- DHT11 temperature/humidity sensor
- DS18B20 waterproof temperature sensor
- HC-SR04 ultrasonic distance sensor
- TDS (Total Dissolved Solids) sensor
- LDR (Light Dependent Resistor)
- 10kΩ resistor for LDR circuit
Additional Components
- Breadboard and jumper wires
- Power supply for Arduino
- Network connection for Raspberry Pi
Software Requirements
- Git: Version control for cloning the repository
- Python 3.7+: For Raspberry Pi MQTT bridge scripts
- Arduino IDE: For uploading firmware to Arduino
- PostgreSQL: Database server (can be local or remote)
This guide assumes basic familiarity with Arduino programming, Linux command line, and Python. If you’re new to these technologies, take time to explore the official documentation for each.
Installation Steps
Set Up Arduino Hardware
Connect your sensors to the Arduino according to the pin configuration in
Arduino/sensores.ino:- Pin Connections
- Power & Ground
Upload Arduino Firmware
Open After installing libraries, upload the sketch to your Arduino board. Open the Serial Monitor (9600 baud) to verify sensor readings:
Arduino/sensores.ino in the Arduino IDE and install required libraries:Configure PostgreSQL Database
Install PostgreSQL and create a database for Aqua-IoT:In the PostgreSQL prompt:
Update the password in
Django/painel/settings.py to match your PostgreSQL credentials. The default configuration uses database name aqua with user postgres.Set Up Django Web Application
Navigate to the Django directory and install dependencies:This installs Django, Django REST Framework, and psycopg2 (PostgreSQL adapter).Run database migrations to create tables:Create a superuser for admin access:Generate an API authentication token:
Configure Raspberry Pi MQTT Bridge
On your Raspberry Pi, install required Python packages:Install Mosquitto MQTT broker:Connect the Arduino to Raspberry Pi via USB and identify the serial port:Update Also update the Django server URL if not running locally:
Raspberry-pi/mqtt-arduino.py if needed (default is /dev/ttyACM0).Edit Raspberry-pi/mqtt-django.py and replace the authentication token on line 30:Verify Installation
Check Arduino Output
Serial Monitor should show sensor readings every 2 seconds
Verify MQTT Topics
Run
mosquitto_sub -t "sensores/#" -v to see published messagesTest API Endpoints
Visit
http://localhost:8000/admin to see stored sensor dataView Dashboard
Login at
http://localhost:8000 with your superuser credentialsTroubleshooting
- Arduino Issues
- MQTT Issues
- Django Issues
- Network Issues
No sensor readings or errors:
- Verify all sensor connections and power
- Check library installations in Arduino IDE
- Test each sensor individually using example sketches
- Confirm DHT11 and DS18B20 sensors are properly pulled up
- Ensure baud rate is 9600 in both Arduino code and Python scripts
- Check USB cable and port permissions on Raspberry Pi
- Try
sudo usermod -a -G dialout $USERand reboot
Next Steps
Now that your Aqua-IoT system is running:- Calibrate Sensors: Run the system for 24 hours and verify readings match known values
- Set Alert Thresholds: Configure minimum/maximum values for automated alerts
- Explore the Architecture: Learn how components interact in the architecture guide
- Customize Dashboard: Modify Django templates to add charts or additional metrics
- Scale Up: Add more Arduino sensor nodes or expand to multiple aquaponics systems
For production deployments, implement proper security measures including MQTT authentication, HTTPS for Django, secure passwords, and regular system updates.
