<?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>Nate&#039;s blog &#187; None</title>
	<atom:link href="http://www.natenewz.com/category/none/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.natenewz.com</link>
	<description>My various projects</description>
	<lastBuildDate>Wed, 27 Oct 2010 00:07:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Designing and Making a Tesla Coil Part 1</title>
		<link>http://www.natenewz.com/2010/10/20/designing-and-fabricating-a-tesla-coil-part-1/</link>
		<comments>http://www.natenewz.com/2010/10/20/designing-and-fabricating-a-tesla-coil-part-1/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 18:48:27 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[Coil]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[impedance]]></category>
		<category><![CDATA[lambda over 4]]></category>
		<category><![CDATA[primary]]></category>
		<category><![CDATA[quality factor]]></category>
		<category><![CDATA[resonance]]></category>
		<category><![CDATA[secondary]]></category>
		<category><![CDATA[Tesla]]></category>
		<category><![CDATA[Tesla Coil]]></category>
		<category><![CDATA[transformer]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=378</guid>
		<description><![CDATA[So, a friend and I decided to build a Tesla Coil. When we started, I wasn&#8217;t very familiar with how they worked, but I had plans for a 12&#8243; spark Tesla Coil in Bob Iannini&#8217;s book, &#8220;Electronic Gadgets for the Evil Genius&#8221; Ch. 14, which promised a working Tesla Coil if we followed the plans.
However, [...]]]></description>
			<content:encoded><![CDATA[<p>So, a friend and I decided to build a Tesla Coil. When we started, I wasn&#8217;t very familiar with how they worked, but I had plans for a 12&#8243; spark Tesla Coil in Bob Iannini&#8217;s book, &#8220;Electronic Gadgets for the Evil Genius&#8221; Ch. 14, which promised a working Tesla Coil if we followed the plans.</p>
<p>However, I wanted to learn about how Tesla Coils worked from this project. So I started researching Tesla Coils, and I want these blog posts to serve as a compilation of my research and design considerations as I fabricate a Tesla coil.</p>
<h2>How do Tesla Coils Work?</h2>
<p>The first question I asked before we started this project was: How do Tesla Coils work?</p>
<p>Tesla Coils make high voltage at high frequencies.</p>
<p>Tesla Coils are generally a two stage transformer, taking in the low voltage 60 Hz wall power, and converting it to millions of Volts at somewhere between 200 KHz to 4 GHz.</p>
<h3>What does the most basic circuit look like?</h3>
<p><a href="http://www.natenewz.com/wp-content/uploads/2010/10/overview-schematic.png"><img style="width: 100%;" title="overview-schematic" src="http://www.natenewz.com/wp-content/uploads/2010/10/overview-schematic.png" alt="" /></a></p>
<h3>How does a Tesla coil change the input frequency?</h3>
<p>From a signals perspective, the first question I would have after reading the description would be, &#8220;how does the frequency change from 60 Hz to hundreds of kilohertz, or where does the non-linearity of this system come from?&#8221; (because linear systems cannot shift the frequency)</p>
<p>Transformers, Capacitors, and Inductors cannot change the frequency, it&#8217;s the spark gap.</p>
<p>In the primary side of a Tesla Coil, the spark gap introduces a non-linearity into the system.</p>
<p>There are three major pieces to the general Tesla Coil, as you can see in the above picture. The low voltage input from the wall to just past the high voltage transformer (yellow), the primary from the tank capacitor to the primary coil (green), and the secondary including the secondary coil and the toroidal top (red). The input charges the tank capacitor to a relatively high voltage (thousands of volts) still at 60 Hz until a spark gap breaks down. When this spark breaks down, it becomes a near zero resistance short circuit, which puts an impulse on the primary coil and causes the whole primary circuit to oscillate at it&#8217;s natural frequency, a function of the inductance of the primary coil, and the capacitance of the tank capacitor. The RLC (Resistor, Inductor, and Capacitor) circuit at resonance, creates a standing voltage wave that</p>
<p><img src='http://s.wordpress.com/latex.php?latex=2%5Cpi%20f%3D%5Cfrac%7B1%7D%7B%5Csqrt%7BL_%7Bind%7DC_%7Bcap%7D%7D%7D&#038;bg=T&#038;fg=000000&#038;s=1' alt='2\pi f=\frac{1}{\sqrt{L_{ind}C_{cap}}}' title='2\pi f=\frac{1}{\sqrt{L_{ind}C_{cap}}}' class='latex' /><br />
You can read more about RLC circuits on Wikipedia <a title="RLC circuits" href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CCUQFjAA&amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRLC_circuit&amp;rct=j&amp;q=RLC&amp;ei=OCi_TPrJAoSXnAeVro2KDg&amp;usg=AFQjCNHCqiAz3-AG6oxFFD7-0TSmmZ4LAA&amp;sig2=m3VuxAZN_LplEi3-cAEgAA&amp;cad=rja" target="_blank">here.</a> The spark gap is the key to the non-linearity in this system.</p>
<h3>How does a Tesla coil make millions of Volts?</h3>
<p>The voltage increases from thousands of Volts to Millions of Volts because of resonance between the primary and secondary parts of the circuit.</p>
<p>The secondary side is another RLC circuit. The L is the secondary inductor, and the C is the torus on top. The R comes from the resistance of the windings on the coil. This low series self-resistance from the coil gives the secondary a high quality factor. The complete circuit occurs when air breaks down around the torus and current flows to the surrounding environment. The secondary is designed to naturally oscillate at the same frequency as the primary. Because they oscillate at the same frequencies, the voltage multiplies from the primary to the secondary. This is called a loosely coupled transformer.</p>
<h3>Is the primary/secondary a normal transformer?</h3>
<p>No. Because the windings of the primary are so far away from the windings of the secondary, and the core of the transformer is  air, it is considered a loosely coupled transformer. This means than the ratio of the windings of the secondary to the primary will not be exactly equivalent to the voltage gain. The voltage gain or ratio of secondary voltage to primary voltage is more affected by how well the primary and secondary resonate together, which happens when they are tuned to the same natural frequency.</p>
<h3>Are there any other factors that affect the performance?</h3>
<p>The secondary should have a length corresponding to the your design frequencies wavelength divided by 4, an antennae and transmission line rule. This is because on the secondary at resonance, a standing voltage wave is created on the length of the wire wrappings of the secondary coil. This standing wave will have a wavelength corresponding to the frequency it is resonating at, which ideally will be 4 times the length of the secondary coil wire.<br />
<img src='http://s.wordpress.com/latex.php?latex=%5Cfrac%7Bc%7D%7B4%2Af%20%7D%3Dl&#038;bg=T&#038;fg=000000&#038;s=1' alt='\frac{c}{4*f }=l' title='\frac{c}{4*f }=l' class='latex' /><br />
where f is the frequency of oscillation, c is the speed of light (3E8m/s)</p>
<p><a href="http://www.natenewz.com/wp-content/uploads/2010/10/sine.png"><img style="width: 100%;" title="Voltage Maximum at lambda/4" src="http://www.natenewz.com/wp-content/uploads/2010/10/sine.png" alt="" /></a><br />
Note that the voltage maximum is where we want our length of wire to be, and it occurs at 1/4 of the width of the sine wave or the wavelength divided by 4.</p>
<h3>Practical Applications</h3>
<p>What does all of this mean for actually building a Tesla Coil?</p>
<p>This means that you should pick a frequency, I picked 600 kHz, for your Tesla Coil to operate at. Then you should calculate the wavelength, by taking the speed of light 3E8m/s divided by your frequency. Then you should divide this wavelength by 4 to get the length of your secondary coil wire in meters. My length was 125 meters. If you are using PVC to wrap your secondary around, pick a standard size outer diameter of PVC, (mine was 3&#8243; PVC with an outer diameter of 3.5&#8243;) and calculate the number of turns by dividing your ideal wire length by pi*outer diameter in meters. 125/(.0889*pi) = 447.56 turns. If you want to be precise, you can also take into account the radius of the wire you are wrapping the PVC with, (mine was 26 gauge). Round up and you now know enough to make your coil.</p>
<p>When winding this coil, the turns should be close together, there should be no overlapping, and no kinks. When you are finished, you can measure the inductance of your coil, and compare to what<a title="Inductance Calculator" href="http://hamwaves.com/antennas/inductance.html" target="_blank"> this website </a>says when you put in your coil dimensions.</p>
<p>In the next post, I will discuss the other half of the secondary, the torus on top, and how to calculate it&#8217;s dimensions so that your secondary oscillates at the design frequency.</p>
<h3>What can I read to gain a better understanding?</h3>
<p>Some other recommended Wikipedia readings are:</p>
<ul>
<li><a title="Electrical Imedance" href="http://en.wikipedia.org/wiki/Electrical_impedance" target="_blank">Electrical Imedance</a></li>
<li><a href="http://en.wikipedia.org/wiki/RLC_circuit#Resonance" target="_blank">Resonance of an RLC circuit</a></li>
<li><a title="Quality Factor" href="http://en.wikipedia.org/wiki/RLC_circuit#Q_factor" target="_blank">Q-Factor</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/10/20/designing-and-fabricating-a-tesla-coil-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting Version Numbers in PHP</title>
		<link>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/</link>
		<comments>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 17:51:50 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sorting]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=371</guid>
		<description><![CDATA[UPDATE:
I found a php function which takes much of the hardest part of this problem and makes it easier. The function is version_compare().
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
What&#8217;s the problem? Say you have a version number such as 1.2.3 stored in a MySql database as a varchar, and you want to sort this version number. Without any decimals, here is [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE:</p>
<p>I found a php function which takes much of the hardest part of this problem and makes it easier. The function is <a title="version_compare" href="http://php.net/manual/en/function.version-compare.php" target="_blank">version_compare</a>().</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>What&#8217;s the problem? Say you have a version number such as 1.2.3 stored in a MySql database as a varchar, and you want to sort this version number. Without any decimals, here is the sorting descending:<br />
+&#8212;&#8212;&#8212;+<br />
| version |<br />
+&#8212;&#8212;&#8212;+<br />
| 9960    |<br />
| 9952    |<br />
| 9765    |<br />
| 9764    |<br />
| 10011   |<br />
+&#8212;&#8212;&#8212;+<br />
5 rows in set (0.00 sec)<br />
It thinks 9960 &gt; 10011<br />
If you don&#8217;t have a decimal point this can be easily remedied by doing:<br />
ORDER BY CAST(version AS UNSIGNED) DESC<br />
But as soon as you put a decimal into the version, it ignores everything to the right of the decimal point.<br />
My solution is a PHP sorting algorithm.<br />
$versions is an indexed array that has this format, which could easily come from a database<br />
array<br />
0 =&gt;<br />
array<br />
&#8216;id&#8217; =&gt; int 88<br />
&#8216;version&#8217; =&gt;<br />
array<br />
0 =&gt; int 0<br />
1 =&gt; int 9<br />
2 =&gt; int 10011<br />
1 =&gt;<br />
array<br />
&#8216;id&#8217; =&gt; int 87<br />
&#8216;version&#8217; =&gt;<br />
array<br />
0 =&gt; int 0<br />
1 =&gt; int 9<br />
2 =&gt; int 9960</p>
<pre id="PHP" class="prettyprint">// convert all values to ints
array_walk_recursive($versions, function(&amp;$val, $i)
{
    if (is_string($val))
        $val = (int)$val;
});
// make to arrays the same length by padding them with 0s
function normalize($a, $b)
{
    $al = count($a);
    $bl = count($b);
    if ($al < $bl)
    {
        // add 0s to $a until they are the same size
        while (count($a) < $bl)
            $a[] = 0;
    }
    elseif ($al > $bl)
    {
        // add 0s to $b until they are the same size
        while ($al > count($b))
            $b[] = 0;
    }
    return array($a, $b);
}
//compare to integers and decide which one is bigger
// return 0 if they are equal
function check($a, $b)
{
    if ($a < $b)
        return 1;
    elseif ($a > $b)
        return -1;
    else
        return 0;
}
// sort the array
usort($versions, function($a, $b)
{
    // make sure the major_version arrays have the same length, pad with 0s to correct
    list($a['version'], $b['version']) = normalize($a['version'], $b['version']);
    for ($i=0; $i < count($a['version']); $i++)
        $check = check($a['version'][$i], $b['version'][$i]);
    return $check;
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/06/29/sorting-version-numbers-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling the Wordpress Flash Uploader</title>
		<link>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/</link>
		<comments>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 16:42:58 +0000</pubDate>
		<dc:creator>nate</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[disabling]]></category>
		<category><![CDATA[flash uploader]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/?p=328</guid>
		<description><![CDATA[Sometimes it can be finnigy &#8212; the wordpress flash uploader. When it works, it works nicely, but when it doesn&#39;t work it can be frustrating to troubleshoot and fix. If you ever decide that you don&#39;t want it anymore, there is a very simple snippet that will make it look like wordpress never had a [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it can be finnigy &#8212; the wordpress flash uploader. When it works, it works nicely, but when it doesn&#39;t work it can be frustrating to troubleshoot and fix. If you ever decide that you don&#39;t want it anymore, there is a very simple snippet that will make it look like wordpress never had a flash uploader at all, and all you see is the html uploader. Create a plugin, add these two lines of code to it, and activate it.</p>
<pre class="prettyprint" id="PHP">&lt;?php
// Disable the flash uploader
add_action(&#39;flash_uploader&#39;, &#39;disableFlashUploader&#39;);
function disableFlashUploader(){return false;}
?&gt;
</pre>
<p><a href="http://www.natenewz.com/wp-content/uploads/2010/03/before.png"><img alt="screenshot of before disabling flash uploader" class="alignleft size-full wp-image-339" height="147" src="http://www.natenewz.com/wp-content/uploads/2010/03/before.png" title="Before" width="486" /></a><a href="http://www.natenewz.com/wp-content/uploads/2010/03/after.png"><img alt="After Disabling the flash uploader" class="alignleft<br />
 size-full wp-image-338" height="147" src="http://www.natenewz.com/wp-content/uploads/2010/03/after.png" title="after" width="416" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2010/03/06/disabling-the-wordpress-flash-uploader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Zenphoto and Wordpress</title>
		<link>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/</link>
		<comments>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 05:28:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[seamless]]></category>
		<category><![CDATA[zenphoto]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/blog/?p=93</guid>
		<description><![CDATA[
Update: I am now using google picasa with the kpicasa plugin. I&#39;ve determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zenphoto.org/"><img alt="Zenphoto" class="size-medium wp-image-96" height="117" src="http://www.natenewz.com/wp-content/uploads/2009/10/zenphoto-300x108.jpg" title="zenphoto" width="329" /></a><a href="http://www.wordpress.org/"><img alt="wordpress" class="size-full wp-image-97" height="117" src="http://www.natenewz.com/wp-content/uploads/2009/10/wordpress-icon-512-300x300.png" title="wordpress-icon-512-300x300" width="117" /></a></p>
<p>Update: I am now using google picasa with the kpicasa plugin. I&#39;ve determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this method will work, but over time if you ever make a change to your wordpress theme, you have to update your look-alike zenphoto theme. Common plugins for zenphoto wordpress integration allow you to put individual albums or photos into posts.<br style="clear: both;" /><br />
	After reading <a href="http://wpengineer.com/embed-wordpress-functions-outside-wordpress/trackback/" target="_blank" title="Calling wordpress functions outside of wordpress">Frank&#39;s post on using wordpress functions outside of wordpress</a>, I had a good idea: Make a zenphoto theme with the wordpress navigation. This allows a nearly seamless level of integration between zenphoto and wordpress. The best starting point for this outline is if you already have a nice looking wordpress theme. The result of this will give you a wordpress &quot;page&quot; that redirects to a lookalike wordpress zenphoto theme complete with wordpress navigation, footer, page title, header, etc. First, you need a way of getting the paths of the blog directory, and the zenphoto directory. I have a www/blog/ folder and a www/gallery/ folder in this example. Place config.php in www/ config.php</p>
<pre class="prettyprint">< ?php
/* config file to unite wordpress and zenphoto */
define('BLOG_PATH', "$_SERVER['DOCUMENT_ROOT']/blog");
// do a var_dump($_SERVER); to find out what something is
define('GALLERY_PATH', "$_SERVER['DOCUMENT_ROOT']/gallery');
?></pre>
<p>You may have to var_dump($_SERVER) to find out the best way of getting to your site&#39;s directory. Okay, we have paths to reference from zenphoto to get to the wordpress directory. Let&#39;s dig into a zenphoto theme. Zenphoto themes are laid out with various files that are called depending on if you are at the zenphoto homepage (index.php), or if you have clicked on an album (album.php), or an image (image.php) and a few others. Your best bet is to copy the &#39;default&#39; zenphoto theme to a folder with a different name, such as nate-theme, then modify it. Let&#39;s look at index.php The first step is to follow Franks post and include the wordpress loader wp-load.php. Put at the very top of your zp-themes index.php file:</p>
<pre class="prettyprint" id="PHP">&lt; ?php
require_once(&quot;{$_SERVER[&#39;something&#39;]}/www/config.php&quot;);
require_once(BLOG_PATH.&quot;/wp-load.php&quot;);
// var_dump(get_current_theme()); // call this to see the name of the wordpress theme activated
if (get_current_theme() == &quot;My Wordpress Theme&quot;) // if the current theme is my wp theme, use it. otherwise use default zenphoto theme
{?&gt;
// wordpress html+php here
&lt; ?php
}else{
?&gt;
// original zenphoto default index.php file here
&lt;?php
}
?&gt;</pre>
<p>This is in case the wordpress theme get&#39;s changed to something else, zenphoto will revert back to the original html/php &#8212; whatever is in the else statement. So then, just copy the basic html structure from the header.php footer.php index.php files from your wordpress theme. You can now call the functions for listing the navigation, <a href="http://codex.wordpress.org/wp_list_pages">wp_list_pages()</a>, getting options <a href="http://codex.wordpress.org/Function_Reference/get_option">get_option()</a>, getting blog title and other information <a href="http://codex.wordpress.org/Template_Tags/bloginfo">bloginfo()</a>, etc. One requirement for this to work, is that the zenphoto and wordpress functions don&#39;t interfere. Luckily, no two functions have the same name, and so this does work. I haven&#39;t tested recreating the sidebar widgets in the zenphoto theme, although it should theoretically work. As for the zenphoto style sheet, I played a trick on apache to make this work. I told apache to parse .css files in the styles/ directory of zenphoto theme as a php file. Just make a .htaccess file in the styles directory, and add this line to it: AddType application/x-httpd-php .css This will allow you to apply the same technique as the index.php page with the if get_current_theme==xx else block. Just use the normal css in the else, and the wordpress css in the if parts. The last step to making this a nearly seamless integration is following my previous post on hardlinking the navigation. create the custom field redirect to the key /gallery/ or the url path to your gallery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

