555: The Timer

Astable Mode

555 Timer Math

When the 555 is wired up in Astable mode you can run it from fractional Hz to around 2Mhz depending on the one you get. Check the datasheet. For our purposes we want to create a primitive MIDI device with a single voice in a limited range of frequencies. Middle C is 261.626hz and B flat is 466.164Hz so we're well within the operational range to try to create notes in octave above Middle C on a piano. And for sound effects it can easily handle lower frequences.

By using the 555 timer we can avoid having to try to program the Arduino to do PWM while running other game logic. There are sound chips out there that are used in various MIDI keyboards that I'm sure you could use but this is a good way to become familiar with practical uses for the 555 and understanding the basics of what goes into a sound chip.

The trick is figuring out what frequencies you need to support and calculating the resister values. In the above link, the capacitor is a known size and the resistor values are calculated.