<?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>musicalgeometry &#187; arduino</title>
	<atom:link href="http://www.musicalgeometry.com/archives/category/arduino/feed" rel="self" type="application/rss+xml" />
	<link>http://www.musicalgeometry.com</link>
	<description>sound, code, &#38; DIY tech</description>
	<lastBuildDate>Sat, 24 Jul 2010 16:32:17 +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>Aluminum Faceplate For SparkFun Button Arduinome Arrives!</title>
		<link>http://www.musicalgeometry.com/archives/861</link>
		<comments>http://www.musicalgeometry.com/archives/861#comments</comments>
		<pubDate>Sat, 09 Jan 2010 08:01:04 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[instrument]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[monome]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=861</guid>
		<description><![CDATA[Just received some aluminum faceplates for my arduinome that I got through a group buy organized by @z15 on the monome community forum. (Thanks!) These aluminum panels are each 5 mm thick which leaves about 2 mm of the SparkFun &#8230; <a href="http://www.musicalgeometry.com/archives/861">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just received some aluminum faceplates for my arduinome that I got through a group buy organized by @z15 on the monome community forum. (Thanks!)</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/4258930822/in/set-72157622012287467/"><img class=" " style="border: 1px solid black;" title="Arduinome Dual Panel Faceplate Design" src="http://farm5.static.flickr.com/4005/4258930822_bb828c0b1c.jpg" alt="" width="500" height="375" /></a><p class="wp-caption-text">Arduinome dual panel faceplate design</p></div>
<p>These aluminum panels are each 5 mm thick which leaves about 2 mm of the SparkFun buttons exposed. My initial test of the faceplate has resulted in a lot of the buttons getting stuck, though most of them not enough to actually make contact. I think that with some time put into smoothing out the button holes and edges that this will provide great button mashing action.</p>
<p>Here is another view:</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/4258929922/in/set-72157622012287467/"><img class=" " style="border: 1px solid black;" title="Arduinome With Aluminum Faceplate" src="http://farm3.static.flickr.com/2742/4258929922_4f2f28ec03.jpg" alt="" width="500" height="375" /></a><p class="wp-caption-text">Arduinome with aluminum faceplate</p></div>
<p>and another:</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/4258931780/in/set-72157622012287467/"><img class=" " style="border: 1px solid black;" title="Arduinome Money Shot" src="http://farm5.static.flickr.com/4011/4258931780_22ce5fc348.jpg" alt="" width="500" height="375" /></a><p class="wp-caption-text">Arduinome money shot</p></div>
<p>I just can&#8217;t get enough glory shots of blinky button grids!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/861/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello Arduinome!</title>
		<link>http://www.musicalgeometry.com/archives/646</link>
		<comments>http://www.musicalgeometry.com/archives/646#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:09:24 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[MaxMSP]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[instrument]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=646</guid>
		<description><![CDATA[I finished the electronics of my Arduinome a couple weeks back and have been having a blast using it in the little spare time I have these days. I am anxiously waiting to hear back from machinecollective.org regarding ordering one &#8230; <a href="http://www.musicalgeometry.com/archives/646">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I finished the electronics of my <a href="http://en.wikipedia.org/wiki/Arduinome">Arduinome</a> a couple weeks back and have been having a blast using it in the little spare time I have these days. I am anxiously waiting to hear back from <a href="http://www.machinecollective.org/">machinecollective.org</a> regarding ordering one of their <a href="http://www.machinecollective.org/products/arduinome-kits/">amazing enclosures</a>. I also have a <a href="http://www.seeedstudio.com/depot/wiimote-3axis-accelerometer-module-adxl330-p-107.html">tilt sensor</a> from <a href="http://www.seeedstudio.com/depot/">Seeed Studio</a> coming for added fun. Here are some pics:</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3902990168/"><img class=" " style="border: 1px solid black;" title="Arduinome running mlr" src="http://farm3.static.flickr.com/2573/3902990168_058ace01ba.jpg" alt="Arduinome running mlr" width="500" height="375" /></a><p class="wp-caption-text">Arduinome running mlr</p></div>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3902223457/"><img class="  " style="border: 1px solid black;" title="Rainbow ribbon cable" src="http://farm3.static.flickr.com/2523/3902223457_729075e71a.jpg" alt="Rainbow ribbon cable" width="500" height="375" /></a><p class="wp-caption-text">Rainbow ribbon cable, Arduino &amp; unsped shield</p></div>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3902242309/"><img class="  " style="border: 1px solid black;" title="Arduinome wiring" src="http://farm3.static.flickr.com/2588/3902242309_4fb0da8fd2.jpg" alt="Arduinome wiring" width="500" height="375" /></a><p class="wp-caption-text">Arduinome wiring</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/646/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building An Arduinome</title>
		<link>http://www.musicalgeometry.com/archives/624</link>
		<comments>http://www.musicalgeometry.com/archives/624#comments</comments>
		<pubDate>Mon, 24 Aug 2009 05:52:00 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[MaxMSP]]></category>
		<category><![CDATA[OSC]]></category>
		<category><![CDATA[ableton]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[make]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=624</guid>
		<description><![CDATA[I finally got together all the parts that I need to build myself  a monome clone. Arduinome is a clone of the open source monome 40h which uses an arduino microcontroller. Wikipedia says, &#8220;The monome is an eight-by-eight grid of backlit &#8230; <a href="http://www.musicalgeometry.com/archives/624">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I finally got together all the parts that I need to build myself  a <a href="http://en.wikipedia.org/wiki/Monome">monome</a> clone.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3854313087/"><img class="  " style="border: 1px solid black;" title="Arduinome parts" src="http://farm3.static.flickr.com/2439/3854313087_b79a765922.jpg" alt="Arduinome parts" width="500" height="375" /></a><p class="wp-caption-text">Arduinome parts</p></div>
<p><a href="http://flipmu.com/work/arduinome/">Arduinome</a> is a clone of the open source monome 40h which uses an <a href="http://www.arduino.cc/">arduino</a> microcontroller.</p>
<p>Wikipedia says, &#8220;The monome is an eight-by-eight grid of backlit buttons which connects to a computer using a USB cable and the <a href="http://en.wikipedia.org/wiki/Open_Sound_Control">Open Sound Control</a> (OSC) protocol. Originally developed as an open ended performance interface for electronic music, its developers have said &#8220;The wonderful thing about this device is that it doesn&#8217;t do anything really.&#8221; As a result, developers have begun to use the monome as an interface for other types of software, from text displays to games.&#8221;</p>
<p>Here is some video of vimeo user <a href="http://vimeo.com/user174568">ro</a> using a monome 256 running <a href="http://docs.monome.org/doku.php?id=app:mlr">mlr</a> and a monome 40h running vu_spec (part of the <a href="http://docs.monome.org/doku.php?id=app:monomebase">monome_base</a>), which is an 8 band spectral display.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=5565568&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=5565568&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I am following the build instructions posted by <a href="http://www.curiousinventor.com/blog/73">Curious Inventor</a>. I started soldering all the LEDs and diodes last night. In an hour and a half I got through all the LEDs and a quarter of the diodes. (there are 64 LEDs and 64 diodes) I think I should be able to finish the diodes tonight and get started on the <a href="http://unsped.bigcartel.com/">unsped</a> arduino shield.</p>
<p>I am waiting to hear back from <a href="http://www.machinecollective.org/products/arduinome-kits/">machinecollective.org</a> about when a case will be available to ship. The sooner the better. I can&#8217;t wait to use those blinky lights and soft buttons to mash things up with <a href="http://www.cycling74.com/products/max5">MaxMSP</a>, <a href="http://www.ableton.com/home">Ableton Live</a> and <a href="http://www.ableton.com/extend">Max for Live</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/624/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino 0017 Released</title>
		<link>http://www.musicalgeometry.com/archives/593</link>
		<comments>http://www.musicalgeometry.com/archives/593#comments</comments>
		<pubDate>Fri, 14 Aug 2009 18:10:47 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=593</guid>
		<description><![CDATA[The latest version of the Arduino IDE has been released. From the arduino.cc website: &#8220;The open-source Arduino environment makes it easy to write code and upload it to the i/o board. It runs on Windows, Mac OS X, and Linux. The &#8230; <a href="http://www.musicalgeometry.com/archives/593">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://arduino.cc/en/Main/Software">latest version</a> of the Arduino IDE has been released.</p>
<div id="attachment_595" class="wp-caption alignnone" style="width: 260px"><a href="http://www.musicalgeometry.com/wp-content/uploads/2009/08/arduinoide.jpg"><img class="size-medium wp-image-595 " style="border: 1px solid black;" title="arduinoide" src="http://www.musicalgeometry.com/wp-content/uploads/2009/08/arduinoide-250x300.jpg" alt="Arduino IDE" width="250" height="300" /></a><p class="wp-caption-text">Arduino IDE</p></div>
<p>From the <a href="http://arduino.cc/">arduino.cc</a> website:</p>
<p>&#8220;The open-source Arduino environment makes it easy to write code and upload it to the i/o board. It runs on Windows, Mac OS X, and Linux. The environment is written in Java and based on Processing, avr-gcc, and other open source software.&#8221;</p>
<p>Arduino 0017 Release Notes:</p>
<pre><code>0017 - 2009.07.25

[documentation / examples]
* Many new and revised examples from Tom Igoe.

[core / libraries]
* Updated LiquidCrystal library by Limor Fried.  See reference for details.
* Updated Firmata library to version 2.1 (rev. 25).
* Replaced the Servo library with one (MegaServo) by Michael Margolis.
  Supports up to 12 servos on most Arduino boards and 48 on the Mega.
* Improving the accuracy of the baud rate calculations for serial
  communication (fixing double-speed problems on 8 MHz Arduino boards).
  Thanks to gabebear.

[environment]
* Synchronized with the Processing 1.0.3 code base (rev. 5503), bringing
  many improvements (listed below).
* New icons and about image by Thomas Glaser (envis precisely).
* Support for multiple sketch windows.
* The serial monitor now has its own window.
* Comment / Uncomment menu item (in Edit) and keyboard shortcut.
* Increase and Decrease Indent menu items (in Edit) and keyboard shortcuts.
* Support for third-party libraries in the SKETCHBOOK/libraries folder.
* Libraries are now compiled with the sketch, eliminating the delay when
  switching boards and the need to delete .o files when changing library
  source code.
* Arduino now comes as an app file (in a dmg) on the Mac.
* Adding the Arduino Nano w/ ATmega328 to the Tools &gt; Board menu.</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/593/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PachubeMon Now Available On The App Store</title>
		<link>http://www.musicalgeometry.com/archives/559</link>
		<comments>http://www.musicalgeometry.com/archives/559#comments</comments>
		<pubDate>Fri, 07 Aug 2009 19:41:11 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[app]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[pachube]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=559</guid>
		<description><![CDATA[I am happy to announce that my Pachube feed organizer/viewer application PachubeMon is now available as a free download on the App Store. It was also announced on the Pachube blog on Monday. Pachube is a web service available at pachube.com &#8230; <a href="http://www.musicalgeometry.com/archives/559">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.musicalgeometry.com/wp-content/uploads/2009/07/pachubemonitorlogo.jpg"><img class="alignnone size-thumbnail wp-image-483" title="pachubemonitorlogo" src="http://www.musicalgeometry.com/wp-content/uploads/2009/07/pachubemonitorlogo-50x50.jpg" alt="pachubemonitorlogo" width="50" height="50" /></a></p>
<p>I am happy to announce that my Pachube feed organizer/viewer application <a href="http://www.musicalgeometry.com/pachubemon">PachubeMon</a> is now available as a free download on the <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=323811139&amp;mt=8">App Store</a>. It was also announced on the <a href="http://bit.ly/ky74u">Pachube blog</a> on Monday.</p>
<div id="attachment_487" class="wp-caption alignnone" style="width: 218px"><a href="http://www.musicalgeometry.com/wp-content/uploads/2009/07/viewfeed.jpg"><img class="size-medium wp-image-487 " style="border: 1px solid black;" title="viewfeed" src="http://www.musicalgeometry.com/wp-content/uploads/2009/07/viewfeed-208x300.jpg" alt="PachubeMon iPhone app" width="208" height="300" /></a><p class="wp-caption-text">PachubeMon iPhone app</p></div>
<p>Pachube is a web service available at <a href="http://www.pachube.com">pachube.com</a> that enables you to connect, tag and share real time sensor data from objects, devices, buildings and environments around the world.</p>
<p style="text-align: left;">PachubeMon is a utility app for the iPhone that lets you manage and view your Pachube feeds all in one place. The main page allows you to add and remove feeds. By selecting a feed from the list you can view it. You can find feed IDs on the Pachube website <a href="http://www.pachube.com">here</a>.</p>
<p style="text-align: left;">For a fascinating deeper look at Pachube and the concepts around it, check out the amazing article and interview <a href="http://www.ugotrade.com/2009/01/28/pachube-patching-the-planet-interview-with-usman-haque/">here</a>.</p>
<p style="text-align: left;"><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=323811139&amp;mt=8"><img class="alignnone size-full wp-image-619" title="marketing_badge" src="http://www.musicalgeometry.com/wp-content/uploads/2009/08/marketing_badge.png" alt="marketing_badge" width="121" height="41" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/559/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pachube: The Internet Of Things</title>
		<link>http://www.musicalgeometry.com/archives/434</link>
		<comments>http://www.musicalgeometry.com/archives/434#comments</comments>
		<pubDate>Wed, 01 Jul 2009 06:39:21 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[energy]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[solar]]></category>
		<category><![CDATA[ubiComp]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=434</guid>
		<description><![CDATA[I just found out about Pachube over on the Make: Blog and am feeling really inspired. Pachube is just awesome! It is a service created by HAQUE design + research that &#8220;enables you to connect, tag and share real time &#8230; <a href="http://www.musicalgeometry.com/archives/434">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just found out about <a href="http://www.pachube.com/">Pachube</a> over on the <a href="http://blog.makezine.com/">Make: Blog</a> and am feeling really inspired. Pachube is just awesome! It is a service created by <a href="http://www.haque.co.uk/">HAQUE design + research</a> that &#8220;enables you to connect, tag and share real time sensor data from objects, devices, buildings and environments around the world. The key aim is to facilitate interaction between remote environments, both physical and virtual.&#8221;  Here is a video outlining the service:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/6kzNKONUGQ8&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/6kzNKONUGQ8&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I have already sent off a request for an invitation to the beta version and am watching my inbox with excitement. I can&#8217;t wait to use an arduino to start logging some data to share online. I would love to track the sun light in my garden or the energy usage in my house or use Pachube as part of a home automation system. Perhaps I will be able to monitor how much time I spend making music versus downsurfing on the interweb!</p>
<p>There is already a convenient way to <a href="http://apps.pachube.com/iphone/">follow peoples Pachube feeds on your iPhone</a> but it might also be interesting to explore the API and create a handy <a href="http://www.musicalgeometry.com/pachubemon">Pachube iPhone app of my own</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/434/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software Debouncing Multiple Latching Switches With Arduino</title>
		<link>http://www.musicalgeometry.com/archives/248</link>
		<comments>http://www.musicalgeometry.com/archives/248#comments</comments>
		<pubDate>Mon, 12 Jan 2009 06:29:57 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[MIDI]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=248</guid>
		<description><![CDATA[This last week I have been working on making the operation of my MIDI controller prototype more robust. One of my tasks has been to debounce and latch the states of my pushbutton toggle switches. Though you could use hardware &#8230; <a href="http://www.musicalgeometry.com/archives/248">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This last week I have been working on making the operation of my MIDI controller prototype more robust. One of my tasks has been to debounce and latch the states of my pushbutton toggle switches. Though you could use hardware for debouncing and latching I chose to do it with software. Doing it this way is cheaper, requires less space on a PCB and is fairly easily accomplished with todays microcontrollers.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3763763709/"><img class=" " style="border: 1px solid black;" title="A lone pushbutton switch" src="http://farm3.static.flickr.com/2436/3763763709_400e22d74e.jpg" alt="A lone pushbutton switch" width="500" height="375" /></a><p class="wp-caption-text">A lone pushbutton switch</p></div>
<p>Before setting out to debounce my pushbuttons I did some searching on Google and discovered an excellent article on debouncing called simply, <a href="http://www.ganssle.com/debouncing.pdf">A Guide To Debouncing</a>. It covers multiple techniques for both hardware and software debouncing.</p>
<p>After reading the article, I decided to go with a software counting algorithm. I did some more research but I wasn&#8217;t happy with the examples that I found. All of them involved debouncing a single switch. I wanted to debounce an entire port of switches. To do this you could just repeat the debouncing code for each switch but I decided to write a single piece of code to handle an entire port.</p>
<p>Below is my solution using PORTB on an Arduino. PORTB is a six pin port. This could easily be ported to be used on any AVR microcontroller or indeed any other microcontroller that can be programmed in C.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3763762659/"><img class="  " style="border: 1px solid black;" title="Arduino NG" src="http://farm4.static.flickr.com/3523/3763762659_6df9ff15c7.jpg" alt="Arduino NG" width="500" height="375" /></a><p class="wp-caption-text">My Arduino NG</p></div>
<p>All the pushbuttons in my example are active high with pull down resistors. The code could easily be adapted for active low. (Note that my prototype actually only has two buttons connected to it. I set up wires with pull downs to act as switches for the remaining pins)</p>
<p>First we define the number of switches on our port (in this case six), then the debounce depth. Debounce depth is the number of consecutive times that a switch must be read to have a certain value (HIGH or LOW, 1 or 0) before a press of that switch is validated.</p>
<pre><code>#define numButtons 6
#define debounceDepth 10</code></pre>
<p>Next we set up the variables we will need. The first one is used to read the PORTB value into. The second is to keep a memory of the last debounceDepth number of reads. The next keeps tabs on whether the pushbutton switch has been released after pressing. This variable provides a form of hysterisis so that we don&#8217;t get multiple toggles on one button press. The buttonPressFilter is a bitwise ANDed sum of all of the debounceDepth number of memories. The result in the buttonPressFilter is what determines if a pushbutton switch has been validly pressed.</p>
<pre><code>char buttonRead;
char buttonMemory[debounceDepth] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int buttonHasReleased[numButtons] = {true,true,true,true,true,true};
char buttonPressFilter = 0xFF;
int buttonState[numButtons] = {0,0,0,0,0,0};</code></pre>
<p>So that is the end of initialization. Now onto the code that you would put in your loop. The buttonPressFilter is an 8-bit variable with each of the lower 6 bits representing the state of a pushbutton switch, pressed or not-pressed. (Remember, PORTB on Arduino only has 6 pins) Each time we loop through here, we reset the buttonPressFilter to start as all 1&#8242;s. As it is bitwise ANDed with the previous button memories, any button read of a zero value will fall through as a zero, the rest will be left as 1&#8242;s. It basically &#8216;filters&#8217; out any button presses that are not yet stable.</p>
<pre><code>buttonPressFilter = 0xFF;</code></pre>
<p>Here we shift all the memory by one, dumping the oldest reading to make room for the new reading. Then we AND all the old memories together.</p>
<pre><code>for(i=(debounceDepth-1); i&gt;0; i--) {
    buttonMemory[i] = buttonMemory[i-1];
    buttonPressFilter &amp;= buttonMemory[i];
}</code></pre>
<p>Here we read the current status of the switches on PORTB.</p>
<pre><code>buttonRead = PINB;</code></pre>
<p>Now for each pushbutton switch we check if the current read indicates a press. If it does, then we set its memory bit, otherwise we clear it.</p>
<pre><code>for(i=0; i&lt;numButtons; i++) {
    if((buttonRead &amp; bitMask[i]) != 0) { // if current read shows button is pressed
        buttonMemory[0] |= bitMask[i];     // set the memory bit for that button
    } else {
        buttonMemory[0] &amp;= ~(bitMask[i]); // otherwise clear the memory bit for that button
    }
}</code></pre>
<p>Take account of the newest read into memory.</p>
<pre><code>buttonPressFilter &amp;= buttonMemory[0]; // AND the final memory bits into the buttonPressFilter</code></pre>
<p>Now the buttonPressFilter contains the current pressed or non-pressed state of the switches. If any switch has had a consistent value for debounceDepth number of times, then toggle the state in the buttonState array and do whatever it is you want your button to do.</p>
<pre><code>for(i=0; i&lt;numButtons; i++) {
    if((buttonPressFilter &amp; bitMask[i]) != 0) {
        if(buttonHasReleased[i] == true) {
            if(buttonState[i] == 0) {
                // ENTER CODE HERE FOR WHAT YOU WANT TO HAPPEN WHEN BUTTON IS ON
                buttonState[i] = 1;
            } else {
                // ENTER CODE HERE FOR WHAT YOU WANT TO HAPPEN WHEN BUTTON IS OFF
                buttonState[i] = 0;
            }
        }
        buttonHasReleased[i] = false;
    } else {
        buttonHasReleased[i] = true;
    }
}</code></pre>
<p>One final thing to mention is that the debounceDepth value is something that you need to experiment with for the specific switches in your project. Currently with my cheap pushbuttons sitting in a cardboard chassis and wired to a breadboard, I need a value of 10 to get stable results. Using better switches, a stable chassis and a PCB I expect this number to drop.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/248/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>DIY Cardboard MIDI Controller</title>
		<link>http://www.musicalgeometry.com/archives/181</link>
		<comments>http://www.musicalgeometry.com/archives/181#comments</comments>
		<pubDate>Sun, 28 Dec 2008 07:32:47 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[AVR]]></category>
		<category><![CDATA[MIDI]]></category>
		<category><![CDATA[MaxMSP]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=181</guid>
		<description><![CDATA[Today I built a DIY cardboard MIDI controller. I used an Atmega168 with code written in Arduino and programmed on an Arduino NG. The whole circuit is breadboarded and connects to the computer via a single USB cable. The serial &#8230; <a href="http://www.musicalgeometry.com/archives/181">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I built a DIY cardboard MIDI controller. I used an Atmega168 with code written in Arduino and programmed on an Arduino NG. The whole circuit is breadboarded and connects to the computer via a single USB cable. The serial output of the MIDI controller is parsed by a MaxMSP patch to the IAC Driver on my MacBookPro. I tested the controller with Ableton Live and it worked without a problem. I also included an LCD display that shows the current value of the controller knobs as they are tweaked and holds the last value of the last knob turned. The pushbuttons send MIDI continuous controller messages that alternate between 0 and 127 and an LED reflects the current value.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3764562284/"><img class="  " style="border: 1px solid black;" title="DIY cardboard MIDI controller" src="http://farm4.static.flickr.com/3510/3764562284_fc8c471f5d.jpg" alt="DIY cardboard MIDI controller" width="500" height="375" /></a><p class="wp-caption-text">DIY cardboard MIDI controller</p></div>
<p>I am planning on using this Arduino based prototype to experiment with fine tuning the firmware for a line of boutique and custom MIDI controllers. The final project will be ported to C using the AVR C library and I will make the whole project open source.</p>
<p>Here is a look at the back. I just used whatever pots I had, so they aren&#8217;t matched. The LCD is a serial one from <a href="http://www.sparkfun.com">SparkFun</a>.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/musicalgeometry/3763765559/"><img class="  " style="border: 1px solid black;" title="Underbelly of the cardboard MIDI controller" src="http://farm3.static.flickr.com/2632/3763765559_d6df57c6d2.jpg" alt="Underbelly of the cardboard MIDI controller" width="500" height="375" /></a><p class="wp-caption-text">Underbelly of the cardboard MIDI controller</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/181/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Max Serial To MIDI Patch</title>
		<link>http://www.musicalgeometry.com/archives/80</link>
		<comments>http://www.musicalgeometry.com/archives/80#comments</comments>
		<pubDate>Mon, 13 Oct 2008 05:28:05 +0000</pubDate>
		<dc:creator>Jason Job</dc:creator>
				<category><![CDATA[MIDI]]></category>
		<category><![CDATA[MaxMSP]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://www.musicalgeometry.com/?p=80</guid>
		<description><![CDATA[I have programmed an Arduino to output serial MIDI CC messages when I adjust potentiometers connected to it. To control my MIDI capable applications I could just send this data to a MIDI cable and then to a commercial USB-MIDI &#8230; <a href="http://www.musicalgeometry.com/archives/80">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have programmed an Arduino to output serial MIDI CC messages when I adjust potentiometers connected to it. To control my MIDI capable applications I could just send this data to a MIDI cable and then to a commercial USB-MIDI interface, but that would still require another cord to power the controller. Instead I have written a Max patch that uses the OSX IAC Driver.</p>
<p>This driver is a virtual midi device that you can use to route MIDI to, through and from. My Max patch parses the serial data from the Arduino to the IAC Driver. By choosing the IAC Driver as a MIDI input in Live (or any other MIDI capable app) you can then use the serial MIDI CC data sent from the Arduino to control your software.</p>
<p>The MIDI data that the Max patch expects at the serial input is in the standard MIDI format for a CC message; a status byte, a control number and a value. This simple patch just listens for a status byte of 176 which is a control change on channel 1. The baud rate I chose for this patch was 57600. Note that you do not have to use the standard MIDI data rate of 31250 baud.</p>
<div id="attachment_198" class="wp-caption alignnone" style="width: 310px"><a href="http://www.musicalgeometry.com/wp-content/uploads/2008/09/iac-driver.jpg"><img class="size-medium wp-image-198  " style="margin-top: 8px; margin-bottom: 8px;" title="iac-driver" src="http://www.musicalgeometry.com/wp-content/uploads/2008/09/iac-driver-300x181.jpg" alt="MIDI Devices" width="300" height="181" /></a><p class="wp-caption-text">MIDI Devices</p></div>
<p>To enable the IAC Driver go to Applications-&gt;Utilities-&gt;Audio MIDI Setup, click on the MIDI Devices tab and then double click the IAC Driver icon make sure that the <em>Device is online</em> check box is checked.</p>
<p>To use this patch you need the <a href="http://www.cycling74.com/downloads/max5" target="_blank">MaxMSP Runtime.</a> Once you have that installed open it up and then open the patch with it. Double click on the <em>midiout</em> object and select the IAC Driver. Then click the button at the top of the chain to start reading the serial port and parsing the data. You should now be able to use  midi learn to map your controllers and start tweaking stuff in realtime with your potentiometers.</p>
<p>Here is what the patch looks like:</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 319px"><a href="http://www.musicalgeometry.com/wp-content/uploads/2008/10/serial2midi.gif"><img class="size-full wp-image-83" title="serial2midi" src="http://www.musicalgeometry.com/wp-content/uploads/2008/10/serial2midi.gif" alt="" width="309" height="373" /></a><p class="wp-caption-text">Serial to MIDI Max patch</p></div>
<p>If you own Max just copy the following code and then paste it in a blank patcher.</p>
<p><code>----------begin_max5_patcher----------<br />
488.3ocuVsrahCCEccxWwUdclQ9QdTlcUpa5h9ETUMxPLTOJwFkXTof5+9X6<br />
.COFjvIjhDgHesu1m64dNIYabDZpdsnEA+BdEhh1FGE4C4BDsabDpludVEu0<br />
uLjR7gd5ePIcSYDqM9vapf4xJinAHE46mUspVppDFelzCA0qLmGctVYT7Zge<br />
ydrQxq1uIK4lYuKUK9ciXloCozT7OwI.kl4tkOwOvFBdaWNcGf4ykhtDPnD6<br />
0+l1cXsxM9IITa1cgkk9S2Vd+ffbg9JN18WxsQMKajJC7xyO87E4ExE4E7P3<br />
ER1I7B6+3kqW3ECovM5EKpD8n5HWs2xv6A+0ZsVx8Pm8nJgMhsvZgoQCY8PW<br />
StAccgu8kQtdsOkqVzGYMcD4jVgqZ.NjUjiwvC.Av8PBbKFeRmtfPxCSdzSy<br />
OaLc+0xRoETe2VeZpWtvRSc2RmL.qOCOxk8bcSM+xUdwnaZnO3cMDbeejQ.t<br />
lIiIw3p.2KIAkx9a.OzbPNl77fYmd8dxrioFehnJo57OovCLW7S4qV8plY6O<br />
1caWBb.ZkhViTwMRs53EcxZdWVVJTG6arRukZaKdGFf2tXyKXHE.hrBDKod2<br />
fDKDLcFU9ciIZ.Phce6brP5b2WRZRHrD99puCwxUbCPxN3q3+JxEVKJ<br />
-----------end_max5_patcher-----------</code></p>
<p>If you don&#8217;t own Max then you can download the patch <a href="http://jasonjob.net/share/myserial2midi.maxpat.zip" target="_blank">here</a>.</p>
<p>I will try and put together a more complete patch with user selectable options sometime soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.musicalgeometry.com/archives/80/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
