<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>DIY Life</title>
<link>http://www.diylife.com</link>
<description>DIY Life</description>
<image>
<url>http://www.diylife.com/media/feed_logo.gif</url>
<title>DIY Life</title>
<link>http://www.diylife.com</link>
</image>
<language>en-us</language>
<copyright>Copyright 2009 Weblogs, Inc. The contents of this feed are available for non-commercial use only.</copyright>
<generator>Blogsmith http://www.blogsmith.com/</generator><item><title>Cadsoft Eagle 5 test drive</title><link>http://www.diylife.com/2008/06/06/cadsoft-eagle-5-test-drive/</link><guid isPermaLink="true">http://www.diylife.com/2008/06/06/cadsoft-eagle-5-test-drive/</guid><comments>http://www.diylife.com/2008/06/06/cadsoft-eagle-5-test-drive/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/robotics/" rel="tag">robotics</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><br />The other day, Make:blog <a href="http://blog.makezine.com/archive/2008/06/eagle_pcb_software_gets_a.html?CMP=OTC-0D6B48984890">mentioned</a> the new <a href="http://www.cadsoft.de/download.htm">5.0 release</a> of Eagle. <a href="http://www.cadsoft.de">Cadsoft Eagle</a> is the most popular circuit design and layout software among DIY'ers, and the program I use in all <a href="http://www.diylife.com/bloggers/ian-lesnet/">my projects</a>. Today I designed a project with Eagle 5 and journaled my favorite updates. I also tested compatibility with the <a href="http://www.matwei.de/doku.php?id=en:eagle3d:eagle3d">current</a> and <a href="http://www.freelists.org/archives/eagle3d/03-2008/msg00000.html">beta</a> versions of <a href="http://www.matwei.de/doku.php?id=en:eagle3d:eagle3d">Eagle3D</a>, a 3D circuit board rendering program.
<div align="center"><a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/"><img vspace="4" hspace="4" border="0" alt="next page" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" /></a><br /></div>
<br /><div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/">Eagle 5 and Eagle3D</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841775/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/brd.highcontrast.667_thumbnail.png" alt="Eagle 5 PCB color scheme" title="Eagle 5 PCB color scheme" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841777/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/context.comp.667_thumbnail.png" alt="Cadsoft Eagle 5 context menus" title="Cadsoft Eagle 5 context menus" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841776/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/cct.prop.667_thumbnail.png" alt="Cadsoft Eagle 5 properties dialog" title="Cadsoft Eagle 5 properties dialog" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841774/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/render-comp.667_thumbnail.jpg" alt="Eagle3D 1.05 and 1.10 comparison" title="Eagle3D 1.05 and 1.10 comparison" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href="http://www.diylife.com/2008/06/06/cadsoft-eagle-5-test-drive/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1215659/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/06/06/cadsoft-eagle-5-test-drive/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>Cadsoft Eagle</category><category>CadsoftEagle</category><category>circuit layout</category><category>CircuitLayout</category><category>software review</category><category>SoftwareReview</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 06 Jun 2008 14:00:00 EST</pubDate></item><item><title>Cadsoft Eagle 5 test drive, part 2</title><link>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/</link><guid isPermaLink="true">http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/</guid><comments>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/robotics/" rel="tag">robotics</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><br /><strong>Cadsoft Eagle 5<br /><br /></strong><a href="http://www.cadsoft.de/">Eagle 5</a> installs to dedicated version 5 directory -- the new version won't overwrite a previous install. You still have full access to your original stuff if anything goes wrong. <br /><br />When I start Eagle 5 it attempts network access; this might be an auto updater or license checker. It didn't complain when I permanently blocked access.<br /><br /> <img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/06/brd.highcontrast.400.png" /><br /><br />All my old schematics and circuit board files from Eagle 4.16r2 load in the new version. The board layout editor got a minor makeover with "web 2.0" pastel color shades.<br /><br />Say goodbye to the awkward ALT+Backspace undo, because Cadsoft joined the rest of the world and standardized on CTRL+Z!!! Need I say more? Oh happy day!<br /><br /><img vspace="4" hspace="4" border="2" src="http://www.blogcdn.com/www.diylife.com/media/2008/06/context.comp.400.png" alt="" /><br /><br />Eagle now has right-click context menus in the schematic editor and the board layout editor. While context menus are ubiquitous (does your browser have it?), previous versions of Eagle pretend the right mouse button doesn't exist. <br />
<div align="center"><a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/">Eagle 5 and Eagle3D</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841775/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/brd.highcontrast.667_thumbnail.png" alt="Eagle 5 PCB color scheme" title="Eagle 5 PCB color scheme" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841777/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/context.comp.667_thumbnail.png" alt="Cadsoft Eagle 5 context menus" title="Cadsoft Eagle 5 context menus" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841776/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/cct.prop.667_thumbnail.png" alt="Cadsoft Eagle 5 properties dialog" title="Cadsoft Eagle 5 properties dialog" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841774/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/render-comp.667_thumbnail.jpg" alt="Eagle3D 1.05 and 1.10 comparison" title="Eagle3D 1.05 and 1.10 comparison" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive/>Read</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1217084/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-2/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>cadsoft-eagle</category><category>circuit-layout</category><category>software-review</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Thu, 05 Jun 2008 23:00:00 EST</pubDate></item><item><title>Cadsoft Eagle 5 test drive, part 3</title><link>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/</link><guid isPermaLink="true">http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/</guid><comments>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/robotics/" rel="tag">robotics</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><br /><img vspace="4" hspace="4" border="2" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/06/cct.prop.400.png" /><br /><br />Another great feature is the properties editor. Component or connection properties can be configured in one place. These features were previously scattered over dozens of menus and icons. <br /><br style="font-weight: bold;" /><strong>Eagle3D 1.05 compatibility<br /><br /></strong>Like a Firefox upgrade, it's important that all your favorite Eagle add-ons are compatible with the new version. For me, that's the ultra-cool 3D rendering script, <a href="http://www.matwei.de/doku.php?id=en:eagle3d:eagle3d">Eagle3D</a>. The 3D renderings that accompany <a href="http://www.diylife.com/bloggers/ian-lesnet/">my projects</a> are made with <a href="http://www.matwei.de/doku.php?id=en:eagle3d:eagle3d">Eagle3D 1.05</a>, but I'll also test a new <a href="http://www.freelists.org/archives/eagle3d/03-2008/msg00000.html">1.1 beta version</a> with Eagle 5. <br /><br />First, I installed Eagle3D 1.05 in the same folder as Eagle 5 (C:\Program Files\EAGLE-5.0.0\Eagle3D). I also installed <a href="http://www.povray.org/">POVray</a> (try <a href="http://users.skynet.be/smellenbergh/ ">MacMegaPOV</a> for Mac) to render the files created by Eagle3D. If you're not familiar with how to use Eagle3D, or run .ulp files with Eagle, see the <a href="http://www.matwei.de/doku.php?id=en:eagle3d:documentation">Eagle3D documentation</a> and this <a href="http://www.instructables.com/id/Render-3D-images-of-your-PCBs-using-Eagle3D-and-PO/">illustrated tutorial</a>.<br /><br />I loaded a circuit board file and rendered it using the Eagle3D .ulp file intended for Eagle version 4.1. It worked normally, and generated a POVray compatible file.<br /><br />New users often run into this error when rendering the their first Eagle3D .pov file with POVray:<br /><em>Parse Error: Cannot open include file tools.inc.<br />File: C:\ ... DIYLife.com - MSP430 voice recorder - vc.pov Line: 117<br />Parse Warning: Check that the file is in a directory specified with a +L switch or 'Library_Path=' .INI item. </em><br /><br />This means that POVray can't find the Eagle3D component libraries. You need to add Eagle3D to the POVray search path: <br />
<ol>
    <li>Open POVray and make sure you have a .pov file open.</li>
    <li>Go to <strong>tools-&gt;edit master povray.ini</strong>. Povray.ini opens in a text editor. </li>
    <li>Add the path to your Eagle3D files at the very bottom of povray.ini. This is the folder where Eagle3D was installed earlier. I added this line to the end of my poyray.ini, but use your own install location: Library_Path="C:\Program Files\EAGLE-5.0.0\Eagle3D\povray"</li>
