Introduction: Pocket Pep Band

Carry your team theme in your pocket! Perfect for annoying rivals! When your team scores, cue up the band! Or use your imagination and create a portable Happy Birthday box, or Darth Vader's leitmotif to scare younglings. If you can hear a tune, you can make a Pocket Pep Band!

Using an ATTINY85 program a tune to play on a piezo buzzer.

Step 1: Gather Your Materials

MATERIALS

1 - Switch

1 - Piezo Buzzer

2 - LEDs (In your chosen theme colors)

1 - 3v Coin Battery

1 - 3v Coin Battery Holder

1 - ATTINY85

1 - Project Box (if you are curiously, I used Altoids tin)

Optional

2 LED Holders

TOOLS

Soldering Iron

22 AWG wire

Arduino to program ATTINY85: (Instructions for programming: http://highlowtech.org/?p=1695 )

Dremel to make appropriate holes in the Altoids box

Sand paper to rough up my LEDS.

Step 2: The Wiring

Step 3: Choose Your Song!

Using the TinyTone() function, you can create your song of choice.

I decided to make this with a well known tune that annoys just about everyone, except IRISH fans. I selected basic sheet music of the Notre Dame Victory march to use as a guide for notes and timing within the song. When you look at the code, you will see how the conversions of notes and time work.

TinyTone divides a sound into 3 categories (divisor, octave, duration). The divisor is the note or tone, the octave is the pitch, and the duration is how long you want the tone to be activated.

I then just added HIGH/LOW and LOW/HIGH commands for every other note for the LEDs so they would blink.

Here is the first part of the code to give you an idea of how to start:

/* TinyTone for ATtiny85 */

// Notes

const int Note_C = 239;

const int Note_CS = 225;

const int Note_D = 213;

const int Note_DS = 201;

const int Note_E = 190;

const int Note_F = 179;

const int Note_FS = 169;

const int Note_G = 159;

const int Note_GS = 150;

const int Note_A = 142;

const int Note_AS = 134;

const int Note_B = 127;

//OUTPUT

int Speaker = 1;

int LED1 = 0;

int LED2 = 2;

void setup() { pinMode(Speaker, OUTPUT);

pinMode(LED1, OUTPUT);

pinMode(LED2, OUTPUT); }

void loop()

{ playTune();

delay(100); }

void TinyTone(unsigned char divisor, unsigned char octave, unsigned long duration)

{

TCCR1 = 0x90 | (8-octave); // for 1MHz clock // TCCR1 = 0x90 | (11-octave); // for 8MHz clock OCR1C = divisor-1; // set the OCR delay(duration); TCCR1 = 0x90; // stop the counter

}

// Play a scale void playTune(void)

{

TinyTone(Note_D, 5, 500);

digitalWrite(LED1, HIGH);

digitalWrite(LED2, LOW);

}

1) The notes/tones are defined.

2) The Piezo Speaker and the 2 LEDs are defined to the ATTINY85 outputs

3) The note, the octave (pitch), and the duration of how long to play the note are defined.

4) The tune is then defined by Note to Play, Octave, Duration, followed by the LED to turn on/off.

*** So if you print out a piece of sheet music and transpose the notes to your code, you will be able to play any tune. Being able to read music helps!!!

Step 4: Programming the ATTINY85

Use your Arduino to program the ATTINY85. On this site, there are NUMEROUS Instructables which describe how to set up your Arduino to program your ATTINY85.

Example:

https://www.instructables.com/id/Programming-the-A...

I burned my ATTINY85 at 1 MHz. (the instructable above burns at 16Mhz)

or

http://highlowtech.org/?p=1695 (not an instructable)

Step 5: Breadboard It!

Step 6: Solder, Drill, Decorate, Celebrate!!!

I used a Dremel to drill the holes for the switch on the side and then two holes on top for the LEDs.I also made some small holes on top so the sound will come out of the box.

Make sure you insulate the inside of the box with some electrical tape before putting it all together.

Decorate with your theme and have fun!!!

Pocket-Sized Contest

Participated in the
Pocket-Sized Contest