Create project Need help?
jippie

Musical Microcontroller

Status: Proposal
2057
2
votes
February 5, 2014
attiny45.jpg

A simple microcontroller like an ATtiny45 (but probably as small as an ATtiny13 as well) can be programmed to play a melody. A bit like a musical greeting card or an electronic doorbell. Please check the video for a proof of concept, the code is largely done but can do with some optimizations for power use.

  • Video: http://www.youtube.com/watch?v=4PpIIu4kVjw
  • Source codes: http://git.linformatronics.nl/gitweb/?p=musicalMicrocontroller;a=summary

Apart from a 100nF power supply decoupling cap, a battery and a piezo speaker, no extra components are required.

The circuit can easily be extended with a push pull BJT output stage from general purpose low power transistors to drive a 8 ohm speaker from the same 5V power supply. This opens the way for use as a doorbell.

When using a piezo speaker you can create a musical greeting card with a customized tune. According to the datasheet, the controller should work fine even below 2.7V, but I didn't test that yet.

To make this project successful though, I need to solve a couple small but essential issues:

  1. Basically any simple single channel melody can be programmed, as long as it can be made up from the reasonably accurate notes B3 up to E7. Actually apart from F7 all notes from B3 up to C#8 are available. I'm not a musician, and for a successful project I am short a couple nice tunes. The format for melody files is pretty straightforward text and I have a Perl script available for conversion into C++ source file. Currently supports 1/1 1/2 and 1/4 notes, but this can easily be extended.
  2. When using a controller in a SOIC-8 package combined with a piezo speaker, the parts are nice and flat and with a bit of glue can easily be fitted onto a greeting card. The only problem is a cheap, probably simple to build DIY battery clip and power switch.
Read the full post
Show less

Loading comments...