<?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; serial</title>
	<atom:link href="http://brettinman.com/tag/serial/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>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 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>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>
		<item>
		<title>Intelligent Control of Woot-Off Lights</title>
		<link>http://brettinman.com/2009/05/16/intelligent-control-of-woot-off-lights/</link>
		<comments>http://brettinman.com/2009/05/16/intelligent-control-of-woot-off-lights/#comments</comments>
		<pubDate>Sat, 16 May 2009 08:32:01 +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[led]]></category>
		<category><![CDATA[motor]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[uln2803]]></category>
		<category><![CDATA[wootofflights]]></category>

		<guid isPermaLink="false">http://brettinman.com/?p=11</guid>
		<description><![CDATA[Please see the WootOff Lights Project category for the most up-to-date posts about this project. Occasionally, Woot has extravaganzas where they post item after item in what is known as a woot-off. Little .gif lights spin round and round to alert visitors to this spectacle. Playing on this, Woot occasionally sells physical woot-off lights. They [...]]]></description>
			<content:encoded><![CDATA[<p><em>Please see the <a href="http://brettinman.com/category/woot-off-lights-project/">WootOff Lights Project category</a> for the most up-to-date posts about this project.</em></p>
<p>Occasionally, <a href="http://www.woot.com">Woot</a> has extravaganzas where they post item after item in what is known as a woot-off. Little .gif lights spin round and round to alert visitors to this spectacle. Playing on this, Woot occasionally sells physical woot-off lights. They run off of USB power, with a switch in each light/motor piece. Since it&#8217;s a standard 5V connection, this opens the doors for all sorts of hackery.</p>
<p>The ultimate goal of this project is to have these lights come on whenever there is a woot-off.</p>
<p>If you aren&#8217;t already familiar with the <a href="http://www.arduino.cc/">Arduino</a>, become familiar now. I&#8217;ll wait.</p>
<p>Ok, so the Arduino is a microcontroller system with a USB-serial input communication, a microprocessor with a bootloader to run &#8220;sketches&#8221;, and the ability to control over a dozen digital logic pins (including a few with PWM or Analog-In). </p>
<p>The setup will use a PC application for monitoring a &#8220;<a href="http://www.brettinman.com/woot">Woot Tracker</a>&#8221; (many of these are available online to reduce load on Woot&#8217;s own servers). The application will check for the presence of the woot-off lights logo, indicating a woot-off &#8211; in the future, the lights will be activated by each changing of an item. The application will then send a byte over serial to indicate the woot-off status to the Arduino. Based on the input from the computer, the Arduino will turn the lights on or off.</p>
<p>Great &#8211; so in order to turn on the lights all we have to do is turn on one of the Arduino&#8217;s pins (they are 5V at digital high). Unfortunately each pin is only capable of supplying at most 50mA, and these lights run on over 100mA. Luckily, the 5V power regulator on the Arduino is capable of supplying much more current &#8211; up to 500mA or so if a good DC power supply is used. So if we hook up the positive lead of these unit to the 5V, we now need to control the ground connection to control the circuit &#8211; connect the ground and the lights go on because the circuit completes.</p>
<p>The ULN2803 chip provides this exact function. The chip is connected to 5V and ground. The ground from the device to be controlled is connected to a pin (remember that the positive of the device is already connected to 5V), and the control signal from the Arduino is connected to the corresponding control pin. When the control pin sees 5V (from the Arduino control signal), the ground lead from the device is connected to the ground of the chip, completing the circuit and sending current to the device. In this case, the lights spin up.</p>
<div id="attachment_14" class="wp-caption aligncenter" style="width: 610px"><img src="http://brettinman.com/blog/wp-content/uploads/2009/05/wootoff1.jpg" alt="Early Woot-Off Light Software/Arduino Control" title="Early Woot-Off Light Software/Arduino Control" width="600" height="450" class="size-full wp-image-14" /><p class="wp-caption-text">Early Woot-Off Light Software/Arduino Control</p></div>
<p>So far I have the hardware running, and have used the Arduino PC software to send input down the serial connection, turning the lights on and off. The next step will be to write an application to send serial information, and then to expand that application to search the textfile of the woot tracker for the lights.gif. The final stage will be to integrate all the hardware into a small package so the device can be used permanently.</p>
]]></content:encoded>
			<wfw:commentRss>http://brettinman.com/2009/05/16/intelligent-control-of-woot-off-lights/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
