Musical Treasure Box

Play a custom tune when your treasure box is opened to warn you someone may be trying to thieve your stuff!

Aug 14, 2020

7494 views

2 respects

Components and supplies

1

Mini breadboard

1

Trim Potentiometer

6

Jumper wires (generic)

1

Resistor 10k ohm

1

Arduino UNO

2

Male/Female Jumper Wires

1

I used an old Tjena box but any box will do

1

LDR, 5 Mohm

1

Buzzer, Piezo

1

ESD Tape, Masking

Apps and platforms

1

Arduino IDE

Project description

Code

LightSensingBuzzer

arduino

Firstly, take a look at the section of code from about lines 30 through to 59. This section determines what tune will be played and at what speed (via tempo value). The current tune has a total of 19 notes and rests. This is the value of songLength (line 31). You must edit this value to match the number of notes/rests in your tune. Edit the song length on line 29 to reflect the number of notes in your song. Include all the notes and rests in the count. Follow the commented instructions in the code when editing the notes and the beats array. You'll need some understanding of how musical compositions work to code your own tune. You can expect to spend some time getting the timing of the notes correct. Speed up or slow down the tune by changing the Tempo value on line 29.

LightSensingBuzzer

arduino

Firstly, take a look at the section of code from about lines 30 through to 59. This section determines what tune will be played and at what speed (via tempo value). The current tune has a total of 19 notes and rests. This is the value of songLength (line 31). You must edit this value to match the number of notes/rests in your tune. Edit the song length on line 29 to reflect the number of notes in your song. Include all the notes and rests in the count. Follow the commented instructions in the code when editing the notes and the beats array. You'll need some understanding of how musical compositions work to code your own tune. You can expect to spend some time getting the timing of the notes correct. Speed up or slow down the tune by changing the Tempo value on line 29.

Downloadable files

Musical Treasure Box Circuit

This circuit has an LDR to sense the light level in the environment and a buzzer to play a tune. The potentiometer is included to encourage others to consider doing an extension of the project but is not used in this project. It can be left out if desired by removing the potentiometer and the three wires connected to it.

Musical Treasure Box Circuit

Comments

Only logged in users can leave comments

joannehadley4

0 Followers

0 Projects

Table of contents

Intro

2

0