fbpx

In Aquaculture, water quality is the most important factor for the growth of aquatic life. Huge losses in aquaculture are due to not maintaining and checking water quality. In India, most of the farmers don’t use smart techniques and Technologies for Aqua-Farming.

Nowadays IoT is expanding its applications in medical, education, farming, industrial, mining and transportation, etc. We are implementing IoT in Aqua-Culture to improve the quality and productivity of Aqua-Farming.

We collect the data of Temperature, pH, DO, TSS, Salinity, Hardness of water from appropriate sensors using ESP32 Micro-Controller, analyze the data using multi-layer perceptron Neural Network model, and send the data to AWS Cloud using IoT through MQTT Protocol. The Publisher(Controller) publishes the data to the AWS Cloud and the subscriber (mobile application) gets the data by subscribing to a particular topic.

The Farmer can able to monitor the water parameters and control the actuators like Aerators and freshwater pumps from a remote location through the MQTT Dash application. The farmer can be also able to detect the problems in the pond within less time. We also

provide solutions for the problems arising due to fluctuations in water parameters.

By this project, farmers can continuously monitor the water parameters and control the aerators, water pumps from a remote location. It also saves time and energy. The farmers can identify the problems that are going to arise due to water quality in the pond within less

time. So that farmers can get less loss in production.

Further, it can be extended by adding more sensors like TDS, DO, etc. The data can be analyzed using Data analytics and different Deep Learning and Machine Learning algorithms. Notifications can be sent through voice calls to illiterate farmers in their regional language using Twilio services.

Smart Aqua-Culture using IoT Block Diagram

Project image 1

Project image 2

APP Dashboard

Arduino Code

#include <WiFi.h>

#include <MQTT.h>

#include <OneWire.h>

#include <DallasTemperature.h>

#include "twilio.hpp"

const char ssid[] = "Madhav";

const char pass[] = "9542856148";

WiFiClient net;

MQTTClient client;

const int oneWireBus = 4;

OneWire oneWire(oneWireBus);

DallasTemperature sensors(&oneWire);

char ph[5],tur[5],Tss[5],T[10],Do[10];

float DO;

String response;

unsigned long lastMillis = 0;


// Values from Twilio (find them on the dashboard)

static const char *account_sid = "AC6de081cd0f23ab0b1b1ecf7626073170";

static const char *auth_token = "db6c5b79a1d6f4dab2020e83510d9752";

// Phone number should start with "+<countrycode>"

static const char *from_number = "+13374434967";

static const char *to_number = "+919542856148";

String message1 = "Value of Temperature is <34 C";

String message2 = "Aerator is ON";

String message3 = "Aerator is OFF";

String message4 = "WaterIN Pump is ON ";

String message5 = "WaterIN Pump is OFF";

String message6 = "WaterOUT Pump is ON ";

String message7 = "WaterOUT Pump is OFF";

Twilio *twilio;

 


void connect() {

 Serial.print("checking wifi...");

 while (WiFi.status() != WL_CONNECTED) {

  Serial.print(".");

  delay(1000);

 }


 Serial.print("\nconnecting...");

 while (!client.connect("arduino", "public", "public")) {

  Serial.print(".");

  delay(1000);

 }


 

 Serial.println("\nconnected!");


 client.subscribe("aqua/aerator");

 client.subscribe("aqua/pump1");

 client.subscribe("aqua/pump2");

}

void messageReceived(String &topic, String &payload) {

  

 Serial.println("incoming: " + topic + " - " + payload);

 //payload.toInt();

 if(topic=="aqua/aerator")

 { int aer = payload.toInt();

 if(aer==1){

 digitalWrite(14,1);

 digitalWrite(27,1);

 Serial.println("Aerator is ON");

 client.publish("aqua/noti",message2);

 bool success1 = twilio->send_message(to_number, from_number, message2, response);

 }

 else if(aer==0){

 digitalWrite(14,0);

 digitalWrite(27,0);

 Serial.println("Aerator is OFF");

 client.publish("aqua/noti",message3);

  bool success1 = twilio->send_message(to_number, from_number, message3, response);

}

 }

 else if(topic=="aqua/pump1")

 {int ipump=payload.toInt();

 if(ipump==1){

 digitalWrite(26,1);

 Serial.println("Water IN Pump is ON");

 client.publish("aqua/noti",message4);

 bool success1 = twilio->send_message(to_number, from_number, message4, response);

 }

 else if(ipump==0)

 {digitalWrite(26,0);

 Serial.println("Water IN Pump is OFF");

 client.publish("aqua/noti",message5);

 bool success1 = twilio->send_message(to_number, from_number, message5, response);

 }

 }

 else if(topic=="aqua/pump2")

 {int opump=payload.toInt();

 if(opump==1){

 digitalWrite(25,1);

 Serial.println("Water OUT Pump is ON");

 client.publish("aqua/noti",message6);

 bool success1 = twilio->send_message(to_number, from_number, message6, response);}

 else if(opump==0){

 digitalWrite(25,0);

 Serial.println("Water OUT Pump is OFF");

 client.publish("aqua/noti",message7);

 bool success1 = twilio->send_message(to_number, from_number, message7, response);}

}

  

}

void setup() {

 pinMode(14,OUTPUT);

 pinMode(27,OUTPUT);

 pinMode(26,OUTPUT);

 pinMode(25,OUTPUT);

 digitalWrite(14,0);

 digitalWrite(27,0);

 digitalWrite(26,0);

 digitalWrite(25,0);

 Serial.begin(115200);

  sensors.begin();

 WiFi.begin(ssid, pass);

 client.begin("3.85.41.35",1883,net);

 client.onMessage(messageReceived);

 connect();

 twilio = new Twilio(account_sid, auth_token);


  

}

void sensor()

{ sensors.requestTemperatures(); 

 float temperatureC = sensors.getTempCByIndex(0);

 float temperatureF = sensors.getTempFByIndex(0);

 Serial.print(temperatureC);

 Serial.println("ºC");

 Serial.print(temperatureF);

 Serial.println("ºF");

  sprintf(T,"%f",temperatureC);

 /* if(temperatureC>34)

  { twilio->send_message(to_number, from_number, message1, response);

   client.publish("aqua/noti",message1);

  }*/


 

 //pH

 float a=analogRead(35);

 float b=analogRead(34);

 float c=-((a-b)/4096)*14/1.0;

 sprintf(ph,"%f",c);

 


//Turbidity & TSS 

 int t1=analogRead(32);

  

 t1=map(t1,0,4095,100,1);

 float t=t1/(1.0);

 //t=(t*(-99)/4095)+100;

 float TSS=pow(t,1.32)+1.162;

 sprintf(tur,"%f",t);

 sprintf(Tss,"%f",TSS);


// DO

 DO=(0.0031090981*pow(temperatureC,2))-(0.31570264*temperatureC)+14.165947 ;

 sprintf(Do,"%f",DO);


  client.publish("aqua/temp",T);

  client.publish("aqua/ph",ph);

  client.publish("aqua/turb",tur);

  client.publish("aqua/tss",Tss);

  client.publish("aqua/DO",Do);

  Serial.println(T);

  Serial.println(ph);

  Serial.println(tur);

  Serial.println(Tss);

  Serial.println(Do);

}

void loop() {

 client.loop();

 delay(10); // <- fixes some issues with WiFi stability

 

 

 if (!client.connected()) {

  connect();

 }

  

 sensor();

  


}

ESP 32 Clent Flow-Chart

Mobile App Client Flow-Chart

Sample SMS Notification

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

or

Log in with your credentials

or    

Forgot your details?

or

Create Account