<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Fanjita's Rants (Entries tagged as analogue)</title>
    <link>http://www.fanjita.org/serendipity/</link>
    <description>The Fanjita Monologues</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.6 - http://www.s9y.org/</generator>
    <pubDate>Fri, 03 Feb 2012 17:58:09 GMT</pubDate>

    <image>
        <url>http://www.fanjita.org/serendipity/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Fanjita's Rants - The Fanjita Monologues</title>
        <link>http://www.fanjita.org/serendipity/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Instrument Tuner - Zero Crossing analysis</title>
    <link>http://www.fanjita.org/serendipity/archives/23-Instrument-Tuner-Zero-Crossing-analysis.html</link>
            <category>Arduino</category>
    
    <comments>http://www.fanjita.org/serendipity/archives/23-Instrument-Tuner-Zero-Crossing-analysis.html#comments</comments>
    <wfw:comment>http://www.fanjita.org/serendipity/wfwcomment.php?cid=23</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.fanjita.org/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=23</wfw:commentRss>
    

    <author>nospam@example.com (Fanjita)</author>
    <content:encoded>
    &lt;p&gt;Having captured audio over a microphone, and converted to a voltage suitable for the Arduino ADC, the next challenge is capturing the analogue data and converting it into an estimation of the frequency of the current note being heard.  That&#039;s a fairly tricky problem, as it turns out.
&lt;p&gt;Firstly, the default Arduino analogRead() function is way too slow.  At 100 microseconds per read, that&#039;s a maximum sample rate of 10kHz - and even that is only possible when tight-looping doing reads, and nothing else.  According to Nyquist&#039;s theorem, at a bare minimum I need to be able to sample at at least twice the highest note&#039;s fundamental frequency, which is probably going to be about 1kHz, so double up to 2kHz.  I&#039;d ideally like to sample at least 5-6 times the highest fundamental, and calculating the incoming frequency requires some maths too.  So, I decided to look into alternative approaches.
&lt;p&gt;A naive approach to frequency counting is to count zero-crossings in a given direction - i.e. observe the waveform, and everytime it goes from negative to positive, increment a counter.  Counting the number of crossings in a given time directly gives you the frequency.  It turns out that both the ATTiny85 and the ATmega328 (Arduino) chips both contain an analogue comparator, hooked up in such a way that zero crossing counting can be done extremely efficiently.
 &lt;br /&gt;&lt;a href=&quot;http://www.fanjita.org/serendipity/archives/23-Instrument-Tuner-Zero-Crossing-analysis.html#extended&quot;&gt;Continue reading &quot;Instrument Tuner - Zero Crossing analysis&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 29 Jan 2012 00:30:28 +0000</pubDate>
    <guid isPermaLink="false">http://www.fanjita.org/serendipity/archives/23-guid.html</guid>
    <category>adc</category>
<category>analogue</category>
<category>arduino</category>
<category>comparator</category>
<category>frequency</category>
<category>timer</category>
<category>tuner</category>

</item>

</channel>
</rss>