</ol>
My board rendered perfectly after this minor configuration change.<br />
<div align="center"><a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/">Eagle 5 and Eagle3D</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841775/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/brd.highcontrast.667_thumbnail.png" alt="Eagle 5 PCB color scheme" title="Eagle 5 PCB color scheme" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841777/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/context.comp.667_thumbnail.png" alt="Cadsoft Eagle 5 context menus" title="Cadsoft Eagle 5 context menus" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841776/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/cct.prop.667_thumbnail.png" alt="Cadsoft Eagle 5 properties dialog" title="Cadsoft Eagle 5 properties dialog" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841774/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/render-comp.667_thumbnail.jpg" alt="Eagle3D 1.05 and 1.10 comparison" title="Eagle3D 1.05 and 1.10 comparison" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive/>Read</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1217085/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-3/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>cadsoft eagle</category><category>CadsoftEagle</category><category>circuit-layout</category><category>circuitlayout</category><category>software-review</category><category>softwarereview</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Thu, 05 Jun 2008 23:00:00 EST</pubDate></item><item><title>Cadsoft Eagle 5 test drive, part 4</title><link>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/</link><guid isPermaLink="true">http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/</guid><comments>http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/robotics/" rel="tag">robotics</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><br /><strong>Eagle3D 1.1 beta compatibility<br /><br /></strong>Next, I upgraded to the new <a href="http://www.freelists.org/archives/eagle3d/03-2008/msg00000.html">1.1 beta version</a> of Eagle3D. The beta version was released on the <a href="http://www.freelists.org/archives/eagle3d/">Eagle3D mailing list</a>.<br /><br />I deleted my old Eagle3D folder and copied the new version to the same location. If you use a different location, update the Library_Path you specified in povray.ini. <em>Be careful not to include multiple search paths for different versions of Eagle3D, the result will be unpredictable.</em><br /><br />The interface of version 1.05 and 1.1 are nearly identical. The new version optionally generates SVG formatted vector graphics. <br /><br />Eagle3D 1.1 generates a list of components it wasn't able to match to the 3D parts library. This is a helpful new feature that will help diagnose why certain parts don't render correctly.<br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/06/render-comp.400.jpg" /><br /><br />Functionally, the new version performs similarly to version 1.05. It didn't render any more parts on my test board than the last version. The new version (above, right) excludes the water background, and I don't know how I feel about this yet -- the old background (above, left) was getting tired, but white is a bit jarring.<br /><br /><strong>Verdict<br /><br /></strong>I'm tentatively using the new versions of Eagle and Eagle3D. They've been solid for a few days, and backwards compatibility seems good. The new features in Eagle 5 make it much easier to use and more intuitive for beginners. Both versions of Eagle3D are compatible with Eagle 5, but I highly recommend the new 1.1 beta version. Eagle3D 1.1 is several years newer than its predecessor, has a larger parts library, and generates helpful reports.<br /><br /><strong>Related links<br /><br /></strong><a href="http://www.instructables.com/id/Draw-Electronic-Schematics-with-CadSoft-EAGLE/">Draw electronics schematics with cadsoft Eagle</a>.<br /><a href="http://www.instructables.com/id/Turn-your-EAGLE-schematic-into-a-PCB/">Turn your eagle schematic into a PCB</a>.<br /><a href="http://www.instructables.com/id/Render-3D-images-of-your-PCBs-using-Eagle3D-and-PO/">Render 3D images of your PCBs using Eagle 3D and POVray</a>.
<div align="center"><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/">Eagle 5 and Eagle3D</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841775/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/brd.highcontrast.667_thumbnail.png" alt="Eagle 5 PCB color scheme" title="Eagle 5 PCB color scheme" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841777/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/context.comp.667_thumbnail.png" alt="Cadsoft Eagle 5 context menus" title="Cadsoft Eagle 5 context menus" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841776/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/cct.prop.667_thumbnail.png" alt="Cadsoft Eagle 5 properties dialog" title="Cadsoft Eagle 5 properties dialog" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/eagle-5-and-eagle3d/841774/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/06/render-comp.667_thumbnail.jpg" alt="Eagle3D 1.05 and 1.10 comparison" title="Eagle3D 1.05 and 1.10 comparison" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive/>Read</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1217103/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/06/05/cadsoft-eagle-5-test-drive-part-4/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>cadsoft eagle</category><category>CadsoftEagle</category><category>circuit-layout</category><category>circuitlayout</category><category>software-review</category><category>softwarereview</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Thu, 05 Jun 2008 23:00:00 EST</pubDate></item><item><title>Computer mouse salvage</title><link>http://www.diylife.com/2008/05/22/computer-mouse-salvage/</link><guid isPermaLink="true">http://www.diylife.com/2008/05/22/computer-mouse-salvage/</guid><comments>http://www.diylife.com/2008/05/22/computer-mouse-salvage/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/robotics/" rel="tag">robotics</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><img width="240" vspace="4" hspace="4" height="201" border="0" align="right" alt="Electronic components." src="http://www.blogcdn.com/www.diylife.com/media/2008/05/desoldering.jpg" />Salvaging <a href="http://www.diylife.com/search/?q=electronic">electronic</a> parts is a must for any DIY'er. You save big on shipping charges, and recycling is good for the environment. <a href="http://www.hackaday.com">Hack-a-day</a> dissected an old computer mouse and found some useful components. <br /><br />What useful parts are inside an outdated PC mouse? There are a bunch of sensors and buttons, including rotary encoders that can be used to measure movement in robotics projects. My favorite find is the microchip that glues the sensors to a computer. Learn about all these parts in detail, in the <a href="http://www.hackaday.com/2008/05/16/how-to-scavenge-a-mouse-for-parts/">how-to</a>.<br /><br />Hack-a-day doesn't delve into the proper techniques for removing parts, but there are a ton of tutorials that can help you get started. It's possible to remove many parts with a simple soldering iron and an absorbent copper braid, called <a href="http://en.wikibooks.org/wiki/Practical_Electronics/Desoldering">solder wick</a>. Many use a <a href="http://www.hardwaresecrets.com/article/164">solder sucker</a> to vacuum solder away from parts, or a special <a href="http://www.instructables.com/id/Salvaging-PCB-Parts/?ALLSTEPS">desoldering iron</a>. Surface mount chips can also be removed, but they may require the gentle embrace of 400 degree air from a <a href="http://www.sparkfun.com/commerce/present.php?p=SMD-HowTo-4">hot air rework station</a>, or the crude gust of a <a href="http://www.instructables.com/id/Heatgun-Desoldering/?ALLSTEPS">heat gun</a>.<p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.hackaday.com/2008/05/16/how-to-scavenge-a-mouse-for-parts/>Read</a> | <a href="http://www.diylife.com/2008/05/22/computer-mouse-salvage/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1202741/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/05/22/computer-mouse-salvage/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>computers</category><category>electronics</category><category>mouse</category><category>recycling</category><category>salvage</category><category>soldering</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Thu, 22 May 2008 16:00:00 EST</pubDate></item><item><title>Record audio with the MSP430 microcontroller</title><link>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller/</link><guid isPermaLink="true">http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller/</guid><comments>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a>, <a href="http://www.diylife.com/category/flashes-and-pulses/" rel="tag">Flashes and Pulses</a></p><em>This article continues a series about building a DIY digital audio recorder. Inspired by <a href="http://www.rpi.edu/%7Ekouttd/03/Rage_against_the_arduino.html">this microcontroller audio project</a> [<a href="http://blog.makezine.com/archive/2008/02/stereo_pwm_audio.html">via</a>], I set out to build a simple digital recording device. I chose Texas Instrument's MSP430 microcontroller for this project because it's fast (16 MHz), it's cheap ($1), and it's very low power. Read the <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">first part</a>, the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">second part</a>, and the <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/">third</a>.</em><br /> <br /> In the first few segments I developed a digital audio recorder prototype that plays raw audio files from an SD card. This time we finish up the introductory segments by recording audio to the SD card. Before the audio can be recorded by the microcontroller, it has to be prepared by a small amplifier. Read on to learn more about working with microphones and recording audio with a microcontroller.<br /> <br /> <img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/audio-diagram-input-2.400.p.png" alt="" /><br /><br /><div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/audio-sampling-with-the-msp430/">MSP430 audio sampling</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/audio-sampling-with-the-msp430/797117/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/audio-diagram-input-2.667.p_thumbnail.png" alt="Audio sample overview" title="Audio sample overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/audio-sampling-with-the-msp430/797072/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/op-amp.667.p8_thumbnail.png" alt="Raw microphone output" title="Raw microphone output" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/audio-sampling-with-the-msp430/797073/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/adc-vref-bits.667.p8_thumbnail.png" alt="Analog measurement" title="Analog measurement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/audio-sampling-with-the-msp430/797075/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/firmware-inout.667.p8_thumbnail.png" alt="Echo audio input" title="Echo audio input" /></a></div><br />
<div align="center"><a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/>Read</a> | <a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1190921/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>digital audio recorder</category><category>DigitalAudioRecorder</category><category>featured</category><category>microcontroller</category><category>msp430</category><category>op-amp</category><category>sd card</category><category>SdCard</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 16 May 2008 16:00:00 EST</pubDate></item><item><title>Record audio with the MSP430 microcontroller pt. 2</title><link>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/</link><guid isPermaLink="true">http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/</guid><comments>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/flashes-and-pulses/" rel="tag">Flashes and Pulses</a></p><strong>Preparing raw microphone output for sampling</strong><br />This project uses a small, common <a href="http://en.wikipedia.org/wiki/Electret_microphone">electret microphone</a> to convert audio to an electrical signal. These are the cheap microphones found in most PC headsets. The microphone output must be amplified and zeroed before it can be recorded with the MSP430. This is done with an <a href="http://en.wikipedia.org/wiki/Operational_amplifier">operational amplifier</a>, or op-amp. The op-amp amplifies the tiny, oddly centered audio signal into a full range signal based on 0 volts. The diagram shows the original signal (blue) and the amplified, full range signal outputted by the op-amp (red).<br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/op-amp.400.p8.png" /><br /><br />I'm not much of an analog designer, so may I refer you to any of these tutorials on op-amps if you need more info: <a href="http://en.wikipedia.org/wiki/Operational_amplifier">wikipedia</a>, <a href="http://www.eas.asu.edu/~holbert/ece201/opamp.html">a flash tutorial</a>, <a href="http://ourworld.compuserve.com/homepages/Bill_Bowden/opamp.htm">opamp basics</a>. <br /><br />The op-amp design I used came directly from TI's digital audio recorder application note <a href="http://focus.ti.com/lit/an/slaa123/slaa123.pdf">slaa123</a> [pdf!] (page 3). TI's design uses a TI <a href="http://focus.ti.com/docs/prod/folders/print/tlv2252.html">TLV2252</a> dual op-amp. We only need one, so I substituted a single channel TI <a href="http://focus.ti.com/docs/prod/folders/print/tlv2221.html">TLV2221</a> op-amp. I used the circuit and values from the TI app note, but substituted the 2K/.01uf low-pass audio filter I <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/">chose in part II</a>. The TLV2221 is only available in a surface mount package. If you want to do an all through-hole version of this project, consider a TLV2252 based design.<br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/opamp-th-cct-400.png" /><br /><a href="http://www.diylife.com/media/2008/05/opamp-th-cct.big.png">click for full sized schematic image</a><br /><br />
<div align="center"><a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/"><br /></a></div>
<strong>Sampling an audio signal</strong><br />We'll use the MSP430's on-chip <a href="http://en.wikipedia.org/wiki/Analog-to-digital_converter">analog-to-digital converter</a> (ADC) to measure the audio signal. The ADC is a pin that measures analog voltages. Measurements taken by the ADC are recorded as a fraction of a <a href="http://en.wikipedia.org/wiki/Voltage_reference">voltage reference</a> (Vref). In the prototype, the voltage reference will equal that of the circuit -- 3.3 volts. <br /><br />The smallest voltage change that can be measured by the ADC is denoted in <a href="http://en.wikipedia.org/wiki/Bit">bits</a>. An 8 bit ADC measures voltage on a scale of 0 to 255. A reading of 127 (127/255=50%) from the ADC represents ~1.65 volts (0.50 * 3.3 volt reference). The diagram shows the relationship between bits, voltage reference, and measurements taken by the ADC.<br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/adc-vref-bits.400.p8.png" /><br /><br />The MSP430F2012 has a 10 bit (0-1024) ADC, while the F2013 has a higher-resolution 16 bit (0-65535) ADC. The higher resolution ADC could, in theory, be used to capture better audio. <br /><br /><em>Gotcha --</em><br />The <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/">prototype design</a> is unproven and bound to have problems. Here's a big one! Most ADCs, including the Microchip PIC, ATMEL AVRs, and even the MSP430F2012, can use the circuit power supply as the ADC voltage reference. An internal switch, manipulated from software, determines the reference source. I planned to use this feature to measure the op-amp output, which is scaled to the 3.3 volts used in the circuit. The F2013, despite my assumptions, does not appear to have an internal Vref connection to the chip power supply. The F2013's internal Vref comes from a precision 1.2 volt reference. An external voltage reference can be sourced through pin 5 (P1.3), where a LED currently connects. Future designs should take this limitation into account, and connect the F2013 Vref pin directly to the power supply.<br /><br />My work-around was to remove the LED and solder a fly-wire from the power pin to the Vref pin. An external Vref is used if SD16REFON and SD16VMIDON are both cleared to 0, according to page 24-4 of the <a href="http://focus.ti.com/lit/ug/slau144e/slau144e.pdf">MSP430F2xxx Family User's Guide</a> [pdf!]. This didn't work for me. <br /><br />Next, I <a href="http://www.sengpielaudio.com/calculator-voltagedivider.htm">calculated a voltage divider</a> to cut the op-amp 3.3 volt output to 1.2 volts - this helped to some extent.<br /><br />Eventually, I messed around enough to destroy the MSP430. In desperate need of a break, I removed the dead MSP430F2013 and replaced it with a F2012. The F2012 has only 10 bits of ADC resolution, but is able to use the chip supply as a voltage reference. <br /><br /><strong>Test audio capture</strong> (example firmware 4)<br />NOTE:unlike the previous firmware, this is intended for the MSP430F2012!!!<br />The example program samples audio from the microphone and puts it immediately in the PWM duty cycle register. The result is a useless "middle man" that echoes everything heard by the microphone.<br /><br />This project is based on the firmware from my <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/">last article</a>. A timer triggers an alarm (an interrupt) 8000 times per second. An ADC measurement is started each time the alarm sounds. The ADC measurement isn't ready immediately - it takes a few cycles for the conversion to be readable. We don't need to worry about this period, because the ADC will trigger it's own interrupt when the measurement is complete. A single line of code in the ADC interrupt service routine copies the ADC measurement to the PWM duty cycle register. <br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/firmware-inout.400.p8.png" /><br /><br />As you can see in the video, everything I play into the microphone can be heard from the powered PC speakers. There's no direct audio path from the microphone to the speakers -- the sound is first sampled, and then output on the PWM. This simple concept can be used in different ways to create custom digital audio effects and real-time audio distortions.<br /><video><object width="400" height="350"> <param name="movie" value="http://www.youtube.com/v/FOnIx5x1Hso"> </param> <embed src="http://www.youtube.com/v/FOnIx5x1Hso" type="application/x-shockwave-flash" width="400" height="350"> </embed> </object></video><br />
<div align="center"><a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/"><img vspace="4" hspace="4" border="0" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/>Read</a> | <a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1197856/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-2/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 16 May 2008 16:00:00 EST</pubDate></item><item><title>Record audio with the MSP430 microcontroller pt. 3</title><link>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/</link><guid isPermaLink="true">http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/</guid><comments>http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/flashes-and-pulses/" rel="tag">Flashes and Pulses</a></p><strong>Recording to a SD card</strong> (example firmware 5)<br />The whole series of articles comes down to this moment -- it's time to save audio samples to the SD card. Like <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/">last time</a>, a MMC/SD card library from TI takes care of accessing the SD card. The original TI library requires a 512 byte block of memory to hold a whole SD card sector, but the F2012/3 chip only has 128 bytes of RAM. A low memory version of the write routine is possible if we write the bytes into the sector sequentially. I broke the write function into three smaller functions that:<br />
<ol>
    <li>mount a sector for writing, </li>
    <li>send a single byte to the SD card, and </li>
    <li>starts the sector save and unmounts the sector. </li>
