艺术
美容与健康
工艺
文化与历史
娱乐
环境
食品与饮料
绿色未来
逆向工程
科学
体育
技术
可穿戴设备
Making a LilyPad Musical Patch
Ed

创建者

Ed

13. 七月 2026FI
0
0
0
0
0

Making a LilyPad Musical Patch

Sew a patch that plays a tune. A LilyPad buzzer and a button let the microcontroller sing a short melody whenever you press it — a musical badge, a fabric greeting card, or a costume piece. This project introduces the buzzer and the Arduino tone() function that turns pin signals into notes.

中级
1-2 hours

说明

1

Sew the board, buzzer and button

Sew a LilyPad Arduino, a LilyPad buzzer and a LilyPad button onto felt. Wire it: the buzzer's + tab to pin 9 and its - tab to -; the button's tabs to analog pin A2 and to -. Keep the lines from crossing.

此步骤所需材料:

LilyPad Arduino Simple BoardLilyPad Arduino Simple Board1
LilyPad BuzzerLilyPad Buzzer1
LilyPad Button BoardLilyPad Button Board1
Conductive Thread - 60g (Stainless Steel)Conductive Thread - 60g (Stainless Steel)1
Hand Sewing Needles (Assorted, 30-Pack)Hand Sewing Needles (Assorted, 30-Pack)1
Wool Felt SheetWool Felt Sheet1
2

Connect the programmer

Plug the LilyPad FTDI onto the programming header and connect the USB cable. Open the Arduino IDE and select the LilyPad Arduino board and its serial port.

此步骤所需材料:

LilyPad FTDI Basic Breakout - 5VLilyPad FTDI Basic Breakout - 5V1
SparkFun Cerberus USB Cable - 1.8 meterSparkFun Cerberus USB Cable - 1.8 meter1

所需工具:

Computer with Arduino IDEComputer with Arduino IDE
3

Upload the melody sketch

Paste this sketch and upload. Pressing the button plays a short rising scale on the buzzer.

lilypad_musical_patch.inoarduino
// Press the button to play a short tune on the LilyPad buzzer.
// Buzzer + on pin 9, button between pin A2 and - (GND).

const int BUZZER_PIN = 9;
const int BUTTON_PIN = A2;   // read as a digital input, pressed = LOW

// A short tune: note frequencies (Hz) and how long each plays (ms)
int melody[]    = { 262, 294, 330, 349, 392 };  // C D E F G
int durations[] = { 200, 200, 200, 200, 400 };

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);  // built-in pull-up: unpressed reads HIGH
}

void loop() {
  if (digitalRead(BUTTON_PIN) == LOW) {   // button pressed
    for (int i = 0; i < 5; i++) {
      tone(BUZZER_PIN, melody[i], durations[i]);
      delay(durations[i] + 50);
    }
    noTone(BUZZER_PIN);
  }
}
4

Press to play, then compose

Press the button — you should hear the five notes. Change the tune by editing the melody[] frequencies (higher number = higher note) and the durations[] in milliseconds, then re-upload. Add more notes to both arrays to make a longer song.

5

Go wireless and wear it

Unplug the FTDI, sew a LilyPad coin-cell holder to the board (+ to +, - to -), drop in a CR2032 and switch on. Sew the felt onto a badge or card — press it to play your tune anywhere.

此步骤所需材料:

LilyPad Coin Cell Battery Holder - w/Switch - 20mmLilyPad Coin Cell Battery Holder - w/Switch - 20mm1
CR2032 Coin Cell BatteryCR2032 Coin Cell Battery1

材料

10

所需工具

1
估计总额
$96.00

CC0 公共领域

此蓝图以 CC0 协议发布。你可以自由复制、修改、分发和使用此作品,无需征得许可。

通过购买蓝图中的产品支持创客,他们将获得 创客佣金 (由供应商设定),或创建此蓝图的新版本并将其作为连接包含在你自己的蓝图中以分享收入。

讨论

(0)

登录 加入讨论

加载评论中...