<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hack a Day &#187; parts</title>
	<atom:link href="http://hackaday.com/category/parts/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackaday.com</link>
	<description>Fresh hacks every day</description>
	<lastBuildDate>Tue, 24 Nov 2009 19:06:31 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='hackaday.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/5560f98f805877b0e332f191cb9e0af3?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Hack a Day &#187; parts</title>
		<link>http://hackaday.com</link>
	</image>
			<item>
		<title>Parts: ChronoDot RTC Module (DS3231)</title>
		<link>http://hackaday.com/2009/10/27/parts-chronodot-rtc-module-ds3231/</link>
		<comments>http://hackaday.com/2009/10/27/parts-chronodot-rtc-module-ds3231/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 16:00:46 +0000</pubDate>
		<dc:creator>James Munns</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[chrono]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[doh]]></category>
		<category><![CDATA[dot]]></category>
		<category><![CDATA[DS3231]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[macetech]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[TCXO]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=17144</guid>
		<description><![CDATA[
Macetech&#8217;s ChronoDot is a Real Time Clock module for projects requiring highly accurate time keeping and measurement. The ChronoDot uses the DS3231 chip, which features a TCXO to compensate for variations in temperature which affect normal oscillators, like the ones in most microcontrollers. The DS3231 uses simple I2C commands and registers for storing and retrieving [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=17144&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="aligncenter size-full wp-image-17802" title="ChronoDot" src="http://hackadaycom.files.wordpress.com/2009/10/chronodot.jpg?w=300&#038;h=291" alt="ChronoDot" width="300" height="291" /></p>
<p><a href="http://docs.macetech.com/doku.php/chronodot">Macetech&#8217;s ChronoDot</a> is a Real Time Clock module for projects requiring highly accurate time keeping and measurement. The ChronoDot uses the <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4627">DS3231</a> chip, which features <a href="http://www.wenzel.com/documents/tcxo.html">a TCXO</a> to compensate for variations in temperature which affect normal oscillators, like the ones in most microcontrollers. The DS3231 uses simple I2C commands and registers for storing and retrieving time, but also features a variable output that goes all the way down to 1.000 hz for low power, interrupt style timekeeping applications. With the provided watch battery, the ChronoDot can keep time in idle mode for up to 8 years.</p>
<p>Normally the <a href="http://macetech.com/store/index.php?main_page=product_info&amp;cPath=5&amp;products_id=8">ChronoDot</a> comes mostly assembled, requiring you to only solder on the watch battery. However, due to a manufacturing mistake, Macetech is selling a version with the header pins on the wrong side they call the <a href="http://macetech.com/store/index.php?main_page=product_info&amp;cPath=5&amp;products_id=15">ChronoDoh</a>. This module is currently nearly half off the regular price of $14.99, which makes it a great low cost addition to a project. Macetech has sent us a couple of these modules to demonstrate how functional they still are.</p>
<p><span id="more-17144"></span></p>
<p><img class="alignnone size-full wp-image-17803" title="Dohdot" src="http://hackadaycom.files.wordpress.com/2009/10/dohdot.jpg?w=470&#038;h=235" alt="Dohdot" width="470" height="235" /></p>
<p>Because of this mistake, using these parts as a breadboard tool is made a little bit harder, as the silkscreen pin names are only on the &#8220;top&#8221; side. However, if a project is designed around this part, or if alternate tools such as a wire ribbon or probes were used, this problem would disappear. It would also be possible to desolder the header pins and remount them, but there is always the possibility of lifting the pads, or otherwise causing damage to the parts whenever desoldering is involved.</p>
<p><img class="alignnone size-full wp-image-17804" title="Preparing to solder the battery on." src="http://hackadaycom.files.wordpress.com/2009/10/cd1.jpg?w=470&#038;h=295" alt="cd1" width="470" height="295" /></p>
<p>We set up one of the ChronoDoh modules as demonstrated, and pinned out the I2C connection using a &#8220;right side up&#8221; ChronoDoh as reference. The Dot must have an external VCC signal to respond to I2C commands, and will only silently keep time when powered by the watch battery. For the ChronoDo(h/t), sample Arduino code and schematics are provided on Macetech&#8217;s website, making initial set up and testing a breeze. We used a <a href="http://www.pjrc.com/teensy/teensyduino.html">Teensy++ running the Teensyduino loader</a> to simplify the process. The sample code simply displayed the time reported over I2C by the Dot, which seemed to be the time since the Dot first received 5V power (when it was most likely initialized). The chip reported that the time was 00:01:55, which meant that it was time to update the registers. Unfortunately, this is where the sample code leaves off, though the provided documentation does provide a list of all of the relevant registers (page 11 of the datasheet).</p>
<p><img class="alignnone size-full wp-image-17805" title="Soldered battery next to unpopulated dot." src="http://hackadaycom.files.wordpress.com/2009/10/cimg0776ed.jpg?w=470&#038;h=198" alt="CIMG0776ed" width="470" height="198" /></p>
<p>After <a href="http://www.robot-electronics.co.uk/htm/using_the_i2c_bus.htm">setting the I2C registers</a>, the ChronoDoh was correctly keeping time, so we decided to test the accuracy. We set up the other module, put it in our freezer for a week, then tested the two against each other. Wonderfully, they both reported identical times. Though unscientific, this is backed up by the <a href="http://www.maxim-ic.com/products/timers/DS3231_demo/">ongoing accuracy test</a> by the makers of the DS3231, which claims an accuracy of &#8220;± 2ppm at 0C to +40C (~1 minute per year)&#8221;.</p>
<p><img class="alignnone size-full wp-image-17806" title="Both dots on a breadboard with the Teensy++" src="http://hackadaycom.files.wordpress.com/2009/10/cimg0783ed.jpg?w=470&#038;h=353" alt="CIMG0783ed" width="470" height="353" /></p>
<p>These breakout boards are a great way to test out this chip, <a href="http://hackaday.com/2009/10/22/gear-clock/">which</a> has <a href="http://hackaday.com/2009/10/14/led-pocket-watch/">tons</a> of <a href="http://hackaday.com/2009/09/27/word-clock-tell-the-time-with-words/">applications</a>, on an easy to use breakout board, which is what Macetech does best.</p>
<p><strong>Hack a Day review disclosure</strong>: Macetech gave us a couple free ChronoDohs to review for this post.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/17144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/17144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/17144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/17144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/17144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/17144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/17144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/17144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/17144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/17144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=17144&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/10/27/parts-chronodot-rtc-module-ds3231/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">jahmez</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/chronodot.jpg" medium="image">
			<media:title type="html">ChronoDot</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/dohdot.jpg" medium="image">
			<media:title type="html">Dohdot</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/cd1.jpg" medium="image">
			<media:title type="html">Preparing to solder the battery on.</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/cimg0776ed.jpg" medium="image">
			<media:title type="html">Soldered battery next to unpopulated dot.</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/cimg0783ed.jpg" medium="image">
			<media:title type="html">Both dots on a breadboard with the Teensy++</media:title>
		</media:content>
	</item>
		<item>
		<title>Online chip reference trims the fat</title>
		<link>http://hackaday.com/2009/10/14/online-chip-reference-trims-the-fat/</link>
		<comments>http://hackaday.com/2009/10/14/online-chip-reference-trims-the-fat/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 19:25:42 +0000</pubDate>
		<dc:creator>Phil Burgess</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[cheat sheet]]></category>
		<category><![CDATA[chip]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[ic]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=17255</guid>
		<description><![CDATA[
Quick: which pins are used for I2C on an ATmega168 microcontroller?
If you’re a true alpha geek you probably already know the answer. For the rest of us, ChipDB is the greatest thing since the resistor color code cheat sheet. It’s an online database of component pinouts: common Atmel microcontrollers, the peripheral ICs sold by SparkFun, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=17255&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-17256" title="partsdb" src="http://hackadaycom.files.wordpress.com/2009/10/partsdb.gif?w=470&#038;h=260" alt="partsdb" width="470" height="260" /></p>
<p>Quick: which pins are used for I2C on an ATmega168 microcontroller?</p>
<p>If you’re a true alpha geek you probably already know the answer. For the rest of us, <a href="http://www.msarnoff.org/chipdb/">ChipDB is the greatest thing since the resistor color code cheat sheet</a>. It’s an online database of component pinouts: common <a href="http://hackaday.com/2009/09/26/avr-dragon-wiring-alternative/">Atmel</a> microcontrollers, the peripheral ICs sold by <a href="http://hackaday.com/2009/07/02/sparkfun-open-sources-latest-kits/">SparkFun</a>, and most of the 4000, <a href="http://hackaday.com/2008/12/18/7400-series-logic-simulator/">7400</a> and LMxxx series parts.</p>
<p>The streamlined interface, reminiscent of Google, returns just the essential information much quicker than rummaging through PDF datasheets (which can also be downloaded there if you need them). And the output, being based on simple text and CSS, renders quite well on any device, even a dinky smartphone screen.</p>
<p>Site developer [<a href="http://www.msarnoff.org/">Matt Sarnoff</a>] summarizes and calls upon the hacking community to help expand the database:</p>
<blockquote><p>“The goal of my site isn&#8217;t to be some comprehensive database like Octopart; just a quick reference for the chips most commonly used by hobbyists. However, entries still have to be copied in manually. If anyone&#8217;s interested in adding their favorite chips, they can request a free account and use the (very primitive at this point) part editor. Submissions are currently moderated, since this is an alpha-stage project.”</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/17255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/17255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/17255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/17255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/17255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/17255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/17255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/17255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/17255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/17255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=17255&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/10/14/online-chip-reference-trims-the-fat/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">philburgess</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/partsdb.gif" medium="image">
			<media:title type="html">partsdb</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: Unboxing the Bus Pirate</title>
		<link>http://hackaday.com/2009/07/20/parts-unboxing-the-bus-pirate/</link>
		<comments>http://hackaday.com/2009/07/20/parts-unboxing-the-bus-pirate/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 19:00:32 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[1-wire]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[jtag]]></category>
		<category><![CDATA[preorder]]></category>
		<category><![CDATA[serial interface]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[unboxing]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=12819</guid>
		<description><![CDATA[
For months we&#8217;ve used our Bus Pirate universal serial interface tool to demonstrate electronics parts, so it&#8217;s only appropriate that the Bus Pirate  get it&#8217;s own parts post. We recently had a Bus Pirate preorder, and today we received the pre-production Bus Pirate prototype from Seeed Studio. This prototype was mailed just a few [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12819&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-12833" title="bp-unbox-3" src="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-3.jpg?w=470&#038;h=326" alt="bp-unbox-3" width="470" height="326" /></p>
<p>For months we&#8217;ve used our <a href="http://www.buspirate.com">Bus Pirate universal serial interface tool</a> to demonstrate <a href="http://hackaday.com/category/parts/">electronics parts</a>, so it&#8217;s only appropriate that the Bus Pirate  get it&#8217;s own parts post. We recently had a <a href="http://hackaday.com/2009/06/25/bus-pirate-preorders-open/">Bus Pirate preorder</a>, and today we received the pre-production Bus Pirate prototype from <a href="http://www.seeedstudio.com/depot/">Seeed Studio</a>. This prototype was mailed just a few days before <a href="http://hackaday.com/2009/07/16/bus-pirate-preorder-1-ships/">preorder 1 started to ship</a>, so those packages should  start arriving any day.</p>
<p>Follow along as we unbox the prototype Bus Pirate, and connect it to a debugger to determine  the <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en026374">PIC24FJ64GA002-I/SO</a> revision that shipped with this board. Use this post to share your own Bus Pirate unboxing experience. Pictures and discussion after the break.</p>
<p><span id="more-12819"></span></p>
<p><img class="alignnone size-full wp-image-12831" title="bp-unbox-1" src="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-1.jpg?w=470&#038;h=328" alt="bp-unbox-1" width="470" height="328" /></p>
<p>Most Bus Pirates will ship <a href="http://hackadaycom.files.wordpress.com/2009/07/ready-envelope-470.jpg?w=470&amp;h=312">in a padded envelope</a> (JPG), but ours came in a box with some PCBs for future projects and  an AVR programmer.</p>
<p><img class="alignnone size-full wp-image-12832" title="bp-unbox-2" src="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-2.jpg?w=470&#038;h=287" alt="bp-unbox-2" width="470" height="287" /></p>
<p>Inside the box, the Bus Pirate is protected by a <em>static dissipative</em> bag. The Bus Pirate pin headers are stuck in foam to protect the packaging.</p>
<p><img class="alignnone size-full wp-image-12834" title="bp-unbox-5" src="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-5.jpg?w=470&#038;h=350" alt="bp-unbox-5" width="470" height="350" /></p>
<p>We ran a battery of functionality tests that covered USB, the user terminal, protocol libraries, power supplies, and pullup resistors. Everything passed our tests.</p>
<p>Next, we used a Microchip ICD2 debugger/programmer to  make a backup of the firmware prior to doing a test upgrade/downgrade with the bootloader.</p>
<blockquote><p>Connecting to MPLAB ICD 2<br />
&#8230;Connected<br />
Setting Vdd source to target<br />
<strong>Target Device PIC24FJ64GA002 found, <span style="text-decoration:underline;">revision = Rev 0&#215;3042</span></strong><br />
&#8230;Reading ICD Product ID<br />
Running ICD Self Test<br />
&#8230;Passed<br />
MPLAB ICD 2 ready for next operation</p></blockquote>
<p>All of our previous Bus Pirate version were built using Rev 0&#215;3003 (A3) of the PIC 24FJ64GA002. Version A3 has a few issues, known as <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/80470a.pdf">errata</a> (PDF), one of which is a <a href="http://www.google.com/codesearch/url?ct=ext&amp;url=http://forum.microchip.com/tm.aspx%3Fm%3D271183%26mpage%3D1&amp;usg=AFQjCNFvedVtagkyXzTS-vmSKIk3OE0eiw">flaky hardware I2C module</a>. These chips aren&#8217;t &#8216;defective&#8217;, they just have a few quirks like any complicated integrated circuit. The Bus Pirate firmware works around these issues using software techniques. Most desktop computer processors go through a similar stepping process.</p>
<p>Our Bus Pirate appears to have a B4 revision PIC (0&#215;3042) that corrects some, but not all, of the errata from A3. This is no guarantee that every Bus Pirate will have a B4 PIC, preorder 1 and 2 are both sourced from multiple international vendors. Additionally, there&#8217;s no immediate benefit from having a B4 chip, someone will have to write software that takes advantage of the hardware. The next  firmware update will print the PIC revision in the user terminal, check the <a href="http://code.google.com/p/the-bus-pirate/source/browse/#svn/trunk/firmware/v0h-nightly">nightly compiles</a> if you&#8217;re anxious.</p>
<p>There is a revision B5 mentioned in the PIC errata. Some of these might find their way into preorder 2 boards.</p>
<p><img class="alignnone size-full wp-image-12830" title="bp-unbox-0" src="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-0.jpg?w=470&#038;h=361" alt="bp-unbox-0" width="470" height="361" /></p>
<p>Now that you&#8217;ve got your Bus Pirate, what do you do with it? We&#8217;ve got a bunch of <a href="http://hackaday.com/the-bus-pirate-universal-serial-interface/">part demonstrations</a> to get you started.</p>
<p>Please leave a comment about your unboxing experience, and the devices you plan to interface.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/12819/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/12819/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/12819/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/12819/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/12819/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/12819/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/12819/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/12819/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/12819/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/12819/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12819&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/07/20/parts-unboxing-the-bus-pirate/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-3.jpg" medium="image">
			<media:title type="html">bp-unbox-3</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-1.jpg" medium="image">
			<media:title type="html">bp-unbox-1</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-2.jpg" medium="image">
			<media:title type="html">bp-unbox-2</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-5.jpg" medium="image">
			<media:title type="html">bp-unbox-5</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/bp-unbox-0.jpg" medium="image">
			<media:title type="html">bp-unbox-0</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: 4&#215;20 VFD character display (NA204SD02)</title>
		<link>http://hackaday.com/2009/07/13/parts-4x20-vfd-character-display-na204sd02/</link>
		<comments>http://hackaday.com/2009/07/13/parts-4x20-vfd-character-display-na204sd02/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:28:48 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[character lcd]]></category>
		<category><![CDATA[futaba]]></category>
		<category><![CDATA[hd44780]]></category>
		<category><![CDATA[lcd]]></category>
		<category><![CDATA[serial interface]]></category>
		<category><![CDATA[vfd]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=11016</guid>
		<description><![CDATA[
Futaba makes vacuum florescent character displays that can be used as a drop-in replacement for common character LCDs. VFDs have a wider viewing angle, and generally look cooler.
Futaba&#8217;s character displays can be interfaced using the standard 8-bit or 4-bit parallel LCD interface, or a simple two-wire protocol. The protocol type is set by resistors on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=11016&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-12656" title="futuba-serial" src="http://hackadaycom.files.wordpress.com/2009/07/futuba-serial.jpg?w=470&#038;h=267" alt="futuba-serial" width="470" height="267" /></p>
<p><a href="http://www.futaba.com/products/display_modules/module_products/character/index.asp">Futaba</a> makes <a href="http://en.wikipedia.org/wiki/Vacuum_fluorescent_display">vacuum florescent character displays</a> that can be used as a drop-in replacement for common character <a href="http://en.wikipedia.org/wiki/Lcd">LCDs</a>. VFDs have a wider viewing angle, and generally look cooler.</p>
<p>Futaba&#8217;s character displays can be interfaced using the standard <a href="http://ouwehand.net/~peter/lcd/lcd0.shtml">8-bit or 4-bit parallel LCD interface</a>, or a simple two-wire protocol. The protocol type is set by resistors on the back of the display, so it&#8217;s not particularly easy to change without a <a href="http://hackaday.com/2009/02/20/tools-aoyue-968-3-in-1-soldering-and-rework-station/">hot-air rework station</a>. Today we&#8217;ll demonstrate a serially-interfaced VFD using the Bus Pirate.</p>
<p><span id="more-11016"></span><strong><a href="http://www.futaba.com/products/display_modules/module_products/character/index.asp">Futuba VFD</a> character LCD replacement (<a href="http://www.primelec.com/Electronic-Components/LCDs-Displays/Futaba-4X20-LCD-Emulator-p7144243.html">NA204SD02</a></strong><strong>, $7.00). <a href="http://www.futaba.com/products/display_modules/lcd_emulator/products/index.asp">Datasheet </a>(PDF).</strong></p>
<table border="0">
<tbody>
<tr>
<td><strong>VFD (pin #)</strong></td>
<td><strong>Bus Pirate</strong></td>
</tr>
<tr>
<td>GND (1)</td>
<td>GND</td>
</tr>
<tr>
<td>+5volts (2)</td>
<td>+5volts, Vpullup</td>
</tr>
<tr>
<td>Data (3)</td>
<td>MOSI</td>
</tr>
<tr>
<td>Strobe (4)</td>
<td>CS</td>
</tr>
<tr>
<td>N/C (5)</td>
<td>&#8211;</td>
</tr>
<tr>
<td>Clock (6)</td>
<td>CLK</td>
</tr>
</tbody>
</table>
<p>We used our <a href="http://buspirate.com">Bus Pirate universal serial interface</a> to demonstrate the Futaba VFD, but the interface operations will be the same for any microcontroller implementation. The connections we made between the VFD and the Bus Pirate are shown in the table above.</p>
<p>We setup the Bus Pirate for raw2wire mode (menu M, 7) with <a href="http://hackaday.com/2009/07/01/mixed-voltage-interfacing-with-the-bus-pirate/">open drain outputs</a> (HiZ). The open drain outputs let us interface the 5volt VFD from the 3.3volt Bus Pirate using the on-board pull-up resistors (menu P, 2). Finally, we enabled the on-board power supply (capital ‘W’).</p>
<p>The VFD&#8217;s strobe pin is connected to the Bus Pirate CS pin.  The auxiliary pin doesn&#8217;t have it&#8217;s own pull-up resistor but CS does. CS is otherwise unused in raw2wire mode, so we reassigned the auxiliary commands to the CS pin (menu C,2).</p>
<p><em>Interfacing</em></p>
<p><em><img class="alignnone size-full wp-image-12648" title="vfd-serial" src="http://hackadaycom.files.wordpress.com/2009/07/vfd-serial.png?w=470&#038;h=193" alt="vfd-serial" width="470" height="193" /><br />
</em></p>
<p>The two-wire interface uses a straight-forward 16bit (2byte)  protocol (datasheet page 20). The LCD control bits (R/W, RS) go in the first byte, and eight data bits go in the second. All transactions start with  strobe low and end with strobe high. Read operations are similar to writes, except the  R/W bit is set and the second byte is read.</p>
<p><img class="alignnone size-full wp-image-12649" title="vfd-command.pg27." src="http://hackadaycom.files.wordpress.com/2009/07/vfd-command-pg27.png?w=470&#038;h=197" alt="vfd-command.pg27." width="470" height="197" /></p>
<p>The Futaba VFD accepts all the standard HD44780 LCD commands (datasheet page 27), see  <a href="http://ouwehand.net/~peter/lcd/lcd0.shtml#instruction_set">these tables</a> for a detailed description of each command. After a reset (power-up), the VFD expects the first command to be the function set command.</p>
<blockquote><p>RAW2WIRE&gt;@ <strong>&lt;&#8211;start with strobe high</strong><br />
AUX HIGH IMP, READ: 1 <strong>&lt;&#8211; aux pin (CS) is now input, pull-up resistor holds strobe high</strong><br />
RAW2WIRE&gt;a 0b11111000 0b00111000 @ <strong>&lt;&#8211;command</strong><br />
AUX LOW <strong>&lt;&#8211;strobe low</strong><br />
WRITE: 0xF8 <strong>&lt;&#8211;start byte (R/W=0, RS=0)</strong><br />
WRITE: 0&#215;38 <strong>&lt;&#8211;instruction byte (function set)</strong><br />
AUX HIGH IMP, READ: 1 <strong>&lt;&#8211;strobe high</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>Function set configures the data interface length (bit 4), display lines (bit 3), and  brightness/luminescence (bits 1,0).  Before we start we set the strobe pin high (@) in case it&#8217;s currently low. Then, we start the transaction by taking the strobe pin low (a), and send the first byte with the R/W and register select (RS) settings.</p>
<p>The second byte is the command. We set the data interface length to 8bits (bit 4 = 1), but in serial mode this is probably ignored. Our display has multiple lines (bit 3 = 1), and we set brightness to full (bits 1,0 = 0). The sequence concludes when the strobe pin returns high (@).</p>
<blockquote><p>RAW2WIRE&gt;a 0b11111000 0b00001111 @<br />
AUX LOW <strong>&lt;&#8211;strobe low</strong><br />
WRITE: 0xF8 <strong>&lt;&#8211;start byte (R/W=0, RS=0)</strong><br />
WRITE: 0&#215;0F <strong>&lt;&#8211;instruction byte (display on/off control)</strong><br />
AUX HIGH IMP, READ: 1 <strong>&lt;&#8211;strobe high</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>The display ON/OFF command enables the display (bit 3), toggles the cursor (bit 1), and blinks the cursor (bit 0). We enabled the display (bit 3 = 1) with a blinking cursor (bit 1,0 = 1) so it&#8217;s obvious that the display is working.</p>
<blockquote><p>RAW2WIRE&gt;a 0b11111000 0b10000000 @<br />
AUX LOW <strong>&lt;&#8211;strobe low</strong><br />
WRITE: 0xF8 <strong>&lt;&#8211;start byte (R/W=0, RS=0)</strong><br />
WRITE: 0&#215;80 <strong>&lt;&#8211;instruction byte (DDRAM address set)</strong><br />
AUX HIGH IMP, READ: 1 <strong>&lt;&#8211;strobe high</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>Before writing characters to the display we need to position the cursor by sending the DDRAM address set command (0b10000000) summed with the desired cursor position. We set the cursor to the first character on line 1.</p>
<p>The second character on line 1  is located at 0&#215;01. To set this address we&#8217;d send 0b10000001 (0b10000000 +0b00000001).</p>
<p>Character display memory isn&#8217;t linear, the first line starts at 0&#215;00, the second line starts on position 0&#215;40, the third at 0&#215;14, and the last line begins with position 0&#215;54. Most displays have a similar configuration, here&#8217;s some  <a href="http://ouwehand.net/~peter/lcd/lcd0.shtml#visible_ddram">tables for determining the layout of different character displays</a>.</p>
<blockquote><p>RAW2WIRE&gt;a 0b11111010 0&#215;48 0&#215;61 0&#215;63 0&#215;6b 0&#215;20 0&#215;61 0&#215;20 0&#215;44 0&#215;61 0&#215;79 @<br />
AUX LOW <strong>&lt;&#8211;strobe low</strong><br />
WRITE: 0xFA <strong>&lt;&#8211;start byte (R/W=0, RS=1)</strong><br />
WRITE: 0&#215;48 <strong>&lt;&#8211;ASCII letter &#8216;H&#8217;</strong><br />
&#8230;<br />
WRITE: 0&#215;79 <strong>&lt;&#8211;ASCII letter &#8216;y&#8217;</strong><br />
AUX HIGH IMP, READ: 1 <strong>&lt;&#8211;strobe high</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>Finally, we can enter some characters at the position  set with the previous command. Characters are entered as their <a href="http://web.cs.mun.ca/~michael/c/ascii-table.html">ASCII equivalent values</a>. We displayed &#8220;Hack a Day&#8221; with proper capitalization.</p>
<p>Multiple characters can be entered at once, but because the memory space isn&#8217;t contiguous it&#8217;s necessary to manually position the cursor at the beginning of each new line. After writing the last position of line 1, the cursor will advance to the first character of line 3. Use another position command, 0b10010100, to set the cursor to the beginning of line 2 (0b10000000 + 0&#215;14 = 0b10010100).</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
<p><strong>Hack a Day review disclosure: We bought the serial VFD demonstrated here on eBay, Futaba also sent us a sample with a parallel interface that we&#8217;ll demo later (<a href="http://hackaday.com/2009/07/02/how-to-bus-pirate-probe-cable/">shown here</a>).</strong></p>
<p><strong><img class="alignnone size-full wp-image-12655" title="futuba-serial.ii" src="http://hackadaycom.files.wordpress.com/2009/07/futuba-serial-ii.jpg?w=470&#038;h=283" alt="futuba-serial.ii" width="470" height="283" /><br />
</strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/11016/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/11016/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/11016/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/11016/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/11016/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/11016/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/11016/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/11016/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/11016/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/11016/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=11016&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/07/13/parts-4x20-vfd-character-display-na204sd02/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/futuba-serial.jpg" medium="image">
			<media:title type="html">futuba-serial</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/vfd-serial.png" medium="image">
			<media:title type="html">vfd-serial</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/vfd-command-pg27.png" medium="image">
			<media:title type="html">vfd-command.pg27.</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/futuba-serial-ii.jpg" medium="image">
			<media:title type="html">futuba-serial.ii</media:title>
		</media:content>
	</item>
		<item>
		<title>Photo interrupters explained</title>
		<link>http://hackaday.com/2009/07/12/photo-interrupters-explained/</link>
		<comments>http://hackaday.com/2009/07/12/photo-interrupters-explained/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 14:49:50 +0000</pubDate>
		<dc:creator>Caleb Kraft</dc:creator>
				<category><![CDATA[led hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[interrupter]]></category>
		<category><![CDATA[ir led]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=12635</guid>
		<description><![CDATA[
[Eric] sent in this very informative writup on how to use Photo interrupters. These things can be used for many things, he lists pellet dispensing and limit switches. He found one in his junk box and realized he knew very little about it. After some exploring and research, he&#8217;s here to educate the rest of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12635&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-12634" title="img_0147 (Custom)" src="http://hackadaycom.files.wordpress.com/2009/07/img_0147-custom.jpg?w=475&#038;h=356" alt="img_0147 (Custom)" width="475" height="356" /></p>
<p>[Eric] sent in this very informative writup on <a href="http://cirictech.com/?p=51">how to use Photo interrupters</a>. These things can be used for many things, he lists pellet dispensing and limit switches. He found one in his junk box and realized he knew very little about it. After some exploring and research, he&#8217;s here to educate the rest of us. There&#8217;s a good breakdown of the circuit itself which is pretty simple as well as a test circuit and some sample code.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/12635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/12635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/12635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/12635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/12635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/12635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/12635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/12635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/12635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/12635/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12635&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/07/12/photo-interrupters-explained/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Caleb Kraft</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/img_0147-custom.jpg" medium="image">
			<media:title type="html">img_0147 (Custom)</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: Ferrite beads</title>
		<link>http://hackaday.com/2009/07/06/parts-ferrite-beads/</link>
		<comments>http://hackaday.com/2009/07/06/parts-ferrite-beads/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:05:44 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[choosing parts]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[ferrite beads]]></category>
		<category><![CDATA[impedance]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=12196</guid>
		<description><![CDATA[
Ferrite beads (L1 in the photo) filter high frequency power supply noise by converting it into a tiny amount of heat. Power supply noise can cause various problems for many parts, especially in analog audio and display circuits.
Ferrite beads are simple, but choosing one can be confusing because they&#8217;re not commonly used by hobbyists. Most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12196&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-12463" title="ferrite-bead.ii" src="http://hackadaycom.files.wordpress.com/2009/07/ferrite-bead-ii.jpg?w=470&#038;h=306" alt="ferrite-bead.ii" width="470" height="306" /></p>
<p><a href="http://en.wikipedia.org/wiki/Ferrite_bead">Ferrite beads</a> (L1 in the photo) filter high frequency power supply noise by converting it into a tiny amount of heat. Power supply noise can cause various problems for many parts, especially in analog audio and display circuits.</p>
<p>Ferrite beads are simple, but choosing one can be confusing because they&#8217;re not commonly used by hobbyists. Most designs will still work if you omit the ferrite bead(s),  but beads are so cheap there&#8217;s no reason to sacrifice the added reliability they provide. We describe how we pick ferrite beads for <a href="http://hackaday.com/category/how-to/">our projects</a> after the break.</p>
<p><span id="more-12196"></span></p>
<p>A ferrite bead is rated for current, impedance, and resistance; see this <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMvgExXaNlWje3%252bUuZptDS8sff%2f6%252b36uVLk%3d">Mouser listing</a> for an example. Unless a datasheet or circuit requests specific bead characteristics, we choose a bead  rated for  sufficient current, and  ignore the impedance and resistance values.</p>
<p>If the bead is for a power supply, we determine the maximum possible current the circuit will  use and find a bead rated for double that amount. Last week we  calculated the <a href="http://hackaday.com/2009/06/25/how-to-the-bus-pirate-v2-with-usb/">the Bus Pirate&#8217;s</a> worst-case current consumption as 525ma, so we looked at beads rated for at least 1000ma. We used <a href="http://www.mouser.com/Search/ProductDetail.aspx?R=BLM21PG331SN1Dvirtualkey64800000virtualkey81-BLM21P331SG">this one</a>, which is rated for 1500ma and costs 10 cents.</p>
<p>Sometimes a ferrite bead is used to filter the power supply for one specific part of a circuit. We used a dedicated bead  to filter the LCD bias voltage on the <a href="http://hackaday.com/2009/01/08/how-to-digital-picture-frame-100-diy/">DIY digital picture frame</a>, and with the  ENC28J60&#8217;s ethernet transceiver on the <a href="http://hackaday.com/2008/09/25/web-server-on-a-business-card-part-2/">web server on a business card</a>. These parts only consume a few milliamps, so we used a smaller <a href="https://www.mouser.com/Search/ProductDetail.aspx?R=BLM21BB600SN1Dvirtualkey64800000virtualkey81-BLM21BB600SN1D">200ma ferrite bead</a> ($0.11).</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/12196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/12196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/12196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/12196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/12196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/12196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/12196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/12196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/12196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/12196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=12196&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/07/06/parts-ferrite-beads/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/07/ferrite-bead-ii.jpg" medium="image">
			<media:title type="html">ferrite-bead.ii</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: SPI EEPROM (25AA/25LC)</title>
		<link>http://hackaday.com/2009/06/30/parts-spi-eeprom-25aa25lc/</link>
		<comments>http://hackaday.com/2009/06/30/parts-spi-eeprom-25aa25lc/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 18:14:10 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[data storage]]></category>
		<category><![CDATA[eeprom]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=10553</guid>
		<description><![CDATA[
Microchip&#8217;s 25AA/25LC EEPROMs are data storage chips with a simple 3-wire interface. The 25AA/LC is an SPI version of the common 24AA/LC I2C EEPROM.  It comes in capacities of 128bytes to 128kilobytes. We looked at the smallest, the 128byte  25AA010A.
There are Bus Pirate demonstrations for most types of serial EEPROMs. Check out our previous [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10553&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-12192" title="3EEPROM-SPI" src="http://hackadaycom.files.wordpress.com/2009/06/3eeprom-spi.jpg?w=470&#038;h=343" alt="3EEPROM-SPI" width="470" height="343" /></p>
<p>Microchip&#8217;s <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&amp;nodeId=2697">25AA/25LC</a> <a href="http://en.wikipedia.org/wiki/EEPROM">EEPROMs</a> are data storage chips with a simple 3-wire interface. The 25AA/LC is an <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI</a> version of the common <a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/#EEPROM">24AA/LC I2C EEPROM</a>.  It comes in capacities of 128bytes to 128kilobytes. We looked at the smallest, the 128byte  <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en025533">25AA010A</a>.</p>
<p>There are Bus Pirate demonstrations for most types of serial EEPROMs. Check out our previous 1-wire (<a href="http://hackaday.com/2008/12/24/parts-1k-1-wire-eeprom-ds2431/">DS2431</a>) and I2C (<a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/#EEPROM">24LC1025</a>) EEPROM posts.</p>
<p>Continue below to see our test circuit and a demonstration of the 25AA010 EEPROM. We used <a href="http://www.buspirate.com/">the Bus Pirate</a> to play with this chip from our PC.  For a limited time you can <a href="http://hackaday.com/2009/06/25/bus-pirate-preorders-open/">get your own Bus Pirate</a>, fully assembled and shipped worldwide, for only $30.</p>
<p><span id="more-10553"></span><br />
<img class="alignnone size-full wp-image-10611" title="25aa" src="http://hackadaycom.files.wordpress.com/2009/04/25aa.png?w=446&#038;h=217" alt="25aa" width="446" height="217" /></p>
<p><strong><a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en025533">25AA010A</a> SPI EEPROM memory, 128bytes (<a href="http://octopart.com/parts/search?q=25AA010A">Octopart search</a>, $0.70). <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/21832E.pdf">Datasheet</a> (PDF).</strong></p>
<p>The schematic above shows a simple test circuit that should work with any 25AA/25LC SPI EEPROM. It&#8217;s a good idea to use a 0.1uF decoupling capacitor (C1) on the power pin in a real circuit, but we didn&#8217;t use one for our demonstration. We also connected the write protect (WP) and hold (HOLD) pins to the supply voltage (V+) to  disable these features.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>25AA/LC (pin #)</strong></td>
</tr>
<tr>
<td>CS</td>
<td>CS (1)</td>
</tr>
<tr>
<td>MISO</td>
<td>SO (2)</td>
</tr>
<tr>
<td>MOSI</td>
<td>SI (5)</td>
</tr>
<tr>
<td>CLK</td>
<td>SCK (6)</td>
</tr>
<tr>
<td>V+</td>
<td>WP (3)</td>
</tr>
<tr>
<td>V+</td>
<td>HOLD (7)</td>
</tr>
<tr>
<td>V+ (3.3volts)</td>
<td>VCC (8)</td>
</tr>
<tr>
<td>GND</td>
<td>GND (4)</td>
</tr>
<tr>
<td>Vpullup</td>
<td>VCC (8)</td>
</tr>
</tbody>
</table>
<p>We used our <a href="http://wwww.buspirate.com">Bus Pirate universal serial interface</a> to demonstrate this chip, but the command sequences will be the same for any setup. We connected the Bus Pirate to the 25AA010 as shown in the table above. We setup the Bus Pirate for SPI mode (M, 5) with normal outputs, and enabled the on-board power supply (capital ‘W’).</p>
<p>25AA parts work from 1.8volts to 5.5volts, 25LC parts have a 2.5volt minimum. We used a 3.3volt supply to power the chip, and interfaced it using the Bus Pirate&#8217;s normal 3.3volt pin outputs.</p>
<p>You could also power the chip from the Bus Pirate&#8217;s 5volt supply. Interface the chip at 5volts by choosing open drain pin type (HiZ) during the mode configuration, then hold the bus high with pull-up resistors connected to 5volts.</p>
<p><em>Interfacing</em></p>
<p>Page 7 of the datasheet has a complete list of interface commands. This demonstration shows the minimum operations needed to write and retrieve data.</p>
<blockquote><p>SPI&gt;[0b110] <strong>&lt;&#8211;Bus Pirate command syntax</strong><br />
CS ENABLED <strong>&lt;&#8211; Chip select enabled (0 volts)</strong><br />
WRITE: 0&#215;06 <strong>&lt;&#8211;Write enable command</strong><br />
CS DISABLED <strong>&lt;&#8211; Chip select disabled (V+)</strong><br />
SPI&gt;</p></blockquote>
<p>A valid  write enable command is required before data can be saved to the EEPROM. Enable the chip select signal to wake the chip ([), send the write enable command (0b110 binary, or 0x06 in hexadecimal), and then disable chip select (]).</p>
<blockquote><p>SPI&gt;[0b10 0 1 2 3 4 5] <strong>&lt;&#8211; Bus Pirate command syntax<br />
</strong>CS ENABLED <strong>&lt;&#8211; Chip select enabled (0volts)</strong><br />
WRITE: 0&#215;02 <strong>&lt;&#8211; Write data command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211; Write address (*sometimes 2 bytes)</strong><br />
WRITE: 0&#215;01 <strong>&lt;&#8211; Data to write (5 bytes)</strong><br />
WRITE: 0&#215;02<br />
WRITE: 0&#215;03<br />
WRITE: 0&#215;04<br />
WRITE: 0&#215;05<br />
CS DISABLED <strong>&lt;&#8211; Chip select disabled (V+)</strong><br />
SPI&gt;</p></blockquote>
<p>Store data in the EEPROM by sending the write command (0&#215;02), the address to start writing  (0&#215;00), and the bytes to write (the values 1 to 5).</p>
<p>Up to 16 bytes can be written in a single operation. All writes must be on the same page of memory, see datasheet page 6 for details. EEPROMs larger than 256 bytes use 16 bit (2 byte) addresses.</p>
<blockquote><p>SPI&gt;[0b11 0 r:5] <strong>&lt;&#8211; Bus Pirate command syntax</strong><br />
CS ENABLED <strong>&lt;&#8211; Chip select enabled (0volts)</strong><br />
WRITE: 0&#215;03 <strong>&lt;&#8211;Read data command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;Read address (*sometimes 2 bytes)</strong><br />
BULK READ 0&#215;05 BYTES:<br />
0&#215;01 0&#215;02 0&#215;03 0&#215;04 0&#215;05 <strong>&lt;&#8211; The data we wrote earlier</strong><br />
CS DISABLED <strong>&lt;&#8211; Chip select disabled (V+)</strong><br />
SPI&gt;</p></blockquote>
<p>Read back the values to verify the write operation. Send the read command (0&#215;03) and the address to start reading at (0&#215;00), then read 5 bytes from the chip (r:5). The output should match the values we wrote earlier.</p>
<p>*EEPROMs larger than 256 bytes use 16 bit (2 byte) addresses. Enter a two byte address such as &#8220;0 0&#8243; if you&#8217;re using one of these EEPROMs.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/10553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/10553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/10553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/10553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/10553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/10553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/10553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/10553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/10553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/10553/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10553&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/06/30/parts-spi-eeprom-25aa25lc/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/06/3eeprom-spi.jpg" medium="image">
			<media:title type="html">3EEPROM-SPI</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/04/25aa.png" medium="image">
			<media:title type="html">25aa</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: ShiftBrite RGB LED module (A6281)</title>
		<link>http://hackaday.com/2009/06/29/parts-shiftbrite-rgb-led-module-a6281/</link>
		<comments>http://hackaday.com/2009/06/29/parts-shiftbrite-rgb-led-module-a6281/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 18:00:00 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[led hacks]]></category>
		<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[blinkenlights]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[serial interface]]></category>
		<category><![CDATA[shiftbrite]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=10589</guid>
		<description><![CDATA[
Macetech&#8217;s ShiftBrite is a high-power RGB LED coupled with an Allegro A6281 backpack. The A6281 uses three 10bit pulse-width modulators to mix millions of colors using the red, green, and blue elements in the RGB LED.  Multiple modules can be chained together for bigger projects, like the  ShiftBrite table.
Below the break we demonstrate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10589&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-11066" title="shiftbriteii" src="http://hackadaycom.files.wordpress.com/2009/05/shiftbriteii.jpg?w=450&#038;h=307" alt="shiftbriteii" width="450" height="307" /></p>
<p><a href="http://www.macetech.com/blog/">Macetech&#8217;s</a> <a href="http://macetech.com/blog/node/54">ShiftBrite</a> is a high-power RGB LED coupled with an <a href="http://www.allegromicro.com/en/Products/Part_Numbers/6281/">Allegro A6281</a> backpack. The A6281 uses three 10bit <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">pulse-width modulators</a> to mix millions of colors using the red, green, and blue elements in the RGB LED.  Multiple modules can be chained together for bigger projects, like the  <a href="http://www.youtube.com/watch?v=C7aUaMiqoIE">ShiftBrite table</a>.</p>
<p>Below the break we demonstrate a ShiftBrite module using <a href="http://www.buspirate.com/">the Bus Pirate</a>. For a limited time you can <a href="http://hackaday.com/2009/06/25/bus-pirate-preorders-open/">get your own Bus Pirate</a>, fully assembled and shipped worldwide, for only $30.</p>
<p><span id="more-10589"></span></p>
<p><img class="alignnone size-full wp-image-11067" title="shiftbrite-over" src="http://hackadaycom.files.wordpress.com/2009/05/shiftbrite-over.jpg?w=450&#038;h=356" alt="shiftbrite-over" width="450" height="356" /></p>
<p><strong><a href="http://macetech.com/blog/node/54">ShiftBrite</a> RGB LED module (<a href="http://macetech.com/store/index.php?main_page=product_info&amp;cPath=1&amp;products_id=1">Macetech</a>, $4.99). ShiftBrite <a href="http://docs.macetech.com/doku.php/shiftbrite">datasheet and example code</a>, Allegro <a href="http://www.allegromicro.com/en/Products/Part_Numbers/6281/">A6281</a> <a href="http://www.allegromicro.com/en/Products/Part_Numbers/6281/6281.pdf">datasheet</a> (PDF).</strong></p>
<p>The ShiftBrite module is a complete A6281 development board. It doesn&#8217;t require any extra parts, just a 5-9volt supply.</p>
<p>The A6281 is one of the most complete RGB LED driver ICs, but it&#8217;s only made in a tiny QFN package. The ShiftBrite is a good way to try the A6281 without soldering a small chip.</p>
<p><img class="alignnone size-full wp-image-11999" title="A6281-connect.470" src="http://hackadaycom.files.wordpress.com/2009/06/a6281-connect-470.png?w=470&#038;h=207" alt="A6281-connect.470" width="470" height="207" /></p>
<p>A bunch of A6281 modules can be chained together. Each module repeats all of the serial input signals on separate output pins, so the A6281 will work over long cable runs.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>ShiftBrite </strong></td>
</tr>
<tr>
<td>MOSI</td>
<td>DI</td>
</tr>
<tr>
<td>CLK</td>
<td>CI</td>
</tr>
<tr>
<td>CS</td>
<td>LI</td>
</tr>
<tr>
<td>AUX</td>
<td>EI</td>
</tr>
<tr>
<td>5volts</td>
<td>V+</td>
</tr>
<tr>
<td>Vpullup</td>
<td>V+</td>
</tr>
<tr>
<td>GND</td>
<td>GND</td>
</tr>
</tbody>
</table>
<p>We used our <a href="http://www.buspirate.com">Bus Pirate universal serial interface</a> to demonstrate the ShiftBrite, but the command sequences will be the same for any microcontroller. We connected the Bus Pirate to the ShiftBrite as shown in the table above.</p>
<p>We setup the Bus Pirate for raw3wire mode (M, 8), and chose open drain outputs (Hi-Z) so we can interface the ShiftBrite at 5volts. The Bus Pirate can&#8217;t output 5volts directly, so we enabled the bus pull-up resistors (menu &#8216;p&#8217; in v2) and attached the pull-up resistor voltage input pin to the 5volt supply. Finally, we enabled the on-board power supply (capital ‘W’).</p>
<p><em>Interfacing</em></p>
<p>The LED driver output is only active when the  enable pin (EI) is held low.</p>
<blockquote><p>RAW3WIRE&gt;A <strong>&lt;&#8211; capital &#8216;A&#8217;, EI pin high, output disabled</strong><br />
AUX HIGH<br />
RAW3WIRE&gt;a <strong>&lt;&#8211; small &#8216;a&#8217;, EI pin low, output active</strong><br />
AUX LOW<br />
RAW3WIRE&gt;</p></blockquote>
<p>We used the Bus Pirate&#8217;s auxiliary pin to toggle the A6281&#8217;s enable pin, but you could also bypass this feature by wiring EI directly to ground. A small &#8216;a&#8217; in the Bus Pirate terminal takes the AUX/EI pin connection low, enabling the LED output.</p>
<p><img class="alignnone size-full wp-image-11998" title="A6281-IO.470" src="http://hackadaycom.files.wordpress.com/2009/06/a6281-io-470.png?w=470&#038;h=95" alt="A6281-IO.470" width="470" height="95" /></p>
<p>Two commands update the A6281  settings. The configuration command controls dot correction and  clock settings. The LED pulse-width modulator (PWM) command updates the  three 10bit values that set the red, green, and blue channel brightness. Both commands are  32 bits (4 bytes) long, bit 30  selects the configuration or pulse-width modulator command.  Refer to the chart above, or datasheet page 7.</p>
<p>The interface protocol is like <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI</a>, but the master-input-slave-output pin is unused. Data is sent most significant bit first, starting with bit 31. Commands are sent by clocking 32 bits into the chip and then toggling the latch pin.</p>
<p>Before we can start mixing colors, we need to setup the A628a&#8217;s internal clock and write the dot correction values.</p>
<blockquote><p>RAW3WIRE&gt;0b01000111 0b11110001 0b11111100 0b01111111 ][<br />
WRITE: 0x47 <strong>&lt;--write 32bits of data</strong><br />
WRITE: 0xF1<br />
WRITE: 0xFC<br />
WRITE: 0x7F<br />
CS DISABLED <strong>&lt;--latch pin high</strong><br />
CS ENABLED <strong>&lt;--latch pin low</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>We wrote the values in binary so it's easy to follow along in the table above. Remember that bit 31 is sent first, so the order of bits shown here is opposite of what is shown in the table.</p>
<p>The complete setup command is 32 bits (4 bytes) long. Bit 30 sets this as a configuration command (1). Bit 7 and 8 configure the clock source, value 00 configures the 800KHz internal oscillator (datasheet page 7). Three 7bit 'dot correction' values fine tune the LED color channels if you want to correct a wonky pixel in a large array (see the register locations in the table above). We set all the dot correction values to full (1111111). Several bits trigger test functions or don't have a purpose, these should be entered as 0.</p>
<p>After entering 32 bits, toggle the A6281 latch pin (][) to lock the data into the register. Now that the chip is configured and the output enabled, we can finally play with the LED.</p>
<blockquote><p>RAW3WIRE&gt;0b00111111 0b11111111 0b11111111 0b11111111 ][<br />
WRITE: 0x3F<br />
WRITE: 0xFF<br />
WRITE: 0xFF<br />
WRITE: 0xFF<br />
CS DISABLED<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>First,  turn all the colors to full. Bit 31 (0) is ignored, bit 30 (0) indicates a LED pulse-width modulator update command, and the remaining bits set all three channels to 100%.  The three PWM values control the output intensity of each color as follows: blue (bits 29:20), red (bits 19:10), and green (bits 9:0). Raise and lower the latch pin (][) to end the command.</p>
<p>Next, test each each color individually.</p>
<blockquote><p>RAW3WIRE&gt;0b00111111 0b11110000 0b00000000 0b00000000 ][<br />
WRITE: 0x3F<br />
WRITE: 0xF0<br />
WRITE: 0x00<br />
WRITE: 0x00<br />
CS DISABLED<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>Bit 30 (0) signals an LED PWM  update command, followed by a 100% setting for the blue channel (1111111111) and 0% settings for the red and green channels. When we toggle the latch pin (][) the new values are saved and the LED color changes to blue.</p>
<blockquote><p>RAW3WIRE&gt;0b00000000 0b00001111 0b11111100 0b00000000 ][<br />
WRITE: 0x00<br />
WRITE: 0x0F<br />
WRITE: 0xFC<br />
WRITE: 0x00<br />
CS DISABLED<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>This time we'll set the LED to 100% red. Bit 30 (0) signals an LED PWM update command, followed by a 0% setting for the blue channel, a 100% setting for the red channel (1111111111), and a 0% setting for green.  When we toggle the latch pin (][)  the LED color changes to red.</p>
<blockquote><p>RAW3WIRE&gt;0b00000000 0b00000000 0b00000011 0b11111111 ][<br />
WRITE: 0x00<br />
WRITE: 0x00<br />
WRITE: 0x03<br />
WRITE: 0xFF<br />
CS DISABLED<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>Finally, we set the LED to 100% green. Bit 30 signals an LED PWM update, followed by 0% settings for the blue and red channels, and a 100% setting for the green channel (1111111111).  Toggle the latch pin (][)  and the LED color changes to green.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
<p><strong>Hack a Day review disclosure</strong>: Macetech gave us a couple free <a href="http://hackaday.com/2008/05/08/maker-faire-2008-shiftbright-rgb-led-module/">ShiftBrites at Maker Faire 2008</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/10589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/10589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/10589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/10589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/10589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/10589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/10589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/10589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/10589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/10589/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10589&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/06/29/parts-shiftbrite-rgb-led-module-a6281/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/05/shiftbriteii.jpg" medium="image">
			<media:title type="html">shiftbriteii</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/05/shiftbrite-over.jpg" medium="image">
			<media:title type="html">shiftbrite-over</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/06/a6281-connect-470.png" medium="image">
			<media:title type="html">A6281-connect.470</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/06/a6281-io-470.png" medium="image">
			<media:title type="html">A6281-IO.470</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: I2C real-time clock calendar (PCF8563)</title>
		<link>http://hackaday.com/2009/06/26/parts-i2c-real-time-clock-calendar-pcf8563/</link>
		<comments>http://hackaday.com/2009/06/26/parts-i2c-real-time-clock-calendar-pcf8563/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 19:31:29 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pcf8563]]></category>
		<category><![CDATA[real time clock]]></category>
		<category><![CDATA[rtc]]></category>
		<category><![CDATA[rtcc]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=10587</guid>
		<description><![CDATA[
The PCF8563 is a real-time clock/calendar/alarm chip with an I2C interface. This would be useful in projects  where the primary microcontroller doesn&#8217;t have enough resources for an interrupt driven clock.
We demonstrate the PCF8563 using the Bus Pirate after the break. For a limited time you can get your own Bus Pirate, fully assembled and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10587&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-11059" title="pcf8563" src="http://hackadaycom.files.wordpress.com/2009/05/pcf8563.jpg?w=450&#038;h=300" alt="pcf8563" width="450" height="300" /></p>
<p>The <a href="http://www.nxp.com/#/pip/pip=[pip=PCF8563_6]|pp=[t=pip,i=PCF8563_6]">PCF8563</a> is a <a href="http://en.wikipedia.org/wiki/Real-time_clock">real-time clock</a>/calendar/alarm chip with an <a href="http://en.wikipedia.org/wiki/I%C2%B2C">I2C interface</a>. This would be useful in projects  where the primary microcontroller doesn&#8217;t have enough resources for an interrupt driven clock.</p>
<p>We demonstrate the PCF8563 using <a href="http://www.buspirate.com">the Bus Pirate</a> after the break. For a limited time you can <a href="http://hackaday.com/2009/06/25/bus-pirate-preorders-open/">get your own Bus Pirate</a>, fully assembled and shipped worldwide, for only $30.</p>
<p><span id="more-10587"></span><img class="alignnone size-full wp-image-10606" title="pcf8563" src="http://hackadaycom.files.wordpress.com/2009/04/pcf8563.png?w=450&#038;h=154" alt="pcf8563" width="450" height="154" /></p>
<p><strong><a href="http://www.nxp.com/#/pip/pip=[pip=PCF8563_6]|pp=[t=pip,i=PCF8563_6]">PCF8563</a> real-time clock calendar (<a href="http://octopart.com/parts/search?q=pcf8563">Octopart search</a>, $1.33). <a href="http://www.nxp.com/acrobat/datasheets/PCF8563_6.pdf">Datasheet</a> (PDF).</strong></p>
<p>The schematic above shows a bare-bones circuit for the PCF8563. It requires a simple external  oscillator circuit with a <a href="http://mouser.com/Search/ProductDetail.aspx?R=AB26T-32.768KHZvirtualkey52750000virtualkey815-AB26T-32.768KHZ">32.768khz watch crystal</a> (Q1). The oscillator input pin needs an external capacitor (C1, 12pF), but the oscillator output pin already has an internal capacitor.  C2 is a 0.1uf decoupling capacitor for the power supply pin. The power supply can be 1.5 to 5.5volts.</p>
<p>The datasheet also recommends a diode on the voltage input. We didn&#8217;t use this in our test.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>PCF8563 (pin #)</strong></td>
</tr>
<tr>
<td>GND</td>
<td>GND (4)</td>
</tr>
<tr>
<td>MOSI</td>
<td>SDA (5)</td>
</tr>
<tr>
<td>CLK</td>
<td>SCL (6)</td>
</tr>
<tr>
<td>3.3volts or 5volts</td>
<td>V+ (8)</td>
</tr>
<tr>
<td>Vpullup</td>
<td>V+ (8)</td>
</tr>
</tbody>
</table>
<p>We used our <a href="http://www.buspirate.com">Bus Pirate universal serial interface</a> to demonstrate this chip, but the transaction sequence will be the same for any microcontroller implementation. We connected the Bus Pirate to the PCF8563 as shown in the table above. We setup the Bus Pirate for I2C mode (M, 4) , and enabled the on-board power supply (capital ‘W’).</p>
<p>Don&#8217;t forget that you need <a href="http://en.wikipedia.org/wiki/Pull-up_resistor">pull-up resistors</a> somewhere on the I2C bus. If you&#8217;re using a Bus Pirate, attach the Vpullup input to the circuit power supply then press p to configure the pullup resistors (or attach the pull-up jumpers for hardware v1a).</p>
<p><em>Interface</em></p>
<blockquote><p>I2C&gt;(1)<strong>&lt;&#8211;search I2C address macro</strong><br />
Searching 7bit I2C address space.<br />
Found devices at:<br />
0xA2 0xA3<br />
I2C&gt;</p></blockquote>
<p>The PCF8563 I2C  write address is 0xa2, and the read address is 0xa3. You can find this in the datasheet, or use the Bus Pirate search macro (1) to check all possible addresses.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Address | </strong></td>
<td><strong> Register name | </strong></td>
<td><strong>Bits</strong></td>
</tr>
<tr>
<td>0&#215;00</td>
<td>control_status_1</td>
<td></td>
</tr>
<tr>
<td>0&#215;01</td>
<td>control_status_2</td>
<td></td>
</tr>
<tr>
<td>0&#215;02</td>
<td>VL_seconds</td>
<td>(0:6)</td>
</tr>
<tr>
<td>0&#215;03</td>
<td>minutes</td>
<td>(0:6)</td>
</tr>
<tr>
<td>0&#215;04</td>
<td>hours</td>
<td>(0:5)</td>
</tr>
<tr>
<td>0&#215;05</td>
<td>days</td>
<td>(0:5)</td>
</tr>
<tr>
<td>0&#215;06</td>
<td>weekdays</td>
<td>(0:2)</td>
</tr>
<tr>
<td>0&#215;07</td>
<td>months</td>
<td>(0:4)</td>
</tr>
<tr>
<td>0&#215;08</td>
<td>years</td>
<td>(0:7)</td>
</tr>
<tr>
<td colspan="3"><em>(see datasheet page 6)</em></td>
</tr>
</tbody>
</table>
<p>This RTC has 16 one-byte registers that configure the clock, and set/retrieve the time. Bytes 0-8, shown in the table above, contain status and time information. The upper 7 bytes configure an alarm, timers, and other advanced features. We&#8217;re just going to focus on the clock functions.</p>
<p>The registers are accessed just like an <a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/#EEPROM">I2C EEPROM</a>. Write values by sending the I2C write address (0xa2), the address to start writing (0-15), and the data bytes(s) to write.</p>
<p>Read values from the chip in two steps. First, use the write command to position the read pointer, but don&#8217;t send any data bytes. Second, use the read address (0xa3) to read bytes starting at the position set during the write command.</p>
<blockquote><p>I2C&gt;{<em>0xa2</em> <strong>2</strong> <span style="text-decoration:underline;">0 30 12 31 1 5 9</span> }<br />
I2C START CONDITION<br />
WRITE: 162 GOT ACK: YES <strong>&lt;&#8211;I2C write address (0xa2=162)</strong><br />
WRITE: 2 GOT ACK: YES <strong>&lt;&#8211;register to begin writing</strong><br />
WRITE: 0 GOT ACK: YES <strong>&lt;&#8211;seconds (0)</strong><br />
WRITE: 30 GOT ACK: YES <strong>&lt;&#8211;minutes (30)</strong><br />
WRITE: 12 GOT ACK: YES <strong>&lt;&#8211;hours (12/noon)</strong><br />
WRITE: 31 GOT ACK: YES<strong>&lt;&#8211;day of the month (31)</strong><br />
WRITE: 1 GOT ACK: YES <strong>&lt;&#8211;day of the week (1/Sunday)</strong><br />
WRITE: 5 GOT ACK: YES <strong>&lt;&#8211;month (5/May)</strong><br />
WRITE: 9 GOT ACK: YES <strong>&lt;&#8211;year (09/2009)</strong><br />
I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>Set the time by writing to registers 0&#215;02 to 0&#215;08. The values are entered in binary coded decimal format, with all numerical date representations being fairly standard (see datasheet pages 6-9). We set the time to 12:30:00 May 31, 2009.</p>
<p>First, send an I2C start condition to tell the chip to listen for its address (Bus Pirate command {). Next, send the PFC8563 write address (<em>0xa2</em>), and set the write pointer to the seconds register (<strong>2</strong>). Finally, write 7 bytes of data to the time registers at addresses 2-8. End the transaction with an I2C stop condition (Bus Pirate command }).</p>
<blockquote><p>I2C&gt;{0xa2 2 { 0xa3 r:7}<br />
I2C START CONDITION<br />
WRITE: 162 GOT ACK: YES <strong>&lt;&#8211;send write address (0xa2=162)</strong><br />
WRITE: 2 GOT ACK: YES <strong>&lt;&#8211;set pointer to register 2, seconds</strong><br />
I2C START CONDITION <strong>&lt;&#8211;repeated start condition</strong><br />
WRITE: 163 GOT ACK: YES <strong>&lt;&#8211;send read address (0xa3=163)</strong><br />
BULK READ 7 BYTES: <strong>&lt;&#8211;read back 7 bytes</strong><br />
17 31 12 31 1 5 9 <strong>&lt;&#8211;time: 12:31:17 Sunday, May 31, 2009</strong><br />
I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>We set the Bus Pirate&#8217;s output mode  to decimal (menu &#8216;o&#8217;) before reading the time. This displays the values in the more familiar decimal format.</p>
<p>Retrieving the time takes two steps. First, a partial write transaction sets the memory location to read. Then, instead of sending any data, send a second start condition ({) and the PCF8563 I2C read address (0xa3) to put the chip in read mode. Finally, read 7 bytes (r:7) from registers 2 to 8. The output shows that a minute has passed since we set the time.</p>
<blockquote><p>I2C&gt;{0xa2 2 { 0xa3 r:7}<br />
I2C START CONDITION<br />
WRITE: 162 GOT ACK: YES <strong>&lt;&#8211;send write address (0xa2=162)</strong><br />
WRITE: 2 GOT ACK: YES <strong>&lt;&#8211;set pointer to register 2, seconds</strong><br />
I2C START CONDITION <strong>&lt;&#8211;repeated start condition</strong><br />
WRITE: 163 GOT ACK: YES <strong>&lt;&#8211;send read address (0xa3=163)</strong><br />
BULK READ 7 BYTES: <strong>&lt;&#8211;read back 7 bytes</strong><br />
34 32 12 31 <em>33</em> <strong>37</strong> 9 <strong>&lt;&#8211;day of week (33) and month (37) appear wrong<br />
</strong>I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>Sometimes the chip appears to return garbage results. The above output is actually a valid time reading, even though it&#8217;s obviously not the 33rd day of the week or the 37th month of the year.</p>
<p>Each register has several &#8216;do not care&#8217; bits (see datasheet page 6). In most devices  &#8216;do not care&#8217; bits are always set to 0, but the PCF8563 appears to use them in some time keeping capacity.</p>
<p>Day of week reads 33, or 0b00100001 in binary. If we ignore the upper 5 bits we get 0b001, or 1/Sunday, the proper day of the week. Similarly, ignore the upper three bits of month (37 = 0b00100101), giving 0b00101 or 5/May.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/10587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/10587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/10587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/10587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/10587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/10587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/10587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/10587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/10587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/10587/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=10587&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/06/26/parts-i2c-real-time-clock-calendar-pcf8563/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/05/pcf8563.jpg" medium="image">
			<media:title type="html">pcf8563</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/04/pcf8563.png" medium="image">
			<media:title type="html">pcf8563</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: Programmable gain amplifier (MCP6S26)</title>
		<link>http://hackaday.com/2009/03/30/parts-programmable-gain-amplifier-mcp6s26/</link>
		<comments>http://hackaday.com/2009/03/30/parts-programmable-gain-amplifier-mcp6s26/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 17:00:38 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[digital audio hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[MCP6S26]]></category>
		<category><![CDATA[programmable gain amplifier]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8944</guid>
		<description><![CDATA[
Microchip&#8217;s MCP6S21/2/6/8 are programmable gain amplifiers that multiply an input voltage by a factor of 1, 2, 4, 5, 8, 10, 16, and 32. The MCP6S22/6/8 also have selectable input channels for working with different signal sources. The multiplication factor and input channel are configured through an SPI interface. This chip is useful for multiplying [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8944&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-8947" title="mcp6s26" src="http://hackadaycom.files.wordpress.com/2009/03/mcp6s26.jpg?w=450&#038;h=339" alt="mcp6s26" width="450" height="339" /></p>
<p>Microchip&#8217;s <span><a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010485">MCP6S21/2/6/8</a> are programmable gain amplifiers that multiply an input voltage by a factor of 1, 2, 4, 5, 8, 10, 16, and 32. The MCP6S22/6/8 also have selectable input channels for working with different signal sources. The multiplication factor and input channel are configured through an <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI</a> interface. This chip is useful for multiplying a small input signal, and selecting among several analog input sources. We demonstrate the six channel MCP6S26 below.<br />
</span></p>
<p><span id="more-8944"></span><img class="alignnone size-full wp-image-8945" title="mcp6s26" src="http://hackadaycom.files.wordpress.com/2009/03/mcp6s26.png?w=452&#038;h=218" alt="mcp6s26" width="452" height="218" /></p>
<p><strong><a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010485">MCP6S26</a> programmable gain amplifier (<a href="http://www.mouser.com/Search/Refine.aspx?Keyword=MCP6S26">Mouser search</a>, <a href="http://octopart.com/search?q=MCP6S26">Octopart search</a>, $2.56) <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/21117a.pdf">Datasheet</a> (PDF).</strong></p>
<p>We tested the chip in the circuit shown above with a 3.3volt power supply. A resistor voltage divider (R1-4) outputs a fraction of the supply on channels 0, 2, and 4. We used 5K resistors, but the value isn&#8217;t critical. The divider outputs 2.4volts on channel 0, 1.6volts on channel 2, and 0.8volts on channel 4.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>DS1801 (pin #)</strong></td>
</tr>
<tr>
<td>ADC</td>
<td>VOUT (1)</td>
</tr>
<tr>
<td>GND</td>
<td>VREF (8)</td>
</tr>
<tr>
<td>GND</td>
<td>VSS (9)</td>
</tr>
<tr>
<td>CS</td>
<td>CS (10)</td>
</tr>
<tr>
<td>MOSI</td>
<td>SI (11)</td>
</tr>
<tr>
<td>MISO</td>
<td>SO (12)</td>
</tr>
<tr>
<td>CLOCK</td>
<td>SCK (13)</td>
</tr>
<tr>
<td>+3.3V</td>
<td>VDD (13)</td>
</tr>
</tbody>
</table>
<p>We used our <a href="http://www.buspirate.com">Bus Pirate universal serial interface</a> to demonstrate this chip, but the transaction sequence will be the same for any microcontroller implementation. We connected the Bus Pirate to the MCP6S26 as shown in the table above. We setup the Bus Pirate for raw3wire mode (M, 8) with normal outputs, and enabled the on-board power supply (capital &#8216;W&#8217;).</p>
<blockquote><p>RAW3WIRE&gt;[0b01000001 0] d<br />
CS ENABLED <strong>&lt;&#8211;begin SPI transaction</strong><br />
WRITE: 0&#215;41 <strong>&lt;&#8211;change input channel command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;change to channel 0</strong><br />
CS DISABLED <strong>&lt;&#8211;end SPI transaction</strong><br />
VOLTAGE PROBE: 2.4VOLTS <strong>&lt;&#8211;Vout voltage measurement</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>Writing 0b01000001 (0&#215;41) followed by a channel number changes the active MCP6S26 input. &#8216;[' lowers the chip select line to start an SPI transaction. We send the change channel command (0x41) followed by 0 to select input 0.  ']&#8216; raises the chip select line to end the SPI transaction. &#8216;d&#8217; takes a voltage measurement and shows that input 0 with 0 gain is 2.4volts.</p>
<p>We can&#8217;t amplify the input voltage beyond the power supply (2.4volts * 2 = 4.8, 4.8volts &gt; 3.3volts), so we need to change to a lower channel to play with the gain features.</p>
<blockquote><p>RAW3WIRE&gt;[0b01000001 4] d<br />
CS ENABLED<br />
WRITE: 0&#215;41<strong> &lt;&#8211;change input channel command</strong><br />
WRITE: 0&#215;04 <strong>&lt;&#8211;change to channel 4</strong><br />
CS DISABLED<br />
VOLTAGE PROBE: 0.8VOLTS <strong>&lt;&#8211;Vout voltage measurement</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>A measurement on channel 4 shows an output of just 0.8volts, plenty of room to test the gain features of the chip.</p>
<blockquote><p>RAW3WIRE&gt;[0b01000000 0b00000001] d<br />
CS ENABLED<br />
WRITE: 0&#215;40 <strong>&lt;&#8211;change gain command</strong><br />
WRITE: 0&#215;01 <strong>&lt;&#8211;gain setting (x2)</strong><br />
CS DISABLED<br />
VOLTAGE PROBE: 1.6VOLTS <strong>&lt;&#8211;Vout is now 0.8volts * 2</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>A two-byte sequence sets the amount of gain. The command 0b01000000 (0&#215;40) addresses the gain register, the second byte sets the multiplication factor (0&#215;01= gain of 2). Setting the gain to 2 multiplies the output voltage by 2, 0.8volts * 2 = 1.6volts.</p>
<blockquote><p>RAW3WIRE&gt;[0b01000000 0b00000010] d<br />
CS ENABLED<br />
WRITE: 0&#215;40 <strong>&lt;&#8211;change gain command</strong><br />
WRITE: 0&#215;02 <strong>&lt;&#8211;gain setting (x4)</strong><br />
CS DISABLED<br />
VOLTAGE PROBE: 3.2VOLTS <strong>&lt;&#8211;Vout is now 0.8volts * 4</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>This time we set a gain of 4, 0.8volts * 4 = 3.2volts.</p>
<blockquote><p>RAW3WIRE&gt;[0b01000000 0b00000011] d<br />
CS ENABLED<br />
WRITE: 0&#215;40 <strong>&lt;&#8211;change gain command</strong><br />
WRITE: 0&#215;03 <strong>&lt;&#8211;gain setting (x5)</strong><br />
CS DISABLED<br />
VOLTAGE PROBE: 3.3VOLTS <strong>&lt;&#8211;not enough headroom to reach 0.8volts * 5</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>The maximum output voltage is the chip&#8217;s power supply voltage. If we set the gain to 5, the output voltage can&#8217;t exceed the power supply of 3.3volts  (0.8volts * 5 = 4volts, 4volts &gt; 3.3volts).</p>
<blockquote><p>RAW3WIRE&gt;[0b00100000 0] d<br />
CS ENABLED<br />
WRITE: 0&#215;20 <strong>&lt;&#8211;sleep command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;don&#8217;t care byte</strong><br />
CS DISABLED<br />
VOLTAGE PROBE: 0.0VOLTS <strong>&lt;&#8211;output is disabled</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>The MCP6S26 has a power-saving sleep mode. Shutdown the chip with the command 0&#215;20, followed by any byte value. Leave sleep by sending any valid command.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8944/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8944/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8944/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8944/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8944/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8944/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8944/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8944/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8944/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8944/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8944&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/03/30/parts-programmable-gain-amplifier-mcp6s26/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/mcp6s26.jpg" medium="image">
			<media:title type="html">mcp6s26</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/mcp6s26.png" medium="image">
			<media:title type="html">mcp6s26</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: DS1801 SPI audio volume potentiometer</title>
		<link>http://hackaday.com/2009/03/16/parts-ds1801-spi-audio-volume-potentiometer/</link>
		<comments>http://hackaday.com/2009/03/16/parts-ds1801-spi-audio-volume-potentiometer/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 15:30:41 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[digital audio hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[3 wire]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[ds1801]]></category>
		<category><![CDATA[potentiometer]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8470</guid>
		<description><![CDATA[
Dallas/Maxim&#8217;s DS1801 is an audio volume potentiometer with a simple SPI interface. This chip has two channels of volume control that might be useful in a DIY audio project. We previously looked at the DS1807, a similar part with an I2C interface. This week we&#8217;ll show you how to use the SPI version.
DS1801 SPI digital [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8470&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-8518" title="ds1801" src="http://hackadaycom.files.wordpress.com/2009/02/ds1801.jpg?w=450&#038;h=314" alt="ds1801" width="450" height="314" /></p>
<p>Dallas/Maxim&#8217;s <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2777">DS1801</a> is an audio volume <a href="http://en.wikipedia.org/wiki/Potentiometer">potentiometer </a>with a simple <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus">SPI</a> interface. This chip has two channels of volume control that might be useful in a DIY audio project. We previously looked at the <a href="http://hackaday.com/2009/02/16/parts-i2c-audio-volume-potentiometer-ds1807/">DS1807</a>, a similar part with an I2C interface. This week we&#8217;ll show you how to use the SPI version.</p>
<p><span id="more-8470"></span><strong><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2777">DS1801</a> SPI digital audio volume potentiometer (<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?lang=en&amp;site=US&amp;keywords=ds1801&amp;x=0&amp;y=0">Digikey search</a>, <a href="http://octopart.com/search?q=ds1801">Octopart search</a>, $6.50). <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2777">Datasheet</a> (PDF).</strong></p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>DS1801 (pin #)</strong></td>
</tr>
<tr>
<td>GND</td>
<td>GND (1)</td>
</tr>
<tr>
<td>AUX</td>
<td>RST (3)</td>
</tr>
<tr>
<td>GND</td>
<td>ZCEN (4)</td>
</tr>
<tr>
<td>GND</td>
<td>AGND (11)</td>
</tr>
<tr>
<td>MOSI</td>
<td>D (12)</td>
</tr>
<tr>
<td>Clock</td>
<td>CLK (13)</td>
</tr>
<tr>
<td>+3.3volts</td>
<td>VCC (14)</td>
</tr>
</tbody>
</table>
<p>We connected the DS1801 to our <a href="http://hackaday.com/the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface tool</a> as shown in the table. We used the Bus Pirate to demonstrate this chip, but the same basic procedures apply to any microcontroller. The DS1801 power requirements are flexible, it works at either 3.3volts or 5volts, we used a 3.3volt supply.</p>
<p>The DS1801 has an SPI interface. The data output pin can be used to cascade multiple DS1801s. We used the Bus Pirate&#8217;s SPI mode with default options to interface this chip.</p>
<p><strong><img class="alignnone size-full wp-image-9058" title="1801-spi" src="http://hackadaycom.files.wordpress.com/2009/03/1801-spi.png?w=450&#038;h=163" alt="1801-spi" width="450" height="163" /></strong></p>
<p>The DS1801 SPI protocol is described in figure (a) on page 4 of the datasheet (shown above). Note that the SPI enable signal, called RST on the DS1801, is actually opposite standard notation. Data input is active when RST is high, and inactive when it&#8217;s low.</p>
<p>Each DS1801 has two audio potentiometers with 64 steps of volume control. 0 is full volume, 63 is the lowest volume, position 64 is mute. Setting the volume is really simple; just raise the RST signal, clock in the volume level for each potentiometer, and lower RST to enact the new settings.</p>
<blockquote><p>SPI&gt;A 64 64 a<br />
AUX HIGH <strong>&lt;&#8211;RST pin high</strong><br />
WRITE: 0&#215;40 <strong>&lt;&#8211;mute setting channel 0</strong><br />
WRITE: 0&#215;40 <strong>&lt;&#8211;mute setting channel 1</strong><br />
AUX LOW <strong>&lt;&#8211;RST pin low</strong><br />
SPI&gt;</p></blockquote>
<p>Here, we set both potentiometers to mute (64). First, raise the RST pin to 3.3volts (capital &#8216;A&#8217;, <a href="http://www.w3.org/TR/CSS2/text.html#caps-prop">silly CSS</a>). Next, write the mute setting for each (64 64). Finally, lower the RST pin to enact the new settings (small &#8216;a&#8217;).</p>
<blockquote><p>SPI&gt;A 0 0 a<br />
AUX HIGH<br />
WRITE: 0&#215;00<br />
WRITE: 0&#215;00<br />
AUX LOW<br />
SPI&gt;</p></blockquote>
<p>Now we change both potentiometers to full volume by writing a 0 to each. The sets a resistance level of 0, or 100% of the input volume.</p>
<blockquote><p>SPI&gt;A 0 64 a<br />
AUX HIGH<br />
WRITE: 0&#215;00<br />
WRITE: 0&#215;40<br />
AUX LOW<br />
SPI&gt;</p></blockquote>
<p>Finally, we set a different volume levels on each potentiometer. Pot 0 is at full volume (0), pot 1 is muted (64).</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8470/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8470/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8470/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8470&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/03/16/parts-ds1801-spi-audio-volume-potentiometer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/02/ds1801.jpg" medium="image">
			<media:title type="html">ds1801</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/1801-spi.png" medium="image">
			<media:title type="html">1801-spi</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: 4&#215;4 RGB button pad controller SPI</title>
		<link>http://hackaday.com/2009/03/09/parts-4x4-rgb-button-pad-controller-spi/</link>
		<comments>http://hackaday.com/2009/03/09/parts-4x4-rgb-button-pad-controller-spi/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 18:38:22 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[peripherals hacks]]></category>
		<category><![CDATA[blinkenlights]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[button pad]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[leds]]></category>
		<category><![CDATA[massive fail]]></category>
		<category><![CDATA[monday parts]]></category>
		<category><![CDATA[RGB LED]]></category>
		<category><![CDATA[sparkfun electronics]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8609</guid>
		<description><![CDATA[
We covered SparkFun&#8217;s new RGB button pad controller a few weeks ago. This is a full-color clone of the monome interface; a 4&#215;4 grid of buttons with tri-color LEDs underneath. Each LED has 24bits of color control, for more than 16million color combinations. Up to 10 panels can be chained together to create huge button [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8609&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-8850" title="cover" src="http://hackadaycom.files.wordpress.com/2009/03/cover.jpg?w=450&#038;h=315" alt="cover" width="450" height="315" /></p>
<p>We covered SparkFun&#8217;s new <a href="http://hackaday.com/2009/02/05/sparkfun-releases-rgb-button-controller/">RGB button pad controller</a> a few weeks ago. This is a full-color clone of the <a href="http://monome.org/">monome</a> interface; a 4&#215;4 grid of buttons with tri-color LEDs underneath. Each LED has <a href="http://en.wikipedia.org/wiki/Truecolor">24bits of color control</a>, for more than 16million color combinations. Up to 10 panels can be chained together to create huge button grids, like <a href="http://www.youtube.com/watch?v=G9RPLtAvXlE">SparkFun&#8217;s Tetris table</a>. We previously used a smaller version in our <a href="http://hackaday.com/2008/06/12/how-to-make-an-rgb-combination-door-lock-part-1/">RGB combination lock</a>.</p>
<p>We asked SparkFun to send us the SPI version of the button controller to test. This is a new product developed in-house at SparkFun, with open source hardware and software. Read about our experience interfacing this board below.</p>
<p><span id="more-8609"></span><strong>4&#215;4 RGB button pad controller SPI (SparkFun #<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9022">WIG-09022</a>, $39.95)</strong></p>
<p>The button pad controller is a bare PCB, we also received a button pad cover (SparkFun #<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=7835">COM-07835</a>, $9.95), and two of each bezel (SparkFun #<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8747">COM-08747</a>, #<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8746">COM-08746</a>, $3.95).  The SPI version we&#8217;re working with can be driven directly by a microcontroller, or by a USB &#8216;master&#8217;. The USB controller version has an additional microcontroller and FTDI USB-&gt;serial converter for PC connectivity.</p>
<p>When the button pad arrived, we immediately sat down with the datasheet and tried to interface the board with our <a href="http://hackaday.com/the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface</a>. The protocol described in version 1 of the datasheet didn&#8217;t work, at all.</p>
<p>SparkFun open sourced this project, so we determined the correct interface protocol from the source code for the <a href="http://www.sparkfun.com/Code/ButtonPadControllerSPI_v15.zip">button pad SPI</a> (ZIP) and the <a href="http://www.sparkfun.com/Code/ButtonPadControllerUSB_v15.zip">button pad USB controller</a> (ZIP). We figured out most of the protocol from the source, but it still took help from SparkFun&#8217;s engineers to uncover some of the undocumented, finer points of interfacing the board. Version 2 of the <a href="http://www.sparkfun.com/datasheets/Widgets/ButtonPadControllerSPI_UserGuide_v2.pdf">datasheet</a> (PDF) accurately depicts the interface protocol.</p>
<p><em>Connections</em></p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>Button pad</strong></td>
</tr>
<tr>
<td>MISO</td>
<td>MISO</td>
</tr>
<tr>
<td>MOSI</td>
<td>MOSI</td>
</tr>
<tr>
<td>Clock</td>
<td>SCK</td>
</tr>
<tr>
<td>CS</td>
<td>CS</td>
</tr>
<tr>
<td>+5volts</td>
<td>VCC</td>
</tr>
<tr>
<td>GND</td>
<td>GND</td>
</tr>
</tbody>
</table>
<p>The button pad&#8217;s SPI signals are described as they relate to the on-board microcontroller, which is opposite the usual notation. The MOSI (master out, slave in) signal is actually the board&#8217;s data output, and MISO (master in, slave out) is the data input.</p>
<p>We tested the button pad with the Bus Pirate, but the same basic principals apply to any custom microcontroller code. The board runs at 5volts, so we powered it from the Bus Pirate&#8217;s on-board 5volt power supply. The SPI interface operates at 5volt logic levels, so we connected the Bus Pirate&#8217;s <a href="http://en.wikipedia.org/wiki/Pull-up_resistor">pull-up resistors</a> to the 5volt power supply and enabled them on all signal lines.</p>
<p>We interfaced the button board using the Bus Pirate&#8217;s raw3wire library. Raw3wire is a software SPI library with bit-wise operations. The hardware SPI library only allows full byte operations which aren&#8217;t granular enough to interface the board. We put the Bus Pirate in raw3wire mode (menu option M), and chose the HiZ pin option because the pull-up resistors will hold the bus at 5volts.</p>
<blockquote><p>RAW3WIRE&gt;l <strong>&lt;&#8211;configure bit order</strong><br />
1. MSB first<br />
2. LSB first<br />
MODE&gt;2<strong> &lt;&#8211;least significant bit first</strong><br />
LSB SET: LEAST SIG BIT FIRST<br />
RAW3WIRE&gt;W <strong>&lt;&#8211;enable power supply</strong><br />
VOLTAGE SUPPLIES ON<br />
RAW3WIRE&gt;</p></blockquote>
<p>The button pad communicates least significant bit first, so we also configured the library to communicate LSB first. Finally, we hit capital &#8216;W&#8217; to enable the Bus Pirate&#8217;s power supplies. The button board will flash each color momentarily as part of its power-on self-test.</p>
<p><em>Single/multiple button board setup</em></p>
<p><img class="alignnone size-full wp-image-8966" title="config2" src="http://hackadaycom.files.wordpress.com/2009/03/config2.png?w=450&#038;h=110" alt="config2" width="450" height="110" /></p>
<p>Each board needs to be configured for single or multi-board use. Boards come pre-programmed for single-board operation, but it might be a good idea to set the configuration anyways. The board configuration is permanently stored in EEPROM, so it only has to be done once.</p>
<blockquote><p>RAW3WIRE&gt;[\_ <strong>&lt;--take all signals low</strong><br />
CS ENABLED <strong>&lt;--CS enabled is 0volts</strong><br />
CLOCK, 0<br />
DATA OUTPUT, 0<br />
RAW3WIRE&gt;</p></blockquote>
<p>A special sequence places the board in configuration mode. Begin with all signal lines low (]\_).</p>
<blockquote><p>RAW3WIRE&gt;-^ 1 1 <strong>&lt;&#8211;set single board operation</strong><br />
DATA OUTPUT, 1 <strong>&lt;&#8211;data high</strong><br />
0&#215;01 CLOCK TICKS <strong>&lt;&#8211;one clock tick</strong><br />
WRITE: 0&#215;01 <strong>&lt;&#8211;config option 1, number of boards</strong><br />
WRITE: 0&#215;01 <strong>&lt;&#8211;set the number of boards</strong><br />
RAW3WIRE&gt;w <strong>&lt;&#8211;small &#8216;w&#8217;, power off</strong><br />
VOLTAGE SUPPLIES OFF<br />
RAW3WIRE&gt;W <strong>&lt;&#8211;capital &#8216;W&#8217;, power on</strong><br />
VOLTAGE SUPPLIES ON<br />
RAW3WIRE&gt;</p></blockquote>
<p>To enter configuration mode, take the data line high (-) and send one clock pulse (^), but <em>leave chip select low</em>. The board is now ready to accept configuration settings.</p>
<p>The first byte sent after entering configuration mode tells the board which setting to modify. Currently, only the number of boards can be configured (0&#215;01). Next, send the number of connected boards, between 1 and 10. we sent 1 because we&#8217;re interfacing a single board. Reset the board and it will light a LED corresponding to the programmed number of boards.</p>
<p><em>Set colors and read button status</em></p>
<p>Now we&#8217;re ready to send color data to the board and read the button status. First, note that the CS (chip select) signal is opposite normal conventions. Usually CS activates a chip when the signal is low (0volts), and idles it when the signal is high (5volts); this is usually denoted by /CS, #CS, or !CS. Instead, the button controller is active when CS is high.</p>
<p><img class="alignnone size-full wp-image-8960" title="frames" src="http://hackadaycom.files.wordpress.com/2009/03/frames.png?w=450&#038;h=62" alt="frames" width="450" height="62" /></p>
<p>A 64byte transaction sets the LED colors and retrieves the button status. The first 16bytes program the red level for each LED, followed by 16bytes of green, and 16bytes of blue. Finish by reading 16bytes from the board to get the status of each button. Buttons data is sent as 0&#215;00 if pressed, and 0xff if not pressed. The datasheet recommends a 400us delay between writing the color frames and reading the button data, but the Bus Pirate is slow enough that we won&#8217;t worry about that.</p>
<p><img class="alignnone size-full wp-image-8961" title="inter" src="http://hackadaycom.files.wordpress.com/2009/03/inter.png?w=450&#038;h=130" alt="inter" width="450" height="130" /></p>
<p>The protocol is simple enough, but there&#8217;s one <em>major</em> catch. The clock line <strong><em>must</em></strong> be high before raising CS, or the bytestream will be off by 1 bit. For this reason, many hardware SPI modules won&#8217;t work with the board.  This isn&#8217;t a problem if your microcontroller lets you twiddle  pins that are controlled by a hardware module, but the micros we&#8217;ve worked with <em>don&#8217;t</em> allow this.</p>
<p><img class="alignnone size-full wp-image-8848" title="white" src="http://hackadaycom.files.wordpress.com/2009/03/white.jpg?w=450&#038;h=338" alt="white" width="450" height="338" /></p>
<blockquote><p>RAW3WIRE&gt;/]255:16 255:16 255:16 r:16[<br />
CLOCK, 1 <strong>&lt;--clock <em>must</em> be high prior to raising CS</strong><br />
CS DISABLED <strong>&lt;--CS to 5volts, opposite normal use</strong><br />
BULK WRITE 0xFF , 0x10 TIMES <strong>&lt;--red LEDs</strong><br />
BULK WRITE 0xFF , 0x10 TIMES <strong>&lt;--green LEDs</strong><br />
BULK WRITE 0xFF , 0x10 TIMES <strong>&lt;--blue LEDs</strong><br />
BULK READ 0x10 BYTES: <strong>&lt;--read button state</strong><br />
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF<br />
CS ENABLED <strong>&lt;--CS to 0volts, opposite normal use</strong><br />
RAW3WIRE&gt;</p></blockquote>
<p>This command sets every color of each LED to full, and reads back the 16 button status bytes.</p>
<p>We first set clock high (/), and only then can we raise CS to 5volts (]) and begin the data transaction. 255:16 is a repeated command that sends the value 255  sixteen times. As each color channel has 8bits of intensity control, 255 is 100% on. We send 255 a total of 48 times, once for each color of each LED. Finally, we retrieve one 16byte frame of button data (r:16) and lower CS to end the transaction ([). The button values are all 0xff, indicating that no buttons are pressed.</p>
<p><img class="alignnone size-full wp-image-8849" title="blue" src="http://hackadaycom.files.wordpress.com/2009/03/blue.jpg?w=450&#038;h=310" alt="blue" width="450" height="310" /></p>
<blockquote><p>RAW3WIRE&gt;/] 0:16 0:16 128:16 r:16[<br />
CLOCK, 1<br />
CS DISABLED<br />
BULK WRITE 0x00 , 0x10 TIMES<br />
BULK WRITE 0x00 , 0x10 TIMES<br />
BULK WRITE 0x80 , 0x10 TIMES <strong>&lt;--all blue to 50%</strong><br />
BULK READ 0x10 BYTES:<br />
0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>Here, we set the blue level of every LED to 50% (128) and turn off all other colors. The button output now shows that button 0 is pressed.</p>
<p><img class="alignnone size-full wp-image-8851" title="red" src="http://hackadaycom.files.wordpress.com/2009/03/red.jpg?w=450&#038;h=324" alt="red" width="450" height="324" /></p>
<blockquote><p>RAW3WIRE&gt;/] 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0:16 0:16 r:16[<br />
CLOCK, 1<br />
CS DISABLED<br />
WRITE: 0&#215;00 <strong>&lt;&#8211; red LED 0, off</strong><br />
&#8230;<strong> &lt;&#8211;more of the same</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211; red LED 3, off</strong><br />
WRITE: 0xFF <strong>&lt;&#8211; red LED 4, 100% on</strong><br />
WRITE: 0xFF <strong>&lt;&#8211; red LED 5, 100% on</strong><br />
WRITE: 0xFF<strong> &lt;&#8211; red LED 6, </strong><strong>100% </strong><strong>on</strong><br />
WRITE: 0xFF<strong> &lt;&#8211; red LED 7, </strong><strong>100% </strong><strong>on</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211; red LED 8, off</strong><br />
&#8230; <strong>&lt;&#8211;more of the same</strong><br />
WRITE: 0&#215;00<strong> &lt;&#8211; red LED 15, off</strong><br />
BULK WRITE 0&#215;00 , 0&#215;10 TIMES <strong>&lt;&#8211; all green LEDs off</strong><br />
BULK WRITE 0&#215;00 , 0&#215;10 TIMES <strong>&lt;&#8211;all blue LEDs off</strong><br />
BULK READ 0&#215;10 BYTES: <strong>&lt;&#8211;read button status</strong><br />
0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF<br />
CS ENABLED<br />
RAW3WIRE&gt;</p></blockquote>
<p>This example shows how to address single LEDs. This time we actually write out all 16 bytes of the red color frame. Buttons 0-3 and 8-15 have a red value of 0 (red off), buttons 4-7 are set to 100% red (255). All green and blue LEDs are off (0, 0%).</p>
<p><em>Conclusion</em></p>
<p>It was really frustrating to get this board working because the first version of the datasheet had so many errors. SparkFun&#8217;s engineers and support were really helpful, and posted a corrected datasheet within days. As long as you have the updated datasheet, this is an easy board to work with.</p>
<p>We&#8217;d like to see a firmware update that eliminates the need to keep the clock signal high before raising CS. This quirk makes the board incompatible with many hardware SPI modules, leaving slow bit-bang routines as the only interface option. Fortunately, the source code is open and available to anyone who wants to make this change.</p>
<p>The button pad controller is a really neat board, and we look forward to using it in a future project.</p>
<p><strong>Hack a Day review disclosure</strong>: We asked for a free board and SparkFun sent it to us. We had a terrible time getting it to work with the instructions in the first version of the datasheet, we documented that experience here.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8609/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8609&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/03/09/parts-4x4-rgb-button-pad-controller-spi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/cover.jpg" medium="image">
			<media:title type="html">cover</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/config2.png" medium="image">
			<media:title type="html">config2</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/frames.png" medium="image">
			<media:title type="html">frames</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/inter.png" medium="image">
			<media:title type="html">inter</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/white.jpg" medium="image">
			<media:title type="html">white</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/blue.jpg" medium="image">
			<media:title type="html">blue</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/03/red.jpg" medium="image">
			<media:title type="html">red</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: 32KB SPI SRAM memory (23K256)</title>
		<link>http://hackaday.com/2009/03/02/parts-32kb-spi-sram-memory-23k256/</link>
		<comments>http://hackaday.com/2009/03/02/parts-32kb-spi-sram-memory-23k256/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 18:00:04 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[23k256]]></category>
		<category><![CDATA[32K]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[sram]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8737</guid>
		<description><![CDATA[
Microchip&#8217;s new 23K256 is a serially interfaced 32 kilobyte SRAM memory chip, available in 8 pin DIP and 8 pin SO packages. SRAM, like EEPROM, is a data storage medium. Data stored in SRAM is lost without constant power, but it&#8217;s really fast and there&#8217;s no limits to the number of write cycles. EERPOM stores [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8737&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-8752" title="23k256ii" src="http://hackadaycom.files.wordpress.com/2009/02/23k256ii.jpg?w=450&#038;h=329" alt="23k256ii" width="450" height="329" /></p>
<p>Microchip&#8217;s new <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en539039">23K256</a> is a serially interfaced 32 kilobyte <a href="http://en.wikipedia.org/wiki/Static_random_access_memory">SRAM</a> memory chip, available in 8 pin DIP and 8 pin SO packages. SRAM, like <a href="http://en.wikipedia.org/wiki/EEPROM">EEPROM</a>, is a data storage medium. Data stored in SRAM is lost without constant power, but it&#8217;s really fast and there&#8217;s no limits to the number of write cycles. EERPOM stores data even without power, but it&#8217;s slow and usually limited to around a million write cycles.</p>
<p>32K SRAM chips typically have 15 address lines and 8 data lines, like the <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMt9mBA6nIyysJcHcPKaCSTLEF2cNpGsvgo%3d">IS61LV256AL</a> we used on our <a href="http://hackaday.com/2008/12/11/how-to-programmable-logic-devices-cpld/">CPLD development board</a>.  The 23K256 requires just four signal lines, but sacrifices the speed of a parallel memory interface. It&#8217;s a great way to add extra memory to a low-pin count microcontroller without routing 23 signal traces. We&#8217;ll show you how to interface this chip below.</p>
<p><span id="more-8737"></span><strong>Microchip 23K256, 32K SPI SRAM (<a href="http://www.mouser.com/Search/Refine.aspx?Keyword=23k256">Mouser search</a>, <a href="http://octopart.com/search?q=23k256">Octopart search</a>, $1.48). <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/22100C.pdf">Datasheet</a> <strong>(PDF).</strong></strong></p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>23K256 (pin #)<br />
</strong></td>
</tr>
<tr>
<td>CS</td>
<td>/CS (1)</td>
</tr>
<tr>
<td>MISO</td>
<td>SO (2)</td>
</tr>
<tr>
<td>MOSI</td>
<td>SI (5)</td>
</tr>
<tr>
<td>Clock</td>
<td>SCK (6)</td>
</tr>
<tr>
<td>GND</td>
<td>/HOLD (7)</td>
</tr>
<tr>
<td>GND</td>
<td>VSS (4)</td>
</tr>
<tr>
<td>+3volts</td>
<td>VCC (8)</td>
</tr>
</tbody>
</table>
<p>We connected the 23K256 to our <a href="http://hackaday.com/the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface tool</a> as shown in the table. It&#8217;s very important to power the chip using only the Bus Pirate&#8217;s 3.3volt supply, the 23K256 isn&#8217;t rated for 5volts.</p>
<p>The Bus Pirate is an easy way to learn about a chip without writing any code, but the same principals apply to using the 23K256 with any microcontroller. This demonstration uses the latest version of the Bus Pirate firmware (26-FEB-2009), which you can download from our <a href="http://code.google.com/p/the-bus-pirate/source/browse/">Google Code SVN</a>.</p>
<blockquote><p>HiZ&gt;m <strong>&lt;&#8211;choose mode</strong><br />
1. HiZ<br />
&#8230;<br />
5. SPI<br />
&#8230;<br />
MODE&gt;5 <strong>&lt;&#8211;SPI mode</strong><br />
MODE SET<br />
&#8230; <strong>&lt;&#8211;30KHz, all default settings</strong><br />
SPI READY<br />
SPI&gt;W <strong>&lt;&#8211;capital &#8216;W&#8217; enables power supplies</strong><br />
VOLTAGE SUPPLIES ON<br />
SPI&gt;</p></blockquote>
<p>First, we put the Bus Pirate into SPI mode at 30KHz and chose the default settings for all options. We enabled the Bus Pirate&#8217;s on-board 3.3volt power supply with a capital &#8216;W&#8217;.</p>
<p><em>Configuration register</em></p>
<p>bit 7,6 = byte (00) page (10) sequence (01) mode<br />
bit 0 = Hold disabled (1)</p>
<p>Data is stored inside the 23K256 in 1024 pages that each contain 32bytes. The scope of reads and writes is set by bit 7 and 6 of the configuration register. Storage can be accessed by the byte (00), by 32byte pages (10), or sequentially through the entire 32K (01).  We&#8217;ll work in sequence mode, which gives us access to read and write any length of data, anywhere in the 32K of storage space.</p>
<p>The hold pin is used to pause transfers when other chips on the same bus need to be accessed. Bit 0 of the configuration register controls the hold pin. When set to 1, the hold pin is disabled. We tied hold to ground for normal operation, but its functionality can be completely disabled by setting bit 0.</p>
<p>The configuration register is changed by sending the <em>write configuration command</em> (0b00000001) and the new settings.</p>
<blockquote><p>SPI&gt;[<em>0b1</em> <strong>0b01000001</strong>] <strong>&lt;&#8211;update config register</strong><br />
CS ENABLED<br />
WRITE: 0&#215;01<strong> &lt;&#8211;write config command</strong><br />
WRITE: 0&#215;41<strong> &lt;&#8211;value to write</strong><br />
CS DISABLED<br />
SPI&gt;</p></blockquote>
<p>We start an SPI transaction by enabling the 23K256 chip select line ([). We send the write configuration command (<em>0b1, 0x01, or 1</em>), followed by the new settings for the configuration register (<strong>0b01000001, 0x41</strong>). We set bit 6 for sequential access mode, and set bit 0 to disable the hold pin function. Bits 5-1 have no function, but the datasheet says to always write 0. The transaction concludes by disabling the chip select signal (]).</p>
<blockquote><p>SPI&gt;[<em>0b101</em> <strong>r</strong>]<br />
CS ENABLED<br />
WRITE: 0&#215;05 <strong>&lt;&#8211;read config register</strong><br />
READ: 0&#215;41 <strong>&lt;&#8211;value read</strong><br />
CS DISABLED<br />
SPI&gt;</p></blockquote>
<p>Next, we use the <em>read configuration register command</em> (<em>0b00000101, 0b101, 0&#215;05, or 5</em>) to verify that the settings were properly written. This command returns one byte (<strong>r</strong>) which should match the value we wrote in the previous operation (0&#215;41, or 0b01000001).</p>
<p><em>Data access</em></p>
<p>Now we can read and write data to the chip. Writes begin with the <em>data write command</em> (0b10, 0&#215;02, or 2), followed by two bytes which determine where to write the data. The values to store are sent after the address. Depending on the access mode, a single byte, a page, or the entire memory can be filled in a single operation.</p>
<blockquote><p>SPI&gt;[<em>0b10</em> <strong>0 0</strong> 1 2 3 4 5 6 7 8 9 10]<br />
CS ENABLED<br />
WRITE: 0&#215;02 <strong>&lt;&#8211;data write command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;address byte 1</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;address byte 2</strong><br />
WRITE: 0&#215;01 <strong>&lt;&#8211;start of data to write</strong><br />
WRITE: 0&#215;02<br />
WRITE: 0&#215;03<br />
WRITE: 0&#215;04<br />
WRITE: 0&#215;05<br />
WRITE: 0&#215;06<br />
WRITE: 0&#215;07<br />
WRITE: 0&#215;08<br />
WRITE: 0&#215;09<br />
WRITE: 0&#215;0A<br />
CS DISABLED<br />
SPI&gt;</p></blockquote>
<p>We start with the <em>write data command</em> (<em>0b10</em>) and set the write location to the beginning of the chip (<strong>0 0</strong>). We send a total of ten values to store, the numbers 1 to 10.</p>
<p>After writing the data, we can read it back with the <em>read data command</em> (0b00000011, 0b11, 0&#215;03, or 3).</p>
<blockquote><p>SPI&gt;[ <em>0b11</em> <strong>0 0</strong> r:10]<br />
CS ENABLED<br />
WRITE: 0&#215;03 <strong>&lt;&#8211;read data command</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;start address byte 1</strong><br />
WRITE: 0&#215;00 <strong>&lt;&#8211;start address byte 2</strong><br />
BULK READ 0&#215;0A BYTES: <strong>&lt;&#8211;read out 10 bytes</strong><br />
0&#215;01 0&#215;02 0&#215;03 0&#215;04 0&#215;05 0&#215;06 0&#215;07 0&#215;08 0&#215;09 0&#215;0A<br />
CS DISABLED<br />
SPI&gt;</p></blockquote>
<p>We send the read data command (<em>0b11</em>), followed by the address from which to start reading (<strong>0 0</strong>). We then read back 10 bytes (r:10). The 10 byte are the numbers 1 to 10, the same values we wrote in the previous step.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8737/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8737/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8737/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8737&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/03/02/parts-32kb-spi-sram-memory-23k256/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/02/23k256ii.jpg" medium="image">
			<media:title type="html">23k256ii</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: Analog distance sensors (Sharp GP2D12/2Y0A02)</title>
		<link>http://hackaday.com/2009/02/24/parts-analog-distance-sensors-sharp-gp2d122y0a02/</link>
		<comments>http://hackaday.com/2009/02/24/parts-analog-distance-sensors-sharp-gp2d122y0a02/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 23:11:11 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[robots hacks]]></category>
		<category><![CDATA[2y0a02]]></category>
		<category><![CDATA[distance sensors]]></category>
		<category><![CDATA[gp2d12]]></category>
		<category><![CDATA[ir rangers]]></category>
		<category><![CDATA[ir sensors]]></category>
		<category><![CDATA[measurement]]></category>
		<category><![CDATA[robot sensors]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[sharp ir rangers]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=7514</guid>
		<description><![CDATA[
Sharp GP2D12 and 2Y0A02 infrared rangers output a voltage proportionate to the distance of an object from the sensor.  The GPD12 senses objects at a distance of 10-80cm, while the 2Y0A02 has twice the range.
We&#8217;ve previously looked at the Sharp GP2Y0D02 digital proximity sensor. It only signals the presence of objects, while the GP2D12 and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=7514&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="text-align:center; display: block;"><a href="http://hackaday.com/2009/02/24/parts-analog-distance-sensors-sharp-gp2d122y0a02/"><img src="http://img.youtube.com/vi/iGiRK0vmcUw/2.jpg" alt="" /></a></span></p>
<p>Sharp GP2D12 and 2Y0A02 infrared rangers output a voltage proportionate to the distance of an object from the sensor.  The GPD12 senses objects at a distance of 10-80cm, while the 2Y0A02 has twice the range.</p>
<p>We&#8217;ve previously looked at the <a href="http://hackaday.com/2009/01/05/parts-digital-proximity-sensor-sharp-gp2y0d02">Sharp GP2Y0D02 digital proximity sensor</a>. It only signals the presence of objects, while the GP2D12 and 2Y0A02 measure distance to them. If you&#8217;ve got a GP2YoD02, it might still be possible to <a href="http://www.ladyada.net/rant/2008/10/quick-tip-analog-signal-from-a-digital-distance-sensor/">tap the analog output</a>. We&#8217;ll show you how use these sensors below.</p>
<p><span id="more-7514"></span></p>
<p><img class="alignnone size-full wp-image-8673" title="cct" src="http://hackadaycom.files.wordpress.com/2009/02/cct.png?w=451&#038;h=213" alt="cct" width="451" height="213" /></p>
<p><strong>Sharp <a href="http://www.acroname.com/robotics/parts/R48-IR12.html">GP2D12</a>, 10-80cm analog IR ranger (Digikey #<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=425-2046-ND">425-2046-ND</a></strong><strong>, $12.81). <a href="http://document.sharpsma.com/files/GP2D12J0000F_SS_20060207.pdf">Datasheet</a> (PDF).</strong><br />
<strong></strong></p>
<p><strong>Sharp <a href="http://www.acroname.com/robotics/parts/R144-GP2Y0A02YK.html">2Y0A02</a>, 20-150cm analog IR ranger (Digikey #<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=425-2062-ND">425-2062-ND</a></strong><strong>, $14.38). <a href="http://document.sharpsma.com/files/gp2y0a02yk_e.pdf">Datasheet</a> (PDF).<br />
</strong></p>
<p>We powered the sensors with a 5volt supply, as shown in the schematic above. We connected the output directly to a multimeter set to measure voltage. The datasheet also recommends a 10uF <a href="http://en.wikipedia.org/wiki/Decoupling_capacitor">bypass capacitor</a> between the power and ground pins, but we didn&#8217;t use it for this demonstration.</p>
<p><img class="alignnone size-full wp-image-8674" title="gp2d12" src="http://hackadaycom.files.wordpress.com/2009/02/gp2d12.jpg?w=450&#038;h=384" alt="gp2d12" width="450" height="384" /></p>
<p>This graph shows the relationship between the output voltage of the GP2D12 and the distance of objects from the sensor (datasheet page 3, figure 6). You can find the distance/voltage curve for the 2Y0A02 in datasheet page 5, figure 2. There&#8217;s <a href="http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html">an equation</a> to determine distance from the output voltage, or you could use a simple <a href="http://en.wikipedia.org/wiki/Lookup_table">lookup table</a>.</p>
<p>The output is unreliable for extremely close objects, seen as the small hump between 5 and 10cm. It&#8217;s possible to combat this by using several sensors with <a href="http://www.acroname.com/robotics/info/articles/sharp/sharp.html#e8">overlapping ranges</a>, or by placing sensors so that <a href="http://www.acroname.com/robotics/info/articles/sharp/sharp.html#e30">nothing can come within the minimum range</a>.</p>
<p>For an exhaustive discussion of the various Sharp proximity sensors, check out the <a href="http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html">Sharp IR ranger information page</a> at Arconame.</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed. Want to request a part post? Please leave your suggestions in the comments.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/7514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/7514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/7514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/7514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/7514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/7514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/7514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/7514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/7514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/7514/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=7514&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/02/24/parts-analog-distance-sensors-sharp-gp2d122y0a02/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/iGiRK0vmcUw/2.jpg" medium="image" />

		<media:content url="http://hackadaycom.files.wordpress.com/2009/02/cct.png" medium="image">
			<media:title type="html">cct</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/02/gp2d12.jpg" medium="image">
			<media:title type="html">gp2d12</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: I2C audio volume potentiometer (DS1807)</title>
		<link>http://hackaday.com/2009/02/16/parts-i2c-audio-volume-potentiometer-ds1807/</link>
		<comments>http://hackaday.com/2009/02/16/parts-i2c-audio-volume-potentiometer-ds1807/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 19:19:01 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[digital audio hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[ds1807]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[potentiometer]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8427</guid>
		<description><![CDATA[
The DS1807 contains two logarithmic digital potentiometers (pots) for audio volume adjustment. Each pot has 64 volume levels plus a mute setting. The volume level of each pot is set over a two-wire I2C serial interface. We&#8217;ll show you how to connect and interface the DS1807 below.

DS1807 I2C audio volume potentiometer (Digikey #DS1807+-ND, $3.04)
Connections



Bus Pirate
DS1807 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8427&subd=hackadaycom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-full wp-image-8515" title="ds1807ii" src="http://hackadaycom.files.wordpress.com/2009/02/ds1807ii.jpg?w=450&#038;h=296" alt="ds1807ii" width="450" height="296" /></p>
<p>The <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2782">DS1807</a> contains two logarithmic <a href="http://en.wikipedia.org/wiki/Digitally_controlled_potentiometer">digital potentiometers</a> (pots) for audio volume adjustment. Each pot has 64 volume levels plus a mute setting. The volume level of each pot is set over a two-wire <a href="http://en.wikipedia.org/wiki/I2c">I2C</a> serial interface. We&#8217;ll show you how to connect and interface the DS1807 below.</p>
<p><span id="more-8427"></span></p>
<p><strong>DS1807 I2C audio volume potentiometer (Digikey #<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=DS1807%2B-ND">DS1807+-ND</a>, $3.04)</strong></p>
<p><em>Connections</em></p>
<table border="0">
<tbody>
<tr>
<td><strong>Bus Pirate</strong></td>
<td><strong>DS1807 (pin #)</strong></td>
</tr>
<tr>
<td>GND</td>
<td>GND (1)</td>
</tr>
<tr>
<td>GND</td>
<td>A2 (2)</td>
</tr>
<tr>
<td>GND</td>
<td>A1 (3)</td>
</tr>
<tr>
<td>GND</td>
<td>A0 (4)</td>
</tr>
<tr>
<td>GND</td>
<td>AGND (11)</td>
</tr>
<tr>
<td>SDA</td>
<td>SDA (12)</td>
</tr>
<tr>
<td>Clock</td>
<td>SCL (13)</td>
</tr>
<tr>
<td>+5volts</td>
<td>VCC (14)</td>
</tr>
</tbody>
</table>
<p>We connected the DS1807 to the <a href="http://hackaday.com/the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface tool</a> as shown in the table, the same basic principals apply to any custom configuration. We used the Bus Pirate&#8217;s 5volt power supply, but the DS1807 will also work at 3.3volts. I2C requires a <a href="http://en.wikipedia.org/wiki/Pull-up_resistor">pull-up resistor</a> on each signal line, we used the Bus Pirate&#8217;s on-board resistors connected to the on-board 5volt power supply.</p>
<p>Connect the DS1807 to an audio source as shown on page 3 of the datasheet. Connect the raw audio signal to the H pin and connect the L pin to ground, the attenuated audio signal will come from the W pin.</p>
<p><em>Interfacing</em></p>
<p>First, setup the Bus Pirate for I2C mode, and activate the 5volt power supply. We covered this procedure in our <a href="http://hackaday.com/2009/02/09/parts-ltc2631a-i2c-digital-to-analog-converter/">last parts post</a>.</p>
<blockquote><p>I2C&gt;v<strong>&lt;&#8211;voltage monitor</strong><br />
9xx VOLTAGE MONITOR: 5V: 4.9 | 3.3V: 0.0 | VPULLUP: 5.0 |<br />
I2C&gt;</p></blockquote>
<p>With the power supply configured, check the voltage monitor (v) to be sure the 5volt supply is active and that 5volts is present at the pull-up resistors.</p>
<blockquote><p>I2C&gt;(0)<strong>&lt;&#8211;list available macros</strong><br />
0.Macro menu<br />
1.7bit address search<br />
I2C&gt;(1)<strong>&lt;&#8211;run address search</strong><br />
xxx Searching 7bit I2C address space.<br />
Found devices at:<br />
0&#215;50 0&#215;51 0&#215;52<strong>&lt;&#8211;potential addresses</strong><br />
I2C&gt;</p></blockquote>
<p>The Bus Pirate&#8217;s address search macro is a quick way to locate I2C devices without looking at the datasheet. 0&#215;50 is an I2C write address because the last bit is 0, 0&#215;51 is read address (last bit 1). 0&#215;52 is probably a group/global write address because it doesn&#8217;t have a corresponding read address.</p>
<p>We could also determine the address from the datasheet: the base address is 0101 plus the three address select bits (A0-2, all grounded, 000) and the write or read bit (0 or 1) gives 0b01010000 (0&#215;50).</p>
<blockquote><p>I2C&gt;[0x51 r r]<strong>&lt;&#8211;read pot values</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;51 GOT ACK: YES <strong>&lt;&#8211;device read address</strong><br />
230 I2C READ: 0&#215;3F<strong>&lt;&#8211;pot0</strong><br />
230 I2C READ: 0&#215;3F<strong>&lt;&#8211;pot1</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>First, we read the potentiometer values at startup. [ issues the I2C start condition, 0x51 is the device read address, "r r" reads two bytes, and ] issues the I2C stop command. The default startup value is 63 (0&#215;3f), one position above mute (datasheet page 2).</p>
<blockquote><p>I2C&gt;[0x50 0b10101001 0]<strong>&lt;&#8211;write pot0</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;50 GOT ACK: YES<strong>&lt;&#8211;DS1807 write address</strong><br />
220 I2C WRITE: 0xA9 GOT ACK: YES<strong>&lt;&#8211;pot0 write command</strong><br />
220 I2C WRITE: 0&#215;00 GOT ACK: YES<strong>&lt;&#8211;volume to set</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;[0x50 0b10101010 64]<strong>&lt;&#8211;write pot1</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;50 GOT ACK: YES<strong>&lt;&#8211;DS1807 write address</strong><br />
220 I2C WRITE: 0xAA GOT ACK: YES<strong>&lt;&#8211;pot1 write command</strong><br />
220 I2C WRITE: 0&#215;40 GOT ACK: YES<strong>&lt;&#8211;volume to set</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;[0x51 r r]<strong>&lt;&#8211;read values back to verify</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;51 GOT ACK: YES<strong>&lt;&#8211;DS1807 read address</strong><br />
230 I2C READ: 0&#215;00<strong>&lt;&#8211;pot0 value</strong><br />
230 I2C READ: 0&#215;40<strong>&lt;&#8211;pot1 value</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>Next, we update each volume pot with a separate command. 0&#215;50 is the DS1807 write address, 0b10101001 (0xA9) is the command to update pot0, and 0 sets the volume to full. The next sequence uses the update pot1 command, 0b10101010 (0xaa), and sets the volume to mute (64, 0&#215;40). Finally, we use the read procedure to verify that the values are correct.</p>
<blockquote><p>I2C&gt;[0x50 0xA9 64 0]<strong>&lt;&#8211;write both pot values</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;50 GOT ACK: YES<br />
220 I2C WRITE: 0xA9 GOT ACK: YES<strong>&lt;&#8211;update pot0 command</strong><br />
220 I2C WRITE: 0&#215;40 GOT ACK: YES<strong>&lt;&#8211;pot0 value</strong><br />
220 I2C WRITE: 0&#215;00 GOT ACK: YES<strong>&lt;&#8211;pot1 value</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;[0x51 r r]<strong>&lt;&#8211;read back values</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;51 GOT ACK: YES<br />
230 I2C READ: 0&#215;40<strong>&lt;&#8211;pot0 value</strong><br />
230 I2C READ: 0&#215;00<strong>&lt;&#8211;pot1 value</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>The pot 0 write command can also be used to set both potentiometer values with a single command. Use the pot0 update command (0b10101001, 0xA9), and  send the pot1 value (0) following the pot0 value (64).</p>
<blockquote><p>I2C&gt;[0x50 0b10101111 0x20]<strong>&lt;&#8211;update both pots with the same value</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;50 GOT ACK: YES<br />
220 I2C WRITE: 0xAF GOT ACK: YES<strong>&lt;&#8211;dual update command</strong><br />
220 I2C WRITE: 0&#215;20 GOT ACK: YES<strong>&lt;&#8211;value to set</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;[0x51 r r]<strong>&lt;&#8211;read back values</strong><br />
210 I2C START CONDITION<br />
220 I2C WRITE: 0&#215;51 GOT ACK: YES<br />
230 I2C READ: 0&#215;20<strong>&lt;&#8211;pot0 value</strong><br />
230 I2C READ: 0&#215;20<strong>&lt;&#8211;pot1 value</strong><br />
240 I2C STOP CONDITION<br />
I2C&gt;</p></blockquote>
<p>Finally, 0xAF (0b10101111) can be used to update both potentiometers with the same value. This is probably the most useful command for stereo audio volume control where both channels have the same value and change simultaneously.</p>
<p>Are there any chips or components you’d like us to cover in future <a href="http://hackaday.com/category/parts/">parts</a> posts?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8427/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&blog=4779443&post=8427&subd=hackadaycom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/02/16/parts-i2c-audio-volume-potentiometer-ds1807/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/02/ds1807ii.jpg" medium="image">
			<media:title type="html">ds1807ii</media:title>
		</media:content>
	</item>
	</channel>
</rss>