<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Small Golden Sceptre</title>
	<atom:link href="http://mythopoeic.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://mythopoeic.org</link>
	<description>Technology, Rambling and Dragons</description>
	<lastBuildDate>Tue, 24 Aug 2010 15:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Dragon Populations Holding Steady</title>
		<link>http://mythopoeic.org/dragon-populations/</link>
		<comments>http://mythopoeic.org/dragon-populations/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 21:46:38 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[Literary]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[humor]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=863</guid>
		<description><![CDATA[Comparing 2008 to 2009, we&#8217;ve seen catastrophic declines in castles, glowy magic and swords. Unicorns have seemingly disappeared, and even formerly sizable populations of elves, wolves and horses are in sharp decline. Dragons, obviously made from sterner stuff, remain unscathed. Context? Fantasy novel covers. This news courtesy of Orbit Books (via Making Light). Their handy [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/chart.png"><img class="size-thumbnail wp-image-864 alignright" title="chart" src="http://mythopoeic.org/wp-content/uploads/2010/08/chart-115x150.png" alt="" width="115" height="150" /></a></p>
<p>Comparing 2008 to 2009, we&#8217;ve seen catastrophic declines in castles, glowy magic and swords. Unicorns have seemingly disappeared, and even formerly sizable populations of elves, wolves and horses are in sharp decline.</p>
<p>Dragons, obviously made from sterner stuff, remain unscathed.</p>
<p>Context? Fantasy novel covers. This news courtesy of <a href="http://www.orbitbooks.net/">Orbit Books</a> (via <a href="http://nielsenhayden.com/makinglight/">Making Light</a>). Their handy comparison chart is reproduced to the right, but really: go read the <a href="http://www.orbitbooks.net/2010/08/16/the-chart-of-fantasy-art-part-one/">original article</a>. Sample quote: &#8220;The number of dragons on covers held steady this year. The dragon  population seems to be in perfect balance – but we can’t tell if that’s  because new dragons are being born to replace old ones, or if last  year’s dragons are just really healthy.&#8221;</p>
<p><span id="more-863"></span></p>
<div style="clear:both"></div>
<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/chart-dragons.png"><img class="size-thumbnail wp-image-869 alignright" title="chart-dragons" src="http://mythopoeic.org/wp-content/uploads/2010/08/chart-dragons-115x150.png" alt="" width="115" height="150" /></a></p>
<p><span style="color: #ff0000;">Update</span>: from the same source, an insightful analysis of dragon coloration on said book covers. Once again, the <a href="http://www.orbitbooks.net/2010/08/19/the-chart-of-fantasy-art-part-3-dragons/">original article</a> is well worth the click-through. (PDF infographic linked via the image to the right.)</p>
<p>Not directly dragon-related but also from Orbit and amusing: <a href="http://www.orbitbooks.net/2010/08/17/the-chart-of-fantasy-art-part-2-urban-fantasy/">fashion trends for fantasy heroines</a> and <a href="http://www.orbitbooks.net/2010/08/19/the-chart-of-fantasy-art-part-4-title-trends/">tag cloud of title words</a>.</p>
<p><span style="color: #ff0000;">Update</span>: The thumbnail images now link to legible but quick-to-download bitmaps (which require no special software to view, and pose negligible security risk). If you want (local copies of) the original PDF sources, they are here:</p>
<ul>
<li><a href="/misc-files/fantasy-cover-chart.pdf">cover image trends</a> (230KB PDF)</li>
<li><a href="/misc-files/chart-dragons.pdf">dragon colors</a> (3MB PDF)</li>
</ul>
<p><em>[Updated 2010 Aug 23 by DGH to add link to dragon colors study.]</em></p>
<p><em>[Updated 2010 Aug 24 by DGH to make images link to bitmaps, and to add separate links to PDF documents.] </em></p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/dragon-populations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheap Self-Programming AVR Proto Board</title>
		<link>http://mythopoeic.org/ems-metaboard/</link>
		<comments>http://mythopoeic.org/ems-metaboard/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 04:26:39 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Compugeekery]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[mad science]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=843</guid>
		<description><![CDATA[There are lots of proto boards for the AVR microcontroller, and lots of programmers. This post presents my approach, which features easy assembly, off-the-shelf PCB, extremely low parts cost and a built-in USB-based programmer. Circuit, PCB and firmware are all completely Open Source. Read on after the jump for details. Overview I haven&#8217;t really invented [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/ems-metaboard.jpg"><img class="alignright size-thumbnail wp-image-844" title="ems-metaboard" src="http://mythopoeic.org/wp-content/uploads/2010/08/ems-metaboard-150x90.jpg" alt="" width="150" height="90" /></a>There are lots of proto boards for the AVR microcontroller, and lots of programmers. This post presents my approach, which features easy assembly, off-the-shelf PCB, extremely low parts cost and a built-in USB-based programmer. Circuit, PCB and firmware are all completely Open Source. Read on after the jump for details.</p>
<p><span id="more-843"></span></p>
<h2>Overview</h2>
<p>I haven&#8217;t really invented anything new here; I&#8217;m just putting together components that other people have developed. Consider this a roadmap to getting to a prototyping system easily and cheaply, so you have more time and money left over for the inventive part.</p>
<p>So what is all this? I started with an <a href="http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega328P">ATmega328P</a>, a handful of inexpensive components and a <a href="http://evilmadscience.com/tinykitlist/74-atmegaxx8">business-card-sized proto board</a> from <a href="http://www.evilmadscientist.com/">Evil Mad Scientist Laboratories</a>. With these, I implemented something very much like the <a href="http://metalab.at/wiki/Metaboard">Metaboard</a> circuit. The microcontroller has the <a href="http://www.obdev.at/products/vusb/usbasploader.html">USBaspLoader</a> firmware in the top 2K of memory as a bootloader.</p>
<p>What does it do? It&#8217;s a USB target device; plug it in to a host and it will be powered from the bus. If a jumper (shorting PD7 to ground) is closed at boot time, it will mimic a <a href="http://www.fischl.de/usbasp/">USBasp </a>programmer, and you can program the microcontroller as normal. After programming is done (or if the device is booted or reset without the jumper), whatever application code you flashed runs normally.</p>
<p>Advantages: Super-cheap, low parts count and self-contained. This plus some free software is a complete development environment. You can use the circuitry already in place for your own USB target applications. Easy to make: no PCB etching or surface-mount soldering, and all components are easy to get. Bootloader firmware is write-protected so you can&#8217;t clobber it by mistake. Some prototyping space available on the board.</p>
<p>Disadvantages: You need some other programming device to load the firmware to begin with. Uses PD4 and INT0 pins (for USB) and PD7 (for jumper detection). Requires an external crystal (thus you can&#8217;t use XTL1, XTL2 for IO). Not the neatest layout in the world. This isn&#8217;t a &#8220;real&#8221; USB target device (it doesn&#8217;t fully comply with the standard) though it does interoperate fine with all USB hosts I&#8217;ve tried. 2K (out of 32K) of flash is taken up by the bootloader, and not available for your application.</p>
<h2>Parts List</h2>
<p>All prices are in US dollars, omitting tax and shipping, current at the time this post was written. Vendors are listed as a convenience only; no endorsement is implied (except for Evil Mad Science, who are awesome). <span style="color: #ff0000;">Update</span>: Note that prices are for new parts in single-unit quantities from a big-name retailer; if you buy in bulk or shop around, you can get much lower prices. The PCB is the only thing that isn&#8217;t a commodity part.</p>
<ul>
<li>(1) ATmega328P microcontroller (<a href="http://www.mouser.com/ProductDetail/Atmel/ATMEGA328P-PU/?qs=K8BHR703ZXguOQv3sKbWcg%3d%3d">Mouser</a>, $4.28)</li>
<li>(1) ATmegaXX8 Target Board (<a href="http://evilmadscience.com/tinykitlist/74-atmegaxx8">Evil Mad Science</a>, $3.00 ea. or $11.50 for five)</li>
<li>(1) 28-pin DIP socket</li>
<li>(1) 12.000 MHz crystal (<a href="http://www.mouser.com/ProductDetail/Citizen/CSA309-12000MAAKB/?qs=sGAEpiMZZMsBj6bBr9Q9acIJmDespmCnbyUyjkJVFJ4%3d">Mouser</a>, $0.22)</li>
<li>(2) 20pF capacitor (<a href="http://www.mouser.com/ProductDetail/Xicon/140-50N5-200J-TB-RC/?qs=sGAEpiMZZMsh%252b1woXyUXjyHZH3XatyV0%252b8WUF9LKkD4%3d">Mouser</a>, $0.07 ea.)</li>
<li>(1) 0.1μF capacitor (<a href="http://www.mouser.com/ProductDetail/TDK/FK18Y5V1H104Z/?qs=sGAEpiMZZMuAYrNc52CMZHuK70fEfNzshTFsxXaLmhA%3d">Mouser</a>, $0.09)</li>
<li>(1) 10μF electrolytic capacitor (<a href="http://www.mouser.com/ProductDetail/Panasonic-Electronic-Components/ECA-1HM100/?qs=sGAEpiMZZMtZ1n0r9vR22YuzYhk2RkTKrGxcSUriC8o%3d">Mouser</a>, $0.09)</li>
<li>(1) 1MΩ resistor (<a href="http://www.mouser.com/ProductDetail/KOA-Speer/MF1-4LCT52R105J/?qs=sGAEpiMZZMu61qfTUdNhG%2fDQawzJ6c7PsruBOD9w8q8%3d">Mouser</a>, $0.05)</li>
<li>(1) 1.5KΩ resistor (<a href="http://www.mouser.com/ProductDetail/KOA-Speer/MF1-4LCT52R152J/?qs=sGAEpiMZZMu61qfTUdNhG%2fDQawzJ6c7PIPf3oHpBkDU%3d">Mouser</a>, $0.05)</li>
<li>(2) 68Ω resistor (<a href="http://www.mouser.com/ProductDetail/KOA-Speer/MF1-4DCT52R68R0F/?qs=sGAEpiMZZMu61qfTUdNhG%2fDQawzJ6c7PAxFZIGy00yc%3d">Mouser</a>, $0.05 ea.)</li>
<li>(2) 3.6V Zener diode, 1N5227B or <strong>close</strong> equivalent (<a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=G5AQjGfRJcLguL3ctsb4aQ==">Mouser</a>, $0.06 ea.)</li>
<li>(1) NO pushbutton switch</li>
<li>(1) 2-pin 2.54mm breakaway header (<a href="http://www.mouser.com/ProductDetail/Tyco-Electronics-AMP/5-146250-1/?qs=sGAEpiMZZMtsLRyDR9nM17rHNLYljp%2fZe5vCg9PgcUA%3d">Mouser</a>, $0.16)</li>
<li>(1) jumper block to fit breakaway header</li>
<li>(1) cable USB &#8220;A&#8221; to pigtails</li>
<li>about 10cm of hookup wire</li>
</ul>
<p>Any microcontroller in the ATmegaXX8(P) family should work, though if you&#8217;re going to go to the trouble of building this, spending a few tens of cents on extra flash memory seems like a prudent idea. A DIP socket is, strictly speaking, optional, but not having it is a genuinely bad idea. (<span style="color: #ff0000;">Update</span>: a 28-pin DIP socket is a bit of an oddball size. If you don&#8217;t have one handy, you can substitute a 20-pin socket plus an 8-pin socket.)</p>
<p>The resistors can be the regular old 5% 1/4W metal film kind from the spare parts bin.</p>
<p>The 20pF caps are for loading the crystal. The cheap dipped ceramic kind work fine.  You might be able to get away with 22pF if that&#8217;s what you have on hand (but make sure they match!). If you pick a different crystal speed, check the specs to find the right loading capacitor value.</p>
<p>The 0.1μF and 10μF caps are just there to bypass high-frequency noise on the power supply. The values aren&#8217;t critical, so long as you&#8217;re in the ballpark.</p>
<p>The crystal can be 12, 15, 16 or 20MHz. (Make sure you get one with at least five significant digits, e.g. 12.000.) You might also be able to substitute a three-pin crystal oscillator for the crystal and loading caps.</p>
<p>The Zener diodes are there to clamp the USB D+ and D- voltages to 3.6V (rather than the native 5V) when the AVR is driving the data lines. Most modern USB hosts deal with 5V on the data lines just fine, but some older ones do not. Not just any 3.6V Zener diode will do; the high-current ones switch too slowly and distort the USB waveform too much. Get the 1N5227B rated for 20mA Zener current.</p>
<p>The pushbutton switch is for reset. It&#8217;s totally optional, but convenient. Use any junk-box normally-open switch you like. (I salvaged mine from a broken stereo receiver.)</p>
<p>The breakaway header should fit the kind of jumper you see on computer motherboards and hard disks. The jumper is there to let you select if the bootloader or application runs when power is first applied. You could use an SPST toggle switch instead if you like.</p>
<p>The least expensive source I found for the USB cable was to buy a USB &#8220;A&#8221; to &#8220;B&#8221; cable at the dollar store, then hack off the &#8220;B&#8221; end.  I tied the cable to the circuit card with a zip tie for strain relief.</p>
<p>The version in the picture has a six-pin ISP header. You can certainly add one if you like, though it probably won&#8217;t be much use unless you&#8217;re developing new bootloader firmware or doing in-circuit debugging or something.</p>
<p><span style="color: #ff0000;">Update</span>: Everything except the PCB, microcontroller, crystal and Zener diodes I was able to supply from my (very modest) stock of parts and salvage bin.</p>
<h2>Construction</h2>
<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/700px-Metaboard-circuit.gif"><img class="alignright size-thumbnail wp-image-846" title="700px-Metaboard-circuit" src="http://mythopoeic.org/wp-content/uploads/2010/08/700px-Metaboard-circuit-150x82.gif" alt="" width="150" height="82" /></a>Start by having a look at the <a href="http://www.mouser.com/ProductDetail/Tyco-Electronics-AMP/5-146250-1/?qs=sGAEpiMZZMtsLRyDR9nM17rHNLYljp%2fZe5vCg9PgcUA%3d">Metaboard</a> schematic (link goes to original Metalab site). My circuit is essentially the same, but without the provision for a separate power source, and none of the extra headers.</p>
<p>There are many similar circuits around the &#8216;net, and variety is good. However, I&#8217;m not fond of the designs that regulate the USB +5V down to 3.3V (using a couple diodes or a low-drop voltage regulator). My understanding is that the ATmega328P needs a Vcc of +5V for clock speeds over 10MHz.</p>
<p>The picture at the top of the article shows the layout I used, which certainly works but isn&#8217;t really ideal. (I&#8217;m especially offended by how I routed the D+ line &#8212; the white wire &#8212; under a resistor lead.) It would probably be improved by swapping the vertical columns used by the D+ and D- stuff.</p>
<p>The USB D+ line must be connected to a hardware interrupt (INT0 or INT1). USB D- and the jumper detect can go to any (two different) general-purpose IO lines. (Out of the box, the USBaspLoader software expects PD4 and PD7 respectively, so that&#8217;s what I used.)</p>
<p>Having a hardware reset line is optional, but makes the development cycle a lot more convenient. (You can flash, test, reset instead of flash, test, unplug, re-plug). If you need one more IO pin really badly, you can always disable reset in the fuses and use PC6 instead.</p>
<p>I used small lengths of recycled component leads to jumper AGND to ground, AREF to Vcc, AVCC to Vcc and the four eight-pin rails in the prototyping areas to whichever of ground or Vcc was nearest. This should be a good choice for most applications, but feel free to alter as needed.</p>
<p>If you&#8217;re the careful sort, plug the newly-assembled board into a cheap USB power supply first, before risking an expensive computer. If something gets hot, smells bad, emits smoke, catches fire or explodes: that&#8217;s not part of the design. Check your wiring.</p>
<h2>Firmware</h2>
<p>The 2010-07-27 version of the <a href="http://www.obdev.at/products/vusb/usbasploader.html">USBaspLoader</a> firmware works just great for me with no major changes. (Earlier versions could be something of a hassle if you had an ATmega328P, GCC 4.x and/or certain crystal speeds.)</p>
<p>You&#8217;ll need to edit the Makefile to set the correct values for clock speed, device type, bootloader address, fuse bits and programmer.</p>
<p>If you have changed any of the pin assignments during construction, edit bootloaderconfig.h to reflect your choices.</p>
<p>Also in bootloaderconfig.h, I edited the bootLoaderInit() function to remove the check for external reset. (I found it more convenient to have the board run the bootloader code at power-up if the jumper was set.)</p>
<p>When you build, make sure the result is smaller than 2K. (I made it with 4 bytes to spare!) If you really need more space, the 328P supports a 4K bootloader (but you&#8217;ll need to change the fuse bits, and you give up 2K of flash your application could otherwise use).</p>
<p>Obviously, you need some other programmer to get the firmware on there in the first place. (If a friend or a local hacker space has a programmer, you&#8217;re all set &#8212; you should only need it once at build time, not for subsequent development.) If you need to buy one, I&#8217;ve had great success with Lady Ada&#8217;s <a href="http://www.ladyada.net/make/usbtinyisp/index.html">USBtinyISP</a> (available as a <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=16&amp;products_id=46">nice kit</a> for $22.00). The AVR Dragon (about $50.00, needs some additional parts) is more expensive but very capable; see <a href="http://mythopoeic.org/avr-dragon-fixing-bad-fuse-settings/">my article about it</a> here on SGS.</p>
<p>When you&#8217;re loading the microcontroller, remember to double-check the fuse bits before you do anything, and to set fuses, flash and set lock bits <strong>in that order</strong>.</p>
<h2>How to Use</h2>
<p>Close the jumper. Make sure the board isn&#8217;t sitting on anything conductive. Plug it in to a USB host. Use as you would a real USBasp programmer connected to a proto board via ISP headers.</p>
<p>After <em>any</em> use of the programmer (even if you just query the device signature or something), it will jump to your application code.</p>
<p>To go back to being a programmer, press the reset button.</p>
<p>If you open the jumper, it will run your application (immediately, and after any power-up or reset). It is safe to move the jumper without disconnecting the board from the USB host.</p>
<p>If you are using the <a href="http://www.nongnu.org/avrdude/">avrdude</a> command-line utility for programming, use the option &#8220;-c usbasp&#8221; to specify programmer type. (You need not specify the port.) For UNIX-alikes: if the avrdude command gives you permissions-related errors when run as a non-root user (but works fine when run as root), you may need to set different group, owner and/or permissions for the device node. (This can be done automatically at device insertion time, but the specifics depend on distribution and version.)</p>
<p>It is possible to use this board with the Aduino IDE, but doing so is beyond the scope of this post. See the <a href="http://metalab.at/wiki/Metaboard">Metaboard</a> page (Metaboard for Arduino Users section) for details.</p>
<p>Note that you will be unable to read or modify fuses or lock bits, you can&#8217;t do a chip erase, and you can&#8217;t write to the top 2K of flash.</p>
<h2>Troubleshooting</h2>
<p>For troubleshooting, I&#8217;m going to assume you&#8217;re using a Linux system of recent vintage (because that&#8217;s what I have). While you can certainly use this design with various other OSen, I don&#8217;t know enough about how the low-level USB stuff works on any of them to give out advice.</p>
<p>Throughout, I&#8217;m going to use &#8220;sudo&#8221; as generic shorthand for &#8220;you probably need to be root in order for the following command to work&#8221;. On Debian-alikes (like Ubuntu), then the &#8220;sudo&#8221; is literally correct. Other distros may have different preferred ways to do privilege escalation. (If you don&#8217;t have root, then what are you doing plugging experimental hardware into the box?!)</p>
<p>Start with the jumper in place and the board disconnected. Run &#8220;sudo dmesg -c&#8221; to clear the kernel message ring buffer.</p>
<p>Plug in the board. If your machine shuts down, there&#8217;s probably a short between Vcc and ground, and that&#8217;s bad. Assuming you&#8217;re still up and running, try &#8220;lsusb&#8221;. You should see output like this:</p>
<pre>Bus 002 Device 020: ID 16c0:05dc VOTI USBasp AVR Programmer</pre>
<p>The bus and device numbers may vary, but the ID and text string should be as described. You can also look at the output of &#8220;sudo dmesg&#8221; which should <span style="text-decoration: line-through;">be</span> <span style="color: #ff0000;">include</span> something like this:</p>
<pre>usb 2-2: new low speed USB device using uhci_hcd and address 20
usb 2-2: configuration #1 chosen from 1 choice</pre>
<p>If you see the above, try &#8220;sudo avrdude -c usbasp -p atmega328p -v&#8221; and see if you get a chip description. If so, congratulations: it&#8217;s working. (Remember that it jumped into application space as soon as it got done handling a single programmer command. Hit reset to get back to programmer mode.)</p>
<p>If you don&#8217;t see the above, check the jumper, wiring and component values. Try a different USB port or a different computer.</p>
<p>Still no joy? Double-check that you selected the correct device type, clock speed, fuse bits and bootloader offset when you built USBaspLoader. (A 2K bootloader on the 328P should go at address 0&#215;7800.) Did you &#8220;make fuse&#8221; then &#8220;make flash&#8221; then &#8220;make lock&#8221; ? Did you look carefully to see if any of those steps yielded an error message? If you read back the flash contents and fuse bits, do you get something that matches what you think you put there?</p>
<p>Using another programmer, try loading some plain vanilla VUSB application and see if it works with the board. If not, it&#8217;s the circuit or components. If so, the bootloader firmware is wrong.</p>
<p>Have a &#8216;scope? See if the crystal is in oscillation, and if the USB waveform looks tidy.</p>
<h2>Credits</h2>
<p>Thanks to the <a href="http://www.obdev.at/index.html">Objective Development</a> crew, and especially to Christian Starkjohann for the patient, prompt and extremely helpful responses to my email. The new USBaspLoader release is all shiny.</p>
<p>Thanks to <a href="http://metalab.at/wiki/Inhalt">Metalab</a> for the idea that got me started, and for the <a href="http://metalab.at/wiki/Metaboard">Metaboard</a> circuit design and schematic.</p>
<p>Thanks to <a href="http://evilmadscience.com/">Evil Mad Science</a> and <a href="http://www.ladyada.net/">Lady Ada</a> for lowering the barrier to entry by making stuff that&#8217;s cheap, easy and works.</p>
<p>Thanks to the cast of thousands involved in creating the Open Source operating system, cross-development tools, text editors, file utilities, web browser and every other bit of free software I used in the process of getting this to work.</p>
<p>Thanks to everyone in the AVR homebrew community who took the time to put example code, circuits and useful clues on the &#8216;net.</p>
<p>Thanks to JDA and WBD for being beta testers.</p>
<h2>Fine Print</h2>
<p>All information is presented as-is, with no warranty either expressed or implied. If you build or do anything based on the information from this post, all consequences are your sole responsibility.</p>
<p>Wear eye protection when soldering, when cutting component leads and when doing anything else that flings nasty bits of stuff through the air. Solder and soldering tools get hot. Solder is toxic (even when not molten).</p>
<p>Never hack hardware you can&#8217;t afford to destroy.</p>
<p>Full disclosure: I have no relationship to any of the businesses mentioned here other than possibly as a customer.</p>
<p>All trademarks and copyrights are acknowledged as the properties of their respective owners, and nothing herein is intended as a challenge to that status.</p>
<p><em>[Edited 16 August 2010 by DGH to make small corrections and add additional notes about parts sourcing.]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/ems-metaboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Old Handle, New Blade</title>
		<link>http://mythopoeic.org/blade/</link>
		<comments>http://mythopoeic.org/blade/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 01:45:47 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[blades]]></category>
		<category><![CDATA[renfaire]]></category>
		<category><![CDATA[scarby]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=816</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://mythopoeic.org/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-816">Password:<br />
<input name="post_password" id="pwbox-816" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/blade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AVR Dragon: Fixing Bad Fuse Settings</title>
		<link>http://mythopoeic.org/avr-dragon-fixing-bad-fuse-settings/</link>
		<comments>http://mythopoeic.org/avr-dragon-fixing-bad-fuse-settings/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 18:43:07 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Compugeekery]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[avr dragon]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=806</guid>
		<description><![CDATA[This post isn&#8217;t about the usual kind of dragon (if there even is a &#8220;usual&#8221; kind). The AVR Dragon is a gizmo made by Atmel, useful for programming their AVR line of microcontrollers. It&#8217;s relatively cheap (around US$50 at the time of this writing) and does many useful things. The specific application I&#8217;m going to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Logo.jpg"><img class="alignright size-thumbnail wp-image-807" title="AVR-Dragon-Logo" src="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Logo-150x87.jpg" alt="" width="150" height="87" /></a>This post isn&#8217;t about the usual kind of dragon (if there even is a &#8220;usual&#8221; kind). The <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3891&amp;source=redirect">AVR Dragon</a> is a gizmo made by <a href="http://www.atmel.com/default.asp?source=global_nav">Atmel</a>, useful for programming their <a href="http://www.atmel.com/products/avr/default.asp?family_id=607&amp;source=home">AVR</a> line of microcontrollers. It&#8217;s relatively cheap (around US$50 at the time of this writing) and does many useful things. The specific application I&#8217;m going to talk about here is using it to &#8220;fix&#8221; parts when you&#8217;ve set the fuses in such a way that said parts won&#8217;t talk to simpler programmers. Details after the jump.</p>
<p><span id="more-806"></span></p>
<h2>Why Get a Dragon?</h2>
<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Full-Edit.jpg"><img class="alignright size-thumbnail wp-image-809" title="AVR-Dragon-Full-Edit" src="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Full-Edit-150x93.jpg" alt="" width="150" height="93" /></a>There are lots of AVR programmers out there. If you&#8217;re just starting out, there are cheaper options that work well (like the <a href="http://www.ladyada.net/make/usbtinyisp/">USBtinyISP</a> from Lady Ada). If you&#8217;re averse to soldering, one of the <a href="http://arduino.cc/en/Main/Hardware">Arduino variants</a> (with on-board programming hardware) may be of more use.</p>
<p>However, the Dragon gives you a lot of flexibility for not much more money &#8212; if you&#8217;re willing to put up with some extra hassle. Here are some of the features that set it apart from other low-end programmers:</p>
<ul>
<li>high-voltage serial programming, so you can program low-pin-count AVR chips</li>
<li>debugWIRE and JTAG support for in-circuit debugging</li>
<li>emulation support for devices with 32KB flash or less</li>
<li>parallel programming, so you can &#8220;unbrick&#8221; chips with mis-set fuse bits</li>
</ul>
<p>It supports the same six-wire ISP as most of the cheap options. The &#8220;avrdude&#8221; utility supports most of the Dragon modes, too.</p>
<h2>Initial Build</h2>
<p><a href="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Proto.jpg"><img class="alignright size-thumbnail wp-image-808" title="AVR-Dragon-Proto" src="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Proto-122x150.jpg" alt="" width="122" height="150" /></a>The Dragon does not arrive ready for use. They give you a flexible prototyping area and a place where you can solder headers. There are lots of approaches that work. My choice, with which I&#8217;ve had good results, is to add pin headers to the HV Prog connector area and the adjacent 40-pin &#8220;EXPAND&#8221; connector, then add a 40pin ZIF socket in the prototyping area. This lets me use the Dragon for any supported combination of target and programming mode, merely by adding jumpers in the right place.</p>
<p>The image to the right (from the <a href="http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon_Prototype_Area.htm">Atmel website</a>) shows the end result:</p>
<p>The disadvantage of this approach is that changing jumper configuration is somewhat time-consuming and potentially error-prone. There are some <a href="http://hackaday.com/2009/09/26/avr-dragon-wiring-alternative/">clever alternative possibilities</a>, though.</p>
<h2>Jumpers: Lazy Method</h2>
<div id="attachment_810" class="wp-caption alignright" style="width: 160px"><a href="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Wiring.jpg"><img class="size-thumbnail wp-image-810" title="AVR-Dragon-Wiring" src="http://mythopoeic.org/wp-content/uploads/2010/08/AVR-Dragon-Wiring-150x100.jpg" alt="" width="150" height="100" /></a><p class="wp-caption-text">Jumpers set for parallel programming of ATmega328P</p></div>
<p>Most of the approaches I&#8217;ve seen to jumper wiring on the Dragon involve ribbon cables with compression-fit connectors on one end and a bunch of individual single-pin sockets on the other. That works, but involves fabricating several such cables. At my local electronics store, I noticed the <a href="http://www.schmartboard.com/index.asp?page=products_jch&amp;id=41">SchmartBOARD jumpers</a>. These are nice stranded 3&#8243; wires with a pin socket on each end, fitted with shrink-fit tubing for insulation and strain relief. Build quality seems good, and at about US$5 for a 10-pack (with a strip of 20 pin headers I&#8217;m sure you&#8217;ll find a use for) they&#8217;re reasonably cheap.</p>
<p>If you&#8217;re doing parallel programming, you&#8217;ll want to get two packs. The 3&#8243; version has worked out fine for all the configurations I&#8217;ve used so far, though you may need a handful of longer jumpers if you&#8217;re programming 40-pin microcontrollers.</p>
<h2>Programming Modes</h2>
<p>There are several different ways for the Dragon to talk to your microcontroller. One of the easiest and most familiar is the six-wire ISP (in-system programming) bus. That&#8217;s a popular method as it requires relatively few pins, and lets you program the microcontroller without removing it from the circuit.</p>
<p>You can&#8217;t always use ISP, though. One reason is that some low-pin-count parts like the ATtiny11 don&#8217;t support it. Another is that ISP only works with certain combinations of fuse bit settings. Since you can set the fuse bits to arbitrary values using ISP (even values that make no sense), you can &#8220;brick&#8221; a microcontroller by applying fuse settings that don&#8217;t work and which you cannot change via ISP. Here are some specific examples:</p>
<ul>
<li>ISP depends on the reset pin acting as a reset rather than a general-purpose I/O. If you enable (set to zero) the RSTDISBL bit, ISP won&#8217;t work.</li>
<li>Turning off (setting to one) the serial programming enable (SPIEN) bit will stop ISP working.</li>
<li>Setting the clock bits to something that prevents the microcontroller from clocking reliably (e.g., telling it to use an external crystal when there isn&#8217;t one) will make ISP not work.</li>
</ul>
<p>In some cases there are workarounds. For example, if you&#8217;ve turned on RSTDISBL, you can still get the chip to reset by applying +12V to the reset pin. If you&#8217;ve done something silly with the clock, you can sometimes get around it by applying an appropriate square wave (possibly generated by another AVR microcontroller) to the clock input and/or messing with the timing settings on your programmer.</p>
<div id="attachment_811" class="wp-caption alignright" style="width: 148px"><a href="http://mythopoeic.org/wp-content/uploads/2010/08/parprog-dragon.png"><img class="size-thumbnail wp-image-811" title="parprog-dragon" src="http://mythopoeic.org/wp-content/uploads/2010/08/parprog-dragon-138x150.png" alt="" width="138" height="150" /></a><p class="wp-caption-text">PP jumpers for ATmega48(P)/88(P)/168(P)/328P</p></div>
<p>However, the only completely general-purpose remedy is using either HVSP (high-voltage serial programming) or PP (parallel programming), depending on the specific microcontroller you&#8217;re trying to fix.</p>
<p>For the popular ATmega168 and ATmega328P parts, parallel programming is what you want. Start by looking at the <a href="http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon.htm">AVR Dragon online help</a>, specifically the <a href="http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon_Device_Support.htm">list of supported devices</a>. Find your device and the required programming mode (one of HVSP or PP). Look at the connection sheet (linked from the list of supported devices) and set the jumpers accordingly.</p>
<p>The image to the right (from the Atmel help website) shows the correct jumper settings for doing parallel programming on the ATmegaXX8(P) parts (where XX is 4, 8, 16 or 32).</p>
<h2>Fixing Fuses</h2>
<p>Once you have the jumpers set up and target microcontroller in the ZIF socket, actually fixing the fuses is quite simple. Just use the command-line &#8220;<a href="http://savannah.nongnu.org/projects/avrdude/">avrdude</a>&#8221; utility with the options &#8220;-c dragon_pp -P usb&#8221; and program as usual. (Other programming software may work also. The Dragon is supported by Atmel&#8217;s <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725">AVR Studio</a> software, though I have not used it myself.)</p>
<p>For help finding the correct fuse values, the <a href="http://www.engbedded.com/fusecalc">Engbedded fuse calculator</a> is quite useful. It even gives you the correct avrdude command-line arguments to cut and paste. Note, however, that unused/non-existent bits (like bits 3..7 of the extended byte on the ATmega328P) read back as all-one on the Dragon, while other programmers read them back as all-zero.</p>
<p>This means (again using the ATmega328P extended bits as an example), if you want to set the BOD level to 4.3v (BODLEVEL=100)  you&#8217;ll get a verification error if you try to use &#8216;-U efuse:w:0&#215;03:m&#8217;. To avoid that, use &#8216;-U efuse:w:0xfb:m&#8217; instead. (The fuse gets set right either way. The latter method just avoids a misleading error report.)</p>
<p>If you do run into the verification error, answer &#8220;no&#8221; when avrdude offers to restore the old setting; if you say &#8220;yes&#8221; it&#8217;ll hang until interrupted.</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/avr-dragon-fixing-bad-fuse-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sand Castle is No Defense</title>
		<link>http://mythopoeic.org/sand-castle-is-no-defense/</link>
		<comments>http://mythopoeic.org/sand-castle-is-no-defense/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 20:32:26 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[om nom nom]]></category>
		<category><![CDATA[sand sculpture]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=776</guid>
		<description><![CDATA[Sometimes, in fairy tales, building a castle can help you avoid being eaten by dragons. On the beach, alas, this is not the case. From the Harrison Lake Sand Sculpture competition, by way of EpicWinFTW.]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/06/sand-dragon1.jpg"><img class="alignright size-thumbnail wp-image-777" src="http://mythopoeic.org/wp-content/uploads/2010/06/sand-dragon1-100x150.jpg" alt="" width="100" height="150" /></a><a href="http://mythopoeic.org/wp-content/uploads/2010/06/sand_dragon2.jpg"><img class="alignright size-thumbnail wp-image-778" style="margin-left: 5px;margin-right: 5px" src="http://mythopoeic.org/wp-content/uploads/2010/06/sand_dragon2-100x150.jpg" alt="" width="100" height="150" /></a>Sometimes, in fairy tales, building a castle can help you avoid being eaten by dragons. On the beach, alas, this is not the case. From the <a href="http://www.greatervancouverparks.com/HARRISONSandCastles01.html">Harrison Lake Sand Sculpture competition</a>, by way of <a href="http://epicwinftw.com/2010/06/15/awesome-photos-building-a-sand-castle-is-dangerous/">EpicWinFTW</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/sand-castle-is-no-defense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bay Area Maker Faire: Saphira</title>
		<link>http://mythopoeic.org/bay-area-maker-faire-saphira/</link>
		<comments>http://mythopoeic.org/bay-area-maker-faire-saphira/#comments</comments>
		<pubDate>Sat, 15 May 2010 23:16:33 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[gadgets]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=765</guid>
		<description><![CDATA[High-school students Sam DeRose and Alex Jacobson have constructed Saphira, a fire-breathing, Arduino-controlled animatronic dragon (named in homage to the protagonist of Christopher Paolini&#8217;s Inheritance trilogy). You can see her in person at the Maker Faire at San Mateo County Event Center, May 22 and 23. (Via Make: Online.)]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/05/saphira-blowing-fire.jpg"><img class="alignright size-thumbnail wp-image-766" src="http://mythopoeic.org/wp-content/uploads/2010/05/saphira-blowing-fire-150x100.jpg" alt="" width="150" height="100" /></a>High-school students Sam DeRose and Alex Jacobson have constructed Saphira, a fire-breathing, <a href="http://en.wikipedia.org/wiki/Arduino">Arduino</a>-controlled animatronic dragon (named in homage to the protagonist of Christopher Paolini&#8217;s <a href="http://www.alagaesia.com/"><em>Inheritance</em> </a>trilogy).</p>
<p>You can see her in person at the <a href="http://makerfaire.com/">Maker Faire</a> at San Mateo County Event Center, May 22 and 23. (Via <a href="http://blog.makezine.com/archive/2010/05/maker_faire_saphira.html">Make: Online</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/bay-area-maker-faire-saphira/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Teeth</title>
		<link>http://mythopoeic.org/teeth/</link>
		<comments>http://mythopoeic.org/teeth/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 15:19:33 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Autobiographical]]></category>
		<category><![CDATA[radiography]]></category>
		<category><![CDATA[technology is freakin' awesome]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=758</guid>
		<description><![CDATA[Completing the set of digital medical imaging, here&#8217;s a set of dental X-rays. (Sorry it&#8217;s one big wide image; that&#8217;s as it was sent to me.) At least now, if something goes terribly wrong during my forays into Mad Science, the medical examiner can look to my blog for help in figuring out who I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/04/X05082.jpg"><img class="alignright size-thumbnail wp-image-759" src="http://mythopoeic.org/wp-content/uploads/2010/04/X05082-150x28.jpg" alt="" width="150" height="28" /></a>Completing the set of digital medical imaging, here&#8217;s a set of dental X-rays. (Sorry it&#8217;s one big wide image; that&#8217;s as it was sent to me.) At least now, if something goes terribly wrong during my forays into Mad Science, the medical examiner can look to my blog for help in figuring out who I was.<a href="http://mythopoeic.org/wp-content/uploads/2010/04/aribex-nomad.jpg"><img class="alignright size-thumbnail wp-image-760" src="http://mythopoeic.org/wp-content/uploads/2010/04/aribex-nomad-137x150.jpg" alt="" width="137" height="150" /></a></p>
<p>The X-ray source for these images was a handheld emitter, which I didn&#8217;t have a chance to oogle as much as I&#8217;d have liked, but which I believe to be not unlike the <a href="http://www.aribex.com/products/nomadpro.html">Aribex Nomad</a> pictured to the right. Technologically cool, and great old-school Buck Rogers styling.</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/teeth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Scarborough 2010 Loot</title>
		<link>http://mythopoeic.org/scarborough-2010/</link>
		<comments>http://mythopoeic.org/scarborough-2010/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 02:49:38 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[loot]]></category>
		<category><![CDATA[renfaire]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=739</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://mythopoeic.org/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-739">Password:<br />
<input name="post_password" id="pwbox-739" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/scarborough-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With Forked Tongue</title>
		<link>http://mythopoeic.org/with-forked-tongue/</link>
		<comments>http://mythopoeic.org/with-forked-tongue/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 04:27:56 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[just look at it]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=733</guid>
		<description><![CDATA[DeviantArt user toge-NYC created this wonderful white dragon with plastic kitchenware. Just look at it.]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/03/Plasticdragon_by_toge_NYC.jpg"><img class="alignright size-thumbnail wp-image-734" src="http://mythopoeic.org/wp-content/uploads/2010/03/Plasticdragon_by_toge_NYC-112x150.jpg" alt="" width="112" height="150" /></a><a href="http://www.deviantart.com/">DeviantArt</a> user <a href="http://toge-nyc.deviantart.com/">toge-NYC</a> created this <a href="http://toge-nyc.deviantart.com/art/Plasticdragon-12822409">wonderful white dragon</a> with plastic kitchenware. Just look at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/with-forked-tongue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>They Both Seem Happy</title>
		<link>http://mythopoeic.org/they-both-seem-happy/</link>
		<comments>http://mythopoeic.org/they-both-seem-happy/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 19:09:02 +0000</pubDate>
		<dc:creator>dhenke</dc:creator>
				<category><![CDATA[Dragons]]></category>
		<category><![CDATA[lol wut]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://mythopoeic.org/?p=730</guid>
		<description><![CDATA[Here&#8217;s an image from the Baje Nalozki Sagen Brauchtum (Book of Woodcut Artwork), courtesy of the image gallery at the Texas Wendish Museum. (The gallery is an autoplaying slide show, so I regret I cannot link directly to the source image.) I&#8217;m not exactly sure what&#8217;s going on here, but I&#8217;m sure there&#8217;s a story [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mythopoeic.org/wp-content/uploads/2010/03/wendish-dragon.jpg"><img class="alignright size-thumbnail wp-image-731" src="http://mythopoeic.org/wp-content/uploads/2010/03/wendish-dragon-150x135.jpg" alt="" width="150" height="135" /></a>Here&#8217;s an image from the <em>Baje Nalozki Sagen Brauchtum</em> (Book of Woodcut Artwork), courtesy of the <a href="http://texaswendish.org/ImageGallery.aspx">image gallery</a> at the <a href="http://texaswendish.org/default.aspx">Texas Wendish Museum</a>. (The gallery is an autoplaying slide show, so I regret I cannot link directly to the source image.)</p>
<p>I&#8217;m not exactly sure what&#8217;s going on here, but I&#8217;m sure there&#8217;s a story behind it.</p>
<p>Caption ideas (even NSFW-ish ones, if they&#8217;re funny) are welcome in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://mythopoeic.org/they-both-seem-happy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
