The MIT App Inventor AND smart Garden-2


 Project Name:

The MIT App Inventor  AND smart Garden-2

Benefits of a Smart Garden

  • Water Conservation: Smart irrigation systems reduce water usage by watering plants only when necessary.

  • Convenience: Automatic watering, lighting, and climate control make plant care easier and less time-consuming.

  • Healthier Plants: Sensors help you keep track of essential factors like soil moisture, temperature, and sunlight to ensure plants thrive.

  • Energy Efficiency: Some systems optimize the use of energy, reducing electricity bills, especially in indoor gardens.

  • Remote Monitoring: You can monitor and adjust your garden remotely via mobile apps.

 Project Related to photos:











 arduino code of MIT App

// Define the pin for the moisture sensor and pump
const int moistureSensorPin = A0;  // Moisture sensor connected to analog pin A0
const int pumpPin = 2;             // Water pump connected to digital pin 8 (via relay)

// Set moisture threshold value
const int lowMoistureThreshold = 200; // Adjust this value based on your sensor's calibration
const int highMoistureThreshold = 950;

void setup() {
  Serial.begin(9600);  // Start serial communication

  // Set the pump pin as output (for relay control)
  pinMode(pumpPin, OUTPUT);

  // Initially turn off the pump (relay will be in "NO" state)
  digitalWrite(pumpPin, LOW);
}

void loop() {
  // Read the moisture level from the sensor
  int moistureValue = analogRead(moistureSensorPin);

  // Print the moisture value to Serial Monitor
  Serial.print("Moisture Value: ");
  Serial.println(moistureValue);

  // Control the pump based on moisture level
  if (moistureValue < lowMoistureThreshold) {
    digitalWrite(pumpPin, HIGH);  // Turn on the pump (relay switches to "COM")
    Serial.println("Pump ON - Soil is Dry!");
  } else {
    digitalWrite(pumpPin, LOW);   // Turn off the pump (relay goes back to "NO")
    Serial.println("Pump OFF - Soil is Wet.");
  }


\
  Serial.println("----------");
  delay(1000);  // Wait 1 second before the next reading
}




The Ardiuno is in intrduction:

Core Components

  1. Arduino Board – The brain. Popular ones include:

    • Arduino Uno (most beginner-friendly)

    • Arduino Nano (compact)

    • Arduino Mega (more inputs/outputs)

    • XIAO INTRODUCTION:

    •  Why Choose XIAO?

      • Compact Size: The tiny form factor is perfect for limited space projects.

      • Affordable: Great price for the features offered, making it accessible for hobbyists and professionals alike.

      • Flexible: Compatible with the Arduino IDE and CircuitPython, giving you a variety of programming options.





Common Applications of IoT

  • Smart Homes: Thermostats, lights, and security systems that you can control with your phone.

  • Healthcare: Wearables that monitor heart rate, oxygen levels, and physical activity.

  • Industrial IoT (IIoT): Machinery maintenance, production line automation, and energy management.

  • Smart Cities: Traffic control, waste management, and environmental monitoring.


 code of soil mosture:

const int relayPin = 7;
const int moisturePin = A0;

void setup() {
  pinMode(relayPin, OUTPUT);
  pinMode(moisturePin, INPUT);
  pinMode(relayPin, OUTPUT);      

  digitalWrite(relayPin, HIGH);
  Serial.begin(9600);
}

void loop() {
  int moistureValue = analogRead(moisturePin); // Read value from sensor
  Serial.println(moistureValue);
  delay(2000);
 

if (Serial.available() > 0) {
    char command = Serial.read();
   
    if (command == 'A') {
      digitalWrite( relayPin ,LOW);
    }
    else if (command == 'a') {
      digitalWrite(relayPin, HIGH);
    }
  }



}










Comments

Popular posts from this blog

Gaming in Scratch

Smart Gardening System