<?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>Dangerous Prototypes &#187; ATtiny</title>
	<atom:link href="http://dangerousprototypes.com/tag/attiny/feed/" rel="self" type="application/rss+xml" />
	<link>http://dangerousprototypes.com</link>
	<description>A new open source hardware project every month</description>
	<lastBuildDate>Fri, 10 Sep 2010 16:34:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prototype: Hackable LED Christmas card &amp; ornament</title>
		<link>http://dangerousprototypes.com/2009/11/16/prototype-christmas-card-ornament/</link>
		<comments>http://dangerousprototypes.com/2009/11/16/prototype-christmas-card-ornament/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 23:59:59 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[Prototypes]]></category>
		<category><![CDATA[holiday cards]]></category>
		<category><![CDATA[atmel]]></category>
		<category><![CDATA[ATtiny]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[blinken christmas]]></category>
		<category><![CDATA[christmas]]></category>

		<guid isPermaLink="false">http://dangerousprototypes.com/?p=2219</guid>
		<description><![CDATA[
Holiday cards that blink and beep have always fascinated us. This is our hackable DIY version, made with an ATtiny13A and a few LEDs. Push the button to play a short light show in the tree. We&#8217;re sending these to friends and family this year. It&#8217;s a handmade, hackable gift, and it was a ton [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2356" title="cover.450" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/cover-450.jpg" alt="cover.450" width="450" height="332" /></p>
<p>Holiday cards that blink and beep have always fascinated us. This is our hackable DIY version, made with an ATtiny13A and a few LEDs. Push the button to play a short light show in the tree. We&#8217;re sending these to friends and family this year. It&#8217;s a handmade, hackable gift, and it was a ton of fun to build.</p>
<p>The card is also an homage to Velleman&#8217;s <a href="http://www.vellemanusa.com/us/enu/product/view/?id=350675">blinking Christmas tree ornament kit</a>, and a kit-biz reference to <a href="http://www.adafruit.com/promise.html">the Adafruit Promise</a>. (Did you know Velleman has a <a href="http://www.vellemanusa.com/us/enu/product/view/?id=525056">nixie tube clock kit</a>? Really!)</p>
<p>You can buy a copy of our card at Seeed Studio. <a href="http://www.seeedstudio.com/depot/preoerderled-christmas-card-ornament-assembled-p-574.html">Assembled cards</a> are $15, and <a href="http://www.seeedstudio.com/depot/preorderled-christmas-card-ornament-kit-p-573.html">a kit for adventurous solderers</a> is $12. We&#8217;re excited to gauge interest an SMD kit, and hope to offer it as an option for future projects.</p>
<p>Video, hardware, firmware, and more, after the break.</p>
<p><span id="more-2219"></span></p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/IKRxKIpAxBY&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/IKRxKIpAxBY&#038;fs=1" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>Hardware</strong></p>
<p><img class="alignnone size-full wp-image-2513" title="cct.450.iii" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/cct-450-iii.png" alt="" width="450" height="326" /></p>
<p><a href="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/cctiii.png">Click for a full size schematic image</a> [PNG]. The schematic and PCB were made with the freeware version of <a href="http://www.cadsoft.de">Cadsoft Eagle</a>. Download the latest design files and firmware on the <a href="http://code.google.com/p/dangerous-prototypes-open-hardware/">project Google Code page</a>.</p>
<p><em>AVR ATTINY-13A</em></p>
<p><img class="alignnone size-full wp-image-2322" title="circuit-cct-pcb.ii" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/circuit-cct-pcb-ii.jpg" alt="circuit-cct-pcb.ii" width="450" height="229" /></p>
<p>A small ATMEL <a href="http://www.atmel.com/dyn/products/product_card.asp?PN=ATtiny13A">ATtiny13A microcontroller</a> (IC1) is the brain of the circuit. One pin (PWM) blinks the lights, most of the other pins are used for programming and power. You could get similar effects with a <a href="http://en.wikipedia.org/wiki/555_timer_IC">555 timer</a> or discrete components, but our goal is to learn about a new microcontroller family and make something easy to hack.</p>
<p>The ATtiny needs a 10K <a href="http://en.wikipedia.org/wiki/Pull-up_resistor">pull-up resistor</a> (R1) to hold the reset pin high, a mini tactile switch (S1) resets the ATtiny by temporarily connecting the reset pin to ground. A 0.1uF capacitor (C1) <a href="http://en.wikipedia.org/wiki/Decoupling_capacitor">decouples</a> the chip from the power supply.</p>
<p><img class="alignnone size-full wp-image-2324" title="isp-bat-back-cct" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/isp-bat-back-cct.jpg" alt="isp-bat-back-cct" width="450" height="141" /></p>
<p>ATtiny microcontrollers are programmed through a six-pin <a href="http://en.wikipedia.org/wiki/Atmel_AVR#AVR_ISP_and_AVR_ISP_mkII">In System Programming</a> (ISP) connection. The ISP header is oriented towards the back of the card. We made a programming probe to avoid soldering a pin header on the board.</p>
<p>Power is supplied by a 3volt, 20mm lithium <a href="http://en.wikipedia.org/wiki/Button_cell">coin cell</a> (BAT1) on the back of the PCB. The holder should work with 2025 or 2032 coin cells.  The ATtiny will work over a range of voltages, down to 1.8volts.</p>
<p><em>Tree LEDs</em></p>
<p><em><img class="alignnone size-full wp-image-2508" title="npn-ledsii" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/npn-ledsii.jpg" alt="" width="450" height="213" /><br />
</em></p>
<p>Our tiny, twinkling Christmas tree lights are 0805 surface mount LEDs (LED1-10). Each LED has a <a href="http://ledz.com/?p=zz.led.resistor.calculator">current limiting resistor</a> (R3-12). We used 390ohm resistors, for about 3mA at 3volts, and 8mA at 5volts during development. All 10 LEDs together use about 30mA when powered by the battery.</p>
<p>30mA is too much current to source or sink on the ATtiny pins. Instead, an NPN transistor (T1) switches the ground connection of the LEDs. Transistors also require a base resistor (R2) to limit how much current is pulled from the microcontroller pin.</p>
<p><img class="alignnone size-full wp-image-2326" title="led-direction.450" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/led-direction-450.jpg" alt="led-direction.450" width="450" height="280" /></p>
<p>LEDs need to be connected in the correct direction or they won&#8217;t light. Through-hole LEDs usually have one longer lead that indicates the positive supply side (anode). SMD LEDs have a green edge, and sometimes an arrow on the back, to indicate the ground connection (cathode). This chart shows the correct orientation for each LED, the ground connection should point the same direction as the arrow.</p>
<p><strong>PCB</strong></p>
<p><strong><img class="alignnone size-full wp-image-2338" title="place" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/place.png" alt="place" width="450" height="291" /><br />
</strong></p>
<p><a href="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/brd-nobtm-600dpi.png">Click for a full size placement image</a> [PNG]. The schematic and PCB were made with the freeware version of <a href="http://www.cadsoft.de/">Cadsoft Eagle</a>. Download the latest design files and firmware on the <a href="http://code.google.com/p/dangerous-prototypes-open-hardware/">project Google Code page</a>. We made the PCBs with Seeed Studio&#8217;s Propaganda service, the extra boards from our order are <a href="http://www.seeedstudio.com/depot/prototyping-service-fusion-pcb-pool-c-64_33.html">in the Seeed store</a>. We expected green PCBs, but got black &#8211; the final PCBs will be <strong><span style="color: #ff0000;">red</span></strong>.</p>
<p>We used vias, components, and the silk screen to create a Christmas theme.  This is our first try, maybe it&#8217;ll become a holiday tradition that we improve on year after year. The final PCB should have visible silver vias on the tree, we didn&#8217;t make them big enough on the prototype. We also removed the year, so if it isn&#8217;t delivered in time for Christmas it can be used again later.</p>
<p>This is a two-layer PCB with parts on both sides. We started on the front, soldering large parts like the microcontroller (IC1) and switch (S1), then added smaller passives like resistors and capacitors. The battery holder goes on the back of the PCB, we soldered it last so the work surface stayed flat and stable while we worked on the front.</p>
<p>If you&#8217;re soldering the PCB yourself, be sure you have <a href="http://www.seeedstudio.com/depot/tweezersstraight-anti-magnetic-p-537.html">tweezers with pointed ends</a> to place and hold components. You&#8217;ll also need flux to make everything flow, and copper wick to clean up any extra solder. We use <a href="http://en.wikipedia.org/wiki/Blu-Tack">Blu-Tack</a> for about everything else.</p>
<p><em>Partslist</em></p>
<table border="0">
<tbody>
<tr>
<td height="17" align="left" valign="middle"><strong>Name</strong></td>
<td align="left" valign="middle"><strong>Quantity</strong></td>
<td align="left" valign="middle"><strong>Value (size)</strong></td>
</tr>
<tr>
<td height="17" align="left" valign="middle">IC1</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://www.mouser.com/ProductDetail/Atmel/ATTINY13A-SSU/?qs=sGAEpiMZZMvu0Nwh4cA1wRKJzS2Lmyk%252briikDXt9eyw%3d">AVR ATtiny13A</a> (SOIC-8)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">C1</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://mouser.com/Search/ProductDetail.aspx?R=C0805C104K5RACTUvirtualkey64600000virtualkey80-C0805C104K5R">0.1uf capacitor</a> (0805)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">T1</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=BC81840MTFvirtualkey51210000virtualkey512-BC81840MTF">NPN 200ma+ 100hfe+ transistor</a> (SOT23)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">R1</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=CR0805-JW-103ELFvirtualkey65210000virtualkey652-CR0805-JW-103ELF">10,000 ohm (10K) resistor</a> (0805)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">R2-R12</td>
<td align="left" valign="middle">10</td>
<td align="left" valign="middle"><a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=2BMLUTrrT4P7Xm58YbKmPg==">390 ohm (390R) resistor</a> (0805)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">LED1-10</td>
<td align="left" valign="middle">10</td>
<td align="left" valign="middle"><a href="http://www2.mouser.com/ProductDetail/Dialight/598-8110-107F/?qs=sGAEpiMZZMuus4pmcqQnzm2UNk7a5HnUwLua0TbMZKg%3d">LEDs</a>, various colors (0805)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">S1</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://mouser.com/ProductDetail/CK-Components/PTS525SM10SMTR-LFS/?qs=sGAEpiMZZMsgGjVA3toVBF5lfIYFP91J3OqLNUrtEI4%3d">Mini tactile switch</a> (SMD)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">BAT</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle"><a href="http://www.mouser.com/ProductDetail/Eagle-Plastic-Devices/12BH002-GR/?qs=sGAEpiMZZMupuRtfu7GC%252bWiBQhRhfHaeMmcKaEBYe5I%3d">20mm battery holder</a> (SMD)</td>
</tr>
<tr>
<td height="17" align="left" valign="middle">CELL</td>
<td align="left" valign="middle">1</td>
<td align="left" valign="middle">20mm battery (CR-2025)</td>
</tr>
</tbody>
</table>
<p><strong>Firmware</strong></p>
<p>The firmware is written in C using the open source <a href="http://winavr.sourceforge.net/">AVR-GCC compiler</a> with <a href="http://www.atmel.com/avrstudio">AVRStudio</a>. Download the latest design files and firmware on the <a href="http://code.google.com/p/dangerous-prototypes-open-hardware/">project Google Code page</a>. Program the firmware through the 6pin ISP programming header with something like the <a href="http://www.seeedstudio.com/depot/atmel-avrisp-stk500-usb-isp-programmer-p-207.html">STK500</a> or <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;products_id=46">USBtinyISP</a>. On a side note, we&#8217;re really excited about using an open source compiler for this project.</p>
<p><img class="alignnone size-full wp-image-2328" title="firmware" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/firmware.png" alt="firmware" width="450" height="72" /></p>
<p>When power is applied to the circuit, the ATtiny runs <a href="http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/trunk/holiday-cards/09-Christmas/firmware/main.c">a simple program</a> that pulses the Christmas tree lights. When the program finishes, the chip sleeps until it&#8217;s reset by a button press or battery change.</p>
<p>The fading program uses software <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">pulse-width modulation</a> to dim the LEDs. The ATtiny13A has hardware PWM, but it outputs on the ISP pins which are already occupied. It&#8217;s possible to share programming pins with other functions, be we weren&#8217;t ready to do that on this project.</p>
<p>When the program completes, the chip just goes to sleep forever. This is different than many microcontroller programs that resume from sleep on a pin change interrupt. A button press resets the ATtiny and starts the program again.</p>
<p><strong>Taking it further</strong></p>
<p>We&#8217;ve got a lot of ideas for future holiday cards &#8211; multiple LED channels, color changing LEDs, sound, accelerometer control, capacitive touch sensing, LCD screens, epaper, festively cut PCBs, and more. We didn&#8217;t use a bootloader in this project, but here&#8217;s <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=printview&amp;t=66614&amp;start=0">a discussion of possible options</a>.</p>
<p>What would you do? Do you have any hacks for this card, or ideas for future cards?</p>
<p><strong>Get one</strong></p>
<p><strong><img class="alignnone size-full wp-image-2358" title="kit.450" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/kit-450.jpg" alt="kit.450" width="450" height="286" /><br />
</strong></p>
<p>Seeed Studio has the card assembled, or as a kit. The kit includes 0805-sized surface mount parts, it isn&#8217;t for everyone. This is our first project to be offered as a kit, we&#8217;re excited to see how many people are interested in an SMD kit. This will be a very limited run, probably 100-200 total, so get yours early!</p>
<ul>
<li>Build your own card from our open source <a href="http://code.google.com/p/dangerous-prototypes-open-hardware/downloads/list">design files and firmware</a>.</li>
<li><a href="http://www.seeedstudio.com/depot/preoerderled-christmas-card-ornament-assembled-p-574.html">An assembled card is $15 at Seeed Studio</a>. The PCB will be <span style="color: #ff0000;"><strong>red</strong></span>. Firmware programmed and battery included.</li>
<li><a href="http://www.seeedstudio.com/depot/preorderled-christmas-card-ornament-kit-p-573.html">A kit is $12 at Seeed Studio</a>. The PCB will be <span style="color: #ff0000;"><strong>red</strong></span>. Firmware programmed and battery included.</li>
</ul>
<p>We&#8217;d like orders to be delivered in time for Christmas, but there&#8217;s a significant chance that might not happen. Seeed Studio is already working on a small number of cards, that should help speed up delivery. Hopefully they arrive in time for Christmas, but delivery will be really tight. We&#8217;ll post manufacturing updates as we get them.</p>
<p>Have a silver, soldery Holiday!</p>
<p><img class="alignnone size-full wp-image-2356" title="cover.450" src="http://dangerousprototypes.com.php5-11.dfw1-1.websitetestlink.com/wp-content/media/2009/11/cover-450.jpg" alt="cover.450" width="450" height="332" /></p>
]]></content:encoded>
			<wfw:commentRss>http://dangerousprototypes.com/2009/11/16/prototype-christmas-card-ornament/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
