The next step...
Complex waveforms are generated by placing a series of values on the PWM in the right order, at the right time. Test program 2 (test2 in the project archive) is a simple program that plays different tones. I re-appropriated the watchdog timer
for a twice-per-second interval alarm. When the alarm sounds (interrupts), the PWM duty cycle is changed to the next value (tone). This generates alternating tones as can be heard in this video.
Next week we'll expand on this basic circuit to play complete audio recordings from SD memory cards. A sneak peak of the next week's project is shown in the full project video.
The Prototype Circuit
The prototype circuit is not intended to be a final project – it's just an aid to understanding the article. It has three basic parts:
1. An MSP430 and support circuitry as described in the project last week
2. An audio filter circuit attached to the PWM as described this week.
3. An SD memory card connected to the MSP430's SPI interface, which I'll introduce next week.
We'll design two final projects in a few weeks, but this prototype will demonstrate the important concepts along the way. There are several problems with this design that I know of, and probably several more that I'll find in the next few weeks.
All the code and design files for the prototype are included in the project archive
. The circuit and PCB were made using the freeware version of Cadsoft Eagle. You can download
it here. The test firmware is written in C and compiled with the free/demo IAR Kickstart compiler
Part list -- Name, value (size)
The parts are specified by value and size. I used mostly surface mount components in this design. SMD parts help keep the design as small as possible, and save a ton of time on drilling. The audio coupling capacitor is a through-hole part because large value electrolytic capapacitors have resisted miniturization and remain quite large.
Nearly all the parts specified are also available in a through-hole version. I know of no through-hole SD card holders, but the large soldering tabs on this part aren't at all intimidating.
The most obscure part is probably the SD card holder. I used ALPS part number SCDA1A0901, purchased at Mouser.com (Mouser number 688-SCDA1A0901). This model is a push in, push out model with a spring. I'd much prefer a simple push in/pull out type, but I've yet to find one. Watch out when you pick a holder, pin placement and measurements vary wildly.
IC1, MSP430F20X2 or F20x3 (PW14)
LED1, SMD LED (0805)
ALPS-SCDA1A0901, Alps SD Card holder (n/a)
C1, 0.1uF (0805)
C2, 0.1uF (0805)
C3, 0.01uF (0805)
C4, 47uF (0805)
R1, 47K (0805)
R3, 330R (0805)
R4, 2K (1206)
Program a MSP430 microcontroller