NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Another "Make Music With a Microcontroller" Project with additions (Working)

September 25, 2010
by bpenglase
bpenglase's Avatar

I just finished up the traffic light program, and playing around with that one, so I looked on the project page for more ideas.

I decided to try out the "Make Music with a microcontroller" Project, but I also put a spin on it.

Since I noticed that the code was written for the ATtiny26L Chip, things didn't match up right away. Along with this, is it seems this was made for an older kit, which had a 24x2 display.

Since I have a newer kit (ATMega168 with 20x4 display), I had to switch things up. I ended up following along the code, but actually re-typed everything into the new project file.

Once I got it working, I decided that since I Still had the LEDs attached from the Traffic light program, I wanted to use them. So now each time a tone is played, a different LED lights up. Granted, it isn't same tone-to-LED, it's just the LEDs go from left to right (Depending on board orientation) right after one another.

Then, once I got that working, I decided it would be fun to also display the temperature. So while the chip is waiting for you to press the button to make music, it will read out the current temperature.

And without further adieu, here is the code I used, I figured it was too long, so I put it up on some personal webspace. There is also a picture of the physical setup, and it waiting for the button press. The code is also there in a .txt, since at least when I clicked the .c, it wanted me to download it, and not just view it in-browser.

http://smart-serv.net/~brandon/nerdkits/mymusicbox/

Almost 12k, I wish I could clean up the the one section (you'll know which), but I'm not really sure there is a way to.

October 26, 2010
by atbrace
atbrace's Avatar

I've been playing around with your source code (credited, of course) and I think I've made it a bit more extensible...still a few issues to resolve but I've got it using a tempo variable that changes DUR to standardize it as a quarter note (2*DUR being half-note, DUR/2 being eighth, etc). Makes it real nice and easy to look at sheet music and just slam it into the program.

I also made it tone-to-LED and tone-to-word, so the lyrics and lights follow right along with the music. However, it is getting reallllly big now and I haven't had a chance to attempt to clean it up. I think mine is sitting a little over 13k right now :/

It is playing the first 3 verses of the Gilligan's Island theme song flawlessly, though. Once I get it all cleaned up, I'll post up my version of the source code.

Thanks a lot btw, your port was really helpful.

Post a Reply

Please log in to post a reply.

Did you know that you can make a capacitive proximity sensor with some aluminum foil and paperclips? Learn more...