<?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>JeeLabs &#187; Hardware</title>
	<atom:link href="http://jeelabs.org/category/hardware/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeelabs.org</link>
	<description>Computing stuff tied to the physical world</description>
	<lastBuildDate>Tue, 22 May 2012 22:18:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>TD &#8211; LED flashlight</title>
		<link>http://jeelabs.org/2012/05/22/td-led-flashlight/</link>
		<comments>http://jeelabs.org/2012/05/22/td-led-flashlight/#comments</comments>
		<pubDate>Mon, 21 May 2012 22:01:27 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Teardown]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19580</guid>
		<description><![CDATA[Welcome to the Tuesday Teardown series, about looking inside the technology around us. Today&#8217;s episode will be a short one, it&#8217;ll become clear halfway down&#8230; This is a little bargain LED flashlight, nothing to it really: Three AAA (not AA) cells, a toggle button, 24 + 4 white LEDs, and that&#8217;s it. Press the button [...]]]></description>
			<content:encoded><![CDATA[<p><em>Welcome to the <a href="http://jeelabs.org/tag/teardown/">Tuesday Teardown</a> series, about looking inside the technology around us.</em></p>

<blockquote>
  <p>Today&#8217;s episode will be a short one, it&#8217;ll become clear halfway down&#8230;</p>
</blockquote>

<p>This is a little bargain LED flashlight, nothing to it really:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_3228.jpg" alt="DSC 3228" title="DSC_3228.jpg" border="0" width="604" height="273" /></p>

<p>Three AAA (not AA) cells, a toggle button, 24 + 4 white LEDs, and that&#8217;s it. Press the button once, and the 4 LEDs on the side turn on, press again to light the 24 on the top, and again to turn it off.</p>

<p>Quite a bright light BTW. The 4 LEDs draw 190 mA, with 16 it rises to 270 mA. That&#8217;s perhaps 4 hours of use with 16 LEDs before the batteries run out.</p>

<p>The circuit is as ridiculously simple as can be &#8211; one 4.7 Ω resistor and a switch:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_3229.jpg" alt="DSC 3229" title="DSC_3229.jpg" border="0" width="604" height="223" /></p>

<p>That &#8220;metal&#8221; reflector is actually plastic with a chrome finish.
The PCB is one-sided, no doubt to lower the cost:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_3230.jpg" alt="DSC 3230" title="DSC_3230.jpg" border="0" width="604" height="386" /></p>

<p>(it won&#8217;t take much bending to create a short with that top wire!)</p>

<p>Using Ohm&#8217;s law (V = I x R), we can deduce that the LED&#8217;s forward voltage is 4.5 &#8211; X = 0.190 x 4.7 &#8211; in other words, X = 4.5 &#8211; 0.190 x 4.7 = 3.6V. Note that the light intensity will vary considerably with battery voltage and that this lamp won&#8217;t work at all with 3 AAA EneLoop batteries which only supply 1.2V to 1.3V when fully charged.</p>

<p>The reason I&#8217;m opening up this trivial little gadget is not to marvel at the deep electronic engineering that went into it, but to show how custom plastics and a custom case makes something quite practical and nice to the touch. The top and bottom have a rubbery feel to them. The bottom has a little plastic hook in it, which can be folded out.</p>

<p><em>The bigger news today is a bit of a mess, unfortunately.</em></p>

<p>Last night I decided to upgrade the JeeLabs server from Mac OSX 10.7.3 to 10.7.4 &#8211; that update had been out for a few days, worked fine on two other machines here, so it seemed safe to apply the update to the server as well.</p>

<p><strong>It failed.</strong></p>

<p>This server is connected via wired Ethernet, and I usually only look at the GUI via a VNC-like &#8220;Screen Sharing&#8221; mechanism built into Mac OSX. It works well, because that connection is re-established even when the machine is in an exclusive &#8220;Updating&#8230;&#8221; mode, so you get to track progress even while the system is busy replacing some of its own bits and pieces. No screen needed, even though part of admin interface sometimes uses the GUI.</p>

<p>Last night, the server failed to come back online. Which is a major hassle, because then I have to move it to another spot to hook up a mouse, keyboard, and monitor to see what&#8217;s going on. Never happened before.</p>

<p>Trouble is (probably), that I turned the darn thing off forcefully. I knew that all the VM&#8217;s had been properly shut down, and I heard the characteristic reboot &#8220;pling&#8221;, so I thought it was waiting for a GUI response&#8230; or something.</p>

<p>Then the trouble started. Hooked it up, did a restart: no go. So I restarted it in recovery mode, and did a disk check/repair of all the disks. Guess what: the startup disk with all VM&#8217;s could not be repaired&#8230; <em>whoops!</em></p>

<p>Time to kick my backup strategy in gear. I have two in place: local hourly Time Machine backups to a second drive, and daily backups for all VM&#8217;s to the cloud.</p>

<p>To make a very long <del>night</del> story short: the local hourly backups are fine, but they do not include the VM&#8217;s (whole-file backups of a VM disk every hour is not really practical). And the daily backups? Well, they are indeed all there &#8211; I can get any day in the past 3 months back, for any of the 4 VM&#8217;s. Awesome.</p>

<p>But Turnkey Linux does things a bit differently. Very clever in fact: it only backs up the minimum. The Linux Debian packages for example: these are not backed up, but re-installed from some other source. The rest is a well thought-out mix of full and incremental backups, and it all works just as expected.</p>

<p>Except that my VM&#8217;s are about two years old now, and no longer the latest base images used by Turnkey Linux. No problem, they say: you can get the latest, and then recover your own stuff on top of that.</p>

<p>So I spent about 6 hours trying to work out how to get my VM&#8217;s back up from the Amazon S3 storage. No joy. I can see all the files being restored, but the result is not a working VM. At some point, package installs &amp; updates hang, with either udev restart problems or bootdisk image generation problems.</p>

<p>And now the crazy bit: the JeeLabs weblog + forum + café sites are all back up again (phew!). I restored from Time Machine to a freshly freed disk partition, and restarted the Mac &#8211; it&#8217;s alive! Right now, the server is running from the new disk partition, but with the 4 VM disk images <em>still</em> on the damaged partition. So apparently they did not get any damage, although the Mac file system <em>structure</em> on that disk seems to be hosed.</p>

<p>I&#8217;ll spend some time thinking about how to clean up this mess, and how to avoid it in the future. The good news is that I lost no data &#8211; just a lot of time and some hair. Yikes &#8230; this really was <em>uncomfortably</em> close to the edge!</p>

<p><em>The moral: test the backup strategy regularly. It can still break, even when not changing anything!</em></p>

<p><strong>Update</strong> &#8211; all systems are &#8220;go&#8221; again.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/22/td-led-flashlight/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Producing a beefier signal</title>
		<link>http://jeelabs.org/2012/05/21/producing-a-beefier-signal/</link>
		<comments>http://jeelabs.org/2012/05/21/producing-a-beefier-signal/#comments</comments>
		<pubDate>Sun, 20 May 2012 22:01:46 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Analog]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19570</guid>
		<description><![CDATA[Let&#8217;s move on, now that we have a clean sine wave. The goal is to produce a ±10V sine wave to use for constructing a Component Tester. The sine wave produced so far was merely ±65 mV. I re-used the same circuit as yesterday, but with slightly different settings. First of all, I replaced the [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s move on, now that we have a <a href="http://jeelabs.org/2012/05/20/a-better-sine-wave/">clean sine wave</a>. The goal is to produce a ±10V sine wave to use for constructing a <a href="http://jeelabs.org/2012/01/31/component-tester/">Component Tester</a>. The sine wave produced so far was merely ±65 mV.</p>

<p>I re-used the same circuit as yesterday, but with slightly different settings. First of all, I replaced the op-amp by an LM358, which can handle higher voltages. Next, I halved all the R&#8217;s to 5 kΩ and doubled all the C&#8217;s to 0.2 µF. This reduces the loading of the feedback loop &#8211; it shouldn&#8217;t really affect the frequency.</p>

<p>To increase the output voltage, I connected the oscillator output signal to a non-inverting op-amp circuit:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/Screen-Shot-2012-05-13-at-18.04.33.png" alt="Screen Shot 2012 05 13 at 18 04 33" title="Screen Shot 2012-05-13 at 18.04.33.png" border="0" width="361" height="205" /></p>

<p>In a nutshell: this circuit tries to keep Ve as close to zero as possible at all times. IOW, the op-amp will constantly adjust its output so that the tap on the Rf:Rg voltage divider <em>tracks</em> the Vin voltage on the &#8220;+&#8221; input pin.</p>

<p>Using Rf = 10 kΩ, and Rg = 470 Ω, its gain will be about 22x. The nice property of this circuit is that it has a very high input impedance, so there is virtually no current draw from the oscillator.</p>

<p>And sure enough, the output of this op-amp is a sine wave with many volts of output swing. Now it&#8217;s simply a matter of cranking up the supply voltages to ±13.6V and bingo, a ±10V sine wave:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR64.png" alt="SCR64" title="SCR64.PNG" border="0" width="604" height="476" /></p>

<p>Very clean. Better even than the original circuit &#8211; the 2nd harmonic is now -49 dBm w.r.t. to the base frequency. That&#8217;s just 0.35% of harmonic distortion &#8211; excellent!</p>

<p>That second op-amp came for free, since an LM358 DIP-8 package has two of them anyway. So the first op-amp is oscillating (at about 470 Hz) and the second op-amp brings the output level to ±10V.</p>

<p>It&#8217;s quite a mess on the mini-breadboard I used, but who cares &#8211; that&#8217;s what prototypes are for:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_3215.jpg" alt="DSC 3215" title="DSC_3215.jpg" border="0" width="604" height="549" /></p>

<p>One last check is needed to make sure that the LM358 is suitable. A component tester measures the effects of an unknown component in series with a 1 kΩ resistor. So in the worst case, with a simple wire as &#8220;unknown component&#8221;, the maximum current through that resistor will be ±10 mA. Luckily, according to the specs, an LM358 can supply at least 10 mA, and typically up to 20 mA on its output.</p>

<p>So that&#8217;s it: our Component Tester will need a ±13.6V supply, an LM358, and a few R&#8217;s and C&#8217;s. That supply voltage is not critical, as long as it&#8217;s stable &#8211; the output level could be adjusted to ±10V via a trimpot.</p>

<p><em>Welcome to the world of analog electronics!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/21/producing-a-beefier-signal/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>A better sine wave</title>
		<link>http://jeelabs.org/2012/05/20/a-better-sine-wave/</link>
		<comments>http://jeelabs.org/2012/05/20/a-better-sine-wave/#comments</comments>
		<pubDate>Sat, 19 May 2012 22:01:19 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Analog]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19126</guid>
		<description><![CDATA[After the pretty bad sine wave trial of the last two days, it&#8217;s time to try another circuit: This is a &#8220;Phase Shift Oscillator&#8221; from the same op-amp book as the other one. I used half a TLV2472. This one is actually a bit simpler to explain: the op-amp is set up with 25..50x amplification, [...]]]></description>
			<content:encoded><![CDATA[<p>After the pretty bad sine wave trial of the <a href="http://jeelabs.org/2012/05/18/generating-a-sine-wave/">last</a> <a href="http://jeelabs.org/2012/05/19/generating-a-sine-wave-part-2/">two</a> days, it&#8217;s time to try another circuit:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/Screen-Shot-2012-05-13-at-15.55.30.png" alt="Screen Shot 2012 05 13 at 15 55 30" title="Screen Shot 2012-05-13 at 15.55.30.png" border="0" width="515" height="166" /></p>

<p>This is a &#8220;Phase Shift Oscillator&#8221; from the same <a href="http://www.ti.com/lit/an/slod006b/slod006b.pdf">op-amp book</a> as the other one. I used half a TLV2472.</p>

<p>This one is actually a bit simpler to explain: the op-amp is set up with 25..50x amplification, i.e almost a comparator (with 50x amplification, a 50 mV input above or below the 2.5V will drive the output to its limit). And indeed, the output signal of the op-amp looks somewhat like a heavily clipped sine wave:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR59.png" alt="SCR59" title="SCR59.PNG" border="0" width="604" height="442" /></p>

<p>The 3 resistors and 3 capacitors create 3 RC &#8220;low-pass&#8221; filters in series, removing all the higher frequencies, i.e. harmonics. A fairly clean sine wave comes out at the end, as you can see here:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR58.png" alt="SCR58" title="SCR58.PNG" border="0" width="604" height="478" /></p>

<p>The only problem is that the signal level has been reduced from a ±2.5 V level to ≈ ±65 mV, a 40-fold reduction!</p>

<p>So the op-amp itself has to amplify that level back up to produce the clipped ±2.5V signal again.</p>

<p>The frequency is determined by &#8220;phase shifts&#8221;. Each RC filter changes the phase of its input signal, and it will be by 60° at a certain frequency, so that 3 of them in series will then shift it by 180°. Since the signal is fed back to the &#8220;-&#8221; pin of the op-amp, that&#8217;s exactly the proper signal to generate the opposite output, i.e. shifted 180° out of 360°. This analog stuff gets complicated &#8211; don&#8217;t worry too much about it: just pick R and C values to get the right frequency, and make all of them the same.</p>

<p>I used 0.1 µF caps i.s.o. 10 nF caps, i.e. 10x larger than the original circuit.
With these values, the oscillation in my setup turned out to occur at just about 440 Hz, i.e. a pure musical &#8220;A&#8221; tone!</p>

<p>I did have to increase the gain (1.5 MΩ / 55.2 kΩ = 27 in the above setup) to force oscillation. I changed RF to 1 MΩ and RG to 22 kΩ, for a gain of 47. This RG value is a bit low, it loads down the last RC section quite a bit.</p>

<p>What you&#8217;re seeing here is a classical example of a negative feedback loop, which ends up in a very stable state of oscillation. It oscillates because we&#8217;re delaying the feedback signal by about 2.27 ms through the RC chain. So the op-amp constantly overshoots around its mid-point (the 2.5V applied to the &#8220;+&#8221; input), but does so in a very controlled way. The amplitude can&#8217;t increase any further, since the op-amp is clipping at its limits already, and the amplification factor is large enough to keep boosting the swing up to that limit. You can see the startup ramp and stabilization when powering up:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR61.png" alt="SCR61" title="SCR61.PNG" border="0" width="604" height="442" /></p>

<p>Here&#8217;s the FFT spectrum analysis of the generated sine wave:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR60.png" alt="SCR60" title="SCR60.PNG" border="0" width="604" height="470" /></p>

<p>A clean signal compared to the previous experiment. The 2nd harmonic is ≈ 42 dBm below the fundamental wave, the rest is even lower. Using this <a href="http://www.sengpielaudio.com/calculator-thd.htm">calculator</a>, we can see that this represents about 0.8% harmonic distortion.</p>

<p>The only issue is that the signal is <em>much</em> weaker than the ±10V needed for a standard Component Tester.</p>

<p><em>But hey, let&#8217;s declare success for now &#8211; we&#8217;ve got a clean sine wave!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/20/a-better-sine-wave/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Generating a sine wave &#8211; part 2</title>
		<link>http://jeelabs.org/2012/05/19/generating-a-sine-wave-part-2/</link>
		<comments>http://jeelabs.org/2012/05/19/generating-a-sine-wave-part-2/#comments</comments>
		<pubDate>Fri, 18 May 2012 22:01:59 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Analog]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19526</guid>
		<description><![CDATA[After yesterday&#8217;s failed attempt to generate a clean since wave, I started experimenting a bit further. How could the Op-amp book be so wrong about the quadrature oscillator circuit? The nice thing about op-amps in DIP-8 packages, is that most of them use the same pinout, so it&#8217;s very easy to swap them out and [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://jeelabs.org/2012/05/18/generating-a-sine-wave/">yesterday&#8217;s</a> failed attempt to generate a clean since wave, I started experimenting a bit further. How could the <a href="http://en.wikipedia.org/wiki/Operational_amplifier">Op-amp book</a> be so wrong about the quadrature oscillator circuit?</p>

<p>The nice thing about op-amps in DIP-8 packages, is that most of them use the same pinout, so it&#8217;s very easy to swap them out and test different brands and types. The TLV2472 only supports up to 6V as power supply, most of the other ones go much higher &#8211; usually above 30V, i.e. ±15V.</p>

<p>Here&#8217;s the list of op-amp chips I tried (yeah, got quite a bunch of them in my lab, for various reasons):</p>

<ul>
<li>TLV2474</li>
<li>LM358N</li>
<li>LM833N</li>
<li>NE5532ANG</li>
<li>OP2340</li>
<li>NJM14558D</li>
<li>MCP6023</li>
<li>LT1413</li>
</ul>

<p>All of them had similar behavior, i.e. clipping at both limits of the voltage range, except for the LT1413:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR56.png" alt="SCR56" title="SCR56.PNG" border="0" width="604" height="478" /></p>

<p>Still nowhere near a sine wave, BTW. But what&#8217;s more interesting, is the the voltage swing of this signal was just 4.5 Vpp, while the op-amp was being driven from a ±15V power supply in this particular case. So for <em>some</em> reason, it was &#8220;oscillating&#8221; at 1.25 KHz (about 8x higher than the other mode).</p>

<p>I have no idea what was going on. When trying to reproduce this a second time, I couldn&#8217;t get this behavior back. I suspect a loose connection, or perhaps some odd interaction due to the breadboard.</p>

<p>I&#8217;m not really interested in tracking down this issue, since it looks like this quadrature oscillator circuit is not suitable for a Component Tester &#8211; not without some sort of amplitude regulation anyway.</p>

<p><em>So there you have it &#8211; analog circuits also need to be debugged, as you can see!</em></p>

<p><strong>Update</strong> &#8211; this issue has now been resolved, see the comments on yesterday&#8217;s weblog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/19/generating-a-sine-wave-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Generating a sine wave</title>
		<link>http://jeelabs.org/2012/05/18/generating-a-sine-wave/</link>
		<comments>http://jeelabs.org/2012/05/18/generating-a-sine-wave/#comments</comments>
		<pubDate>Thu, 17 May 2012 22:01:50 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Analog]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19102</guid>
		<description><![CDATA[After the recent pretty disappointing results with a transformer-based Component Tester, I&#8217;d like to try and generate a ± 10 V sine wave at approximately 50 Hz in some other way. Using as few components as possible. This is where we enter, eh, squarely into the analog electronics domain. Yes, we could generate it with [...]]]></description>
			<content:encoded><![CDATA[<p>After the <a href="http://jeelabs.org/2012/04/25/component-tester-revisited/">recent</a> pretty disappointing results with a transformer-based <a href="http://jeelabs.org/2012/02/01/component-tester-part-2/">Component Tester</a>, I&#8217;d like to try and generate a ± 10 V sine wave at approximately 50 Hz in some <em>other</em> way. Using as few components as possible.</p>

<p>This is where we enter, eh, <em>squarely</em> into the analog electronics domain. Yes, we <em>could</em> generate it with an ATmega, but frankly that sounds like a bit of overkill, would require a fair amount of filtering to remove residual switching effects, and besides we&#8217;d still have to amplify it up to 10 Vpp.</p>

<p><em>Time to introduce some new circuitry!</em></p>

<p>One of the most incredible electronic building blocks invented in the second world-war era was the <a href="http://en.wikipedia.org/wiki/Operational_amplifier">Operational Amplifier</a>, or &#8220;op-amp&#8221; in short.</p>

<p>There&#8217;s <em>way</em> too much to say about this amazingly universal circuit, which even has its own schematic symbol:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/180px-Op-amp_symbol.svg_.png" alt="180px Op amp symbol svg" title="180px-Op-amp_symbol.svg.png" border="0" width="180" height="153" /></p>

<p>A positive and negative power supply pin, a positive and a negative input, and an output pin. That&#8217;s it.</p>

<p>I&#8217;ve only just started exploring op-amps, really &#8211; one superb resource on the web comes in the form of a free <a href="http://www.ti.com/lit/an/slod006b/slod006b.pdf">eBook</a> from 2002 on the Texas Instruments site, titled &#8220;Op Amps For Everyone&#8221;, by Ron Mancini.</p>

<p>In his chapter on Sine Wave Oscillator, he mentions a &#8220;Quadrature Oscillator&#8221; built from two op-amps:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/Screen-Shot-2012-04-18-at-01.08.17.png" alt="Screen Shot 2012 04 18 at 01 08 17" title="Screen Shot 2012-04-18 at 01.08.17.png" border="0" width="519" height="275" /></p>

<p>It uses very few components. This one was dimensioned for about 1.6 KHz, so I started with capacitors ten times as large, i.e. 0.1 µF, to lower the oscillation frequency. Here&#8217;s the result, using a TLV2472 dual op-amp:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/DSC_3056.jpg" alt="DSC 3056" title="DSC_3056.jpg" border="0" width="604" height="474" /></p>

<p>Powered by a supply of ±2.5V (i.e. 0 / 2.5V / 5V), I see this result on the scope, when attached to the sine output:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR53.png" alt="SCR53" title="SCR53.PNG" border="0" width="604" height="478" /></p>

<p>Yeah, right. Clipping like crazy, i.e. overshooting into the limiting 0V and 5V power lines. The FFT shows it&#8217;s not anywhere <em>near</em> a pure sine wave, even though the shape <em>vaguely</em> resembles one:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR54.png" alt="SCR54" title="SCR54.PNG" border="0" width="604" height="468" /></p>

<p>A pure sine wave would have a single peak at the oscillating frequency.</p>

<p>Here&#8217;s the cosine output, again showing that it&#8217;s running <em>way</em> outside its linear range:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR52.png" alt="SCR52" title="SCR52.PNG" border="0" width="604" height="478" /></p>

<p>So yeah, we&#8217;re generating a 160 Hz signal, but it&#8217;s no sine wave and it would be useless as Component Tester.</p>

<p><em>Oh well, it was still an interesting first trial!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/18/generating-a-sine-wave/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>TK &#8211; Frequency accuracy</title>
		<link>http://jeelabs.org/2012/05/17/tk-frequency-accuracy/</link>
		<comments>http://jeelabs.org/2012/05/17/tk-frequency-accuracy/#comments</comments>
		<pubDate>Wed, 16 May 2012 22:01:13 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Analog]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19350</guid>
		<description><![CDATA[Welcome to the Thursday Toolkit series, about tools for building Physical Computing projects. (this is again a bit of a side excursion, about checking the quality of a measuring instrument) I recently visited a friend who had to get his frequency meter&#8217;s calibration verified to a fairly high precision. Thinking of the Rubidium clock I [...]]]></description>
			<content:encoded><![CDATA[<p><em>Welcome to the <a href="http://jeelabs.org/tag/toolkit/">Thursday Toolkit</a> series, about tools for building Physical Computing projects.</em></p>

<blockquote>
  <p>(this is again a bit of a side excursion, about checking the quality of a measuring instrument)</p>
</blockquote>

<p>I recently visited a friend who had to get his frequency meter&#8217;s calibration verified to a fairly high precision. Thinking of the <a href="http://jeelabs.org/2012/03/11/rubidium-clock-part-2/">Rubidium clock</a> I got from eBay, he came up with the idea of using a <em>transfer standard</em>.</p>

<p>The thing with accuracy, is that you have to have an <em>absolute</em> reference to compare against. One option is to go to a &#8220;calibration lab&#8221; and have them test, adjust, and certify that your instrument has a certain accuracy. Awkward, expensive, and usually a bit over the top for &#8220;simple&#8221; hobby uses.</p>

<p>So the other way to do things, is to &#8220;transfer&#8221; the calibration in some way. Buy or build a device which can <em>keep</em> the desired property stable, calibrate it to some standard, move it to where the instrument needing calibration is located, and compare the two. Or vice versa: match to instrument, then compare with a standard.</p>

<p>The latter is exactly what we ended up doing. First we created a little Arduino daughter board with a &#8220;VC-TCXO&#8221; on it: that&#8217;s a &#8220;Temperature Compensated Xtal Oscillator&#8221; which can be fine-tuned through a voltage. Here&#8217;s the setup, created and built by Rohan Judd:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/DSC_3082.jpg" alt="DSC 3082" title="DSC_3082.jpg" border="0" width="604" height="403" /></p>

<p>On the left, an SPI-controlled digital potmeter, on the right a VC-TCXO running at 10 MHz.</p>

<p>Via a sketch, the VC-TCXO was fine-tuned to produce <em>exactly</em> 10.000,000 MHz readout on the frequency counter we wanted to verify. This was done at about 18°C, but a quick test showed that this VC-TCXO was indeed accurately keeping its frequency, even when cooled down by more than 10°C.</p>

<p>I took this device back home with me, and set up my frequency generator to use the Rubidium clock as reference. So now I had two devices on my workbench at JeeLabs, both claiming to run at 10 MHz &#8230;</p>

<p><em>Evidently, they are bound to differ to some degree &#8211; the question was simply: by how much?</em></p>

<p>Remember <a href="http://jeelabs.org/2012/03/26/lissajous-is-tea-for-two/">Lissajous</a>? By hooking up both signals to the oscilloscope, you can compare them in X-Y mode:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/SCR26.png" alt="SCR26" title="SCR26.PNG" border="0" width="592" height="440" /></p>

<p>Channel 1 (yellow) is the VC-TCXO signal, some sort of odd square wave &#8211; I didn&#8217;t pay any attention to proper HF wiring. Channel 2 (blue) is the sine wave generated by the frequency generator.</p>

<p>The resulting image is a bit messy, but the <em>key</em> is that when both frequencies match up exactly, then that image will stay the same. If they differ, then it will appear to rotate in 3D. It&#8217;s very easy to observe.</p>

<p>The last trick needed to make this work is simply to <em>adjust</em> the frequency generator until the image does indeed stop rotating. This is extra-ordinarily sensitive &#8211; the hard part is actually first finding the approximate setting!</p>

<p>After a bit of searching and tweaking, and after having let everything warm up for over an hour, I got this:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/04/DSC_3080.jpg" alt="DSC 3080" title="DSC_3080.jpg" border="0" width="604" height="348" /></p>

<p>IOW, the frequency I <em>transferred</em> back to JeeLabs with me was 9.999,999,963 MHz. We&#8217;re done!</p>

<p>To put it all into perspective: that highlighted digit is 0.1 ppb (billion!). So the frequency counter appears to be 3.7 ppb slow. Assuming that the transfer standard did not lose accuracy during the trip, and that my Rubidium clock is 100% accurate. Which it isn&#8217;t of course, but since its frequency is based on atomic resonance properties, I&#8217;m pretty confident that it&#8217;s indeed accurate to more than 0.1 ppb.</p>

<p><em>The real story here, though, is that such breath-taking accuracy is now within reach of any hobbyist!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/17/tk-frequency-accuracy/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>First solar results</title>
		<link>http://jeelabs.org/2012/05/16/first-solar-results/</link>
		<comments>http://jeelabs.org/2012/05/16/first-solar-results/#comments</comments>
		<pubDate>Tue, 15 May 2012 22:01:28 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[AVR]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Solar]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19610</guid>
		<description><![CDATA[Some first results from trying to run a JeeNode off a 24 x 32 mm indoor solar cell&#8230; In each of the cases described below, I&#8217;m using a JeeNode without regulator and with 100 µF cap hooked up, with fuses and settings as described in this post. The cap should have enough energy to cushion [...]]]></description>
			<content:encoded><![CDATA[<p>Some first results from trying to run a JeeNode off a 24 x 32 mm indoor solar cell&#8230;</p>

<p>In each of the cases described below, I&#8217;m using a JeeNode without regulator and with 100 µF cap hooked up, with fuses and settings as described in <a href="http://jeelabs.org/2012/04/30/tiny-lipo-discharge/">this post</a>. The cap should have enough energy to cushion the dip from a small packet transmission. I&#8217;m using the latest <a href="https://github.com/jcw/jeelib/blob/master/examples/RF12/radioBlip2/radioBlip2.ino">radioBlip2</a> sketch, which now sends out the following 7-byte payload:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/Screen-Shot-2012-05-14-at-13.33.17.png" alt="Screen Shot 2012 05 14 at 13 33 17" title="Screen Shot 2012-05-14 at 13.33.17.png" border="0" width="392" height="87" /></p>

<p>The benefit of this version, is that the sketch reports not just the battery level but also how far the battery level drops <em>after</em> sending out a packet once a minute. That value is sent out in the <em>next</em> packet, so it always lags.</p>

<p>To get started, I connect the JeeNode to a BUB, which charges the 100 µF cap to 5V (and runs the RFM12B slightly above spec). Then I disconnect and hook it up to the solar setup. This way I don&#8217;t have to deal with startup problems yet &#8211; which is an entirely different (and tricky) problem.</p>

<p>Yesterday&#8217;s <a href="http://jeelabs.org/2012/05/15/new-solar-setup/">elaborate setup</a> didn&#8217;t get very far, unfortunately. Two different runs gave me just a few packets:</p>

<pre><code>    L 09:16:01.571 usb-A600dVPp OK 17 1 0 0 0 1 209 0
    L 09:18:07.445 usb-A600dVPp OK 17 3 0 0 0 1 86 51
    L 09:19:10.308 usb-A600dVPp OK 17 4 0 0 0 1 86 50

    L 09:24:12.477 usb-A600dVPp OK 17 1 0 0 0 1 206 0
    L 09:25:15.707 usb-A600dVPp OK 17 2 0 0 0 1 86 210
</code></pre>

<p>Values are 20 mV steps, offset by 1V &#8211; the actual battery voltage is: <strong>1 + 0.02 * X</strong> (where X is the reported value).</p>

<p>In the above runs, the battery is 86 (2.72V) before sending, and 50 (2.00V) after. That&#8217;s pretty close to the edge, I&#8217;m not sure why the drop is so large.</p>

<p>Another test with a <a href="http://jeelabs.org/2012/05/09/not-long-enough/">0.47 Farad supercap</a>, charged for about 3 days to get the charge &#8220;deep&#8221; into the supercap, seems to fare a little better:</p>

<pre><code>    L 09:43:06.943 usb-A600dVPp OK 17 19 0 0 0 1 210 52
    L 09:44:10.771 usb-A600dVPp OK 17 20 0 0 0 1 175 210
    L 09:45:14.549 usb-A600dVPp OK 17 21 0 0 0 1 175 146
    L 09:46:18.339 usb-A600dVPp OK 17 22 0 0 0 1 175 147
    L 09:47:22.100 usb-A600dVPp OK 17 23 0 0 0 1 175 147
    ...
</code></pre>

<p>That&#8217;s 4.50V and 3.94V before and after transmission, respectively. But a 0.47F supercap has a lot less energy in it than that 3.4 mAh Lithium cell used in the first tests above, so it&#8217;ll probably run down a lot faster.</p>

<p>After one hour, voltages drop to 4.28V and 3.72V.
Two hours: 4.14V and 3.60V. Five hours: 3.92V and 3.36V. I&#8217;m not sure this will work, unless the node sends less at night perhaps or always restarts reliably the next day.</p>

<p><em>To be continued&#8230;</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/16/first-solar-results/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New solar setup</title>
		<link>http://jeelabs.org/2012/05/15/new-solar-setup/</link>
		<comments>http://jeelabs.org/2012/05/15/new-solar-setup/#comments</comments>
		<pubDate>Mon, 14 May 2012 22:01:08 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[LowPower]]></category>
		<category><![CDATA[Solar]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19500</guid>
		<description><![CDATA[Time for another experiment, this time combining my small solar panel with the 3.4 mAh Lithium battery which seems to work so well. The circuit I&#8217;m going to try is as follows: Here&#8217;s the construction, cozily attached to the back of the solar cell: Same solar cell, I think it can supply up to 4.5V [...]]]></description>
			<content:encoded><![CDATA[<p>Time for another experiment, this time combining my small <a href="http://jeelabs.org/2012/05/09/not-long-enough/">solar panel</a> with the 3.4 mAh <a href="http://jeelabs.org/2012/05/02/tiny-lithium-packet-test/">Lithium battery</a> which seems to work so well. The circuit I&#8217;m going to try is as follows:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/JCs-Grid-page-16.png" alt="JC s Grid page 16" title="JC's Grid, page 16.png" border="0" width="548" height="230" /></p>

<p>Here&#8217;s the construction, cozily attached to the back of the solar cell:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_31281.jpg" alt="DSC 3128" title="DSC_3128.jpg" border="0" width="604" height="440" /></p>

<p>Same solar cell, I think it can supply up to 4.5V @ 1 mA in full sunlight.</p>

<p>The tricky bit is that the rechargable lithium cell needs to be treated with care. For maximum life, it needs to be hooked up to a voltage source between 2.8V and 3.2V, and the charge current has to be limited.</p>

<p>Note that the 1 kΩ resistor is put in series with the battery not only to charge it, but also when taking charge <em>out</em> of it. Seems odd, but that&#8217;s the way the datasheet and examples show it. Then again, with a 10 µA current draw the voltage drop and losses are only about 10 mV. A diode bypass could be added later, if necessary.</p>

<p>The diode after the regulator has the nice effect of dropping the 3.3V output to an appropriate value, as well as blocking all reverse current flow. There is no further circuitry for the regulator, since I don&#8217;t really care what it does when there is too much or too little power coming from the solar cell. Let&#8217;s assume it&#8217;s stable without caps.</p>

<p>It all looks a bit wasteful, i.e. linearly regulating the incoming voltage straight down to 3.3V regardless of PV output levels and discarding the excess. But given that this little 3V @ 3.4 mAH battery has already supported a few days of running time when fully charged, maybe it&#8217;s still ok.</p>

<p>I&#8217;ll let this charge for a day or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/15/new-solar-setup/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Forward voltage drop on a diode</title>
		<link>http://jeelabs.org/2012/05/14/forward-voltage-drop-on-a-diode/</link>
		<comments>http://jeelabs.org/2012/05/14/forward-voltage-drop-on-a-diode/#comments</comments>
		<pubDate>Sun, 13 May 2012 22:01:51 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Solar]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19491</guid>
		<description><![CDATA[With all this tinkering with solar panels, little batteries, supercaps, etc, you often need to prevent current from leaking away. The usual approach is to insert a diode into the circuit. Diodes conduct current in one direction and block the current in the opposite direction. Well, that&#8217;s the theory anaway. In real life, diodes only [...]]]></description>
			<content:encoded><![CDATA[<p>With all this tinkering with solar panels, little batteries, supercaps, etc, you often need to prevent current from leaking away. The usual approach is to insert a <a href="http://en.wikipedia.org/wiki/Diode">diode</a> into the circuit.</p>

<p>Diodes <em>conduct</em> current in one direction and <em>block</em> the current in the opposite direction.</p>

<p>Well, that&#8217;s the theory anaway. In real life, diodes only conduct current once the voltage is above a certain level, and they tend to leak minute amounts of current when blocking the reverse voltage.</p>

<p>For ultra-low power use and the low voltage levels involved, you need to be careful about the type of diode used. A regular 1N4148 silicon diode has a <em>forward drop</em> of about 0.65V, quite a bit when supplies are 2..3V!</p>

<p>The <a href="http://en.wikipedia.org/wiki/Schottky_diode">Schottky diode</a> has a much lower voltage drop. It&#8217;s usually specified as 0.3..0.4V, but it really depends on the amount of current passed through it.</p>

<p>To see the properties of the BAT43 Schottky diode I&#8217;ve been using, I created this simple test setup:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/JCs-Grid-page-18.png" alt="JC s Grid page 18" title="JC's Grid, page 18.png" border="0" width="368" height="248" /></p>

<p>A 10 Hz &#8220;sawtooth&#8221; voltage is used to create a signal rising from -3V to +3V in a linear fashion, 10 times a second. This means that the current through the 100 kΩ resistor will go from -30 µA to +30 µA. We can then watch the voltage over the diode, and how it goes from a blocking to a conducting state:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR45.png" alt="SCR45" title="SCR45.PNG" border="0" width="604" height="442" /></p>

<p>The yellow trace is the sawtooth signal applied to the circuit. The blue trace is the voltage over the diode. Note the difference in vertical scale.</p>

<p>You can see that with negative voltages, the diode just blocks. As it should.
With positive voltages up to 1.2V, i.e. a current up to 12 µA, the voltage drop over the diode is under 0.15V, rising slowly to about 0.175V at 30 µA.</p>

<p>Changing the resistor to 10 kΩ to increase the current by a factor of 10, we get this:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR49.png" alt="SCR49" title="SCR49.PNG" border="0" width="604" height="442" /></p>

<p>Same picture, different scale. At 300 µA, the voltage drop is now about 0.23V, and it&#8217;s fairly flat at that point.</p>

<p>For comparison, here&#8217;s a run-off-the-mill 1N4148 &#8220;standard&#8221; silicon diode:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/SCR50.png" alt="SCR50" title="SCR50.PNG" border="0" width="604" height="442" /></p>

<p>Again: different vertical scale. About 0.53V at 300 µA. More importantly, it&#8217;s already 0.4V at 60 µA.</p>

<p><em>So when losses matter at low voltages and low currents, it&#8217;s better to use Schottky diodes.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/14/forward-voltage-drop-on-a-diode/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Watching it go down</title>
		<link>http://jeelabs.org/2012/05/13/watching-it-go-down/</link>
		<comments>http://jeelabs.org/2012/05/13/watching-it-go-down/#comments</comments>
		<pubDate>Sat, 12 May 2012 22:01:25 +0000</pubDate>
		<dc:creator>jcw</dc:creator>
				<category><![CDATA[AVR]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[LowPower]]></category>

		<guid isPermaLink="false">http://jeelabs.org/?p=19477</guid>
		<description><![CDATA[Now that there&#8217;s low-power vccRead() code to measure the current power supply voltage, we can finally get a bit more valuable info from the radioBlip sketch, which sends out one packet per minute. So here&#8217;s a new radioBlip2 sketch which combines both functions. To support more test nodes, I&#8217;m adding a byte to the payload [...]]]></description>
			<content:encoded><![CDATA[<p>Now that there&#8217;s low-power <a href="https://github.com/jcw/jeelib/blob/master/examples/Ports/bandgap/bandgap.ino">vccRead()</a> code to measure the current power supply voltage, we can finally get a bit more valuable info from the <a href="https://github.com/jcw/jeelib/blob/master/examples/RF12/radioBlip/radioBlip.ino">radioBlip</a> sketch, which sends out one packet per minute.</p>

<p>So here&#8217;s a new <a href="https://github.com/jcw/jeelib/blob/master/examples/RF12/radioBlip2/radioBlip2.ino">radioBlip2</a> sketch which combines both functions. To support more test nodes, I&#8217;m adding a byte to the payload for a unique node ID, as well as a byte with the measured voltage level:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/Screen-Shot-2012-05-09-at-18.28.02.png" alt="Screen Shot 2012 05 09 at 18 28 02" title="Screen Shot 2012-05-09 at 18.28.02.png" border="0" width="104" height="72" /></p>

<p>As a quick test I used a JeeNode without regulator, running off an electrolytic 1000 µF cap, charged to 5V via a USB BUB, and then disconnected (this is running the RFM12B module beyond its 3.8V max specs, BTW):</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/DSC_3127.jpg" alt="DSC 3127" title="DSC_3127.jpg" border="0" width="604" height="272" /></p>

<p>Here&#8217;s a dump of the received packets:</p>

<pre><code>    L 16:56:32.032 usb-A600dVPp OK 17 1 0 0 0 1 209
    L 16:57:35.859 usb-A600dVPp OK 17 2 0 0 0 1 181
    L 16:58:39.543 usb-A600dVPp OK 17 3 0 0 0 1 155
    L 16:59:43.029 usb-A600dVPp OK 17 4 0 0 0 1 134
    L 17:00:46.323 usb-A600dVPp OK 17 5 0 0 0 1 115
    L 17:01:49.431 usb-A600dVPp OK 17 6 0 0 0 1 98
    L 17:02:52.314 usb-A600dVPp OK 17 7 0 0 0 1 82
    L 17:03:55.016 usb-A600dVPp OK 17 8 0 0 0 1 66
    L 17:04:57.526 usb-A600dVPp OK 17 9 0 0 0 1 50
</code></pre>

<p>Or, more graphically, as voltage &#8211; showing 8 minutes before the sketch runs out of juice:</p>

<p><img src="http://jeelabs.org/wp-content/uploads/2012/05/Screen-Shot-2012-05-09-at-19.06.19.png" alt="Screen Shot 2012 05 09 at 19 06 19" title="Screen Shot 2012-05-09 at 19.06.19.png" border="0" width="420" height="192" /></p>

<p>This consumes only marginally more power than without the VCC measurements:  the original radioBlip sketch lasted 1 minute longer under similar conditions, i.e. one extra packet transmission.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeelabs.org/2012/05/13/watching-it-go-down/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.627 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-23 09:46:48 -->

