<?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>Doswa &#187; Electronics</title>
	<atom:link href="http://doswa.com/blog/category/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://doswa.com/blog</link>
	<description>Programming, physics, mathematics</description>
	<lastBuildDate>Sat, 28 Aug 2010 16:20:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Kaoss Guitar (Update 2)</title>
		<link>http://doswa.com/blog/2010/08/27/kaoss-guitar-update-2/</link>
		<comments>http://doswa.com/blog/2010/08/27/kaoss-guitar-update-2/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 22:43:55 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[kaoss guitar]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=484</guid>
		<description><![CDATA[The touchscreen is now working. I&#8217;m using the internal pull-up resistor on the ADC pin to detect when the touchscreen isn&#8217;t touched. The algorithm looks something like this: uint16_t x = touch_get_x&#40;&#41;; // ADC values go from 0-1023, so a &#8230; <a href="http://doswa.com/blog/2010/08/27/kaoss-guitar-update-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://doswa.com/blog/wp-content/uploads/2010/08/touchscreen.jpg"><img src="http://doswa.com/blog/wp-content/uploads/2010/08/touchscreen-1024x541.jpg" alt="" title="touchscreen" width="640" height="338" class="aligncenter size-large wp-image-485" /></a><br />
<span id="more-484"></span></p>
<p>The touchscreen is now working. I&#8217;m using the internal pull-up resistor on the ADC pin to detect when the touchscreen isn&#8217;t touched. The algorithm looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">uint16_t x <span style="color: #339933;">=</span> touch_get_x<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// ADC values go from 0-1023, so a value over 1000 indicates</span>
<span style="color: #666666; font-style: italic;">// that the screen isn't being touched and the resistor is</span>
<span style="color: #666666; font-style: italic;">// what's pulling the value high. The value when someone</span>
<span style="color: #666666; font-style: italic;">// is touching the screen varies from around 100 to 900.</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Screen is not being touched</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Screen is being touched</span>
    x <span style="color: #339933;">=</span> touch_normalize_x<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// ...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2010/08/27/kaoss-guitar-update-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AVRDUDE 5.10 with FTDI bitbang on Linux</title>
		<link>http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/</link>
		<comments>http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 19:35:59 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=460</guid>
		<description><![CDATA[Programming an ATmega168 using SparkFun&#8217;s FTDI Basic Breakout. This guide works for other FT232R-based devices as well. First, install the dependencies. On Ubuntu 10.04, this should take care of all of them: sudo apt-get install patch build-essential libreadline-dev libncurses-dev libusb-dev &#8230; <a href="http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://doswa.com/blog/wp-content/uploads/2010/08/ftdi.jpg" alt="" title="ftdi" width="628" height="374" class="aligncenter size-full wp-image-461" /></p>
<p><i>Programming an ATmega168 using <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9115">SparkFun&#8217;s FTDI Basic Breakout</a>. This guide works for other FT232R-based devices as well.</i></p>
<p><span id="more-460"></span></p>
<p>First, install the dependencies. On Ubuntu 10.04, this should take care of all of them:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">patch</span> build-essential libreadline-dev libncurses-dev libusb-dev libftdi-dev <span style="color: #c20cb9; font-weight: bold;">automake</span> <span style="color: #c20cb9; font-weight: bold;">autoconf</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep avrdude avrdude-doc</pre></div></div>

<p>Next, create a working directory for the build and cd into it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> avrdude
<span style="color: #7a0874; font-weight: bold;">cd</span> avrdude</pre></div></div>

<p>Now download the D2xx driver from FTDI. Only download the one that corresponds to your OS (either 64 bit or 32 bit).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># For 64-bit:</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ftdichip.com<span style="color: #000000; font-weight: bold;">/</span>Drivers<span style="color: #000000; font-weight: bold;">/</span>D2XX<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>libftd2xx0.4.16_x86_64.tar.gz
<span style="color: #666666; font-style: italic;"># For 32-bit:</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ftdichip.com<span style="color: #000000; font-weight: bold;">/</span>Drivers<span style="color: #000000; font-weight: bold;">/</span>D2XX<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>libftd2xx0.4.16.tar.gz</pre></div></div>

<p>Download AVRDUDE and the <a href="http://savannah.nongnu.org/patch/?6886">FTDI bitbang patches</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.savannah.gnu.org<span style="color: #000000; font-weight: bold;">/</span>releases-noredirect<span style="color: #000000; font-weight: bold;">/</span>avrdude<span style="color: #000000; font-weight: bold;">/</span>avrdude-5.10.tar.gz
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">8</span> <span style="color: #000000;">7</span> <span style="color: #000000;">6</span> <span style="color: #000000;">5</span> <span style="color: #000000;">4</span> <span style="color: #000000;">3</span> <span style="color: #000000;">2</span> <span style="color: #000000;">1</span> <span style="color: #000000;">0</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> patch-<span style="color: #007800;">$i</span>.diff http:<span style="color: #000000; font-weight: bold;">//</span>savannah.nongnu.org<span style="color: #000000; font-weight: bold;">/</span>patch<span style="color: #000000; font-weight: bold;">/</span>download.php?<span style="color: #007800;">file_id</span>=<span style="color: #000000;">1851</span><span style="color: #007800;">$i</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Extract everything, put the drivers into place, and apply the patches:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzf avrdude-5.10.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzf libftd2xx<span style="color: #000000; font-weight: bold;">*</span>.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> avrdude-<span style="color: #000000;">5.10</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> ..<span style="color: #000000; font-weight: bold;">/</span>patch-<span style="color: #000000; font-weight: bold;">*</span>.diff; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p0</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$file</span>; <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> ..<span style="color: #000000; font-weight: bold;">/</span>libftd2xx<span style="color: #000000; font-weight: bold;">*/</span>static_lib<span style="color: #000000; font-weight: bold;">/*</span> .
<span style="color: #c20cb9; font-weight: bold;">cp</span> ..<span style="color: #000000; font-weight: bold;">/</span>libftd2xx<span style="color: #000000; font-weight: bold;">*/*</span>.h .
<span style="color: #c20cb9; font-weight: bold;">cp</span> ..<span style="color: #000000; font-weight: bold;">/</span>libftd2xx<span style="color: #000000; font-weight: bold;">*/*</span>.cfg .</pre></div></div>

<p>Configure and compile AVRDUDE.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">&quot;-g -O2 -DSUPPORT_FT245R&quot;</span> <span style="color: #007800;">LIBS</span>=<span style="color: #ff0000;">&quot;./libftd2xx.a.0.4.16 -lpthread&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>If you&#8217;re using <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9115">SparkFun&#8217;s FTDI Basic Breakout</a> board, you can use the following to update your AVRDUDE configuration. If you&#8217;re using some other FTDI breakout board, you&#8217;ll need to modify the miso, sck, mosi, and reset options. FTDI has a listing of which bits correspond to which pins <a href="http://www.ftdichip.com/Documents/AppNotes/AN232B-01_BitBang.pdf">on page 1 of the bit-bang mode datasheet</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'
programmer
  id    = &quot;ftdi&quot;;
  desc  = &quot;SparkFun FTDI Basic Breakout&quot;;
  type  = ft245r;
  miso  = 1;  # RXD
  sck   = 3;  # CTS
  mosi  = 0;  # TXD
  reset = 4;  # DTR
;'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> avrdude.conf;</pre></div></div>

<p>If you&#8217;re using SparkFun&#8217;s FTDI Basic Breakout, you can make your connections as follows. Otherwise, make your connections according to the pins you chose in the previous step (more details <a href="http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/">in my previous post on the subject</a>).</p>
<pre>FTDI -> MCU (ATmega168 PDIP pin)
--------------------------------
DTR -> RESET (1)
RXI -> MISO (18)
TXO -> MOSI (17)
5V -> VCC (7 &#038; 20)
CTS -> SCK (19)
GND -> GND (8 &#038; 22)</pre>
<p>Now try it out to make sure everything worked. On Ubuntu, sudo is required because of the default permissions applied to USB devices. The `-B 1` option sets the programming speed to the lowest possible. You can omit that option if your AVR is clocked higher than 8MHz. If this runs successfully, your AVR&#8217;s high fuse byte should be printed to the terminal in hexadecimal.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>avrdude <span style="color: #660033;">-C</span> avrdude.conf <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> m168 <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-U</span> hfuse:r:-:h <span style="color: #660033;">-B</span> <span style="color: #000000;">1</span></pre></div></div>

<p>If everything worked well, you can now install AVRDUDE.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># If you're using Ubuntu, you can use checkinstall to build a .deb package and install it:</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> checkinstall
<span style="color: #666666; font-style: italic;"># Otherwise, just use `make install`:</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>You should now be able to use AVRDUDE without specifying a configuration file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> avrdude <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> m168 <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-U</span> hfuse:r:-:h <span style="color: #660033;">-B</span> <span style="color: #000000;">1</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kaoss Guitar (Update 1)</title>
		<link>http://doswa.com/blog/2010/04/18/kaoss-guitar-day-1/</link>
		<comments>http://doswa.com/blog/2010/04/18/kaoss-guitar-day-1/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 10:32:47 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[kaoss guitar]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=402</guid>
		<description><![CDATA[For a while, a friend and I have been planning to build a specialized MIDI controller into a guitar to control a Korg Kaoss Pad KP2. The idea came from the guitar used by Matt Bellamy of Muse (check out &#8230; <a href="http://doswa.com/blog/2010/04/18/kaoss-guitar-day-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For a while, a friend and I have been planning to build a specialized MIDI controller into a guitar to control a Korg <a href="http://en.wikipedia.org/wiki/Kaoss_Pad">Kaoss Pad</a> KP2. The idea came from the guitar used by Matt Bellamy of Muse (check out <a href="http://www.youtube.com/watch?v=h1cZDQFgHH8">a video of it</a>).<br />
<span id="more-402"></span></p>
<p>We ordered the electronics for the guitar from <a href="http://sparkfun.com">SparkFun Electronics</a> and <a href="http://digikey.com">Digi-Key</a>. When the project is over, I plan to add up the total cost and post a bill of materials. I suspect it will total to around $100.</p>
<p>Today we tested out <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8448">the 4.3&#8243; touchpad from SparkFun</a> using an Arduino. I have just finished setting up an ATmega328P on a breadboard and got a basic blink program running. The final product will be running on a plain AVR without the Arduino libraries/bootloader.</p>
<p>One problem I ran into using my <a href="http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/">FTDI programmer</a> was the clock rate. A fresh ATmega328P comes running at 1 MHz, significantly lower than the default 16 MHz on Arduino-prepared ATmegas. As a result, I kept getting errors like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">david<span style="color: #000000; font-weight: bold;">@</span>second:~$ avrdude <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> atmega168 <span style="color: #660033;">-P</span> ft0
avrdude: BitBang OK 
avrdude: pin assign miso <span style="color: #000000;">1</span> sck <span style="color: #000000;">3</span> mosi <span style="color: #000000;">0</span> reset <span style="color: #000000;">4</span>
avrdude: drain OK 
&nbsp;
 ft245r:  bitclk <span style="color: #000000;">230400</span> -<span style="color: #000000; font-weight: bold;">&gt;</span> ft baud <span style="color: #000000;">115200</span>
avrdude: ft245r_program_enable: failed
avrdude: initialization failed, <span style="color: #007800;">rc</span>=-<span style="color: #000000;">1</span>
         Double check connections and try again, or use <span style="color: #660033;">-F</span> to override
         this check.
&nbsp;
&nbsp;
avrdude done.  Thank you.</pre></div></div>

<p>Eventually I found AVRDUDE&#8217;s <code>-B</code> option. It adjusts the clock rate that&#8217;s fed into the SCK pin on the AVR. I found that a value of <code>-B 76800</code> works well, but if you&#8217;re running into this problem, I recommend starting with <code>-B 1</code> and going up until it stops working. To be explicit, this is the command that I found works:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">david<span style="color: #000000; font-weight: bold;">@</span>second:~$ avrdude <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> atmega168 <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-B</span> <span style="color: #000000;">76800</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2010/04/18/kaoss-guitar-day-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DIY aux input on Alpine car stereo (M-BUS)</title>
		<link>http://doswa.com/blog/2010/01/01/diy-aux-input-on-alpine-car-stereo-m-bus/</link>
		<comments>http://doswa.com/blog/2010/01/01/diy-aux-input-on-alpine-car-stereo-m-bus/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 07:51:31 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=324</guid>
		<description><![CDATA[If anything in this article is unclear or confusing, please let me know in the comments and I&#8217;ll do my best to clarify. Disclaimer: by following the instructions below, you may end up destroying your stereo, car, MP3 player, interpersonal &#8230; <a href="http://doswa.com/blog/2010/01/01/diy-aux-input-on-alpine-car-stereo-m-bus/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>If anything in this article is unclear or confusing, please let me know in the comments and I&#8217;ll do my best to clarify.</strong></p>
<p><em>Disclaimer: by following the instructions below, you may end up destroying your stereo, car, MP3 player, interpersonal relationships, and everything else you hold dear. I am not responsible for any of this. That being said, it worked fine for me.</em></p>
<p>This method will work on any Alpine stereos with an 8-pin M-BUS connector in the back. (The stereo I performed this on was an Alpine CDM-9821.) The connector itself should look something like this:<br />
<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&#038;name=275-1027-ND"><img src="http://doswa.com/blog/wp-content/uploads/2010/01/2dj-0108psa2.jpg" alt="2dj-0108psa2" title="2dj-0108psa2" width="166" height="200" class="aligncenter size-full wp-image-328" /></a></p>
<p>After some searching around, I located the functions of each pin on this connector at <a href="http://pinouts.ru/Home/alpine_cdchanger_pinout.shtml">pinouts.ru</a>. The pins on interest are the bottom three:<br />
<img src="http://doswa.com/blog/wp-content/uploads/2010/01/2dj-0108psa2asdfasdf.jpg" alt="2dj-0108psa2asdfasdf" title="2dj-0108psa2asdfasdf" width="282" height="200" class="aligncenter size-full wp-image-330" /></p>
<p>This corresponds perfectly with the contacts on a 3.5mm headphone plug:<br />
<img src="http://doswa.com/blog/wp-content/uploads/2010/01/ak203mm.jpg" alt="ak203mm" title="ak203mm" width="348" height="250" class="aligncenter size-full wp-image-332" /></p>
<p>So all that&#8217;s left to do is make an adapter between the two. I ordered these parts from Digi-Key: <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&#038;name=CP-1080-ND">CP-1080-ND</a>, <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&#038;name=AE9918-ND">AE9918-ND</a>, and <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&#038;lang=en&#038;site=us&#038;keywords=CP1-3513-ND&#038;x=0&#038;y=0">CP1-3513-ND</a>.</p>
<p>Gather up some solder, a soldering iron, and wire. Make the following connections:</p>
<ol>
<li>&#8220;Audio Ground&#8221; pin from the M-BUS connector goes to the pin closest to the hole on the 3.5mm audio jack</li>
<li>&#8220;Right Audio Input&#8221; goes to the pin farthest from the hole</li>
<li>&#8220;Left Audio Input&#8221; goes to the only remaining pin.</li>
</ol>
<p>You should end up with an adapter cable like this:<br />
<img src="http://doswa.com/blog/wp-content/uploads/2010/01/sj1-3513.jpg" alt="sj1-3513" title="sj1-3513" width="476" height="250" class="aligncenter size-full wp-image-335" /></p>
<p>Plug the M-BUS connector into the back of your stereo and mount the audio jack somewhere on the dash.</p>
<p>Now turn on your car. If all went well, nothing will start on fire. Hold the &#8220;Setup&#8221; button on the stereo and enable aux input in the menu. Now hit the &#8220;Source&#8221; button until you get to AUX. At this point, you should be able to plug in an MP3 player and have the audio routed to your car&#8217;s speakers.</p>
]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2010/01/01/diy-aux-input-on-alpine-car-stereo-m-bus/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SparkFun&#8217;s FTDI Basic Breakout as an AVR programmer</title>
		<link>http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/</link>
		<comments>http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 18:28:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=308</guid>
		<description><![CDATA[This guide has been merged into my AVRDUDE 5.10 bitbang guide. Original post follows (left here for reference). Now open up avrdude.conf in a text editor. Add this entry by the other programmers: # FTDI basic breakout programmer id = &#8230; <a href="http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>This guide has been merged into my <a href="http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/">AVRDUDE 5.10 bitbang guide</a>. Original post follows (left here for reference).</strong><br />
<span id="more-308"></span></p>
<p><a href="http://doswa.com/blog/wp-content/uploads/2009/12/screenshot1.jpg"><img src="http://doswa.com/blog/wp-content/uploads/2009/12/screenshot1.jpg" alt="screenshot1" title="screenshot1" width="384" height="320" class="aligncenter size-full wp-image-310" /></a></p>
<p>Now open up <code>avrdude.conf</code> in a text editor. Add this entry by the other programmers:</p>
<pre># FTDI basic breakout
programmer
  id = "ftdi";
  desc = "FTDI Basic Breakout";
  type = ft245r;
  miso = 1; # RxD
  sck = 3; # CTS
  mosi = 0; # TxD
  reset = 4; # DTR
;</pre>
<p>Now you can attach your FTDI Breakout to the target AVR like this:<br />
<u>FTDI -> MCU (ATmega168 PDIP pin)</u><br />
DTR -> RESET (1)<br />
RXI -> MISO (18)<br />
TXO -> MOSI (17)<br />
5V -> VCC (7 &#038; 20)<br />
CTS -> SCK (19)<br />
GND -> GND (8 &#038; 22)</p>
<p>With the 3&#215;2 ICSP header on the Arduino, that would look like this:</p>
<pre>        +----------------+
[RXI]--o| 1 MISO   +5V 2 |o--[5V]
[CTS]--o| 3 SCK   MOSI 4 |o--[TXO]
[DTR]--o| 5 RESET  GND 6 |o--[GND]
        +----------------+</pre>
<p>Note that may need to supply the AVR with an external oscillator or clock source. For virgin ATmega168s, you won&#8217;t need to (because it initially uses the internal oscillator), but you&#8217;ll need an external crystal oscillator if you&#8217;re using one that came out of an Arduino.</p>
<p>From there you can use AVRDUDE like normal using the `-c ftdi` switch. For example, to read fuse bytes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>avrdude <span style="color: #660033;">-C</span> avrdude.conf <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> m168 <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-U</span> hfuse:r:-:h <span style="color: #660033;">-U</span> lfuse:r:-:h <span style="color: #660033;">-U</span> efuse:r:-:h</pre></div></div>

<p><strong>Edit 2010-04-18:</strong></p>
<p>I just found out that new AVRs need to have the clock rate adjusted before this will work. This is because AVRs come with the internal clock set to 1 MHz (actually, 8 MHz with the CKDIV8 fuse bit set) instead of the Arduino default 16 MHz. This can be done with AVRDUDE&#8217;s <code>-B</code> option. This option determines what clock is fed into the AVR&#8217;s SCK pin. I recommend starting with a value of <code>-B 1</code> and working your way up to a reasonable clock speed. Here is the adjusted command for new AVRs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>avrdude <span style="color: #660033;">-C</span> avrdude.conf <span style="color: #660033;">-c</span> ftdi <span style="color: #660033;">-p</span> m168 <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-U</span> hfuse:r:-:h <span style="color: #660033;">-U</span> lfuse:r:-:h <span style="color: #660033;">-U</span> efuse:r:-:h <span style="color: #660033;">-B</span> <span style="color: #000000;">1</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AVRDUDE 5.8 with FTDI bitbang patch on Linux</title>
		<link>http://doswa.com/blog/2009/12/20/avrdude-58-with-ftdi-bitbang-patch-on-linux/</link>
		<comments>http://doswa.com/blog/2009/12/20/avrdude-58-with-ftdi-bitbang-patch-on-linux/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 18:16:23 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=292</guid>
		<description><![CDATA[I updated this walkthrough for AVRDUDE 5.10. Original guide for AVRDUDE 5.8 follows. &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Description: This is an adaptation of the work by Kimio Kosaka, Nate Phillips, and Massimo. It allows you to use AVRDUDE with an FTDI chip (like &#8230; <a href="http://doswa.com/blog/2009/12/20/avrdude-58-with-ftdi-bitbang-patch-on-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/">I updated this walkthrough for AVRDUDE 5.10</a>. Original guide for AVRDUDE 5.8 follows.</strong><br />
<span id="more-292"></span></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Description:</strong> <em>This is an adaptation of the work by <a href="http://www.geocities.jp/arduino_diecimila/bootloader/index_old_en.html">Kimio Kosaka</a>, <a href="http://labs.coffeebot.net/content/ftdi-drivers-avrdude-linux">Nate Phillips</a>, and <a href="http://savannah.nongnu.org/users/runaway">Massimo</a>. It allows you to use AVRDUDE with an FTDI chip (like the one on the Arduino boards or SparkFun&#8217;s FTDI Basic Breakout). This can be useful if you manage to brick your Arduino and you have no programmer.</em></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>If you&#8217;re on Ubuntu or Debian, install the prerequisites with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">patch</span> build-essential libreadline-dev libncurses-dev libusb-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep avrdude avrdude-doc</pre></div></div>

<p>&#8212;</p>
<p>Start by grabbing a copy of AVRDUDE 5.8, untarring it in the directory, and switching to that directory:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.savannah.gnu.org<span style="color: #000000; font-weight: bold;">/</span>releases-noredirect<span style="color: #000000; font-weight: bold;">/</span>avrdude<span style="color: #000000; font-weight: bold;">/</span>avrdude-5.8.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzf avrdude-5.8.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> avrdude-<span style="color: #000000;">5.8</span></pre></div></div>

<p>&#8212;</p>
<p>Now get a copy of the FTDI bitbang patch files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">8</span> <span style="color: #000000;">7</span> <span style="color: #000000;">6</span> <span style="color: #000000;">5</span> <span style="color: #000000;">4</span> <span style="color: #000000;">3</span> <span style="color: #000000;">2</span> <span style="color: #000000;">1</span> <span style="color: #000000;">0</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> patch-<span style="color: #007800;">$i</span>.diff http:<span style="color: #000000; font-weight: bold;">//</span>savannah.nongnu.org<span style="color: #000000; font-weight: bold;">/</span>patch<span style="color: #000000; font-weight: bold;">/</span>download.php?<span style="color: #007800;">file_id</span>=<span style="color: #000000;">1851</span><span style="color: #007800;">$i</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>&#8212;</p>
<p>Apply the patches:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> patch-<span style="color: #000000; font-weight: bold;">*</span>.diff; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p0</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$file</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>&#8212;</p>
<p>Also get a copy of the FTDI driver. For 32-bit:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ftdichip.com<span style="color: #000000; font-weight: bold;">/</span>Drivers<span style="color: #000000; font-weight: bold;">/</span>D2XX<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>libftd2xx0.4.16.tar.gz</pre></div></div>

<p>For 64-bit:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.ftdichip.com<span style="color: #000000; font-weight: bold;">/</span>Drivers<span style="color: #000000; font-weight: bold;">/</span>D2XX<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>libftd2xx0.4.16_x86_64.tar.gz</pre></div></div>

<p>&#8212;</p>
<p>Extract the FTDI driver and copy over the needed files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzf libftd2xx<span style="color: #000000; font-weight: bold;">*</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">cp</span> libftd2xx<span style="color: #000000; font-weight: bold;">*/</span>static_lib<span style="color: #000000; font-weight: bold;">/*</span> .
<span style="color: #c20cb9; font-weight: bold;">cp</span> libftd2xx<span style="color: #000000; font-weight: bold;">*/*</span>.h .
<span style="color: #c20cb9; font-weight: bold;">cp</span> libftd2xx<span style="color: #000000; font-weight: bold;">*/*</span>.cfg .</pre></div></div>

<p>&#8212;</p>
<p>Generate your makefile:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure</pre></div></div>

<p>&#8212;</p>
<p>Open <code>Makefile</code> in a text editor and perform the following operations:</p>
<ol>
<li>Find the line <code>CFLAGS = -g -O2</code> and replace it with <code>CFLAGS = -g -O2 -DHAVE_LIBUSB -DSUPPORT_FT245R</code>.</li>
<li>Find the line <code>LIBS = -lreadline -lncurses -ltermcap</code> and replace it with <code>LIBS = -lreadline -lncurses -ltermcap ./libftd2xx.a.0.4.16 -lrt</code>.</li>
</ol>
<p>&#8212;</p>
<p>Now to actually compile it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>&#8212;</p>
<p>From here, you can follow the instructions at <a href="http://www.geocities.jp/arduino_diecimila/bootloader/index_old_en.html">http://www.geocities.jp/arduino_diecimila/bootloader/index_old_en.html</a> starting at step 5. Note that you&#8217;ll need to modify the commands a little bit. Instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">avrdude <span style="color: #660033;">-c</span> diecimila <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-p</span> m168</pre></div></div>

<p>you should write:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>avrdude <span style="color: #660033;">-C</span> avrdude.conf <span style="color: #660033;">-c</span> duemilanove <span style="color: #660033;">-P</span> ft0 <span style="color: #660033;">-p</span> m168</pre></div></div>

<p>(Note: you can still use it on a Diecimila, just specify the programmer as `-c duemilanove` and it should work.)</p>
<p>If you&#8217;d like to use SparkFun&#8217;s FTDI Basic Breakout as a programmer, try <a href="http://doswa.com/blog/2009/12/20/sparkfuns-ftdi-basic-breakout-as-an-avr-programmer/">these instructions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2009/12/20/avrdude-58-with-ftdi-bitbang-patch-on-linux/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Accessing AVR GPIOs via bit fields</title>
		<link>http://doswa.com/blog/2009/12/08/accessing-avr-gpios-via-bit-fields/</link>
		<comments>http://doswa.com/blog/2009/12/08/accessing-avr-gpios-via-bit-fields/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 15:16:56 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=261</guid>
		<description><![CDATA[I noticed that the TMS320F2809 examples accessed GPIOs by bits rather than as 32-bit ints. For example, it&#8217;s possible to set a GPIO like this on the TMS320F280x: GpioDataRegs.GPADAT.bit.GPIO12 = 1; // Sets GPIO12 to high. Normally when working with &#8230; <a href="http://doswa.com/blog/2009/12/08/accessing-avr-gpios-via-bit-fields/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://doswa.com/blog/wp-content/uploads/2009/12/atmega328.png" alt="atmega328" title="atmega328" width="307" height="245" class="aligncenter size-full wp-image-267" /></p>
<p>I noticed that the <a href="http://focus.ti.com/docs/prod/folders/print/tms320f2809.html">TMS320F2809</a> examples accessed GPIOs by bits rather than as 32-bit ints. For example, it&#8217;s possible to set a GPIO like this on the TMS320F280x:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">GpioDataRegs.<span style="color: #202020;">GPADAT</span>.<span style="color: #202020;">bit</span>.<span style="color: #202020;">GPIO12</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets GPIO12 to high.</span></pre></div></div>

<p>Normally when working with AVRs, I would set bits like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">PORTB <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">&lt;&lt;</span>PB3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets port b, bit 3 to high.</span></pre></div></div>

<p>After a bit of tinkering, I came up with this (for AVRs):</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">portb.<span style="color: #202020;">bit</span>.<span style="color: #202020;">b3</span> <span style="color: #339933;">=</span> HIGH<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets port b, bit 3 to high.</span></pre></div></div>

<p>I personally think it looks a bit cleaner, so I&#8217;ll probably be using it in the future. If you&#8217;re interested in trying it out, you can download a full example here: <a href="http://doswa.com/projects/avr_bitfields/bitfields.zip">bitfields.zip</a>.</p>
<hr />
<p><small><br />
Side note: It is also possible to access GPIOs as 32-bit ints on the TMS320F280x like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">GpioDataRegs.<span style="color: #202020;">GPADAT</span>.<span style="color: #202020;">all</span> <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">&lt;&lt;</span><span style="color: #0000dd;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Sets GPIO12 to high.</span></pre></div></div>

<p></small></p>
<hr />
<p>Edit: <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&#038;file=viewtopic&#038;t=86521">Looks like I&#8217;m not alone</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2009/12/08/accessing-avr-gpios-via-bit-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino 0017 on 64-bit Ubuntu 9.04 and 9.10</title>
		<link>http://doswa.com/blog/2009/10/29/arduino-0017-on-64-bit-ubuntu-904/</link>
		<comments>http://doswa.com/blog/2009/10/29/arduino-0017-on-64-bit-ubuntu-904/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 05:11:28 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://doswa.com/blog/?p=245</guid>
		<description><![CDATA[Edit: This post isn&#8217;t really relevant anymore—Arduino 0018 has a 64 bit binary. Original post follows. Update 2009-12-25: these instructions work on both 9.10 Karmic and 9.04 Jaunty. Install all dependencies: sudo apt-get install sun-java6-jre gcc-avr avr-libc ia32-libs librxtx-java Download &#8230; <a href="http://doswa.com/blog/2009/10/29/arduino-0017-on-64-bit-ubuntu-904/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em><strong>Edit:</strong> This post isn&#8217;t really relevant anymore—Arduino 0018 has a 64 bit binary. Original post follows.</em><br />
<span id="more-245"></span></p>
<hr />
<p><img src="http://doswa.com/blog/wp-content/uploads/2009/06/arduino-64-bit.png" alt="arduino-64-bit" title="arduino-64-bit" width="502" height="157" class="alignnone size-full wp-image-142" /></p>
<p><strong>Update 2009-12-25</strong>: these instructions work on both 9.10 Karmic and 9.04 Jaunty.</p>
<hr />
<ol>
<li>Install all dependencies:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-jre gcc-avr avr-libc ia32-libs librxtx-java</pre></div></div>

</li>
<li>Download 32-bit version of Arduino 0017: <a href="http://arduino.googlecode.com/files/arduino-0017.tgz">[download]</a></li>
<li>Extract it and navigate to the <code>lib/</code> directory. Delete <code>RXTXcomm.jar</code> and <code>librxtxSerial.so</code>.</li>
<li>Go back to the main directory and open the <code>arduino</code> script in a text editor. Replace its contents with:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">APPDIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(dirname -- &quot;${0}&quot;)</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> LIB <span style="color: #000000; font-weight: bold;">in</span> \
    java<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>rt.jar \
    java<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>tools.jar \
    lib<span style="color: #000000; font-weight: bold;">/*</span>.jar \
    ;
<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #007800;">CLASSPATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${CLASSPATH}</span>:<span style="color: #007800;">${APPDIR}</span>/<span style="color: #007800;">${LIB}</span>:/usr/share/java/RXTXcomm.jar&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">export</span> CLASSPATH
&nbsp;
<span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib:<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>lib:<span style="color: #800000;">${LD_LIBRARY_PATH}</span>
<span style="color: #7a0874; font-weight: bold;">export</span> LD_LIBRARY_PATH
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${APPDIR}</span>/java/bin:<span style="color: #007800;">${PATH}</span>&quot;</span>
&nbsp;
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base</pre></div></div>

</li>
<hr />
<p><b>Note:</b><br />
The Serial Monitor in the Arduino IDE doesn&#8217;t work. As a replacement, you can install <i>screen</i> with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">screen</span></pre></div></div>

<p>To start <i>screen</i> for use with an Arduino, run this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ttyUSB0 <span style="color: #000000;">9600</span></pre></div></div>

<p>Replace <code>/dev/ttyUSB0</code> with the location of your serial port and <code>9600</code> with the baud rate you&#8217;re using.</p>
<p>To quit <i>screen</i>, press Ctrl-a then press k. You must quit <i>screen</i> before you can upload a program via the Arduino IDE.</p>
]]></content:encoded>
			<wfw:commentRss>http://doswa.com/blog/2009/10/29/arduino-0017-on-64-bit-ubuntu-904/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
