<?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; Arduino</title>
	<atom:link href="http://brettinman.com/tag/arduino/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>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>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>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>USB Power Shield</title>
		<link>http://brettinman.com/2009/06/10/usb-power-shield/</link>
		<comments>http://brettinman.com/2009/06/10/usb-power-shield/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 04:33:05 +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[schematic]]></category>
		<category><![CDATA[transistors]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[usbpowershield]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=82</guid>
		<description><![CDATA[I really wanted there to be a complete solution for the Woot-Off lights project that could be almost plug and play for the end user, so today I drew up a schematic and a board for a USB Power Shield for the Arduino. It pops onto the Arduino like any other shield, and by controlling [...]]]></description>
			<content:encoded><![CDATA[<p>I really wanted there to be a complete solution for the Woot-Off lights project that could be almost plug and play for the end user, so today I drew up a schematic and a board for a USB Power Shield for the Arduino. It pops onto the Arduino like any other shield, and by controlling pins 9-12, you can control power to four devices. </p>
<p>There are two USB ports for anything that takes USB power (5V) &#8211; of course, these ports are for power only (no data). You can use these to control the Woot-Off lights without cutting and soldering the cord, and something else (USB Fan? Light? <a href="http://www.thinkgeek.com/interests/giftsunder10/9c89/">Humping Dog</a>?). There are also four pads toward the middle so you can solder in anything else that takes 5V power.</p>
<div id="attachment_91" class="wp-caption aligncenter" style="width: 610px"><a href="http://brettinman.com/blog/wp-content/uploads/2009/06/board.jpg"><img src="http://brettinman.com/blog/wp-content/uploads/2009/06/board.jpg" alt="USB Power Shield board" title="USB Power Shield board" width="600" height="439" class="size-full wp-image-91" /></a><p class="wp-caption-text">USB Power Shield board</p></div>
<p>Schematic <a href="http://brettinman.com/blog/wp-content/uploads/2009/06/boardschematic.jpg">here</a>.</p>
<p>Since the Arduino can only supply maybe 300mA while on USB power and 600mA from its small 5V regulator (using DC in), I&#8217;ve included the stuff necessary to add a 7805 regulator and related components to allow up to 1A (if you use a heatsink). You can always leave these pads empty if you don&#8217;t plan on using that much power. The Woot-Off Lights will need at least the 5V regulator on the Arduino. There are also LEDs to show if the regulator and board itself are powered &#8211; these can be omitted as well.</p>
<p>The board uses four 2N3906 to control power of up to 200mA at 5V to four devices. By writing the corresponding pin LOW on the Arduino, you turn on the transistor and allow current to flow from 5V to the device (and then, hopefully, out to GND). Very Simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/06/10/usb-power-shield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Woot-Off Lights &#8211; in Python</title>
		<link>http://brettinman.com/2009/06/03/woot-off-lights-in-python/</link>
		<comments>http://brettinman.com/2009/06/03/woot-off-lights-in-python/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 01:07:56 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=70</guid>
		<description><![CDATA[The Woot-Off Lights project continues to slowly progress. Over the weekend we moved over to Python for the coding, since that&#8217;s the language Alex is most familiar with right now (especially in networking). Serial control of the lights in Python took longer than expected &#8211; we could have saved over an hour of troubleshooting had [...]]]></description>
			<content:encoded><![CDATA[<p>The Woot-Off Lights project continues to slowly progress. Over the weekend we moved over to Python for the coding, since that&#8217;s the language Alex is most familiar with right now (especially in networking). </p>
<p>Serial control of the lights in Python took longer than expected &#8211; we could have saved over an hour of troubleshooting had we simply waited two seconds between opening the serial connection and transmitting the first byte (allowing the connection protocols time to complete), but instead we tried half a dozen Python libraries, thinking the problem was somewhere in the code library. Lesson learned &#8211; the exact specifics of interaction between software and hardware is not to be ignored.</p>
<p>We then were able to force the Woot Tracker to update it&#8217;s cache, pull down the XML file generated by the tracker, parse it for the value we are looking for (wootoff, true or false), and take action based upon it. </p>
<p>Now we&#8217;re simply trying to figure out how to package the program into an .exe that can be hidden in the tray, and also figure out how the timing should work &#8211; I would prefer that my server didn&#8217;t get a ton of update requests at the same time, especially during a Woot-Off. Right now it looks like we&#8217;ll run a custom version of the software on our machine to update the tracker, and the software we distribute publicly will simply pull down the XML (without first updating the cache, because our software has already done so).</p>
<p>On the hardware side of things, I&#8217;ve consolidated the driver circuitry onto a small piece of protoboard that pops into the Arduino like a shield. I&#8217;ve also cut up an Altoids tin and housed the assembly inside of it. Don&#8217;t forget the isolate the top/bottom of the board with electrical tape or similar so the metal case doesn&#8217;t short anything.</p>
<p>Here&#8217;s a few pictures of the assembly, with the lights being controlled via the Python application.</p>
<p style="text-align: center;">
<div class="ngg-galleryoverview" id="ngg-gallery-1-70">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-1" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://brettinman.com/blog/wp-content/gallery/tin/tin1.jpg" title=" " rel="lightbox[set_1]" >
								<img title="tin1.jpg" alt="tin1.jpg" src="http://brettinman.com/blog/wp-content/gallery/tin/thumbs/thumbs_tin1.jpg" width="100" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-2" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://brettinman.com/blog/wp-content/gallery/tin/tin2.jpg" title=" " rel="lightbox[set_1]" >
								<img title="tin2.jpg" alt="tin2.jpg" src="http://brettinman.com/blog/wp-content/gallery/tin/thumbs/thumbs_tin2.jpg" width="100" height="75" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-3" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://brettinman.com/blog/wp-content/gallery/tin/tin3.jpg" title=" " rel="lightbox[set_1]" >
								<img title="tin3.jpg" alt="tin3.jpg" src="http://brettinman.com/blog/wp-content/gallery/tin/thumbs/thumbs_tin3.jpg" width="100" height="75" />
							</a>
		</div>
	</div>
	
		
 	 	
	<!-- Pagination -->
 	<div class='ngg-clear'></div>
 	
</div>

</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/06/03/woot-off-lights-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Driving Speakers with Arduino</title>
		<link>http://brettinman.com/2009/05/30/driving-speakers-with-arduino/</link>
		<comments>http://brettinman.com/2009/05/30/driving-speakers-with-arduino/#comments</comments>
		<pubDate>Sat, 30 May 2009 09:30:36 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[boarduino]]></category>
		<category><![CDATA[buzzer]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=56</guid>
		<description><![CDATA[In my quest to try out everything the Arduino can possibly do, I decided to hook up a buzzer and try messing around with generating some tones. Since my little 8ohm buzzer seemed to have gone missing, I substituted one of Sparkfun&#8217;s audio jack breakout boards and a cheap pair of earbuds I had lying [...]]]></description>
			<content:encoded><![CDATA[<p>In my quest to try out everything the Arduino can possibly do, I decided to hook up a buzzer and try messing around with generating some tones. Since my little 8ohm buzzer seemed to have gone missing, I substituted one of Sparkfun&#8217;s audio jack <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8827">breakout boards</a> and a cheap pair of earbuds I had lying around. DO NOT use a quality set of earbuds or headphones, or any set that you wouldn&#8217;t want damaged &#8211; we&#8217;ll see why in a minute. Just connect ground to ground and either the left or right channel (or both) to one of the digital pins &#8211; I used 13 so the LED would light up with the rhythm of the music. I eventually found a couple more buzzers and hooked them in.</p>
<p><div id="attachment_60" class="wp-caption aligncenter" style="width: 610px"><img src="http://brettinman.com/blog/wp-content/uploads/2009/05/buzzer.jpg" alt="Arduinos with Buzzers" title="buzzer" width="600" height="450" class="size-full wp-image-60" /><p class="wp-caption-text">Arduinos with Buzzers</p></div><br />
My new Boarduino USB from <a href="http://www.adafruit.com/">Adafruit</a> is on the left in a breadboard and the Duemilanove is on the right.</p>
<p>The most basic way to create audio using the Arduino is essentially bit-banging one of the digital pins &#8211; write high and low at the frequency you wish to generate. The downside is that this creates a nearly square wave, which sound very harsh and unnatural. Also, the &#8220;high&#8221; is 5V, which is a very high amplitude to be supplying to headphones. Constant use at this amplitude (volume) will probably damage the drivers in earbuds &#8211; use the cheap earbuds that came with your MP3 player. Using a standard 8ohm buzzer is of course the preferred method if you have one lying around. I found a buzz function online to control this &#8211; pass it the pin to buzz on, the frequency, and the length, and it does the work for you. </p>
<p><code>void buzz(int targetPin, long frequency, long length) {<br />
  long delayValue = 1000000/frequency/2; // calculate the delay value between transitions<br />
  //// 1 second's worth of microseconds, divided by the frequency, then split in half since<br />
  //// there are two phases to each cycle<br />
  long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing<br />
  //// multiply frequency, which is really cycles per second, by the number of seconds to<br />
  //// get the total number of cycles to produce<br />
 for (long i=0; i < numCycles; i++){ // for the calculated length of time...<br />
    digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphram<br />
    delayMicroseconds(delayValue); // wait for the calculated delay value<br />
    digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphram<br />
    delayMicroseconds(delayValue); // wait againf or the calculated delay value<br />
  }<br />
}<br />
</code></p>
<p>The downside is that this uses the delay function. That means your controller can't do anything else while waiting for the end of the delay. You would also have to use a delay function between the notes to create spaces. This is sufficient for a small buzzer project, but if you're looking to do more complex things (especially signals other than square wave),  try consulting the Arduino <a href="http://www.arduino.cc/playground/Main/InterfacingWithHardware#Audio">Playground</a>.</p>
<p>I was able to find a script for the Mario Bros theme online, and covert it into a series of buzz and delay calls. Not all the notes are correct and some of the spacing is off, but it's good enough to get the idea. The entire Arduino script is available <a href="http://www.brettinman.com/elec/buzzer.pde">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/05/30/driving-speakers-with-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Woot-Off Lights Schematic and Hardware</title>
		<link>http://brettinman.com/2009/05/18/woot-off-lights-schematic-and-hardware/</link>
		<comments>http://brettinman.com/2009/05/18/woot-off-lights-schematic-and-hardware/#comments</comments>
		<pubDate>Tue, 19 May 2009 05:58:18 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[schematic]]></category>
		<category><![CDATA[uln2803]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=46</guid>
		<description><![CDATA[Here&#8217;s some details about the hardware setup for the woot-off lights. It&#8217;s exactly as I described in the first post &#8211; this just includes the schematic and goes a little more in depth. Let&#8217;s take it from left to right. USB input to the Arduino to send serial data. The current from the USB port [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some details about the hardware setup for the woot-off lights. It&#8217;s exactly as I described in the first post &#8211; this just includes the schematic and goes a little more in depth.</p>
<div id="attachment_47" class="wp-caption aligncenter" style="width: 610px"><img src="http://brettinman.com/blog/wp-content/uploads/2009/05/schematic.jpg" alt="Quick and Dirty Schematic for Woot-Off Light Control" title="Woot-Off Lights Schematic" width="600" height="238" class="size-full wp-image-47" /><p class="wp-caption-text">Quick and Dirty Schematic for Woot-Off Light Control</p></div>
<p>Let&#8217;s take it from left to right. USB input to the Arduino to send serial data. The current from the USB port is not sufficient to start the motors (they require a bit of boost when turned on and consume less current during normal operation), therefore we use the DC input on the Arduino board to supplement the USB. Feed it somewhere between 7-10V (up to 12V should be fine). The Arduino contains a regulator to lower the Vin down to 5V.</p>
<p>The 5V is then connected to the V+ of the lights (red wire). The GND of the lights is connected to Pin 18 of the ULN2803 IC. The ULN2803 also has it&#8217;s own 5V/GND connections (the 5V connection is necessary in this application because of the inductance of the motors). When the ULN2803 receives a HIGH input on Pin 1 (coming from Pin 9 on Arduino), it connects Pin 18 to GND (note that this is the same for all pins on the IC except 9/10 &#8211; i.e., Pin 2 controls Pin 17, etc). Thus, the lights are now fully connected to both 5V and GND, the circuit is complete, and we have spinny lights.</p>
<p>Work continues on reading a Woot-Off Tracker from a C++ application &#8211; if anyone has tips or ideas, they&#8217;d be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/05/18/woot-off-lights-schematic-and-hardware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serial Control of Woot-Off Lights Working</title>
		<link>http://brettinman.com/2009/05/18/serial-control-of-woot-off-lights-working/</link>
		<comments>http://brettinman.com/2009/05/18/serial-control-of-woot-off-lights-working/#comments</comments>
		<pubDate>Mon, 18 May 2009 08:03:16 +0000</pubDate>
		<dc:creator>brettinman</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Woot-Off Lights Project]]></category>
		<category><![CDATA[communications]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=34</guid>
		<description><![CDATA[After a few hours of clumsy and inept coding, I managed to scrape together a basic windows console application to send data over serial. Right now it just asks you which COM port the Arduino is on (usually COM3), and then you hit enter to turn the lights on/off. All that&#8217;s actually happening is the [...]]]></description>
			<content:encoded><![CDATA[<p>After a few hours of clumsy and inept coding, I managed to scrape together a basic windows console application to send data over serial. Right now it just asks you which COM port the Arduino is on (usually COM3), and then you hit enter to turn the lights on/off. All that&#8217;s actually happening is the program sending the character &#8217;1&#8242; or &#8217;0&#8242; down the serial pipe.</p>
<p>On the other end of the pipe, the Arduino is listening to the serial communication. The sketch I have set up simply sets pin 9 to HIGH when it receives a 1, and LOW when it receives a 0. That&#8217;s it. Then the hardware is controlled as discussed in the previous post.</p>
<div id="attachment_35" class="wp-caption aligncenter" style="width: 610px"><img src="http://brettinman.com/blog/wp-content/uploads/2009/05/serialconsole.jpg" alt="Prototype console application for Arduino Serial communication" title="serialconsole" width="680" height="333" class="size-full wp-image-35" /><p class="wp-caption-text">Prototype console application for Arduino Serial communication</p></div>
<p>So at this point we have:<br />
a) Hardware control of lights<br />
b) Windows console application for serial communication on/off</p>
<p>Which leaves:<br />
c) Having the application read the tracker for wootoff status<br />
d) Packaging it together in a nice, pretty package</p>
<p>So for those following along with an Arduino, I&#8217;m posting the Arduino sketch and the console application below. If you want to use a pin other than pin 9 on the arduino, just modify that part at the top of the sketch. Obviously, you should upload the sketch to the Arduino first, exit the Arduino software (since only one application can access the port at a time), identify which port your Arduino is on, and then run the console application. <strong>I AM NOT RESPONSIBLE FOR ANY HORRIBLE THINGS THAT RESULT FROM THE USE OF THIS SOFTWARE</strong>, largely because I started college as a CS major and switched to EE a year later because I hate coding. That said, it works fine on my and my roommate&#8217;s machines.</p>
<p><a href="http://www.brettinman.com/elec/wootoff.pde">Arduino Sketch</a><br />
<a href="http://www.brettinman.com/elec/wootserialcontrol.exe">Windows Console Application</a></p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/05/18/serial-control-of-woot-off-lights-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
