PROJECT ALARM PENDETEKSI POLUSI UDARA MENGGUNAKAN TINKERCAD

3 min read 2 hours ago
Published on Oct 03, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through building an air pollution detection alarm system using Tinkercad. The system utilizes sensors to detect gas pollution levels and activates an LED, LCD, and buzzer in response. This project is ideal for learning about electronics and programming in a practical, hands-on way.

Step 1: Set Up Tinkercad

  • Go to the Tinkercad website and log in or create an account.
  • Start a new project by clicking on "Create New Circuit."
  • Familiarize yourself with the workspace and tools available in Tinkercad.

Step 2: Add Components to Your Circuit

  • Drag and drop the following components from the components panel:
    • Arduino board
    • Gas sensor (e.g., MQ-2 or similar)
    • LED (choose different colors for visual indication)
    • Buzzer
    • LCD display (16x2 is a common choice)
    • Resistors (220 ohm for the LED, as required)
    • Breadboard (optional, for organization)

Step 3: Connect Components

  • Wiring the Gas Sensor:

    • Connect the gas sensor's VCC pin to the Arduino's 5V pin.
    • Connect the GND pin to the Arduino's GND.
    • Connect the analog output pin (A0) of the sensor to one of the Arduino’s analog input pins (A0).
  • Wiring the LED:

    • Connect the longer leg (anode) of the LED to a digital pin on the Arduino (e.g., pin 9) through a 220-ohm resistor.
    • Connect the shorter leg (cathode) to GND.
  • Wiring the Buzzer:

    • Connect one terminal of the buzzer to another digital pin on the Arduino (e.g., pin 10).
    • Connect the other terminal to GND.
  • Wiring the LCD:

    • Connect the LCD pins according to the following:
      • VSS to GND
      • VDD to 5V
      • V0 to a resistor (optional, for contrast adjustment)
      • RS to a digital pin (e.g., pin 12)
      • RW to GND
      • E to a digital pin (e.g., pin 11)
      • D4 to a digital pin (e.g., pin 5)
      • D5 to a digital pin (e.g., pin 4)
      • D6 to a digital pin (e.g., pin 3)
      • D7 to a digital pin (e.g., pin 2)

Step 4: Write the Arduino Code

  • Open the code editor in Tinkercad and input the following code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int gasSensorPin = A0;
int ledPin = 9;
int buzzerPin = 10;
int gasValue;

void setup() {
  lcd.begin(16, 2);
  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  lcd.print("Pollution Level");
}

void loop() {
  gasValue = analogRead(gasSensorPin);
  lcd.setCursor(0, 1);
  lcd.print(gasValue);
  
  if (gasValue > 400) { // Adjust threshold as needed
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzerPin, LOW);
  }
  delay(1000);
}

Step 5: Simulate Your Circuit

  • After completing the circuit and code, click on the "Start Simulation" button in Tinkercad.
  • Test the functionality by simulating gas input. Adjust the threshold in the code as necessary to ensure proper activation of the alarm system.

Conclusion

You have successfully built an air pollution detection alarm system using Tinkercad. This project helps you understand the integration of sensors, displays, and alarms in electronics. Experiment with different gas sensors and thresholds for further learning. Consider expanding your project by adding wireless features or more sensors for a comprehensive environmental monitoring system.