หน้าแรก ดูโปรเจกต์ทั้งหมด
Intermediate

โปรเจกต์ Timer Alarm Clock 30 นาที

Timer Alarm Clock 30 นาที แบบง่ายที่ใช้ Arduino พร้อมเสียง gong ที่นุ่มนวล

โปรเจกต์ Timer Alarm Clock 30 นาที

รายการอุปกรณ์และเครื่องมือ

1x 3D Printer (generic)
-
1x 5V 2.5A Switching Power Supply
-
1x Arduino Micro
-
1x High Accuracy Pi RTC (DS3231)
🛒 สั่งซื้อ
1x Pro Micro - 5V/16MHz
-
1x Pushbutton Switch, SPST-NO
🛒 สั่งซื้อ
1x Speaker: 3W, 4 ohms
-
1x DFPlayer Mini MP3 player
🛒 สั่งซื้อ
1x I2C 16x2 Arduino LCD Display Module
🛒 สั่งซื้อ
1x Flash Memory Card, MicroSD Card
-
}

รายละเอียดและวิธีทำ

นี่คือเครื่องตั้งเวลา 30 นาทีอย่างง่ายสำหรับการพักช่วงสั้นๆ หรือการต้มไข่ โดยใช้ Arduino Uno, Piezo Buzzer, Push Button และ LED

การทำงานของโปรเจกต์

เมื่อคุณกด Button เครื่องตั้งเวลาจะเริ่มนับถอยหลัง LED จะสว่างขึ้นเพื่อแสดงว่าเครื่องกำลังทำงาน (Active) หลังจากผ่านไป 30 นาที Buzzer จะส่งเสียงเตือนเพื่อให้คุณรู้ว่าหมดเวลาแล้ว

Components

  • Arduino Uno
  • Breadboard
  • LED
  • Resistor (220 ohm สำหรับ LED)
  • Resistor (10k ohm สำหรับ Button)
  • Piezo Buzzer
  • Push Button
  • Jumper wires

วงจร (The Circuit)

การต่อวงจรนั้นเรียบง่ายมาก:

  • เชื่อมต่อ Button เข้ากับ Digital Pin 2 พร้อมกับ Resistor 10k ohm แบบ Pull-down
  • เชื่อมต่อ LED เข้ากับ Digital Pin 13 พร้อมกับ Resistor 220 ohm
  • เชื่อมต่อ Piezo Buzzer เข้ากับ Digital Pin 8
Circuit Diagram
แผนผังวงจรสำหรับการเชื่อมต่อ Components เข้ากับ Arduino Uno

Code

คุณสามารถคัดลอก Code นี้ไปใส่ใน Arduino IDE แล้วทำการ Upload ลงใน Arduino ของคุณได้เลย:


// กำหนด Pin สำหรับแต่ละ Component
const int buttonPin = 2;
const int buzzerPin = 8;
const int ledPin = 13;

// ตั้งค่าเวลา 30 นาที (30 นาที * 60 วินาที * 1000 มิลลิวินาที)
const unsigned long timerDuration = 30 * 60 * 1000;

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  if (digitalRead(buttonPin) == HIGH) {
    digitalWrite(ledPin, HIGH); // เริ่มจับเวลา
    delay(timerDuration);
    
    // เสียงเตือนเมื่อครบเวลา
    for (int i = 0; i < 5; i++) {
      tone(buzzerPin, 1000);
      delay(500);
      noTone(buzzerPin);
      delay(500);
    }
    digitalWrite(ledPin, LOW);
  }
}

วิธีใช้งาน

หลังจากทำการ Upload Code เรียบร้อยแล้ว ให้กด Push Button หนึ่งครั้งเพื่อเริ่มการนับเวลา LED จะติดสว่างตลอดช่วงเวลา 30 นาที และเมื่อครบกำหนด Buzzer จะส่งเสียงเตือน 5 ครั้งเพื่อให้คุณทราบ

Code

🔒 ปลดล็อก Code

สนับสนุนเพื่อรับ Source Code หรือแอปพลิเคชันสำหรับโปรเจกต์นี้

รหัสอ้างอิงโปรเจกต์: 30-minute-timer-alarm-clock-95154f
870 บาท
PromptPay QR Code