</ol>
If we only write a single byte to the card at a time, a full 512 byte cache is unnecessary. This is the same technique I used to read from the card in <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/">Make a talking MSP430 microcontoller</a>.<br /><br />The example firmware builds on the existing projects. A timer generates an interrupt 8000 times per second. Ten seconds of audio is recorded immediately after the circuit is powered. For these ten seconds, each timer interrupt begins an ADC measurement. Upon completion, the ADC triggers an interrupt that stores the audio sample in a buffer and sets a flag. This flag triggers code in the main program loop to write the byte to the SD card. After ten seconds (80000 samples, 157 sectors), recording stops.<br /><br /><img vspace="4" hspace="4" border="1" alt="" id="img1" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/audio-diagram-input-2.400.p.png" /><br /><br />Next, the recorded audio is played in a loop. As in the <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/">previous project</a>, each timer interrupt (8000 per second) copies a sample from the SD card to the PWM duty cycle register.<br /><br /><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/">Sector switching</a> and management is handled in the background by the sdRead() and sdWrite() functions. Every 512 bytes the sector is switched -- the old sector is closed and the next sector is mounted. If you use these functions, pay close attention to the setup steps that prepare the card for a sequential read or write. Set the start location to read or write in the flashDisk and audio variables, and manually mount the start sector.<br /><br />NOTE: The SD card is used as a cheap and handy source of flash storage. Audio data is recorded to the SD card in a raw format. Audio files will not appear if you put the card into a memory card reader and attach it to a PC. The MSP430F2012/3 lacks the resources needed to implement a full <a href="http://en.wikipedia.org/wiki/FAT_file_system">FAT file system</a>. The raw data can still be viewed and extracted with special disk tools, such as <a href="http://mh-nexus.de/hxd/">HxD</a>.<br /><br />The example program starts recording audio at the beginning of the SECOND sector of the SD card (sector 1). The first sector (sector 0) will be used to record the length of the file in the final digital audio projects. The reserved sector provides 512 bytes for meta data, allowing us to delineate the flash storage space into multiple audio clips.<br /><br /><strong>Continuing...</strong><br />Next time, I'll finish up with the MSP430 by designing a complete digital audio recording experimenter's board. The final project joins everything from the previous four articles with an amplifier chip that drives a small speaker.<br /><br /><strong>Prototype</strong><br />This project uses the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/">digital audio recorder prototype</a> from <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">Make a singing MSP430 microcontoller</a>. I replaced the original F2013 with a F2012. The only difference between these chips is the type of ADC: the F2012 has a 10 bit ADC, the F2013 has a 16 bit sigma delta ADC.<br /><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/project.p8.400.jpg" /><br /><br />The microphone amplifier prototype is included in the <a href="http://www.whereisian.com/DIYLife9.zip">project archive</a>. The circuit was designed with the freeware version of <a href="http://cadsoft.de/">Cadsoft Eagle</a>.<br /><br /><strong>Parts list</strong><br /><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/05/opamp-th-novalue-label-400.png" /><br /><br /><em>Op-amp:</em><br />U1 - TLV2221 (surface mount, SOT23-5L). TLV2211, and TLV2231 would also work.<br /><br /><em>Capacitors:</em> (through-hole unless noted)<br />C4 - 0.1uF (surface mount, 0805) <br />C5 - 0.01uF <br />C7,8 - 4.7uF <br />C9 - 470pF <br /><br /><em>Resistors:</em> (all through-hole)<br />R2 - 2K <br />R5,6 - 18K <br />R7,8 - 1K1 <br />R9 - 56K<br /><br /><div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/">MSP430 electret microphone ampifier</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/797089/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/opamp-th-cct-667_thumbnail.png" alt="Microphone amplifier circuit" title="Microphone amplifier circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/797091/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/opamp-th-novalue-label-667_thumbnail.png" alt="PCB and part placement" title="PCB and part placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/797087/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/render.667.p8_thumbnail.jpg" alt="Mic amp rendering" title="Mic amp rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/797093/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/opamp.p8.667_thumbnail.jpg" alt="Mic amp prototype" title="Mic amp prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/electret-microphone-ampifier/797092/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/05/project.p8.667_thumbnail.jpg" alt="Prototype overview" title="Prototype overview" /></a></div><br /><br /><br /><br /><br /><strong>Related links</strong><br /><a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller">Program a MSP430 microcontroller</a>.<br /><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller">Make a singing MSP430 microcontroller</a>.<br /><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/">Make a talking MSP430 microcontroller</a>.<p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1197857/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/05/16/record-audio-with-the-msp430-microcontroller-pt-3/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 16 May 2008 16:00:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller - part 2</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><strong><br />Overview</strong><br />Read the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">previous article</a> in this series for the fundamentals of microcontroller audio. Learn about basic MSP430 connections and programming in the <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller">MSP430 primer</a>. This week we'll use the tiny, inexpensive MSP430 microcontroller to play audio from a SD card. <br /><br /><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.400.p8.png" alt="" /><br /><br /><strong>Playing an audio file</strong><br />In the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">previous project</a>, I used the MSP430 pulse-width modulator (PWM) to generate simple tones. The PWM duty cycle changed the frequency, and thus tone, of the generated signal. The signal is cleaned by a simple audio filter, and amplified by powered PC speakers. Hear it in this video clip from the previous article:<br /><br /><br /><video><object width="400" height="355"><param name="movie" value="http://www.youtube.com/v/BcIwQJCzT50&amp;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/BcIwQJCzT50&amp;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="400" height="355"></embed></object></video><br /><br />Each value generates a different frequency. If we change the values about 8000 times a second (8KHz) we can reproduce <a href="http://en.wikipedia.org/wiki/Bit_rate#Other_audio">telephone quality audio</a>. <br /><br /><a href="http://en.wikipedia.org/wiki/Audio_bit_depth">8 bit audio</a> (each sample requires one <a href="http://en.wikipedia.org/wiki/Byte">byte</a>) at 8KHz requires 8000 bytes of data per second. <a href="http://en.wikipedia.org/wiki/Audio_bit_depth">16 bit audio</a>, the quality associated with CD players and PCs, requires twice as much data per sample (16 bits or 2 bytes) -- <a href="http://en.wikipedia.org/wiki/Bit_rate#Bitrates_in_multimedia">16 kilobytes/second</a>. <br /><br />With 2K of internal flash, the MSP430 can store about one-quarter second of audio. External memory is needed to store any meaningful amount of audio. There's no better source of cheap storage than <a href="http://en.wikipedia.org/wiki/Flash_memory">flash memory chips</a>. A raw flash memory chip would be a special order item, but you probably already have some flash memory -- <a href="http://en.wikipedia.org/wiki/Secure_Digital_card">SD cards</a>! These cards are ubiquitous in digital cameras and low-end MP3 players.
<div align="center"><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/">MSP430 audio output</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770749/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-preview1.667_thumbnail.jpg" alt="MSP430 audio prototype" title="MSP430 audio prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/755932/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.667_thumbnail.png" alt="Project overview" title="Project overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770748/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/sdcard-detail.667.p8_thumbnail.png" alt="SD card SPI interface" title="SD card SPI interface" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770750/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.667.p8_thumbnail.png" alt="SD card data layout" title="SD card data layout" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770752/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.667.p8_thumbnail.png" alt="Playing a raw audio file" title="Playing a raw audio file" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-talking-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1177770/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadget</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller - part 3</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><strong><br />Working with SD cards</strong><br /><em>NOTE!!!</em> We are going to use the SD card as flash memory. It will not have a full (<a href="http://en.wikipedia.org/wiki/File_Allocation_Table">FAT</a>) file system, and can not be read on a PC by the usual methods. It will not be possible to drag and drop a raw audio file to the card and read it with the MSP430, nor will it be possible see recordings from the file browser on a Mac or PC. Special disk tools provide access to the raw disk, but a full FAT file system implementation is too big for the tiny microcontroller. The F2013 has 128 bytes of RAM and 2 kilobytes of flash. A <a href="http://www.larwe.com/zws/products/dosfs/index.html">workable FAT implementation</a> requires 1024 bytes of <a href="http://en.wikipedia.org/wiki/RAM">RAM</a> and several kilobytes of flash program space. <br /><br />The prototype design accesses the SD card using the simple <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI protocol</a>. SPI is a simple three wire interface that allows a microcontroller to read and write data from external chips. If you want the dirty details on how the SD card works in SPI mode, read some of these tutorials [<a href="http://focus.ti.com/mcu/docs/mcusupporttechdocsc.tsp?sectionId=96&amp;tabId=1502&amp;abstractName=slaa281b">Tutorial 1</a>, <a href="http://pic18fusb.online.fr/wiki/wikka.php?wakka=MsDrive">Tutorial 2</a>]. A <a href="http://focus.ti.com/mcu/docs/mcusupporttechdocsc.tsp?sectionId=96&amp;tabId=1502&amp;abstractName=slaa281b">source code library</a> from TI provides easy access to the disk without writing our own initialization and read/write routines (mmc.c/mmc.h in the project archive). <br /><br /><img vspace="4" hspace="4" border="1" alt="" id="img1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.400.p8.png" /><br /><br />SD card storage is divided into 512 byte chunks called <a href="http://en.wikipedia.org/wiki/Disk_sector">sectors</a>. A full 512 byte sector must be read or written at once. The MSP430F2013 has only 128 bytes of RAM -- not enough to hold a whole sector for random access. We can still read/write each byte in order, as it's needed. This method will suffice as long as each byte is read or written sequentially.<br /><br />Playing an audio file is as simple as reading a byte from the SD card and writing it to the PWM duty cycle register. <br /><br /><strong>Converting audio to a raw format</strong><br />My 'hello world' audio clip comes from the intro to my videos. I converted the clip to an 8KHz .wav file with <a href="http://audacity.sourceforge.net/">Audacity</a> and then saved it to raw text file with the free version of <a href="http://www.nch.com.au/switch/index.html">Switch</a>, as described <a href="http://www.rpi.edu/~kouttd/03/Rage_against_the_arduino.html">here</a>. <br />
<ol>
    <li>First, install <a href="http://www.nch.com.au/switch/index.html">Switch</a>. </li>
    <li>Start Switch, and add your desired files to the queue by clicking "add files". </li>
    <li>Now set the output format to ".raw", and then click "Encoder Options". Set the encoder format to "8 bit unsigned", sample rate to "8000", and channels to "mono". </li>
    <li>Now click convert and the raw version of the audio files are created.</li>
