Rui Teh
Created April 22, 2021

Sustainable Aquaponics System

A system that will allow one to grow food and raise fish at the same time, conserving space and money!

33
Sustainable Aquaponics System

Story

Read more

Code

sketch_nov13a.ino

Arduino
Code For Arduino to Run the temperature sensor and the hygrometer.
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <LiquidCrystal.h>
    LiquidCrystal lcd(12, 11, 5,4,3,2);
    #define ONE_WIRE_BUS 8
    int potPin = A0; //input pin 
    int soil=0;
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    float Celsius = 0;
    float Fahrenheit = 0;
    
    void setup() {
    sensors.begin();
    lcd.begin(16, 2);
    Serial.begin(9600);
    }

    void loop() { 
    int soil = analogRead(potPin) ;
    soil = constrain(soil, 485, 1023);
    soil = map(soil, 485, 1023, 100, 0);
    lcd.setCursor(0,0);
    lcd.print("Water Percentage"); 
    lcd.setCursor(0, 1);
    lcd.print(soil);
    lcd.print("%");
    delay(75); 
    lcd.print(" ");
    delay(10000);
    lcd.clear();
    
    sensors.requestTemperatures();
    Celsius = sensors.getTempCByIndex(0);
    Fahrenheit = sensors.toFahrenheit(Celsius);
    lcd.setCursor(0,0);
    lcd.print("Aquarium Temp");
    lcd.setCursor(0, 1);
    lcd.print(Celsius);
    lcd.print(" Celsius  ");
    lcd.setCursor(0, 2);
    lcd.print(Fahrenheit);
    lcd.println(" Fahrenheit ");
    delay(10000);
    lcd.clear();

    } 

Credits

Rui Teh

Rui Teh

3 projects • 1 follower
Hi

Comments