<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0" 
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:html="http://www.w3.org/1999/html" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>Daniel Nouri's Blog</title>
   <link>http://danielnouri.org/blog</link>
   <description>Observing the unobserved</description>
   <language>en</language>
   <copyright>Copyright 2006 Daniel Nouri</copyright>
   <ttl>60</ttl>
   <pubDate>Sat, 24 May 2008 15:58 GMT</pubDate>
   <managingEditor>daniel.nouri@gmail.com</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.3.2 2/13/2006</generator>
<item>
   <title>Arduino: Square wave synthesizer with LFO and variable frequency</title>
   <guid isPermaLink="false">devel/hardware/arduino-synth-with-variable-frequency</guid>
   <link>http://danielnouri.org/blog/devel/hardware/arduino-synth-with-variable-frequency.html</link>
   <description><![CDATA[

<div class="document">
<p>After going through part two of this <a class="reference" href="http://www.uchobby.com/index.php/2007/11/11/arduino-sound-part-1/">Arduino sound tutorial</a>, I made
this little synthesizer.</p>
<embed src="http://blip.tv/play/AbmoBwA" type="application/x-shockwave-flash" width="320" height="270" allowscriptaccess="always" allowfullscreen="true"></embed>   <p>Click <a class="reference" href="http://danielnouri.org/blog/devel/hardware/arduino-synth-with-variable-frequency.html">here</a> if you can't see the video.</p>
<p>You can see that it starts out with a constant frequency that can be
varied with the potentiometer.</p>
<p>An LFO is added to the frequency once I push the button.  Successive
button pushes will change the amplitude of the LFO.</p>
<p>While the aforementioned tutorial explains how to connect Arduino with
your PC sound card to get sound, I simply plugged in a Piezo buzzer.
The advantage being that this synth is totally self-contained and
portable, so I could use it in the train (<strong>I won't!</strong>).  The downside
is that the audio quality is bad, and it's even worse in the video.</p>
<p>Everything I needed to build this came with the <a class="reference" href="http://pcb-europe.net/catalog/product_info.php?cPath=29&amp;products_id=51">Arduino workshop
kit</a> (50 EUR).  This includes the Arduino Diecimila itself,
potentiometer, buzzer, breadboard, and button.</p>
<p>The button press detection in the <a class="reference" href="http://wiring.org.co/">Wiring</a> code doesn't work
properly.  A good implementation would probably need to use interrupt
handlers.  I ignored this issue for now:</p>
<pre class="literal-block">
int buttonPin = 7;
int buzzerPin = 8;
int potPin = 2;

void setup() {
  pinMode(buzzerPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}

void inner_loop(int j) {
  digitalWrite(buzzerPin, HIGH);
  delayMicroseconds(j*16 + analogRead(potPin));
  digitalWrite(buzzerPin, LOW);
  delayMicroseconds(j*16 + analogRead(potPin));
}

void loop() {
  int val = digitalRead(buttonPin);
  int factor = 0;

  for (int i = 100; i &gt; 0; i--) {
    inner_loop(i * factor);
  }

  // XXX: This doesn't work very well
  if (digitalRead(buttonPin) != val &amp;&amp; val == HIGH) {
    factor++;
    if (factor &gt; 3)
      factor = 0;
  }

  for (int i = 0; i &lt; 100; i++) {
    inner_loop(i * factor);
  }
}
</pre>
</div>

]]></description>
   <category domain="http://danielnouri.org/blog"></category>
   <pubDate>Sat, 24 May 2008 15:58 GMT</pubDate>
</item>
<item>
   <title>Building an alarm clock</title>
   <guid isPermaLink="false">devel/hardware/snorrrhea</guid>
   <link>http://danielnouri.org/blog/devel/hardware/snorrrhea.html</link>
   <description><![CDATA[

<div class="document">
<p><a class="reference" href="http://nessming.org">Vanessa</a> and I did some <a class="reference" href="http://nessming.org/blog/arduino-and-snorrrhea">fun experiments</a> lately with <a class="reference" href="http://arduino.cc">Arduino</a> and
<a class="reference" href="http://supercollider.sourceforge.net">SuperCollider</a>.  We're building an alarm clock that wakes you up with
quite an unusual sound...</p>
<p><a class="reference" href="http://nessming.org/blog/arduino-and-snorrrhea">Read the story here</a>.</p>
</div>

]]></description>
   <category domain="http://danielnouri.org/blog"></category>
   <pubDate>Sun, 18 May 2008 22:53 GMT</pubDate>
</item>
</channel>
</rss>