</ol>
The raw text version of the audio file is included in the <a href="http://www.whereisian.com/DIYLife8.zip">project archive</a>.
<div align="center"><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/">MSP430 audio output</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770749/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-preview1.667_thumbnail.jpg" alt="MSP430 audio prototype" title="MSP430 audio prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/755932/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.667_thumbnail.png" alt="Project overview" title="Project overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770748/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/sdcard-detail.667.p8_thumbnail.png" alt="SD card SPI interface" title="SD card SPI interface" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770750/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.667.p8_thumbnail.png" alt="SD card data layout" title="SD card data layout" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770752/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.667.p8_thumbnail.png" alt="Playing a raw audio file" title="Playing a raw audio file" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-talking-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1177774/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-3/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadget</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller - part 4</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><strong><br />Imaging an SD card</strong><br />The MSP430 isn't powerful enough to deal with a file system, so we need the audio to start exactly at the first sector the of SD card. A simple copy-&gt;paste operation would put the file on the SD card according to the rules of the PC file system. To avoid this, we <a href="http://en.wikipedia.org/wiki/Disk_image">image</a> the file directly onto the card. This will be familiar if you've ever 'imaged' a CD .iso file, say, for a bootable <a href="http://en.wikipedia.org/wiki/LiveCD">Linux live CD</a>. I used <a href="http://www.dubaron.com/diskimage/">DiskImage 0.9 from Durban</a>. <br /><br />Imaging the audio file onto a flash card was pretty easy with DiskImage. I put the SD card in a USB flash card reader and attached it to the USB port. I opened DiskImage and it detected the card as a logical and physical volume. <br />
<ol>
    <li>It's crucial to deal with the disk directly, rather than through the file system. All operations should be done to the listings under "Physical drives - raw drive, independent of partitions" box. </li>
    <li>Find the physical partition that represents your SD card - it's easy to identify the correct physical drive because it should be type "Removable" and the correct size (in my case 14MB). Be sure you don't overwrite your actual hard drive, this utility can easily do that!!!</li>
    <li>Click on the correct drive to highlight it. </li>
    <li>In the "With selected item do" box, click the "Import from file" button. Click yes, and type "i agree" after you verify that the correct disk is selected. Click yes again.</li>
    <li>Next, DiskImage prompts for the file that will be imaged onto the disk. Choose the raw audio .txt file outputted earlier.</li>
