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

<channel>
	<title>Brett&#039;s Build Log &#187; brettinman</title>
	<atom:link href="http://brettinman.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettinman.com</link>
	<description>Hardware tinkering with the occasional bit of software</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:24:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>RFID Door Opener, Part 1</title>
		<link>http://brettinman.com/2010/01/09/rfid-door-opener-part-1/</link>
		<comments>http://brettinman.com/2010/01/09/rfid-door-opener-part-1/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 07:40:59 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[door]]></category>
		<category><![CDATA[dooropener]]></category>
		<category><![CDATA[mechanical]]></category>
		<category><![CDATA[rfid]]></category>
		<category><![CDATA[servo]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=221</guid>
		<description><![CDATA[Inspired by the numerous door openers out there, I decided I&#8217;d give it a shot (ok, really, I was just looking for something to do with my spiffy Parallax RFID reader). At first I was hoping I could use the RFID tag that opens the entrances to my apartment building; however, those turned out to [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by the <a href="http://sites.google.com/site/teamtobor/rfid-door-opener">numerous</a> <a href="http://blog.makezine.com/archive/2006/10/diy_door_unlocker.html">door</a> <a href="http://hackaday.com/2009/07/06/automated-dorm-room-door/">openers</a> <a href="http://www.instructables.com/id/Arduino-RFID-Door-Lock/">out</a> <a href="http://bear24rw.blogspot.com/2008/12/rfid-door-unlocker.html">there</a>, I decided I&#8217;d give it a shot (ok, really, I was just looking for something to do with my spiffy <a href="http://www.parallax.com/Store/Accessories/Communication/tabid/161/ProductID/114/List/0/Default.aspx?SortField=ProductName,ProductName">Parallax RFID reader</a>). At first I was hoping I could use the RFID tag that opens the entrances to my apartment building; however, those turned out to be on the 13.56MHz frequency for which there is very little hobby-level gear out there &#8211; certainly nothing in the price range that would be acceptable for a basic door opener. So I settled on using 125KHz and having to carry two tags on my keychain (or possibly a credit-card tag in my wallet).</p>
<p>Thinking this out from the beginning, there are several parts that make up this system:</p>
<p>1) <strong>Controller</strong>. I&#8217;ll be using the Arduino platform &#8211; quit moaning, I can hear you. Honestly, for something so simple (take serial characters from reader, activate servo), it&#8217;s not worth prototyping a little AVR board and programming through an FTDI cable. Plus the Arduino environment already has a Servo library and there is code written for the Parallax RFID module &#8211; if you&#8217;ve read the title of this blog, you might know why this appeals to me.</p>
<p>2) <strong>RFID reader</strong>. The Parallax module does all the work of generating a 125KHz signal and measuring the response, and converting that to a string of characters which it sends down by a serial connection. It requires a 5V supply which can be borrowed from the Arduino and there is a pin to enable the reader &#8211; HIGH is off, LOW is on. The state of the reader is reflected in the color of the LED; oddly, red is on/ready while green is disabled.</p>
<p>3) <strong>Servo.</strong> A standard, continuous rotation <a href="http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servo/List/0/SortField/4/ProductID/102/Default.aspx">hobby servo</a> will be used. Since the handle is rather hard to pull, I&#8217;ll want to use the maximum voltage the servo is rated for (6V) in order to get the most torque out of it. Another thing to keep in mind is that these servos can use a lot of current, especially when fighting against a load. A 1A power supply is probably recommended, although I wasn&#8217;t able to find anything other than rough estimates for the maximum current under load.</p>
<p>4) <strong>Door/Servo interface</strong>. For turning the handle of my door I&#8217;ve decided to mount a small spool on the continuous servo &#8211; it will spool up wire connected to the handle, pulling the handle down. The opening of the door is the aspect I&#8217;m most worried about &#8211; I&#8217;m no mechanical engineer and this method could fail depending on the amount of torque needed and how good my spool scheme is. A linear actuator might be called for but would probably be overkill.</p>
<p><span id="more-221"></span></p>
<p>So far I&#8217;ve hooked up the RFID reader and used the sample code to read the values off some tags. Only tags that have their unique code programmed into the Arduino will initiate a response. I&#8217;ve used the LED conveniently located on Pin 13 to signal that a valid code has been read by the unit (instead of, and eventually in addition to, activating the servo). Also, the enable pin on the reader will be brought HIGH to turn the LED on the unit green to give a visual response that the code has been identified.</p>
<p>My sample code uses Pin 12 to indicate denied tags &#8211; readings that have a valid 10-character RFID code but do not match the list of allowed codes. I doubt anyone else in the building has any 125KHz rfid tags and will be waving them around my door, but this will prevent all but the most dedicated of hackers from accessing our apartment, mainly because they would have to either try to brute-force crack the unique ID or be within inches of our keyrings to read the tags.</p>
<p>Right now I&#8217;m waiting on some drill bits and screws to attach the spool to the servo, a 6V supply for the servo, and an <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9219">Arduino Pro</a> to build into the device so I won&#8217;t have to permanently leave in my Duemilanove that I use for prototyping. I&#8217;m also thinking of adding a buzzer to indicate that the door is opening, or perhaps a dual-color LED inside of the peephole so you can see from the outside whether your tag has been accepted or not. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2010/01/09/rfid-door-opener-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIY Audio on a &#8220;Student&#8217;s&#8221; Budget</title>
		<link>http://brettinman.com/2009/08/19/diy-audio-on-a-students-budget/</link>
		<comments>http://brettinman.com/2009/08/19/diy-audio-on-a-students-budget/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:50:57 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[diy]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=190</guid>
		<description><![CDATA[Today, a whole new topic in DIY electronics &#8211; audio. Audiophiles (or just anyone looking to get good sound quality) can spend hundreds or thousands of dollar on systems whose parts may only cost a tiny fraction of the retail cost. So the DIY community has stepped up to the plate, with many extremely knowledgeable [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both;">Today, a whole new topic in DIY electronics &#8211; audio. Audiophiles (or just anyone looking to get good sound quality) can spend hundreds or thousands of dollar on systems whose parts may only cost a tiny fraction of the retail cost. So the DIY community has stepped up to the plate, with many extremely knowledgeable engineers and hobbyists collaborating on original circuit designs that rival or better many commercial &#8220;audiophile&#8221; products.</p>
<p style="clear: both;"><a class="image-link" href="http://brettinman.com/blog/wp-content/uploads/2009/08/ssmhblog1-full1.jpg"><img class="linked-to-original" style="text-align: center; display: block; margin: 0 auto 10px;" src="http://brettinman.com/blog/wp-content/uploads/2009/08/ssmhblog1-thumb13.jpg" alt="" width="600" height="450" /></a>Recently, I had the great fortune to get in on a group buy of sorts, for a modified version of the Starving Student Millet Hybrid amplifier. The SSMH started life as a simple but ingenious hybrid (tube and solid state) design by <a href="http://www.pmillett.com/">Pete Millett</a>, in which he used the heating element of the tubes to put a load on the MOSFETs of the amplifier, cutting complexity and cost. Originally, it was a very basic amplifier with a budget-minded soul, built into whatever enclosure was handy with point to point (P2P) wiring. You can see the original build at his site <a href="http://www.pmillett.com/starving.htm">here</a>, and the forum thread following it&#8217;s history <a href="http://www.head-fi.org/forums/f6/millett-starving-student-hybrid-amp-319231/">here</a>.</p>
<p style="clear: both;">DIY forum user <a href="http://www.ecp.cc/diy-audio.html">Dsavitsk</a> then improved on the design with some slight modifications to the circuit. He also developed an equally ingenious way to mount the amp in an enclosure &#8211; a PCB would be developed and attached to the sliding top of a standard Hammond enclosure, allowing the tubes to be mounted to the &#8220;underside&#8221; of the PCB and stick out through the case. This would eliminate the P2P wiring that caused many problems in DIY builds of the amp &#8211; problems with grounding and bad connections had plagued countless hobbyists.</p>
<p style="clear: both;">Collaborating with Tom Blanchard of <a href="http://www.beezar.com/oscommerce2/catalog/index.php">Beezar Audio</a>, the two developed PCBs and set the project in motion. Tom took on the arduous task of organizing the procurement of the increasingly rare 19J6 vacuum tubes, the custom-machined Hammond cases, and all the other various parts needed to develop kits of the SMMH.</p>
<p style="clear: both;">I was lucky enough to get in on this undertaking and purchase a kit, and after a couple months (during which the cases were machined), I recently took delivery of the kit and quickly put it together.</p>
<p><span id="more-190"></span></p>
<p style="clear: both;"><a class="image-link" href="http://brettinman.com/blog/wp-content/uploads/2009/08/ssmhblog2-full.jpg"><img class="linked-to-original" style="text-align: center; display: block; margin: 0 auto 10px;" src="http://brettinman.com/blog/wp-content/uploads/2009/08/ssmhblog2-thumb1.jpg" alt="" width="600" height="450" /></a>The ease of construction of this amp is a great testament to the amount of work that Tom, Dsavitsk, and originally Pete put into this design. I had the amp completed from start to finish in less than 5 hours, with no serious problems. With me and DIY projects, that&#8217;s unheard of. Tom made it extremely smooth with his excellent <a href="http://www.head-fi.org/forums/f6/starving-student-millett-hybrid-pcb-step-step-build-guide-437075/index2.html">instructions</a>. I flipped the power switch, watched the glow of the tube heaters and LEDs come to life, and plugged in my headphones and source. I wouldn&#8217;t call myself an Audiophile, but the sound of this amplifier far outranks anything I&#8217;ve listened to, and blows my own basic DIY amps out of the water. Plus, it looks amazing on my desk. Glass tubes? How quaint!</p>
<p style="clear: both;">For those looking for a great audio project with that old-school tube feel, <span style="text-decoration: line-through;">there are still PCBs and tubes available, with a chance that more custom cases will become available.</span> [EDIT] As of February 2010, the supply of 19J6 tubes has been nearly exhausted and no more PCBs or kits based on this tube will be produced unless a stash is found in the corner of a warehouse somewhere. The possibility of doing this build point-to-point still exists if you want to buy the tubes in small quantities at high prices, and there are modifications that can be made to use this design with more common tubes &#8211; see the SSMH website or the Head-Fi thread for details.</p>
<p style="clear: both;">Even if this amp seems like too much of an undertaking, I highly recommend dabbling in DIY audio &#8211; a great place to start is the classic CMoy headphone amp in a mint tin. Tangent has some of the most complete instructions <a href="http://tangentsoft.net/audio/cmoy-tutorial/">here</a>.</p>
<p style="clear: both;"><em>Un-Disclaimer: I&#8217;m in no way involved with Beezar audio or anyone else mentioned in the post; this was just an awesome project that came together through the power of the DIY community.</em></p>
<p><br class="final-break" style="clear: both;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/08/19/diy-audio-on-a-students-budget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB Power Shield v2.0</title>
		<link>http://brettinman.com/2009/08/07/usb-power-shield-v2-0/</link>
		<comments>http://brettinman.com/2009/08/07/usb-power-shield-v2-0/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 06:05:09 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[board]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[pcb]]></category>
		<category><![CDATA[usbpowershield]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=121</guid>
		<description><![CDATA[The new USB Power Shield boards (rev. 2.0) have just arrived from BatchPCB! As always, they were quick, great quality, and they even sent me a few extra! Awesome service. Version 2.0 has some major revisions since v1.0, including: Smaller Size &#8211; cost is determined by size, so I brought it down to the bare [...]]]></description>
			<content:encoded><![CDATA[<p>The new USB Power Shield boards (rev. 2.0) have just arrived from <a href="http://www.batchpcb.com/">BatchPCB</a>! As always, they were quick, great quality, and they even sent me a few extra! Awesome service.<br />
<div id="attachment_147" class="wp-caption aligncenter" style="width: 297px"><a href="http://brettinman.com/blog/wp-content/uploads/2009/07/usbpowershieldv2.png"><img src="http://brettinman.com/blog/wp-content/uploads/2009/07/usbpowershieldv2-287x300.png" alt="Top View of the USB Power Shield v2.0" title="usbpowershieldv2" width="287" height="300" class="size-medium wp-image-147" /></a><p class="wp-caption-text">Top View of the USB Power Shield v2.0</p></div><br />
Version 2.0 has some major revisions since v1.0, including:</p>
<ul>
<li><strong>Smaller Size</strong> &#8211; cost is determined by size, so I brought it down to the bare minimum &#8211; just enough to cover the Arduino pins.</li>
<li><strong>Power Planes</strong> &#8211; Added a 5V plane on top and a GND plane on the bottom to increase the reliability of the design, allow higher current, and also act as a bit of a heatsink</li>
<li><strong>Thicker Traces</strong> &#8211; the traces in v1.0 are only 8mil, which is pretty small and is really only good for about 200mA. Some devices powered here may need more than that. To support the USB spec of 500mA per device, I&#8217;ve bumped up all the traces to 16mil. There&#8217;s plenty of space for traces anyways.</li>
<li><strong>Remove the Vin LED</strong> &#8211; unnecessary.</li>
<li><strong>Flush caps</strong> &#8211; leave space so the caps can be bent down, so another shield can be fitted on top of this one. The regulator is also mounted on the edge to allow bending it down, although in many application it will need a heatsink so they may not clear even when bent down.</li>
</ul>
<p>And here it is built:<br />
<a href="http://brettinman.com/blog/wp-content/uploads/2009/08/usbpowershieldv20.jpg"><img src="http://brettinman.com/blog/wp-content/uploads/2009/08/usbpowershieldv20.jpg" alt="USB Power Shield v2.0" title="USB Power Shield v2.0" width="600" height="450" class="aligncenter size-full wp-image-176" /></a></p>
<p><strong>Parts needed:</strong><br />
Keep in mind not all parts on the board are needed. For instance, if you&#8217;re powering a single pair of lights (or anything running at <300ma) you can just use the Arduino's built in DC-in with voltage regulator (USB power alone is not going to cut it). If that's the case, you can leave out the 7805 regulator, the 100uF capacitor (keep the 10uF), and the power diode D1. You also don't have to have the power indicator LED or its resistor RLED. And if you're only controlling one device, you only need one relay and one USB connector. All in all, you can get the parts cost for this board down to about $4 at the minimum configuration. If you want to go all out, here's what you'll need:</p>
<p><span id="more-121"></span><br />
2x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMs3UE%252bXNiFaVF12THBPgwXPMqsHAm3LTXk%3d">G6JU-2P-Y-DC4.5</a> Relays      @ ~$2.85 each<br />
2x <a href="http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtDa8bhoiaN7HDJKsykYnjc">USB A connectors</a>               @ ~$0.45 each<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMug9GoBKXZ757KFYdywgvBV7%2f%2fqrdjjhZ4%3d">7805 5V Regulator </a>              @ ~$0.37<br />
1x DC-in <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMu2f9RNbWupYpN4Bpd1ZXeWglHv88z1Rc8%3d">2.1mm Jack</a>                @ ~$0.63<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMukHu%252bjC5l7YRoIw1o9fDs4D4Fc6M2xHYA%3d">100uF 25V</a> capacitor            @ ~$0.03<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMsCnlYck6hSqAlrlujfUe4KIkXd8xoFS7c%3d">10uF 25V </a>(10V ok) capacitor @ ~$0.03<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtEwUVCuofpuFOn%252bHIvCcyB6OioqsTJAaU%3d">1N4004</a> standard Diode        @ ~$0.04<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtlubZbdhIBICS9vICa6AcH4aX3A0%2fcTv0%3d">450-500 ohm</a> resistor           @ ~$0.04<br />
1x <a href="http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMvxtGF7dlGNpme%252bpiiSarbFh83YGHyHNnM%3d">6x6mm pushbutton</a> switch    @ ~$0.24<br />
1x <a href="http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtJ8nYvfCigMixTPG3SOeuhNvhVjLU1XIY%3d">5mm LED</a> (any type/color is fine)                           @ ~$0.08<br />
1x 28+ pin row <a href="http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMvlX3nhDDO4AJDbeIeePM9P3yCR%252beDTu28%3d">.1&#8243; male header</a>  @ ~0.11</p>
<p><strong>Total parts cost ~$8.17</strong></p>
<p><em>You&#8217;ll also need a heatsink for the regulator if you plan on drawing more than ~200ma from it, those can range from $0.30 to $2, depending on size and complexity. There is a quite large one in the picture above as I was using it to charge my MP3 player, which draws a lot of current.</em></p>
<p>Stay tuned for an assembly guide. Also, I&#8217;ll be selling the few extra boards I have at cost to those interested, details to come soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/08/07/usb-power-shield-v2-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using the Bus Pirate v2go on Mac</title>
		<link>http://brettinman.com/2009/07/24/using-the-bus-pirate-v2go-on-mac/</link>
		<comments>http://brettinman.com/2009/07/24/using-the-bus-pirate-v2go-on-mac/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 22:38:05 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Bus Pirate]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[communications]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=156</guid>
		<description><![CDATA[My Bus Pirate v2go just arrived this morning and I was eager to try it out. There is some documentation on Hack-a-Day on how to use the bus pirate with HyperTerminal. However, all of my electronics stuff is on the other side of the room from my Windows desktop. I use my MacBook for programming [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.buspirate.com">Bus Pirate v2go</a> just arrived this morning and I was eager to try it out. There is some documentation on Hack-a-Day on how to use the bus pirate with HyperTerminal. However, all of my electronics stuff is on the other side of the room from my Windows desktop. I use my MacBook for programming the Arduino and my other AVR projects, so I wanted to use it for the Bus Pirate as well. What to do?</p>
<p><del datetime="2009-08-12T19:22:23+00:00">My first google searches ended in disappointment &#8211; using the built in <a href="http://www.macosxhints.com/article.php?story=20061109133825654">Terminal program with Screen</a> was unsuccessful (probably because it doesn&#8217;t seem like you can set the baudrate).</del><em> Update: it turns out that you can set the baudrate with screen using an argument like so &#8211;  &#8220;screen /dev/ttyWHATEVER 115200&#8243;. Thanks goes to the David in the comments below.</em> After a little searching, it looked like the few serial terminal applications for Mac were old and outdated, but I did manage to find <a href="http://homepage.mac.com/dalverson/zterm/">ZTerm</a>. It&#8217;s simple and basic &#8211; perfect for use with the bus pirate.</p>
<p>Don&#8217;t forget that you need to have already installed the <a href="http://www.ftdichip.com/Drivers/VCP.htm">FTDI driver</a> so that your computer will see the device over USB. Start Zterm and choose the correct port in the popup window (if it isn&#8217;t already chosen automatically). Then you need to change the connection settings to talk to the Bus Pirate properly. Go to Settings-&gt;Connection and set it like this:<br />
<a href="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-1.png"><img class="aligncenter size-full wp-image-157" title="ZTerm settings for Bus Pirate" src="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-1.png" alt="ZTerm settings for Bus Pirate" width="489" height="344" /></a><br />
Data Rate: 115200<br />
Data Bits: 8<br />
Parity: None<br />
Stop bits: 1</p>
<p>The rest you can leave at the default. <strong>[UPDATE] On newer firmware versions you&#8217;ll need to deselect Xon/Xoff</strong> as per Ian in the comments below.</p>
<p>Hit ok and go back to the terminal window to start talking<span id="more-156"></span></p>
<p>Hit enter to start communicating. Entering ? will bring up the list of commands like so:<br />
<a href="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-2.png"><img class="aligncenter size-medium wp-image-160" title="Bus Pirate menu" src="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-2.png" alt="Bus Pirate menu" width="600" height="538" /></a><br />
To test some functionality of the bus pirate, we&#8217;re going to measure the voltage on the ADC pin. We&#8217;ll do this by putting the Bus Pirate into just about any mode besides HiZ &#8211; we&#8217;ll choose 1-Wire since it&#8217;s simple to set up.</p>
<p>Enter &#8220;m&#8221; to bring up the mode menu, choose 1-Wire by entering &#8220;2&#8243;. Hook up some voltage to the ADC pin (see the bottom of the Bus Pirate for it&#8217;s pinout). Then enter &#8220;d&#8221; to read the value on the pin. I connected the pin to the 5V input from the USB line, so it reads 5.1V. You can see that full process in the terminal below.<br />
<a href="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-3.png"><img class="aligncenter size-full wp-image-164" title="Bus Pirate ADC Reading" src="http://brettinman.com/blog/wp-content/uploads/2009/07/Picture-3.png" alt="Bus Pirate ADC Reading" width="345" height="305" /></a></p>
<p>That&#8217;s it for the basics! See the <a href="http://www.buspirate.com">Bus Pirate</a> site for more examples of how to use this nice piece of hardware.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/07/24/using-the-bus-pirate-v2go-on-mac/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Woot-off Time!</title>
		<link>http://brettinman.com/2009/07/21/woot-off-time/</link>
		<comments>http://brettinman.com/2009/07/21/woot-off-time/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 06:40:39 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Interesting Links]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[usbpowershield]]></category>
		<category><![CDATA[wootoff]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=154</guid>
		<description><![CDATA[Just in time to test the USB Power Shield, it&#8217;s a Woot-off! I&#8217;ll post some pics of the lights in action tomorrow, but for now, head over to the Woot Tracker to keep up with all the items.]]></description>
			<content:encoded><![CDATA[<p>Just in time to test the <a href="http://brettinman.com/2009/07/14/success-usb-power-shield-v1-0/">USB Power Shield</a>, it&#8217;s a <a href="http://www.woot.com/">Woot-off</a>! I&#8217;ll post some pics of the lights in action tomorrow, but for now, head over to the <a href="http://www.brettinman.com/woot/">Woot Tracker</a> to keep up with all the items.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/07/21/woot-off-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sketching with the USB Power Shield</title>
		<link>http://brettinman.com/2009/07/16/sketching-with-the-usb-power-shield/</link>
		<comments>http://brettinman.com/2009/07/16/sketching-with-the-usb-power-shield/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 05:04:25 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[relay]]></category>
		<category><![CDATA[sketch]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=132</guid>
		<description><![CDATA[So you have a USB Power Shield (or anything that uses a latching relay). How do you control it in an Arduino Sketch? Normal relays are pretty simple &#8211; supply voltage/current to the coil and it generates a magnetic field, which pushes the switch to the ON position. You only need one pin to run [...]]]></description>
			<content:encoded><![CDATA[<p>So you have a USB Power Shield (or anything that uses a latching relay). How do you control it in an Arduino Sketch?</p>
<p>Normal relays are pretty simple &#8211; supply voltage/current to the coil and it generates a magnetic field, which pushes the switch to the ON position. You only need one pin to run it, although you may need a transistor to supply more current because most microcontrollers can only supply 50mA, which often isn&#8217;t enough current to create a magnetic field to move the switch. You must maintain the current to keep the switch on.</p>
<p>Latching relays are similar to this, but once put into position, it &#8220;latches&#8221; there and requires no further current to stay in that position. This uses less power and makes the switching more reliable &#8211; if there is a decrease in current supplied, the switch will still stay in position, unlike the regular relay which could flicker. The downside is that the common types require two pins. Sending current in one direction switches on, and reversing the current switches it off.</p>
<p>So how do you control it? Set two pins to be outputs (the USB Power Shield uses 12/11 and 10/9 for the two relays). Write one pin LOW and the other pin HIGH. After a sufficient time to make the switching happen (50ms or less, check the datasheet for the relay), switch the HIGH pin back to low. This gives the magnetic field a place to sink, as well as making sure no more current is supplied to the coil, preventing overheating and wasting power. </p>
<p>Ideally, with a normal relay you&#8217;d like to force the stored current from the magnetic field back through the coil by using a flyback diode across it, but with a latched relay and current running in both directions, a diode would be needed in each direction. And that would simply cause a short circuit both ways. I&#8217;ve tested the relays used in the USB Power Shield and they don&#8217;t harm the Arduino (even over thousands of cycles) so this isn&#8217;t a huge worry here.</p>
<p>Below is some sample code for using the USB Power Shield with an Arduino. <span id="more-132"></span></p>
<p>Simply set up the pins for relay1 and relay2:<br />
<code>//give the pins names<br />
int relay11 = 12;<br />
int relay12 = 11;<br />
int relay21 = 10;<br />
int relay22 = 9;<br />
void setup()<br />
{<br />
//set the pins to outputs<br />
  pinMode(relay11, OUTPUT);<br />
  pinMode(relay12, OUTPUT);<br />
  pinMode(relay21, OUTPUT);<br />
  pinMode(relay22, OUTPUT);<br />
//make sure they start in the off position<br />
  relay1(false);<br />
  relay2(false);<br />
  // do other stuff<br />
}</code></p>
<p>Then add these functions to turn the relays on and off:<br />
<code>void relay1 (bool state)<br />
{<br />
  if (state)<br />
  {<br />
    digitalWrite(relay12,LOW); //set the current in one direction<br />
    digitalWrite(relay11,HIGH);<br />
    delay(50); //hold long enough to switch<br />
    digitalWrite(relay11,LOW);   //set both to ground to stop current<br />
  }<br />
  else<br />
  {<br />
    digitalWrite(relay11,LOW);<br />
    digitalWrite(relay12,HIGH);<br />
    delay(50);<br />
    digitalWrite(relay12,LOW);<br />
  }<br />
}<br />
void relay2 (bool state)<br />
{<br />
  if (state)<br />
  {<br />
    digitalWrite(relay22,LOW);<br />
    digitalWrite(relay21,HIGH);<br />
    delay(50);<br />
    digitalWrite(relay21,LOW);<br />
  }<br />
  else<br />
  {<br />
    digitalWrite(relay21,LOW);<br />
    digitalWrite(relay22,HIGH);<br />
    delay(50);<br />
    digitalWrite(relay22,LOW);<br />
  }<br />
}</code></p>
<p>Then simply write your main loop to do whatever you wish. Call relay1(true) to turn relay1 on, call relay2(false) to turn relay2 off, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/07/16/sketching-with-the-usb-power-shield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Success! USB Power Shield v1.0</title>
		<link>http://brettinman.com/2009/07/14/success-usb-power-shield-v1-0/</link>
		<comments>http://brettinman.com/2009/07/14/success-usb-power-shield-v1-0/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 00:51:51 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[board]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[pcb]]></category>
		<category><![CDATA[usbpowershield]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=119</guid>
		<description><![CDATA[A special envelope arrived yesterday from BatchPCB &#8211; the envelope containing the prototype board for the USB Power Shield v1.0. Or should I say prototype boards &#8211; they were kind enough to produce two, even though I only ordered one. Consider me a happy customer, especially because the boards work. That&#8217;s right, the very first [...]]]></description>
			<content:encoded><![CDATA[<p>A special envelope arrived yesterday from BatchPCB &#8211; the envelope containing the prototype board for the USB Power Shield v1.0. Or should I say prototype <em>boards</em> &#8211; they were kind enough to produce two, even though I only ordered one. Consider me a happy customer, especially because the boards <strong>work</strong>.</p>
<p>That&#8217;s right, the very first prototype board actually functions. I&#8217;m amazed too.</p>
<div id="attachment_125" class="wp-caption aligncenter" style="width: 610px"><a href="http://brettinman.com/blog/wp-content/uploads/2009/07/usbv10.jpg"><img class="size-full wp-image-125" title="USB Power Shield v1.0" src="http://brettinman.com/blog/wp-content/uploads/2009/07/usbv10.jpg" alt="The first working prototype" width="600" height="450" /></a><p class="wp-caption-text">The first working prototype</p></div>
<p>Of course, there are some changes I&#8217;d like to make &#8211; expect to see a v2.0 very soon. A few big things will be happening in the next revision, including addition of power planes and making the board smaller to reduce cost (by 30% ! ).</p>
<p>If anyone&#8217;s interested in ordering one of these from BatchPCB, <a title="Reveal this e-mail address" onclick="window.open('http://mailhide.recaptcha.net/d?k=01jlbGx1TZWHVloS28A_lV0A==&amp;c=-lwJp3roR08RVHblSvniF2KWeWePDTR86n3VPm23Z30=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" href="http://mailhide.recaptcha.net/d?k=01jlbGx1TZWHVloS28A_lV0A==&amp;c=-lwJp3roR08RVHblSvniF2KWeWePDTR86n3VPm23Z30=">email me</a> and I&#8217;ll send you the link and parts list . I don&#8217;t want to make it completely public yet with the upcoming revision, which will be cheaper and more stable, but if you want to try it now let me know.</p>
<p>Also expect to see a basic Arduino library for controlling it soon, and we&#8217;re working on completing the WootOff application &#8211; the pressure&#8217;s on now that there is a working board!</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/07/14/success-usb-power-shield-v1-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Coming Soon</title>
		<link>http://brettinman.com/2009/07/12/coming-soon/</link>
		<comments>http://brettinman.com/2009/07/12/coming-soon/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 02:25:30 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Rambling]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[coming soon]]></category>
		<category><![CDATA[communications]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[pcb]]></category>
		<category><![CDATA[tweet-a-watt]]></category>
		<category><![CDATA[wireless outlet]]></category>
		<category><![CDATA[xbee]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=115</guid>
		<description><![CDATA[Things have been quite here lately &#8211; but think of it as the lull before the storm! Coming soon to a blog near you: USB Power Shield Prototype The PCB has finally been produced and is on the way. Expect to see a fully functional (*fingers crossed*) version in the next few days! If the [...]]]></description>
			<content:encoded><![CDATA[<p>Things have been quite here lately &#8211; but think of it as the lull before the storm! Coming soon to a blog near you:</p>
<p><strong>USB Power Shield Prototype</strong><br />
The PCB has finally been produced and is on the way. Expect to see a fully functional (*fingers crossed*) version in the next few days! If the board is good, I&#8217;ll make it available as a public design on BatchPCB so others can order it &#8211; it comes out to about $25-30 a board after shipping, which is a little high but would be lower if we got enough interest to do a full panel.</p>
<p><strong>Remote Control Outlet</strong><br />
I&#8217;ve put together an outlet on an extension cord with a built-in relay, and the next step is to install an Xbee to make it wireless. Think of it as budget home automation, especially in combination with&#8230;</p>
<p><strong>Tweet-A-Watt</strong><br />
This isn&#8217;t a brettinman.com original, but I&#8217;m working on putting together a <a href="http://www.ladyada.net/make/tweetawatt/">Tweet-A-Watt </a>and will be posting up some photos and thoughts on this excellent kit. Perfect for apartments, since we can&#8217;t get a current meter around our incoming electrical.</p>
<p>All this and more, coming soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/07/12/coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First USB Power Shield Prototype on the Way!</title>
		<link>http://brettinman.com/2009/06/24/first-usb-power-shield-prototype-on-the-way/</link>
		<comments>http://brettinman.com/2009/06/24/first-usb-power-shield-prototype-on-the-way/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 01:52:06 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[USB Power Shield]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[pcb]]></category>
		<category><![CDATA[schematic]]></category>
		<category><![CDATA[usbpowershield]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=111</guid>
		<description><![CDATA[After toying with the relays and Arduino I found that the diodes weren&#8217;t necessary &#8211; especially since the relay is latching, and current will be flowing both ways, so putting a diode in each direction would just create a short. As such, I made some modifications to the board and put it into Gerber files [...]]]></description>
			<content:encoded><![CDATA[<p>After toying with the relays and Arduino I found that the diodes weren&#8217;t necessary &#8211; especially since the relay is latching, and current will be flowing both ways, so putting a diode in each direction would just create a short.</p>
<p>As such, I made some modifications to the board and put it into Gerber files using Eagle, uploaded them to <a href="http://batchpcb.com/">BatchPCB</a>, and am now waiting for the first one to arrive so that I can populate and test it. In the meantime, I need to get around to packaging the WootOff software for distribution, and come up with some documentation of this project that&#8217;s more readable than this series of blog posts.</p>
<p>Here&#8217;s the board schematic of the Prototype board:<br />
<div id="attachment_112" class="wp-caption aligncenter" style="width: 905px"><a href="http://brettinman.com/blog/wp-content/uploads/2009/06/shieldv1.jpg"><img src="http://brettinman.com/blog/wp-content/uploads/2009/06/shieldv1.jpg" alt="USB Power Shield v1.0 - Prototype" title="USB Power Shield v1.0 - Prototype" width="600" height="412" class="size-full wp-image-112" /></a><p class="wp-caption-text">USB Power Shield v1.0 - Prototype</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/06/24/first-usb-power-shield-prototype-on-the-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Un-Mac the Mac</title>
		<link>http://brettinman.com/2009/06/19/un-mac-the-mac/</link>
		<comments>http://brettinman.com/2009/06/19/un-mac-the-mac/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 07:05:30 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Rambling]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[whining]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=101</guid>
		<description><![CDATA[So I &#8220;caved&#8221;. I bought a Mac. I&#8217;ve used Windows for years, from our first computer running 95, to the screaming gaming desktop I built by hand and continue to upgrade to the latest and greatest. Windows has always treated me well. As long as you&#8217;re semi-competent, it&#8217;s easy enough to deal with its occasional [...]]]></description>
			<content:encoded><![CDATA[<p>So I &#8220;caved&#8221;. I bought a Mac. I&#8217;ve used Windows for years, from our first computer running 95, to the screaming gaming desktop I built by hand and continue to upgrade to the latest and greatest. Windows has always treated me well. As long as you&#8217;re semi-competent, it&#8217;s easy enough to deal with its occasional quirks (User Account Control, anyone?).</p>
<p>So why did I move to the Mac? Bottom line, they have great hardware. Find me a PC with a 2.26GHz, 2GB DDR3, 9400M graphics, and a 7 Hour battery (no joke) for $1099, not to mention the amazing build quality with the unibody Aluminum casing and glass screen/trackpad, and the awesome support Apple offers.</p>
<p>Of course, every Mac comes with OSX. After a couple weeks of using it, I&#8217;m split. As we&#8217;ll see, I&#8217;ve been able to find most of the software I need on Mac. On the other hand, OSX has some quirks that severely bother me. </p>
<p>As far as program compatibility, it&#8217;s half and half. Matlab has a Mac version which works great and there is a version of Spice available (called MacSpice), but it lacks a graphical schematic creator (such as Orcad Capture). Also, the Mac version of Excel lacks Basic and therefore the ability to run linear regressions (or just about any other function) on data. And of course, OSX lacks the ability to play any serious game, even though the hardware on the new MacBook is more than capable for most.</p>
<p>On the downside, I&#8217;m starting to get severely frustrated with some quirks in OSX. To start with, why in the world can&#8217;t I resize a window from any side &#8211; OSX only resizes from the bottom right corner, while Windows will do it on any side. It may not seem like a big deal, but on the other hand, it&#8217;s so easy to implement. It should only take a few minutes, and yet it&#8217;s been overlooked (copy/paste on the iPhone, anyone?).</p>
<p>Along the same lines, why can&#8217;t I fullscreen most programs? Firefox in windows can go fullscreen with the push of a button, but on the Mac I&#8217;m wasting an inch or two of screen real estate on the OSX menu bar and the Firefox toolbar. Once again, not a huge deal, but it shouldn&#8217;t be hard to do &#8211; how can you implement huge pieces of architecture (Time Machine?) and yet leave out these simple details? Apple is all about the details in their hardware; I wish this same level of obsession with usability would reach through to permeate their GUI user experience.</p>
<p>So how did I Un-Mac the Mac?</p>
<p>I boot-camped Windows 7 onto it. Installed an aftermarket 128GB solid-state drive and spun up the Release Candidate for Microsoft&#8217;s latest OS. Let&#8217;s just say I&#8217;m cursing at Windows 7 a lot less than I am at OSX.</p>
<p>Bottom line &#8211; excellent hardware, but the OSX user experience could be improved. </p>
<p>And where the hell is my dang middle-click gesture? I need to open links in new tabs with one click!</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/06/19/un-mac-the-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
