SMART GREEN HOUSE WITH PLASTIC BOTTLES

by Boateng in Circuits > Arduino

2269 Views, 25 Favorites, 0 Comments

SMART GREEN HOUSE WITH PLASTIC BOTTLES

FIP4IGMLWYZDSRS.png
Screenshot 2024-06-03 134925.png

In this project, we will construct a smart greenhouse using plastic bottles. This innovative greenhouse features capacitive soil moisture sensing, automatic irrigation with a 5V water pump controlled by a relay, and temperature and humidity monitoring via DHT22 sensors. The greenhouse integrates an LCD display for real-time data viewing and uses the Uno R4 WiFi to connect to Arduino IoT Cloud for remote monitoring. By repurposing plastic bottles for the greenhouse structure, we contribute to recycling efforts and demonstrate an eco-friendly approach to agriculture.

Supplies

Construction Materials

  • Plastic bottles
  • Wooden or metal frame (for structure support, as designed in Fusion 360)
  • PVC pipes

Electronic Components

  • Capacitive soil moisture sensor
  • 5V water pump
  • Relay
  • Microcontroller (Uno R4 WiFi)
  • Temperature and humidity sensor (DHT22)
  • Relay module or L298N Motor shield
  • LCD display
  • Jumper wires
  • Power supply (batteries)

Tools

  • Scissors
  • Soldering iron
  • Hot glue gunr

Software

  • Fusion 360
  • Arduino IDE
  • Arduino IoT Cloud

Design the Greenhouse Structure in Fusion 360

Screenshot 2024-06-03 220610.png
Screenshot 2024-06-03 220654.png
Screenshot 2024-06-03 220431.png
Screenshot 2024-06-03 220454.png
Screenshot 2024-06-03 220516.png
Screenshot 2024-06-03 220532.png

Create a 3D Model: Use Fusion 360 to design the structure of the greenhouse. Plan the dimensions and layout, ensuring space for the sensors and irrigation system.

Generate Blueprints: Create detailed blueprints and export them for use in the construction phase.

Collect and Prepare Plastic Bottles

Screenshot 2024-06-03 135022.png
  • Collect Plastic Bottles: Gather plastic bottles of various sizes.
  • Clean and Dry: Clean and dry the plastic bottles to ensure they are free of any contaminants.
  • Cutting Plastic Bottles: Cut the plastic bottles into flat pieces or desired shapes for constructing the greenhouse walls and roof.

Building the Greenhouse Structure

Screenshot 2024-06-03 130520.png
Screenshot 2024-06-03 134940.png
Screenshot 2024-06-03 135000.png

Construct the Frame: Build the frame of the greenhouse using wooden or metal supports as per the Fusion 360 blueprints.

Prepare Plastic Bottle Panels: Flatten the cut pieces of plastic bottles and arrange them to form panels.

Attach Plastic Bottle Panels: Attach the prepared plastic bottle panels to the frame using screws, nails, or hot glue. Ensure that the panels are securely fastened to create a stable structure.

Install Water Tubing: Install water tubing at the base of the greenhouse for the irrigation system.

Install and Connect Sensors

Set Up Water Pump: Place the 5V water pump in a water source and connect it to the water tubing.

Attach Soil Moisture Sensors: Place capacitive soil moisture sensors in the soil where plants will be grown.

Place Temperature and Humidity Sensors: Install DHT22 temperature and humidity sensors inside the greenhouse at appropriate locations.

Install LCD Display: Mount the LCD display in a visible location.

Connect Components to Uno R4 WiFi:

  • Connect the soil moisture sensors, DHT22 sensors, and LCD display to the Uno R4 WiFi using jumper wires.
  • Connect the water pump to a relay module, and connect the relay module to the Uno R4 WiFi.

Program and Test System:

  • Write a program for the Uno R4 WiFi to read sensor data and control the water pump via the relay module, ensuring automatic irrigation based on soil moisture.
  • Modify the program to display real-time data from the sensors on the LCD display.
  • Test all components to ensure they work together seamlessly and make any necessary adjustments.
#include <Wire.h>
#include <hd44780.h>                       // Main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
#include <DHT.h>
#include <DHT_U.h>


// DHT sensor setup
#define DHTPIN 8
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);


