Lab set Program-6

Develop a program to classify dry and wet waste with the Moisture sensor (DHT22).

Important Note:

  • In real life, a Soil Moisture Sensor is used to detect wet/dry conditions.

  • Tinkercad does not provide a Soil Moisture sensor or DHT22 directly.

  • But we can simulate moisture detection using a Potentiometer as a replacement (to act like varying soil/moisture resistance).


Objective

To develop an Arduino program that classifies dry and wet waste using a moisture sensor (simulated with a potentiometer in Tinkercad) and displays the result through LEDs.


Learning Outcomes

After completing this experiment, students will be able to:

  1. Understand how a moisture sensor works (wet waste = high moisture, dry waste = low moisture).

  2. Simulate unavailable sensors in Tinkercad using alternatives (here, potentiometer).

  3. Write Arduino programs to classify sensor data.

  4. Apply IoT-based waste classification for smart cities.


Components (from Tinkercad Palette)

  • Arduino UNO board

  • Potentiometer (simulated moisture sensor, connected to A0)

  • 2 LEDs (Red = Dry waste, Green = Wet waste)

  • 220Ω resistors × 2

  • Breadboard

  • Jumper wires


Circuit Wiring

  1. Potentiometer (Moisture Sensor substitute)

    • One outer leg → 5V

    • Other outer leg → GND

    • Middle pin → A0

  2. LEDs

    • Green LED (Wet Waste) → Pin 9 (with 220Ω resistor to GND)

    • Red LED (Dry Waste) → Pin 10 (with 220Ω resistor to GND)



Arduino Sketch

int moisturePin = A0;     // Potentiometer as moisture sensor
int greenLED = 9;         // Wet waste indicator
int redLED = 10;          // Dry waste indicator
int moistureValue = 0;

void setup() {
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  moistureValue = analogRead(moisturePin);  
  Serial.print("Moisture Value: ");
  Serial.println(moistureValue);

  if (moistureValue > 600) {          // High moisture = wet waste
    digitalWrite(greenLED, HIGH);
    digitalWrite(redLED, LOW);
  } else {                            // Low moisture = dry waste
    digitalWrite(greenLED, LOW);
    digitalWrite(redLED, HIGH);
  }

  delay(500);
}

How It Works

  1. The potentiometer simulates a moisture sensor:

    • Turning it one way increases analog value → simulating wet waste.

    • Turning the other way decreases value → simulating dry waste.

  2. Arduino reads analog values (0–1023).

  3. Threshold (600) decides classification:

    • Above 600 = Wet Waste → Green LED ON.

    • Below 600 = Dry Waste → Red LED ON.


Common Mistakes & Quick Fixes

  • Forgetting to connect potentiometer middle pin to A0 → always 0 reading.

  • Not using a resistor with LEDs → LED may burn out.

  • Using very small threshold → unstable switching.


Viva / Check-Your-Understanding

  1. What is the principle of a soil/moisture sensor?

  2. Why do we use a potentiometer in Tinkercad instead of a moisture sensor?

  3. How does Arduino distinguish between wet and dry waste?

  4. What real-world applications can use this system?


Extensions (Mini-Tasks)

  • Add a buzzer to beep when wet waste is detected.

  • Use Serial Plotter to visualize moisture changes.

  • Classify three levels: Dry, Moist, and Wet using multiple thresholds.


Lab Record (Suggested Headings)

  1. Title

  2. Objective

  3. Components Used

  4. Circuit Diagram (Tinkercad screenshot)

  5. Arduino Program

  6. Output


Tinkercad Link

https://www.tinkercad.com/things/dIh5cIvwTpB-labset-prog-6

Comments

Popular posts from this blog