<?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>Tinkerlog &#187; sound</title>
	<atom:link href="http://tinkerlog.com/category/sound/feed/" rel="self" type="application/rss+xml" />
	<link>http://tinkerlog.com</link>
	<description>Alex' blog</description>
	<lastBuildDate>Sun, 13 May 2012 10:54:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tengu clone on PCB</title>
		<link>http://tinkerlog.com/2008/05/03/tengu-clone-on-pcb/</link>
		<comments>http://tinkerlog.com/2008/05/03/tengu-clone-on-pcb/#comments</comments>
		<pubDate>Sat, 03 May 2008 11:29:54 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PCB]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/2008/05/03/tengu-clone-on-pcb/</guid>
		<description><![CDATA[
This is a new version of my Tengu clone. This time on a printed circuit board (PCB).  I have them produced by Olimex and I am very pleased with the quality. The PCB worked on the first try and has some minor issues only.

Materials


Tengu PCB
Everlight 8*5 LED dot matrix
ATmega48, 4kB Flash RAM,  512 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://tinkerlog.com/wp-content/uploads/2008/05/dsc_0498_s.jpg" alt="dsc_0498_s.jpg" /></p>
<p>This is a new version of my <a href="http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/" title="DIY Tengu">Tengu clone</a>. This time on a printed circuit board (PCB).  I have them produced by <a href="http://tinkerlog.com/2008/04/04/pcbs-from-olimex/" title="PCBs from Olimex" target="_blank">Olimex</a> and I am very pleased with the quality. The PCB worked on the first try and has some minor issues only.</p>
<p><span id="more-99"></span></p>
<h3>Materials</h3>
<p><img src="http://tinkerlog.com/wp-content/uploads/2008/05/dsc_0497_s.jpg" alt="dsc_0497_s.jpg" /></p>
<ul>
<li>Tengu PCB</li>
<li>Everlight 8*5 LED dot matrix</li>
<li>ATmega48, 4kB Flash RAM,  512 bytes RAM</li>
<li>4 MHz crystal</li>
<li>LM386 Op-Amp</li>
<li>28 pin header</li>
<li>8 pin header</li>
<li>2 * 22pF capacitors</li>
<li>3 * 100nF capacitors</li>
<li>10k potentiometer</li>
<li>100k potentiometer</li>
<li>100k resistor</li>
<li>5 * 1k resistors</li>
<li>2 * 7 pin header sockets</li>
<li>2 pin headers for power supply and microphone (optional)</li>
<li>Electret microphone (not on the picture)</li>
</ul>
<p>Note, that the electret microphone has a polarity. On the PCB the inner pin is the positive one. If you connect it the wrong way, it is heating up really quick.</p>
<p>The microphone that I used here has an impedance of 2k. You may have to experiement a bit with different microphones.</p>
<p>The capacitor C2 is used to control the amplification of the LM386. I used 0.1uF but you can use up to 10uF to get a stronger amplification. Here is the <a href="http://www.josepino.com/circuits/index?mini_amplifier_lm386.jpc" title="Mini amplifier with LM386" target="_blank">amplifier circuit</a> that I used.</p>
<h3>PCB design issues</h3>
<p><img src="http://tinkerlog.com/wp-content/uploads/2008/05/dsc_0506_s.jpg" alt="dsc_0506_s.jpg" /></p>
<p>As this is my first design, there are a couple of things that I would redesign.</p>
<p>As I tried to insert the pin header sockets, I realized that the drill holes were a bit too narrow. You have to use a bit of strength to insert the headers, but it works.</p>
<p>All solder pads used for resistors and capacitors are a bit too small. It was a bit difficult to solder them. I would make them a larger next time.</p>
<p>I think I should use a bit less of the silk layer. Some solder pads are covered with silk. Most of the time that does not hurt as it is on the top side. But there are pins that you may wont to solder on the top side, e.g. the power connector.</p>
<h3>Improvements</h3>
<p>The component count could be reduced if I had dropped crystal. For the animation of the LED matrix the internal oscillator would be sufficient. On the other hand, with a suited crystal, this circuit could be modified to display the time.</p>
<p>I would add an ISP (in system programming) header for easier programming. Now you have to flip off the display, take out the controller, program it, re-insert it and put the display back in place. Not a fast turn around if you want to modify the firmware.</p>
<p>What would you think of an Arduino version of this circuit? The controller could be replaced with an Arduino compatible ATmega168. Or maybe as an Arduino shield?</p>
<h3>Conclusion</h3>
<p>It is great to see your first produced PCB. Even better if it works on the first try. Maybe I can even build a kit out of it with the next revision of the board.</p>
<p><object type="application/x-shockwave-flash" data="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&amp;feedurl=http%3A%2F%2F9600baud%2Eblip%2Etv%2Frss&amp;file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F881117%3Freferrer%3Dblip%2Etv%26source%3D1&amp;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" allowfullscreen="true" id="showplayer" height="255" width="400"><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&amp;feedurl=http%3A%2F%2F9600baud%2Eblip%2Etv%2Frss&amp;file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F881117%3Freferrer%3Dblip%2Etv%26source%3D1&amp;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf"></param><param name="quality" value="best"></param><ibed quality="best" width="400" height="255" name="showplayer" type="application/x-shockwave-flash"></ibed></p>
<p></object>As I have still two boards left, you can email me at alex at this domain and I will send you the PCB for free. The only requirement would be, that you really want to build it and that you give me feedback on how it worked, what you would change or how you modded it.</p>
<h3>Links and Downloads</h3>
<ul>
<li><a href="http://www.mr-jones.org/tengu/index.html" title="Crispni Jones Tengu" target="_blank">Crispin Jones Tengu</a>, the original idea of this device</li>
<li><a href="http://www.josepino.com/circuits/index?mini_amplifier_lm386.jpc" title="Mini amplifier with LM386" target="_blank">Mini Amplifier with LM386</a></li>
<li><a href="http://tinkerlog.com/2007/11/10/tengu-clone-update/" title="Tengu clone on prototype board">Tengu clone on prototype board</a></li>
<li><a href="http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/" title="Tengu clone on a breadboard">Tengu clone on a breadboard</a></li>
<li><a href="http://tinkerlog.com/wp-content/uploads/2008/05/tengu-clone-rev-10a.zip" title="tengu-clone-rev-10a.zip">tengu-clone-rev-1.0a.zip</a> source and Eagle schematics</li>
</ul>
<p>More at Flickr.<br />
<!-- Start of Flickr Badge --></p>
<style type="text/css"> #flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;} #flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;} #flickr_icon_td {padding:0 5px 0 0 !important;} .flickr_badge_image {text-align:center !important;} .flickr_badge_image img {border: 1px solid black !important;} #flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;} #flickr_badge_uber_wrapper a:hover, #flickr_badge_uber_wrapper a:link, #flickr_badge_uber_wrapper a:active, #flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;} #flickr_badge_wrapper {background-color:#ffffff;border: solid 1px #000000} #flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;} </style>
<table id="flickr_badge_uber_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr>
<td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color: #3993ff">flick<span style="color: #ff1c92">r</span></strong>.com</a></p>
<table id="flickr_badge_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr><script src="http://www.flickr.com/badge_code_v2.gne?count=3&amp;display=random&amp;size=t&amp;layout=h&amp;source=user_tag&amp;user=8123185%40N02&amp;tag=tengu" type="text/javascript"></script></tr>
</table>
</td>
</tr>
</table>
<p><!-- End of Flickr Badge --></p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2008/05/03/tengu-clone-on-pcb/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>Arduino XMAS hitcounter</title>
		<link>http://tinkerlog.com/2007/12/04/arduino-xmas-hitcounter/</link>
		<comments>http://tinkerlog.com/2007/12/04/arduino-xmas-hitcounter/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 22:34:52 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/2007/12/04/arduino-xmas-hitcounter/</guid>
		<description><![CDATA[Christmas is coming closer, so here is my contribution to put you in the right mood.
It is a blog hitcounter, that rings a bell. Literally. It puts a smile on your face, every time someone hits your blog. And it is a great way to annoy your colleages or your girl friend.
It consists of an [...]]]></description>
			<content:encoded><![CDATA[<p>Christmas is coming closer, so here is my contribution to put you in the right mood.</p>
<p>It is a blog hitcounter, that rings a bell. Literally. It puts a smile on your face, every time someone hits your blog. And it is a great way to annoy your colleages or your girl friend.</p>
<p>It consists of an Arduino board, a bell, a servo and a couple of lines of code in c, python and php.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/12/imgp2495_a.jpg" alt="Arduino XMAS hitcounter" /></p>
<p><span id="more-61"></span></p>
<h3>Materials</h3>
<p>So what is needed?</p>
<ul>
<li>Arduino Board. I have an <a href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=17&amp;products_id=50" title="Arduino Diecimila">Arduino     Diecimila</a> from Adafruits. In the meantime there are really cheap and handy clones out there, e.g. the <a href="http://moderndevice.com/RBBB.shtml" title="Real Bare Bone Board, Arduino clone" target="_blank">bare bone board</a> from Modern Devices, especially if you want to use them on a breadboard.</li>
<li>A <a href="http://en.wikipedia.org/wiki/Servo_motor" title="Wikipedia: Servo motor">servo motor</a>. Any servo will do. I took an old one that was used in my former hobby.</li>
<li>A bell. Prefarably one that is small enough to shake it with the servo.</li>
<li>Two paperclips. A large one to hold the bell and a small one to build the actuator to ring the bell.</li>
<li>A website. In fact it hasn&#8217;t has to be a website or a blog. Actually everything that can be counted, will work.</li>
<li>A PC or a Mac to connect the Arduino board  with the blog or website.</li>
<li>Wires.</li>
</ul>
<h3>Assembly</h3>
<p>The bell is held by a strong paperclip. The small paperclip is used to form a kind of arm that is atached to the servo motor.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/12/imgp2490_a.jpg" title="imgp2490_a.jpg" alt="imgp2490_a.jpg" hspace="5" vspace="5" /><img src="http://tinkerlog.com/wp-content/uploads/2007/12/imgp2505_a.jpg" title="imgp2505_a.jpg" alt="imgp2505_a.jpg" hspace="5" vspace="5" /></p>
<h3>Schematics</h3>
<p>There is no real schematic. Just attach the servo motor to the Arduino. The servo has three wires:</p>
<ul>
<li>yellow or orange: signal</li>
<li>red: VCC</li>
<li>brown: GND</li>
</ul>
<p>The red and the brown one are attached to the according pins on the Arduino. The orange one is wired to pin 2. It will signal the servo in which direction to turn.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/12/imgp2486_b.jpg" alt="Servo connector" /></p>
<h3>Software</h3>
<p>The software stack has three parts. First part is the counter embedded in my blog. Second is the glue code, running on my mac to fetch the counter and to update the Arduino. Third is the Arduino sketch itself to control the servo motor.</p>
<p>This is a small php snippet to write a counter into a text file. I have included it into one of my wordpress templates. That&#8217;s not very smart, but for now my traffic is not that high so this should not be a problem.</p>
<pre name="code" class="php">
&lt;?php  $count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hit = trim($hits[0]);
$hit++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hit");
fclose($fp);
echo $hit;
?&gt;</pre>
<p>Here is the second part, the python snippet to fetch the counter. It opens a connection to the saved hitcounter.txt and loads the content, which is the actual value of the counter. This counter is compared with the previous fetched value. If it differs, than it has an incident to report. The delta is written as byte to the serial port and sent to the Arduino. That is done every ten seconds.</p>
<pre name="code" class="python">
#
# fetch counter
#
import time
import urllib
import serial

# usb serial connection to arduino

ser = serial.Serial(
   '/dev/tty.usbserial-A4001JAh', 9600)
myUrl = 'http://tinkerlog.com/hitcounter.txt'

last_counter = urllib.urlopen(myUrl).read()
while (True):
  counter = urllib.urlopen(myUrl).read()
  delta = int(counter) - int(last_counter)
  print "counter: %s, delta: %s" % (counter, delta)
  ser.write(chr(ord(chr(delta))))
  last_counter = counter
  time.sleep(10)</pre>
<p>Last part is the Arduino sketch. It is mainly based on the code that I found at the <a href="http://itp.nyu.edu/physcomp/Labs/Servo" title="ITP Physical Computing">ITP Physical Computing</a>. In the loop you see the reading of the delta value provided by the python script. If there are some rings to perform, a little state machine takes control of how far and when to move the servo arm. The servo motor is controlled with PWM, <a href="http://www.tigoe.net/pcomp/analogout.shtml" title="PWM explained" target="_blank">pulse width modulation</a>. That&#8217;s the last part of the sketch. How far the servo arm turns can be adjusted with the min- and maxPulse values.</p>
<pre name="code" class="c">
/*
 * Arduino XMAS Blog hitcounter
 * http://tinkerlog.com/
 *
 * Reference:
 * - Servo control from an analog input
 *   taken from http://itp.nyu.edu/physcomp/Labs/Servo
 *
 */
int servoPin = 2;      // control pin for servo motor
int minPulse = 1200;   // minimum servo position
int maxPulse = 1700;   // maximum servo position
int pulse = 0;         // amount to pulse the servo
int rings = 0;         // amount of rings
long nextMillis = 0;   // the time to pass before the next action
long lastPulse = 0;    // the time in milliseconds of the last pulse
int refreshTime = 20;  // the time needed in between pulses
int state = 0;         // for the state machine

void setup() {
  pinMode(servoPin, OUTPUT);  // Set servo pin as an output pin
  pulse = minPulse;           // Set the motor position value to the minimum
  Serial.begin(9600);
}

// define states for the state machine
#define PULSE_ON       0
#define WAIT_PULSE_ON  1
#define PULSE_OFF      2
#define WAIT_PULSE_OFF 3

void loop() {

  // read the rings
  if (Serial.available() &gt; 0) {
    rings += Serial.read();
    Serial.println(rings);
  }

  // state machine to control, which action to perform
  if (rings &gt; 0) {
    switch (state) {
      case PULSE_ON:
        pulse = maxPulse;                // send servo to max position
        nextMillis = millis() + 300;     // wait 300 ms
        state = WAIT_PULSE_ON;
        break;
      case WAIT_PULSE_ON:
        if (millis() &gt; nextMillis) {
          state = PULSE_OFF;             // time is up
        }
        break;
      case PULSE_OFF:
        pulse = minPulse;                // send servo to min position
        nextMillis = millis() + 1000;    // wait 1 second between two rings
        state = WAIT_PULSE_OFF;
        break;
      case WAIT_PULSE_OFF:
        if (millis() &gt; nextMillis) {
          state = PULSE_ON;              // time is up
          rings--;                       // one ring is done
        }
        break;
      }
  }

  // pulse the servo again if the refresh time (20 ms) have passed:
  if (millis() - lastPulse &gt;= refreshTime) {
    digitalWrite(servoPin, HIGH);   // Turn the motor on
    delayMicroseconds(pulse);       // Length of the pulse sets the motor position
    digitalWrite(servoPin, LOW);    // Turn the motor off
    lastPulse = millis();           // save the time of the last pulse
  }

}</pre>
<h3>Conclusion</h3>
<p>It is the first time, that I built something, that has moving parts. That&#8217;s my first step to bridge the gap between the virtual and the real world. And it was really easy, the code is straight forward. Also most of the parts were in my trash bin, except the bell. Putting everything together and waiting for someone to hit my blog was fun.</p>
<p>Side note:</p>
<ul>
<li>Me, excited: &#8220;Did you hear that? There was another one!&#8221;</li>
<li>My girlfriend: &#8220;I  k-n-o-w  a-l-r-e-a-d-y!&#8221;</li>
</ul>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/12/imgp2500_a.jpg" alt="Assembled Arduino XMAS hitcounter" /></p>
<h3>Action</h3>
<p>Ok, time for some action.<br />
<center> <script src="http://blip.tv/scripts/pokkariPlayer.js?ver=2007111701" type="text/javascript"></script> <script src="http://blip.tv/syndication/write_player?skin=js&amp;posts_id=526283&amp;source=3&amp;autoplay=false&amp;file_type=flv&amp;player_width=440&amp;player_height=248" type="text/javascript"></script></p>
<p id="blip_movie_content_526283"><a href="http://blip.tv/file/get/9600baud-ArduinoXMASHitcounter302.flv" onclick="play_blip_movie_526283(); return false;" rel="enclosure"><img src="http://blip.tv/file/get/9600baud-ArduinoXMASHitcounter302.flv.jpg" alt="Video thumbnail. Click to play." title="Click to play" border="0" /></a><br />
<a href="http://blip.tv/file/get/9600baud-ArduinoXMASHitcounter302.flv" onclick="play_blip_movie_526283(); return false;" rel="enclosure">Click To Play</a></p>
<p><script type="text/javascript">	play_blip_movie_526283();</script> </center>BTW, the fabulous soundtrack used in this video is free and can be found here: <a href="http://en.wikipedia.org/wiki/Image:Jingle_Bells_Or_The_One_Horse_Open_Sleigh_Complete.ogg" title="Jingle Bells" target="_blank">Wikipedia Jingle Bells</a>, performed by the <em><a href="http://en.wikipedia.org/wiki/Festival_Speech_Synthesis_System" title="Festival Speech Synthesis System">Festival Speech Synthesis System</a>&#8217;s &#8220;singing-mode&#8221;</em>.</p>
<h3>Links</h3>
<ul>
<li><a href="http://www.arduino.cc/" title="Arduino home" target="_blank">Arduino, official site</a></li>
<li><a href="http://itp.nyu.edu/physcomp/Labs/Servo" title="IPT Physical Computing" target="_blank">Arduino servo control</a></li>
<li><a href="http://www.moderndevice.com/RBBB.shtml" title="Real Bare Bone Board, Arduino clone" target="_blank">Real Bare Bone Board</a> at Modern Devices</li>
<li><a href="http://www.adafruit.com/index.php?main_page=product_info&amp;cPath=17&amp;products_id=50" title="Arduino at Adafruits" target="_blank">Arduino Diecimila</a> at Adafruits</li>
</ul>
<p><!-- Start of Flickr Badge --></p>
<style type="text/css"> #flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;} #flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;} #flickr_icon_td {padding:0 5px 0 0 !important;} .flickr_badge_image {text-align:center !important;} .flickr_badge_image img {border: 1px solid black !important;} #flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;} #flickr_badge_uber_wrapper a:hover, #flickr_badge_uber_wrapper a:link, #flickr_badge_uber_wrapper a:active, #flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;} #flickr_badge_wrapper {background-color:#ffffff;border: solid 1px #000000} #flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;} </style>
<table id="flickr_badge_uber_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr>
<td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color: #3993ff">flick<span style="color: #ff1c92">r</span></strong>.com</a></p>
<table id="flickr_badge_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr><script src="http://www.flickr.com/badge_code_v2.gne?count=5&amp;display=random&amp;size=s&amp;layout=h&amp;source=user_tag&amp;user=8123185%40N02&amp;tag=hitcounter" type="text/javascript"></script></tr>
</table>
</td>
</tr>
</table>
<p><!-- End of Flickr Badge --></p>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2007/12/04/arduino-xmas-hitcounter/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
<enclosure url="http://blip.tv/file/get/9600baud-ArduinoXMASHitcounter302.flv" length="2816464" type="video/x-flv" />
		</item>
		<item>
		<title>Tengu clone update</title>
		<link>http://tinkerlog.com/2007/11/10/tengu-clone-update/</link>
		<comments>http://tinkerlog.com/2007/11/10/tengu-clone-update/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 14:52:39 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[avr]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/2007/11/10/tengu-clone-update/</guid>
		<description><![CDATA[I just finished the tengu clone on a prototype board. Here are some pictures.


As you can see, everything fits nice under the LED display.

The next step would be to design a PCB of it.

More and full size pictures at Flickr.

 #flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;} #flickr_badge_icon {display:block !important; margin:0 !important; border: [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished the <a href="http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/" title="DIY tengu">tengu clone</a> on a prototype board. Here are some pictures.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/11/tengu2.JPG" alt="tengu2.JPG" /></p>
<p><span id="more-50"></span></p>
<p>As you can see, everything fits nice under the LED display.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/11/tengu4.JPG" alt="tengu4.JPG" /></p>
<p>The next step would be to design a PCB of it.</p>
<p><img src="http://tinkerlog.com/wp-content/uploads/2007/11/tengu5.JPG" alt="tengu5.JPG" /></p>
<p>More and full size pictures at Flickr.</p>
<p><!-- Start of Flickr Badge --></p>
<style type="text/css"> #flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;} #flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;} #flickr_icon_td {padding:0 5px 0 0 !important;} .flickr_badge_image {text-align:center !important;} .flickr_badge_image img {border: 1px solid black !important;} #flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;} #flickr_badge_uber_wrapper a:hover, #flickr_badge_uber_wrapper a:link, #flickr_badge_uber_wrapper a:active, #flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;} #flickr_badge_wrapper {background-color:#ffffff;border: solid 1px #000000} #flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;} </style>
<table id="flickr_badge_uber_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr>
<td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color: #3993ff">flick<span style="color: #ff1c92">r</span></strong>.com</a></p>
<table id="flickr_badge_wrapper" border="0" cellpadding="0" cellspacing="10">
<tr><script src="http://www.flickr.com/badge_code_v2.gne?count=3&amp;display=random&amp;size=t&amp;layout=h&amp;source=user_tag&amp;user=8123185%40N02&amp;tag=tengu" type="text/javascript"></script></tr>
</table>
</td>
</tr>
</table>
<p><!-- End of Flickr Badge --></p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/" title="DIY Tengu">DIY Tengu on a breadboard</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2007/11/10/tengu-clone-update/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DIY Tengu on a breadboard</title>
		<link>http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/</link>
		<comments>http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 21:59:05 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[avr]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/</guid>
		<description><![CDATA[When I first saw Crispin Jones Tengu, I was sure, I must have one. If you don&#8217;t know tengu and don&#8217;t want to follow the link, it&#8217;s a small face, made of LEDs, that reacts to music and sound.
It did not take long until I decided to clone this funny little device. All it needs [...]]]></description>
			<content:encoded><![CDATA[<p>When I first saw Crispin Jones <a title="Crispin Jones' Tengu" href="http://www.mr-jones.org/tengu/index.html" target="_blank">Tengu</a>, I was sure, I must have one. If you don&#8217;t know tengu and don&#8217;t want to follow the link, it&#8217;s a small face, made of LEDs, that reacts to music and sound.<br />
It did not take long until I decided to clone this funny little device. All it needs is a microcontroller, an LED matrix and a sound sensor.</p>
<p><a title="Photo Sharing" href="http://www.flickr.com/photos/8123185@N02/1693164655/"><img src="http://farm3.static.flickr.com/2302/1693164655_8e59df59c5.jpg" alt="Tengu clone" width="450" height="335" /></a></p>
<p><span id="more-42"></span></p>
<p><strong>Parts</strong></p>
<ul>
<li>ATmega48, 4kb flash memory, 512 bytes main memory</li>
<li>crystal, 10 MHz</li>
<li>Everlight 8&#215;5 LED dot matrix display</li>
<li>electret microphone, taken from an old mobile phone head set</li>
<li>LM386 op-amp</li>
<li>5 x 1k resistor</li>
<li>1 x 100k resistor</li>
<li>1 x 10k potentiometer</li>
<li>1 x 100k potentiometer</li>
<li>3 x 0.1u capicitor</li>
<li>2 x 22p capicitor</li>
</ul>
<p>All parts should be available for less than US10$.</p>
<p><strong>Sound sensor</strong></p>
<p>To get a good and robust signal out of the microphone, an amplifier is needed. I found an really easy schematic of an amplifier at <a title="LM386 amplifier" href="http://www.josepino.com/circuits/index?mini_amplifier_lm386.jpc" target="_blank">Jose Pino&#8217;s site</a>. It is based on the LM386, an op-amp, often used in small music amplifiers, e.g. <a title="Cracker box amp" href="http://www.make-digital.com/make/vol09/?pg=112" target="_blank">Cracker box Amp</a> in Make 09.</p>
<p>I assembled it on a small breadboard and tested it with my new Arduino.</p>
<p><a title="Photo Sharing" href="http://www.flickr.com/photos/8123185@N02/1693171715/"><img src="http://farm3.static.flickr.com/2239/1693171715_38b2de6bc7.jpg" alt="Sound sensor with Arduino" width="450" height="335" /></a></p>
<p>It worked great, but I had to use an alternative power source. When I used USB as power supply, the on- and off-switching of the monitoring LED lead to additional noise. 4 AAA cells solved that problem. For the first test you can use a small speaker attached to pin 5 of the LM386. Be sure to add the 220u capicitor between the LM386 and the speaker as shown in the schematic, otherwise you may blow your amplifier.</p>
<p>Here is a little sketch, that I used to test the sound sensor.</p>
<pre name="code" class="c">/*
 * Monitor for sound sensor
 */

int potPin = 2;    // select the input pin for sound sensor
int ledPin = 13;   // select the pin for the LED
int val = 0;
int amp = 0;

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  val = analogRead(potPin);
  amp = (val &gt;= 512) ? val - 512 : 512 - val;
  if (amp &gt; 100) {
    digitalWrite(ledPin, HIGH);
    delay(20);
  }
  else {
    digitalWrite(ledPin, LOW);
  }
}</pre>
<p><strong>Controller and LED matrix</strong></p>
<p>The Everlight LED matrix with its 40 LEDs is big enough to display a small face. The matrix needs 5 1k resistors for every row to limit the current.</p>
<p><a title="Photo Sharing" href="http://www.flickr.com/photos/8123185@N02/1696720251/"><img src="http://farm3.static.flickr.com/2213/1696720251_7afc6b8713.jpg" alt="tengu clone" width="450" height="335" /></a></p>
<p>The sound and its amplitude is sampled by the ATmega48 with one of its analog input pins (ADC). Then the suitable face is choosen to display. The faces are stored as simple bitmaps.</p>
<p><strong>Conclusion</strong></p>
<p>This small thingy is fun to watch. And it was fun to build. Maybe I&#8217;ll try to put it on a prototype board to be able to carry it around.<br />
<script src="http://blip.tv/scripts/pokkariPlayer.js?ver=2007100301" type="text/javascript"></script> <script src="http://blip.tv/syndication/write_player?skin=js&amp;posts_id=445416&amp;source=3&amp;autoplay=false&amp;file_type=flv&amp;player_width=320&amp;player_height=240" type="text/javascript"></script></p>
<p id="blip_movie_content_445416"><a onclick="play_blip_movie_445416(); return false;" rel="enclosure" href="http://blip.tv/file/get/9600baud-DIYTenguClone735.flv"><img title="Click to play" src="http://blip.tv/file/get/9600baud-DIYTenguClone735.flv.jpg" border="0" alt="Video thumbnail. Click to play." /></a><br />
<a onclick="play_blip_movie_445416(); return false;" rel="enclosure" href="http://blip.tv/file/get/9600baud-DIYTenguClone735.flv">Click To Play</a></p>
<p><script type="text/javascript"><!--
	play_blip_movie_445416();
// --></script></p>
<p>Yes, I know. My camera sucks.<strong></strong></p>
<p><strong>Links</strong></p>
<ul>
<li><a title="Tengu" href="http://www.mr-jones.org/tengu/index.html" target="_blank">Crispin Jones Tengu</a></li>
<li><a title="Mini amplifier with LM386" href="http://www.josepino.com/circuits/index?mini_amplifier_lm386.jpc" target="_blank">Mini amplifier with LM386</a></li>
<li><a title="Cheap sound sensor for AVR" href="http://tinkerlog.com/2007/05/20/cheap-sound-sensor-for-avr/">Cheap sound sensor for AVR</a></li>
</ul>
<p><strong>Downloads</strong></p>
<ul>
<li><a title="tengu_clone.zip" href="http://tinkerlog.com/wp-content/uploads/2008/01/tengu_clone.zip">tengu_clone.zip</a>, source, hex and Eagle schematic</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
<enclosure url="http://blip.tv/file/get/9600baud-DIYTenguClone735.flv" length="13417153" type="video/x-flv" />
		</item>
		<item>
		<title>Cheap Sound Sensor for AVR</title>
		<link>http://tinkerlog.com/2007/05/20/cheap-sound-sensor-for-avr/</link>
		<comments>http://tinkerlog.com/2007/05/20/cheap-sound-sensor-for-avr/#comments</comments>
		<pubDate>Sun, 20 May 2007 14:15:11 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[avr]]></category>
		<category><![CDATA[sensor]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://tinkerlog.com/2007/05/20/cheap-sound-sensor-for-avr/</guid>
		<description><![CDATA[I searched the web for a cheap method to let the ATmega respond to sound. My knowledge in analog circuits is very limited, but what I do remember, is that you can not attach a electret mircophone to a controller pin. The signal of the microphone is just too small and has to be amplified. [...]]]></description>
			<content:encoded><![CDATA[<p>I searched the web for a cheap method to let the ATmega respond to sound. My knowledge in analog circuits is very limited, but what I do remember, is that you can not attach a electret mircophone to a controller pin. The signal of the microphone is just too small and has to be amplified. There is much of information out there, especially on diy amplifiers. I stumbled upon this little circuit <a href="http://www.reconnsworld.com/forum/read.php?9,10" title="Simple Preamp">here</a>. It consists only of a handful of components:</p>
<ul>
<li>2 resistors 10k</li>
<li>1 resistor 100k</li>
<li>transistor 2N3904</li>
<li>1 capacitor 0.1u</li>
<li>electret microphone</li>
</ul>
<p><strong>Prototyping the amplifier</strong></p>
<p>Putting things together on a breadboard.</p>
<p><a href="http://www.flickr.com/photos/8123185@N02/505756876/" title="Photo Sharing"><img src="http://farm1.static.flickr.com/209/505756876_a77b9ac912_m.jpg" alt="IMGP1255" height="240" width="182" /></a></p>
<p>Actually I had no 2N3904 around, so I replaced it with a BC337. The circuit is a emitter circuit with voltage degeneration (I dont know if that exists in english). I dropped the couple capacitor and took the signal right away at the collector.</p>
<p><strong>Prototyping with the ATmega</strong></p>
<p>The sound sensing is done with the ADC of the ATmega. A simple program reads the analog value of the amplifier over and over. If the value (loudness) exeeds a specific level, an LED is lit.<br />
<a href="http://www.flickr.com/photos/8123185@N02/505756872/" title="Photo Sharing"><img src="http://farm1.static.flickr.com/230/505756872_833393f29c_m.jpg" alt="IMGP1253" height="180" width="240" /></a></p>
<p>The schematic for rebuilding.<br />
<a href="http://www.flickr.com/photos/8123185@N02/505756880/" title="Photo Sharing"><img src="http://farm1.static.flickr.com/218/505756880_b3daa2f405_m.jpg" alt="mic-schematic" height="166" width="240" /></a></p>
<p>The code can be found here <a href="http://tinkerlog.com/wp-content/uploads/2007/05/mic_sensor.c" title="mic_sensor.c">mic_sensor.c</a>. It is just hacked together and has lots of room for improvements.</p>
<p><strong>Video </strong></p>
<p>Here is a video that I made. Has lousy quality, for both, video and audio.</p>
<p><center><br />
<script src="http://blip.tv/scripts/pokkariPlayer.js" type="text/javascript"></script> <script src="http://blip.tv/syndication/write_player?skin=js&amp;posts_id=239440&amp;source=3&amp;autoplay=false&amp;file_type=flv&amp;player_width=&amp;player_height=" type="text/javascript"></script></p>
<p id="blip_movie_content_239440"><a href="http://blip.tv/file/get/9600baud-AudioSensorForAVR198.flv" onclick="play_blip_movie_239440(); return false;"><img src="http://blip.tv/file/get/9600baud-AudioSensorForAVR198.flv.jpg" title="Click To Play" border="0" /></a><br />
<a href="http://blip.tv/file/get/9600baud-AudioSensorForAVR198.flv" onclick="play_blip_movie_239440(); return false;">Click To Play</a></p>
<p></center><br />
<script type="text/javascript">	play_blip_movie_239440();</script><strong>Conclusion</strong></p>
<p>It was easy and worked pretty well. I enjoyed looking at the LED responding to the music. I haven&#8217;t recorded anything with this amplifier, it might sound awfull. Next steps could be playing the sound back or be able to analyze the sound (FFT). And (re-)learning more on analog circuit design.</p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://www.reconnsworld.com/forum/read.php?9,10" title="simple preamp">Simple preamp</a></li>
<li><a href="http://www.hobbyprojects.com/A/audio_amplifiers.html" title="Audio Amplifiers">Audio Amplifiers</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tinkerlog.com/2007/05/20/cheap-sound-sensor-for-avr/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
<enclosure url="http://blip.tv/file/get/9600baud-AudioSensorForAVR198.flv" length="2723539" type="video/x-flv" />
		</item>
	</channel>
</rss>