// Define variables for Temperature and Humidity
float temp;
float hum;
const int DryValue = 2000;
const int WetValue = 1000;


// Variables for soil moisture
int soilMoisturePin = A0;
int soilMoistureValue;
int soilMoisturePercent;


// Relay Port
#define RELAY_OUT 3
String pump_status_text = "OFF";
int pump_trigger = 30;


#include "thingProperties.h"


// LCD setup
hd44780_I2Cexp lcd; // Declare lcd object


void setup() {
  Serial.begin(9600);
  delay(1500);


  // Initialize LCD
  lcd.begin(16, 4);  // Initialize the lcd for 16x4 display
  lcd.setBacklight(255);  // Turn on the backlight


  // Initialize cloud properties
  initProperties();


  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();


  // Initialize DHT22
  dht.begin();
  pinMode(RELAY_OUT, OUTPUT);
  digitalWrite(RELAY_OUT, LOW);
  pump_status = false;


  // Display initial message on LCD
  lcd.setCursor(0, 0);
  lcd.print("Initializing...");
  delay(2000); // Wait for 2 seconds
  lcd.clear();
}


void loop() {
  ArduinoCloud.update();
  temp = dht.readTemperature();
  hum = dht.readHumidity();


  // Update cloud variables
  temperaturepin = temp;
  humiditypin = hum;
  soilMoistureValue = analogRead(soilMoisturePin);
  soilMoisturePercent = map(soilMoistureValue, DryValue, WetValue, 20, 100);
  soilMoisturePercent = constrain(soilMoisturePercent, 0, 100);
  soilmoisturepin = soilMoisturePercent;


  if (soilMoisturePercent <= pump_trigger) {
    pumpOn();
  } else {
    pumpOff();
  }


  // Update LCD display
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(temp);
  lcd.print(" C");


  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.print(hum);
  lcd.print(" %");


  lcd.setCursor(0, 2);
  lcd.print("Soil Moist: ");
  lcd.print(soilMoisturePercent);
  lcd.print(" %");


  lcd.setCursor(0, 3);
  lcd.print("Pump: ");
  lcd.print(pump_status_text);


  delay(2000); // Update every 2 seconds
}


void pumpOn() {
  digitalWrite(RELAY_OUT, HIGH);
  pump_status_text = "ON";
  pump_status = true;
}


void pumpOff() {
  digitalWrite(RELAY_OUT, LOW);
  pump_status_text = "OFF";
  pump_status = false;
}


void onTriggerLevelChange() {
  pump_trigger = triger_level;
}


void dht_sensor_getdata() {
  temp = dht.readTemperature();
  hum = dht.readHumidity();
  temperaturepin = temp;
  humiditypin = hum;
  soilMoistureValue = analogRead(soilMoisturePin);
  soilMoisturePercent = map(soilMoistureValue, DryValue, WetValue, 20, 100);
  soilMoisturePercent = constrain(soilMoisturePercent, 0, 100);
  soilmoisturepin = soilMoisturePercent;
}


void onSoilmoisturepinChange() {
  // Add your code here to act upon Soilmoisturepin change
}


void onTrigerLevelChange() {
  // Add your code here to act upon TrigerLevel change
}


void onPumpStatusChange() {
  // Add your code here to act upon PumpStatus change
}


Integrate Arduino IoT Cloud for Monitoring

Screenshot 2024-06-03 224311.png
Screenshot 2024-06-03 144821.png

Set Up Arduino IoT Cloud: Create an account on Arduino IoT Cloud and set up your device.

Configure Sensors: Configure the soil moisture, temperature, and humidity sensors in Arduino IoT Cloud.

Create Dashboards: Create dashboards to monitor sensor data in real-time.

Connect and Test: Ensure the Uno R4 WiFi is connected to the IoT Cloud and verify that all sensors are transmitting data correctly.

Conclusion

Screenshot 2024-06-03 130616.png
Screenshot 2024-06-03 134532.png

This innovative smart greenhouse project repurposes plastic waste for its structure and integrates technology for optimal plant growth. Designed with precision using Fusion 360 and monitored remotely via Arduino IoT Cloud, it's both sustainable and efficient. Additionally, it serves as an educational tool, promoting recycling, sustainability, and IoT in agriculture. The invitation to expand on the project encourages further innovation for a greener future.