Undergraduate Thesis Project Documentation (S1) - Informatics UPN Veteran Jatim
An aquaponic system is a combined farming system between fish with vegetables where the activities are mutually beneficial. On the other hand, crop failure can also be a concern for aquaponic farmers as this can happen at any time. Harvest failure can be influenced by many factors, but is usually caused by the high pH ambiguity of the water around the scope of cultivation. The aquaponic farmers are worried that if the crop failure continues it will harm their food security. This project was created in the hope of solving the pH problem. This project has been carried out and took approximately 1 year. The system created can control and monitor changes in water pH at any time. This system is based on the Internet of Things (IoT), using MQTT as the communication protocol. This system is also equipped with artificial intelligence, which uses IT2FL (Interval Type-2 Fuzzy Logic) as its decision support. In addition, the system interface uses Telegram Bot, making it easier for users to interact.
Part | Description |
---|---|
Development Board | DOIT ESP32 DEVKIT V1 |
Supporting Board | Arduino Uno R3 |
Code Editor | Arduino IDE |
Application Support | • Telegram Bot • Matlab R2020 |
Driver | CP210X USB Driver |
IoT Platform | io-t.net |
Communications Protocol | • Inter Integrated Circuit (I2C) • Message Queuing Telemetry Transport (MQTT) • MTProto |
IoT Architecture | 4 Layer |
Matlab | Fuzzy Interface System |
Programming Language | C/C++ |
Arduino Library | • WiFi (default) • Wire (default) • PubSubClient • LiquidCrystal_I2C • CTBot • ArduinoJson • RTClib |
Actuators | • Submersible pump aquarium (x1) • Pneumatic solenoid valve (x2) • Piezoelectric (x1) |
Sensor | • pH Sensor (x1) • RTC (x1) |
Display | LCD I2C (x1) |
Experimental Object | • Pakcoy mustard seeds • Dumbo catfish fry |
Other Components | • Micro USB cable - USB type A (x1) • Jumper cable (1 set) • Switching power supply 12V 1A (x1) • Electrical relay 2 channel (x1) • Round switch (x1) • ESP32 expansion board (x1) • PCB Dot Matrix (x1) • Terminal PCB block screw (x10) • Socket female jack DC (x1) • Connector male jack DC (x3) • Probe Elektroda pH (x1) • Pipes (1 set) • Netpot (1 set) • Rockwool (1 set) • Flannel fabric (1 set) • Water filter (x1) • Glass hubcap (1 set) • Bottle (x2) • Aquarium wheeled placemat (x1) • Aquarium (x1) • Casing box (x1) • Skun (1 set) • Galvanized plate (x1) • Bolts plus (1 set) • Nuts (1 set) |
-
Arduino IDE
https://www.arduino.cc/en/software
-
CP210X USB Driver
https://bit.ly/CP210X_USB_Driver
-
Matlab R2020
https://bit.ly/Matlab_R2020a_Installer
Pictorial Diagram | Prototype Design | Main Box Design |
---|---|---|
Fuzzy Interface System IT2FL | IT2FL Input Variable | IT2FL Output Variable |
---|---|---|
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
while (!Serial); // Wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop() {
int nDevices = 0;
Serial.println("Scanning...");
for (byte address = 1; address < 127; ++address) {
// The i2c_scanner uses the return value of the Wire.endTransmission
// To see if a device did acknowledge to the address
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
++nDevices;
} else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("done\n");
}
delay(5000); // Wait 5 seconds for next scan
} |
The pH sensor can be calibrated using the results of a linear regression calculation. You can see the linear regression equation as follows.
I |
|
Explanation of the symbols in equation I, you can see more details in the following table.
Symbol | Description |
---|---|
𝑌 | pH buffer value |
𝑋 | voltage value obtained based on Y |
𝑎 and 𝑏 | linear regression determination value |
The linear regression determination values (a and b) can be obtained through equations II and III.
II |
|
III |
|
Example of pH sensor calibration: Click Here
This RTC sensor can be calibrated using the following program code :
#include <RTClib.h> // Calling the RTC library
RTC_DS3231 rtc; // Constructor
void setup(){
RTCinit(); // Calling the RTCinit method
}
void loop(){}
void RTCinit(){
// Starting up the RTC
rtc.begin();
// DateTime Setting
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// Set Time Now
// If calibrated, please close with a comment
rtc.adjust(DateTime(YYYY,MM,DD,HH,MM,SS));
} |
-
Open the
Arduino IDE
first, then open the project by clickingFile
->Open
:PH_IT2FL.ino
-
Fill in the
Additional Board Manager URLs
in Arduino IDEClick
File
->Preferences
-> enter theBoards Manager Url
by copying the following link :https://dl.espressif.com/dl/package_esp32_index.json
-
Board Setup
in Arduino IDEHow to setup the
DOIT ESP32 DEVKIT V1
board• Click
Tools
->Board
->Boards Manager
-> Installesp32
.• Then selecting a Board by clicking:
Tools
->Board
->ESP32 Arduino
->DOIT ESP32 DEVKIT V1
.•
Arduino Uno
board in this project is only used as a filter or voltage divider.• You don't need to configure the
Arduino Uno
board, just focus on theESP32
.
-
Change the Board Speed
in Arduino IDEClick
Tools
->Upload Speed
->115200
-
Install Library
in Arduino IDEDownload all the library zip files. Then paste it in the:
C:\Users\Computer_Username\Documents\Arduino\libraries
-
Port Setup
in Arduino IDEClick
Port
-> Choose according to your device port(you can see in device manager)
-
Change the
WiFi Name
,WiFi Password
, and so on according to what you are currently using. -
Before uploading the program please click:
Verify
. -
If there is no error in the program code, then please click:
Upload
. -
Some things you need to do when using the
ESP32 board
:•
Arduino IDE
information:Uploading...
-> immediately press and hold theBOOT
button.•
Arduino IDE
information:Writing at .... (%)
-> release theBOOT
button.• Wait until the message appears:
Done Uploading
->The program is directly operated
.• Press the
EN (RST)
button and thenRestart
to handle theESP32
board that cannot process theSC
.• Do not press the
BOOT
andEN
buttons at the same time as this may switch toUpload Firmware
mode.
-
If there is still a problem when uploading the program, then try checking the
driver
/port
/others
section.
-
Getting started with io-t.net :
• Go to the official website at the following link : io-t.net.
• If you do not have an account, please Register first -> activate your account via email.
• If you already have an account, please Sign In to be able to access io-t.net services.
-
Create a node :
• Go to
Instance
menu ->Set Node
.• Then give the node a unique name that you use.
-
Create a device :
• Go to
Devices
menu.• Select
Add Devices
-> fill in theClient ID
,Access
,Topic
sections as needed. For example :-
Client ID
->Phiotnet_v1
. -
Access
->Publish & Subscribe
. -
Topic
->detect
.
-
-
Open @BotFather.
-
Type
/newbot
. -
Type the desired bot name, for example:
phiotnet_bot
. -
Type the desired bot username, for example:
phiotnet_bot
. -
Also do it for bot image settings, bot descriptions, and so on according to your needs.
-
Copy
your telegram bot API token
-> then paste it into the#define BOTtoken "YOUR_API_BOT_TOKEN"
section.For example :
#define BOTtoken "2006772150:AAE6Fdjk3KbiySkzV6CLbd6ClJDzgTfJ5y0"
-
Open the
Matlab
. -
Open the
Set Path
dialog box using the command :pathtool
-
Select
Add Folder...
-> search theFIS-IT2FLS-Toolbox-MATLAB
folder ->Select Folder
. -
Click
Save
and then clickClose
. -
Open the
IT2FL Toolbox
using the command :fuzzyt2
-
The rest you can customize according to your needs.
-
Download and extract this repository.
-
Make sure you have the necessary electronic components.
-
Make sure your components are designed according to the diagram.
-
Configure your device according to the settings above.
-
Please enjoy [Done].
Via Telegram: @phiotnet_bot
Product | IT2FL Decision Support System | Telegram Bot |
---|---|---|
More information:
• Undergraduate Thesis: Click Here |
-
Hardware:
• Electrical leakage current is caused by the use of non-standard PSU or the lack of insulators used.
• Lack of air circulation in the main box can cause heat.
• NO (Normally Open) applied to the relay causes the solenoid valve to become hot.
• The lack of electric current causes the LCD to not power on.
• The use of Arduino Uno as a filter or voltage divider is considered inefficient.
• The pH sensor probe has no protection.
-
Firmware:
• The delay time in each method is considered excessive, it should use the
millis()
function so as not to interfere with other methods.• The use of
io-t.net
is considered not maximal because it is known that its use is just limited topublish
.• The security features on telegram bots are not good.
-
Others:
• Filling gallons of pH and giving AB Mix is still done manually, making it difficult for users.
• Fish feeding is still done manually.
• Pakcoy mustard greens lack regular sunlight intake, so after transplanting the land, its development is not as fast as before.
• Draining and filling the aquarium water is still done manually, making it very inconvenient for users.
• The system interface is through a telegram bot, so that giving orders as well as monitoring efforts can be done anytime and anywhere. • With IT2FL, the accuracy of the sensor becomes more accurate. • The system can automatically make its own decisions and can also be manually controlled by the user. • The system has been equipped with a timing feature. |
• Need for increased amperage. You can use a 3A PSU. • Need to change the NO (Normally Open) to NC (Normally Close) on the relays so that the electrified device can avoid damage. • Need for voltage and current sharing. You can use a step down. • Need for increased the security features of telegram bots. • Need for increased security on the pH sensor. • Need for the addition of pH tank re-fill devices and AB mix tanks that are made automatically. • Need for additional devices that can measure water temperature and ammonia. • Need for additional devices in automatic fish feeding. • Need for additional devices that can emit warm light as a substitute for sunlight. • Need for additional devices that can drain and fill aquarium water. • Need for additional devices that can optimally cool the main box. • The existing hydroponic planting field in this study may need to be developed further in the future. In addition, rockwool planting media can be replaced with other planting media that are more adequate for plant needs, for example: husk charcoal or cocopeat. |
If this work is useful to you, then support this work as a form of appreciation to the author by clicking the ⭐Star
button at the top of the repository.
This application is my own work and is not the result of plagiarism from other people's research or work, except those related to third party services which include: libraries, frameworks, and so on.
MIT License - Copyright © 2022 - Devan C. M. Wijaya, S.Kom
Permission is hereby granted without charge to any person obtaining a copy of this software and the software-related documentation files to deal in them without restriction, including without limitation the right to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons receiving the Software to be furnished therewith on the following terms:
The above copyright notice and this permission notice must accompany all copies or substantial portions of the Software.
IN ANY EVENT, THE AUTHOR OR COPYRIGHT HOLDER HEREIN RETAINS FULL OWNERSHIP RIGHTS. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, THEREFORE IF ANY DAMAGE, LOSS, OR OTHERWISE ARISES FROM THE USE OR OTHER DEALINGS IN THE SOFTWARE, THE AUTHOR OR COPYRIGHT HOLDER SHALL NOT BE LIABLE, AS THE USE OF THE SOFTWARE IS NOT COMPELLED AT ALL, SO THE RISK IS YOUR OWN.