</ol>
With the raw audio imaged onto the SD card, we're ready to play it from the MSP430. Take the SD card out of the computer and put it into the card holder on the prototype.<br /><br />
<div align="center"><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/">MSP430 audio output</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770749/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-preview1.667_thumbnail.jpg" alt="MSP430 audio prototype" title="MSP430 audio prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/755932/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.667_thumbnail.png" alt="Project overview" title="Project overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770748/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/sdcard-detail.667.p8_thumbnail.png" alt="SD card SPI interface" title="SD card SPI interface" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770750/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.667.p8_thumbnail.png" alt="SD card data layout" title="SD card data layout" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770752/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.667.p8_thumbnail.png" alt="Playing a raw audio file" title="Playing a raw audio file" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1177777/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-4/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadget</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><em><img vspace="5" hspace="5" border="0" align="right" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/singingmsp0000.jpg" alt="talking msp430" />This article continues a series about building a DIY digital audio recorder. Inspired by <a href="http://www.rpi.edu/%7Ekouttd/03/Rage_against_the_arduino.html">this microcontroller audio project</a> [<a href="http://blog.makezine.com/archive/2008/02/stereo_pwm_audio.html">via</a>], I set out to build a simple digital recording device. I chose Texas Instrument's MSP430 microcontroller for this project because it's fast (16 MHz), it's cheap ($1), and it's very low power.</em> Read the <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">first part</a>, and the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">second part</a>.<br /> <br />This week we'll progress towards a digital audio recorder by playing audio files from a <a href="http://en.wikipedia.org/wiki/Secure_Digital_card">SD memory card</a>. First, we'll convert an audio file to a raw format and image it directly to a SD card. Then, we'll interface the SD card with the MSP430 and play an audio file. See it in the video:<br /> <video><object width="400" height="355"><param name="movie" value="http://www.youtube.com/v/dn6S6vpBIGs&amp;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/dn6S6vpBIGs&amp;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="400" height="355"></embed></object></video><br /> <br /> Next time we'll extend this basic circuit to include a microphone and audio recording capabilities.<br /> <br /> Read on to learn more about generating audio with a microcontroller.<br /><br />
<div align="center"><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-2/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/">MSP430 audio output</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770749/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-preview1.667_thumbnail.jpg" alt="MSP430 audio prototype" title="MSP430 audio prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/755932/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.667_thumbnail.png" alt="Project overview" title="Project overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770748/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/sdcard-detail.667.p8_thumbnail.png" alt="SD card SPI interface" title="SD card SPI interface" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770750/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.667.p8_thumbnail.png" alt="SD card data layout" title="SD card data layout" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770752/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.667.p8_thumbnail.png" alt="Playing a raw audio file" title="Playing a raw audio file" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1162422/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadget</category><category>featured</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller - part 5</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><br /><strong>Firmware</strong><br />The example program is included in the <a href="http://www.whereisian.com/DIYLife8.zip">project archive</a>. The example software is written using the demo <a href="http://focus.ti.com/docs/toolsw/folders/print/iar-kickstart.html">TI/IAR Kickstart C</a> compiler.<br /><br /><img vspace="4" hspace="4" border="1" alt="" id="img3" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.400.p8.png" /><br /><em><br />SD card access</em><br />The example firmware starts reading the SD card at the first sector. It reads one byte at a time over the SPI interface and places the byte in the PWM duty cycle register. When the end of a sector (byte 511) is reached, the next sector is immediately loaded and initialized so that the next byte is always ready when needed.<br /><br />The example firmware will copy bytes from the SD card to the PWM register until it reaches the sector defined by the variable <strong>flashDisk.lastSector</strong>. At the end of this sector, the program begins again at the first sector. <br /><br />The value to use here is determined by the number of sectors consumed by the audio file. The example audio file consumes 58,447 bytes. The SD card is arranged into 512 byte sectors, so the file ends at sector 115 (sector numbering starts with 0). Update this value if you are working with a custom audio file:<br /><br />flashDisk.lastSector=115; //last sector (512byte block) where file is stored on flash...<br /><br /><em>Playback rate</em><br />The playback must match the sampling rate of the audio file, or the audio will sound too fast or too slow. Since I sampled audio at 8KHz, the PWM duty cycle register should be updated with a new value 8000 times each second. I appropriated the <a href="http://en.wikipedia.org/wiki/Watchdog_timer">watchdog timer</a> (WDT) from the MSP430 to sound an alarm (an <a href="http://en.wikipedia.org/wiki/Interrupt">interrupt</a>) 8000 times per second. When the timer interrupts, a bit of code copies the next byte from the SD card to the PWM duty cycle register. <br /><br />The timer runs on the calibrated 8 MHz internal clock. The WDT is set to trigger every 512 counts of the internal clock (8MHZ/512), or 15,625 times per second. This is about twice as fast as we need, so the interrupt routine uses a switch that updates the audio only once every other interrupt, or 7,812.5 times per second. Not exactly 8000 samples-a-second, but the internal oscillator will vary with temperature and age anyway. Using the internal crystal keeps the design simple and the part-count low.<br /><br />If you're after tighter tolerances, consider using a watch crystal on the <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/">P2.6/7 pins of the MSP430</a> as the timer clock source. <br /><br />When the MSP430 is not copying audio to the PWM, it enters a loop that continually checks if a new audio byte should be loaded into a single byte buffer. The buffer ensures that data is available when it's needed, and that audio quality isn't effected by delays in reading data from the SD card. A ton of power could be saved by entering sleep mode between interrupts, we'll look at this again in a future article.
<div align="center"><a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-talking-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1177784/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-5/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadet</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a talking MSP430 microcontroller - part 6</title><link>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/</guid><comments>http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/audio-and-video/" rel="tag">audio and video</a>, <a href="http://www.diylife.com/category/computers-and-internet/" rel="tag">computers and internet</a>, <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><br /><strong>Say Hello </strong><br />In the video you can see the basic firmware functions. First, a breakpoint set at the timer shows how the audio is only updated on every other byte. If we move the breakpoint inside this switch, the debugger stops every time the audio changes. Next, execution halts each time 512 bytes are read from the SD card and the sector changes. A final breakpoint halts execution each time the sector resets to 0.<br /><strong><br />Next time</strong><br />The next article will be the final functional enhancement to the digital audio recorder. We'll extend this basic circuit to include a microphone and audio recording capabilities.<br /><br /><strong>Prototype Circuit</strong><br />For complete details of the prototype, see the <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/">previous article</a> in this series. This week's firmware is in the <a href="http://www.whereisian.com/DIYLife8.zip">project archive</a>.<br /><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/brd-place.400.p8.png" id="img6" alt="" /><br /><br /><strong>Related links</strong><br /><a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller">Program a MSP430 microcontroller</a>.<br /><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller">Make a singing MSP430 microcontroller</a>.<br /><div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/">MSP430 audio output</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770749/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-preview1.667_thumbnail.jpg" alt="MSP430 audio prototype" title="MSP430 audio prototype" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/755932/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-sd.667_thumbnail.png" alt="Project overview" title="Project overview" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770748/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/sdcard-detail.667.p8_thumbnail.png" alt="SD card SPI interface" title="SD card SPI interface" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770750/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/byte-sector-diagram.667.p8_thumbnail.png" alt="SD card data layout" title="SD card data layout" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-output/770752/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram-byteflow.667.p8_thumbnail.png" alt="Playing a raw audio file" title="Playing a raw audio file" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1177809/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/25/make-a-talking-msp430-microcontroller-part-6/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio recorder</category><category>AudioRecorder</category><category>circuit</category><category>electronics</category><category>engadget</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 25 Apr 2008 15:30:00 EST</pubDate></item><item><title>Make a singing MSP430 microcontroller</title><link>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/</guid><comments>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><div align="center"><a href="http://www.diylife.com/photos/msp430-audio-prototype/734490/"><em><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/il82374t.jpg" alt="" /></em></a><br /></div>
<em><br />This is my second article about building a DIY digital audio recorder. Inspired by this <a href="http://www.rpi.edu/~kouttd/03/Rage_against_the_arduino.html">microcontroller audio project</a> [<a href="http://blog.makezine.com/archive/2008/02/stereo_pwm_audio.html">via</a>], I set out to build a simple digital recording device. I chose Texas Instrument's MSP430 microcontroller for this project because it's fast (16 MHz), it's cheap ($1), and it's very low power. </em><a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">Read the first part here</a>. <br /><br />This week we'll progress towards a digital audio recorder by generating simple tones with the MSP430 microcontroller. We'll use the MSP430's pulse-width modulator to generate an audio waveform, and clean it up with a simple low-pass filter. The signal won't be strong enough to drive a speaker directly, but it'll work great with a cheap set of powered PC speakers.<br /><br />Next week we'll expand on this basic circuit to play audio recordings from <a href="http://en.wikipedia.org/wiki/Secure_Digital_card">SD memory cards</a>.<br /> <br />Read on to learn more about generating audio with a microcontroller.<br /><br />
<div align="center"> <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/"><img vspace="4" hspace="4" border="0" alt="next page" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/">MSP430 audio prototype</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734486/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.audio-outdetail_thumbnail.png" alt="Audio filter example" title="Audio filter example" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734488/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.cct_thumbnail.png" alt="MSP430 audio prototype circuit" title="MSP430 audio prototype circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734490/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.render_thumbnail.jpg" alt="MSP430 audio prototype rendering" title="MSP430 audio prototype rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734487/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.brd-place_thumbnail.png" alt="MSP430 audio prototype PCB placement" title="MSP430 audio prototype PCB placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734489/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.proto-board-nopart.8_thumbnail.png" alt="MSP430 audio prototype bare PCB" title="MSP430 audio prototype bare PCB" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1158436/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>electronics</category><category>featured</category><category>microcontroller</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 11 Apr 2008 15:00:00 EST</pubDate></item><item><title>Make a singing MSP430 microcontroller - part 2</title><link>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/</guid><comments>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><p><object width="400" height="289"><param name="movie" value="http://www.youtube.com/v/uf82rc57YCA&amp;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/uf82rc57YCA&amp;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object><strong></strong></p>
<p><strong>Microcontroller audio<br /><br /></strong>There some great resources on the web to get us started with microcontroller audio. <br /><br />This series of articles on Arduino audio (<a href="http://www.uchobby.com/index.php/2007/11/11/arduino-sound-part-1/">part 1</a>, <a href="http://www.uchobby.com/index.php/2007/11/14/arduino-sound-part-2-hello-world/">part 2</a>, <a href="http://www.uchobby.com/index.php/2008/01/08/arduino-audio-dac-options/">DAC options</a>) gives a fantastic introduction to the theory side. There's tons of great stuff in these pages that I won't duplicate here. <br /><br /><a href="http://www.rpi.edu/~kouttd/03/Rage_against_the_arduino.html">Another project</a> feeds audio samples into the microcontroller from a PC serial port. The microcontroller is like a simple PC sound card, it's not capable of independent operation. This project, and the great video, inspired me to design this digital audio recorder. <br /><br />TI and ATMEL have application notes detailing designs for simple digital audio recorders. <a href="http://focus.ti.com/lit/an/slaa123/slaa123.pdf">TI's design</a>[pdf] records 12 seconds of low quality audio to the flash program memory of an MSP430. It uses a specialized chip to create the audio signal, complicating the design. A great <a href="http://focus.ti.com/lit/an/slaa361/slaa361.pdf">TI app note on speech compression</a>[pdf] also has some interesting support circuitry for digital audio. The ATMEL <a href="http://www.atmel.com/dyn/resources/prod_documents/doc1456.pdf">digital sound recorder</a>[pdf] uses a small external memory chip to store a few seconds of audio. <br /><br /><strong>Pulse-width modulated audio synthesis<br /><br /></strong>The cheapest, easiest way to generate audio on a modern mirocontroller is to use a hardware <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">pulse-width modulator</a> (PWM). A PWM is a circuit that generates a repeating time period (called the period), and turns on a switch during a percentage of that time period (called the duty cycle). This happens so fast that only the average value of the on and off periods is measurable. Different audio tones can be generated by varying the duty cycle. <br /><br />For more about pulse-width modulation, see my previous projects: <a href="http://www.diylife.com/2008/01/25/make-a-usb-color-changing-light/">Make a USB color changing light</a>, and <a href="http://www.diylife.com/2008/02/02/show-pc-stats-on-analog-gauges/">Show PC stats on analog gauges</a>. <br /><br />This diagram gives an overview of the design.<br /><img alt="" hspace="4" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram.png" vspace="4" border="1" /><br /><br /></p>
<div align="center"><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/"><img alt="next page" hspace="4" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" vspace="4" border="0" /></a><br /><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/">MSP430 audio prototype</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734486/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.audio-outdetail_thumbnail.png" alt="Audio filter example" title="Audio filter example" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734488/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.cct_thumbnail.png" alt="MSP430 audio prototype circuit" title="MSP430 audio prototype circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734490/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.render_thumbnail.jpg" alt="MSP430 audio prototype rendering" title="MSP430 audio prototype rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734487/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.brd-place_thumbnail.png" alt="MSP430 audio prototype PCB placement" title="MSP430 audio prototype PCB placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734489/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.proto-board-nopart.8_thumbnail.png" alt="MSP430 audio prototype bare PCB" title="MSP430 audio prototype bare PCB" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1163115/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-2/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>electronics</category><category>microprocessor</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 11 Apr 2008 15:00:00 EST</pubDate></item><item><title>Make a singing MSP430 microcontroller - part 3</title><link>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/</guid><comments>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><div align="center"><img vspace="4" hspace="4" border="1" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-diagram.png" /><br /></div>
<br /><strong>MSP430<br /><br /></strong>The digital audio recorder will use a MSP430 <a href="http://focus.ti.com/docs/prod/folders/print/msp430f2013.html">F2012 or F2013</a>. Both have useful hardware modules, like a <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">pulse-width modulator</a> (PWM) to generate sound, an <a href="http://en.wikipedia.org/wiki/Analog-to-digital_converter">analog to digital converter</a> (ADC) to capture audio from a microphone, and a hardware communication module (<a href="en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI</a>) to communicate with external memory chips. They're also fast (16 MHz), cheap ($1), and very low power. <br /><br /> F2012 and F2013 target boards are available for the <a href="http://www.designmsp430.com/">ez430 development kit</a>. You can get started on this project with a full programmer, debugger, and development board <a href="http://www.designmsp430.com/">for $20</a>. You'll still need the extra parts described in this article, but the development kit can make life easier if you're worried about working with surface mount components. The both MSP430 models are also available as a through-hole parts.<br /><br /> If you want to know more about basic MSP430 connections and programming, read <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">last week's primer</a> on the MSP430. <br /><br /> <strong>The MSP430 pulse-width modulator<br /><br /></strong> The MSP430 has a 16 bit PWM. This could be used to play 16 bit resolution audio, a vast improvement over most previous 8 bit microcontroller audio projects. <br /><br />The MSP430 PWM has a ton of modes. I'm sure they're all super useful, but we just want a standard pulse without the fancy stuff. To do this on the MSP430, I set the following registers: <br /><br /> CCTL1 = OUTMOD_6; // Mode 6 is toggle/set<br /> CCR0 = 0xFE; // 16 bit PWM Period, use period-1 for MC_1(up counter)<br /> TACTL = MC_1; 		 // Timer A MC_1 mode counts up to the value in CCR0, resets<br /> <br /> The PWM output signal can be enabled on three different pins. This is handy, but it can also be really confusing. I designated pin P2.6 for the audio PWM output. P2.6 is also used for an optional 32.768khz watch crystal. The crystal oscillator circuitry on the pins must be disabled before using the PWM output. This isn't documented very well in the MSP430 datasheets, read more in this <a href="http://www.nabble.com/Selecting-TA1-pin-on-MSP430F2012-td10083881.html#a10895658">forum post</a>. <br /><br /> BCSCTL3|=LFXT1S1+LFXT1S0; //enable PWM output on P2.6, disable oscillator.<br /> //.........................................................//now there are limitations on VLO....<br /> <br /> This was a real pain to figure out. I don't usually include these details in an article, but I hope this info will now be easily accessible to anyone facing a similar problem in the future. <br /><br />
<div align="center"><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/"><img vspace="4" hspace="4" border="0" alt="next page" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/">MSP430 audio prototype</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734486/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.audio-outdetail_thumbnail.png" alt="Audio filter example" title="Audio filter example" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734488/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.cct_thumbnail.png" alt="MSP430 audio prototype circuit" title="MSP430 audio prototype circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734490/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.render_thumbnail.jpg" alt="MSP430 audio prototype rendering" title="MSP430 audio prototype rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734487/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.brd-place_thumbnail.png" alt="MSP430 audio prototype PCB placement" title="MSP430 audio prototype PCB placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734489/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.proto-board-nopart.8_thumbnail.png" alt="MSP430 audio prototype bare PCB" title="MSP430 audio prototype bare PCB" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1163122/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-3/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>electronics</category><category>microprocessor</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 11 Apr 2008 15:00:00 EST</pubDate></item><item><title>Make a singing MSP430 microcontroller - part 4</title><link>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/</guid><comments>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><strong>Audio hardware<br /><br /></strong> The signal from MSP430 PWM pin isn't quite ready to drive a speaker or amplifier. First, we can clean up the signal a bit by running it through a <a href="http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/experiment/lowpass/lpf.html">low pass filter</a>. This clips the sharp edges from the PWM waveform to make it sound a bit more natural. <br /><br />You can calculate the ideal low pass filter for a given frequency with a calculator <a href="http://www.muzique.com/schem/filter.htm">like this</a>. I used an 8000Hz frequency because I eventually plan to play and record about 8000 samples-per-second with the digital voice recorder. Note that this is just a fraction of the 48000 samples-per-second used by CD players and PCs. At 8000Hz my ideal low-pass filter has a 0.01uF capacitor (C1) and a2K ohms resistor (R1). <br /><br /><img vspace="4" hspace="4" border="1" align="middle" alt="" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/audio-outdetail.png" /><br /> <br /> Finally, it's proper form to block any DC voltage from the signal path using an electrolytic capacitor (POL-C1). The capacitor allows only the AC waveform to pass out of the circuit. A value between 4.7uF and 47uF seems to work fine. I didn't notice a difference among the range of values that I tried for the quality of audio produced. This capacitor is usually not necessary, as most amplifiers have a similar capacitor at the audio input connection.<br /><br /> <strong>Generating an audio signal in software<br /><br /></strong> Now that the signal is conditioned, we can connect it to an audio amplifier. A cheap set of powered PC speakers work great. <br /><br />Test program 1 (test1 in the project archive) creates a 50% 'on' signal with the PWM. This generates a continuous tone from the speakers. See it in this short video clip. <br /><br />
<div align="center"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/E3pCrHfzpzA&amp;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/E3pCrHfzpzA&amp;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object><br /></div>
<div align="center"><a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/"><img vspace="4" hspace="4" border="0" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" alt="next page" /></a><br /></div>
<div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/">MSP430 audio prototype</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734486/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.audio-outdetail_thumbnail.png" alt="Audio filter example" title="Audio filter example" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734488/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.cct_thumbnail.png" alt="MSP430 audio prototype circuit" title="MSP430 audio prototype circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734490/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.render_thumbnail.jpg" alt="MSP430 audio prototype rendering" title="MSP430 audio prototype rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734487/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.brd-place_thumbnail.png" alt="MSP430 audio prototype PCB placement" title="MSP430 audio prototype PCB placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734489/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.proto-board-nopart.8_thumbnail.png" alt="MSP430 audio prototype bare PCB" title="MSP430 audio prototype bare PCB" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1163662/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-4/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>electronics</category><category>microprocessor</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 11 Apr 2008 15:00:00 EST</pubDate></item><item><title>Make a singing MSP430 microcontroller - part 5</title><link>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/</link><guid isPermaLink="true">http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/</guid><comments>http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a>, <a href="http://www.diylife.com/category/giy-geek-it-yourself/" rel="tag">GIY: Geek-it-yourself</a></p><strong>The next step...<br /><br /></strong> 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 <a href="http://en.wikipedia.org/wiki/Watchdog_timer">watchdog timer</a> 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.<br /><br />
<div align="center"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/BcIwQJCzT50"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/BcIwQJCzT50" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object><br /></div>
<br /><br />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. <br /><br /> <strong>The Prototype Circuit<br /><br /></strong>
<div align="left"><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/cct.png" alt="" /><br /></div>
<div align="left"><a href="http://www.diylife.com/media/2008/04/p7.cct.300.png">Click here for a fill size circuit image</a><br /></div>
<br /> 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:<br /><br /> 1. An MSP430 and support circuitry as described in the project <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">last week</a>.<br /> 2. An audio filter circuit attached to the PWM as described this week.<br /> 3. An SD memory card connected to the MSP430's SPI interface, which I'll introduce next week.<br /> <br /> 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. <br /><br />All the code and design files for the prototype are included in the <a href="http://www.whereisian.com/DIYLife7.zip">project archive</a>. The circuit and PCB were made using the freeware version of Cadsoft Eagle. You can <a href="http://www.cadsoft.de/">download</a> it here. The test firmware is written in C and compiled with the free/demo <a href="http://focus.ti.com/docs/toolsw/folders/print/iar-kickstart.html">IAR Kickstart compiler</a>. <br /><br />Prototype <em>PCB</em><br />
<div align="left"><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/04/proto-board.png" alt="" /><br /></div>
<div align="left"><a href="http://www.diylife.com/media/2008/04/p7.brd-place.300.png">Click here for a full size board image</a><br /></div>
<br /> <em>Part list -- Name, value (size)</em><br />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. <br /><br />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. <br /><br />The most obscure part is probably the SD card holder. I used ALPS part number SCDA1A0901, purchased at Mouser.com (Mouser number <span id="ctl00_ContentMain_lblMouserPartNum">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. <br /><br /></span><em>Misc</em><br />IC1, MSP430F20X2 or F20x3 (PW14) <br />LED1, SMD LED (0805) <br />ALPS-SCDA1A0901, Alps SD Card holder (n/a)<br /><em><br />Capacitors</em><br />C1, 0.1uF (0805) <br />C2, 0.1uF (0805)<br />C3, 0.01uF (0805)<br />C4, 47uF (0805) <br /> <br /><em>Resistors</em><br />R1, 47K (0805) <br />R3, 330R (0805) <br />R4, 2K (1206) <strong><br /><br /> Related link</strong><br /><a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller/">Program a MSP430 microcontroller</a><br /><br /><div class="postgallery"><p><strong>Gallery: <a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/">MSP430 audio prototype</a></strong></p><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734486/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.audio-outdetail_thumbnail.png" alt="Audio filter example" title="Audio filter example" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734488/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.cct_thumbnail.png" alt="MSP430 audio prototype circuit" title="MSP430 audio prototype circuit" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734490/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.render_thumbnail.jpg" alt="MSP430 audio prototype rendering" title="MSP430 audio prototype rendering" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734487/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.brd-place_thumbnail.png" alt="MSP430 audio prototype PCB placement" title="MSP430 audio prototype PCB placement" /></a><a href="http://".$GLOBALS["HTTP_HOST"]."/photos/msp430-audio-prototype/734489/"><img src="http://www.blogcdn.com/www.diylife.com/media/2008/04/p7.667.proto-board-nopart.8_thumbnail.png" alt="MSP430 audio prototype bare PCB" title="MSP430 audio prototype bare PCB" /></a></div><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller/>Read</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1163670/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/04/11/make-a-singing-msp430-microcontroller-part-5/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>audio</category><category>electronics</category><category>microprocessor</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 11 Apr 2008 15:00:00 EST</pubDate></item><item><title>Program a MSP430 microcontroller pt. 2</title><link>http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/</link><guid isPermaLink="true">http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/</guid><comments>http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/#comments</comments><description><![CDATA[<p>Filed under: <a href="http://www.diylife.com/category/geek-it-yourself/" rel="tag">geek it yourself</a>, <a href="http://www.diylife.com/category/electronics/" rel="tag">electronics</a></p><strong> Basic Connections</strong><br /> Before we program the MSP430, let's look at the basic connections required to get it running.<br /><br /><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/02/msp430base-large.png" alt="" /><br /><br /><em>Vcc/Vss</em><br /> As with any chip, connect every power and ground pin. Manufacturers use different terms for these. Other names for Vcc include: Vdd, power, supply, "+", the bumpy side of the battery, and the red wire. Vss is "ground", and almost always 0 volts. You'll also see ground referred to as: negative, ground, "-", gnd, the flat side of the battery, and the black wire. Decouple each pair of supply pins with a 0.1uF capacitor (C1). These small value capacitors prevent electrical noise from running rampant in our circuit.<br /> <br /><em> RST/NMI/SBWTDIO</em><br /> In this lot, we're just interested in the RST function. A circuit tends to be a bit noisy when power is first applied. The RST pin and resistor hold the MSP430 in a reset state until the supply is adequate for operation. The RST pin also resets the MSP430 if there is a brown-out, or unacceptable but temporary reduction in supply voltage. This pin gets a 47K ohm resistor (R1) to the power supply. This is very similar to the MCLR pin on a PIC microcontroller.<br /><br style="font-style: italic;" /><em>Optional features: 32.768khz crystal</em><br /> The MSP430 has a really cool function: most newer models have built-in capacitors to support a <a href="http://en.wikipedia.org/wiki/Watch_crystal#Commonly_used_crystal_frequencies">32.768khz</a> <a href="http://en.wikipedia.org/wiki/Quartz_clock#Mechanism">time keeping</a> crystal used to implement a <a href="http://en.wikipedia.org/wiki/Real-time_clock">real-time-clock</a>. The diagram below compares the stuff you need to keep time on a MSP430 (Q1) and a PIC (Q1, C1, C2). This is a huge time saver because routing a clean ground supply for external capacitors (C1 &amp; C2) can be a pain. Even better - the value of the internal capacitors can be adjusted from software! This isn't strictly required to get an MSP430 up and running, but it's a great feature. Learn more about <a href="http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=slaa322">routing the MSP430 crystal</a> in this PDF.<br /><br /><img vspace="4" hspace="4" border="1" src="http://www.blogcdn.com/www.diylife.com/media/2008/02/crystal-comp.400.png" alt="" /><br /><br /><a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-3/"><img vspace="4" hspace="4" border="0" alt="next page" src="http://www.blogcdn.com/www.diylife.com/media/2008/03/lesnetnext.gif" /></a><p style="clear: both; padding: 8px 0 0 0; height: 2px; font-size: 1px; border: 0; margin: 0; padding: 0;"> </p><p><a href=http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-3/>Read</a> | <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/" rel="bookmark" title="Permanent link to this entry">Permalink</a> | <a href="http://www.diylife.com/forward/1151572/" title="Send this entry to a friend via email">Email this</a> | <a href="http://www.diylife.com/2008/03/28/program-a-msp430-microcontroller-pt-2/#comments" title="View reader comments on this entry">Comments</a></p>]]></description><category>ian-lesnet</category><category>microcontroller</category><category>msp430</category><dc:creator>Ian Lesnet</dc:creator><pubDate>Fri, 28 Mar 2008 15:00:00 EST</pubDate></item></channel></rss>