กลับไปหน้ารวมไฟล์
passive-buzzer-rickroll-system-en.md

Musical Mischief: Passive Buzzer Rickroll

The Passive Buzzer Rickroll project is a lightweight, invisible prank device. It combines the tone() generation capabilities of the Arduino with a light sensor, remaining completely silent until someone opens a drawer or turns on a light switch.

arduino_memory_game_piezo_macro_1772681197420.png

Frequencies and Rhythms in C++

To make an electronic "beep" recognizable as a pop song, you need accurate math.

  1. The Header File: You include a pitches.h tab in your sketch, containing all the musical notes mapped to their hertz frequencies (e.g., #define NOTE_D4 294).
  2. The Melody Array: You compose the riff of the song int melody[] = {NOTE_C4, NOTE_D4, NOTE_F4, NOTE_D4...};.
  3. The Duration Array: You list the beats: 1/4 notes, 1/8 notes, etc.
  4. The Trigger Loop: You wait for a condition to be met (e.g., analogRead(lightSensor) > 500). When triggered, a for loop plays the arrays using the tone(pin, pitch, duration) function.

Concealment Hardware

  • ATtiny85 Microcontroller: The smaller the better! A huge Arduino Uno is too obvious to hide. You can program an 8-pin ATtiny85 using your Uno.
  • Passive Piezo Buzzer: Essential. Active buzzers can only play one terrible beep.
  • LDR (Photoresistor): The trigger mechanism.
  • Coin Cell Battery (CR2032).

Tape this to the bottom of your roommate's desk drawer, and wait for the hilarity to ensue when they open it!

ข้อมูล Frontmatter ดั้งเดิม

title: "Passive Buzzer Rickroll System"
description: "Prank your friends! Program an Arduino to play the internet's most famous song, 'Never Gonna Give You Up', using a basic piezo buzzer."
category: "Audio & Sound"
difficulty: "Easy"