Tuesday, May 29, 2012

simple tone/music player

Here's a reasonably simple way to get ugly square waves playing music, much like an old Nokia ringtone. It has been configured to use the G2211 that comes with the MSP430 Launchpad. It doesn't really need any special functions and can run on other value line MSP430s. This project uses Code Composer Studio 5.2 with Grace.

All you need to add is a speaker between P2.6 and GND (they're adjacent pins) and press the button connected to P1.3. The code isn't all that elegant and I've ignored all the new ULP rules.

The DCO is set to 12MHz for the purposes of interrupts. I have included a spreadsheet that calculates the constants from music note frequencies into the adjusted DCO periods. The main function changes the note and duration while the interrupt routine toggles the output and keeps track of time for the note period and total duration.

http://db.tt/HKXGJrFq

This particular file plays 'Thaxted'. I found the sheet music from the Mutopia Project's website.

Sunday, May 6, 2012

Temperature readout

I've got a bad habit of leaving things on breadboard for tinkering with later... but it never really gets finished. But this time I really do need to clear off a breadboard for something else. It uses an MSP430-F2012's internal temperature sensor. It seems to be a bit high in the room - I spotted keyword 'self-heating' mentioned elsewhere.
All eight bits of port 1 and two bits from port 2 are used to drive the display. It's not enough to give the decimal point so a transistor pulls the decimal point LED low when digit two is displayed.
Behind it is a TPS60121 to boost the two AAA cells up to 3.3V. The datasheet shows that it works down to 1.8V so hopefully I can use up 'flat' batteries in this application.
The TPS60121 was a nice and friendly TSSOP-20 package so I purchased boards to make it DIP-friendly and tiny SMD ceramic capacitors from RS components. All $2.09 worth of capacitors with free shipping. Crazy pricing.