<?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>Keith&#039;s Electronics Blog &#187; Circuits</title>
	<atom:link href="http://www.neufeld.newton.ks.us/electronics/?cat=6&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.neufeld.newton.ks.us/electronics</link>
	<description></description>
	<lastBuildDate>Fri, 18 Apr 2025 00:10:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>BatchPCB</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1505</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1505#comments</comments>
		<pubDate>Mon, 18 Jun 2012 03:36:56 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[EAGLE]]></category>
		<category><![CDATA[Products]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1505</guid>
		<description><![CDATA[My academic background is in mathematics and computer science and I&#8217;ve picked up electronics as a hobby along the way, primarily self-taught through excellent books by Forrest Mims, the easy crossovers from math and CS to digital logic and digital design (still my strongest area of electronics), a stubborn willingness to read datasheets, and a [...]]]></description>
			<content:encoded><![CDATA[<p>My academic background is in mathematics and computer science and I&#8217;ve picked up electronics as a hobby along the way, primarily self-taught through excellent books by Forrest Mims, the easy crossovers from math and CS to digital logic and digital design (still my strongest area of electronics), a stubborn willingness to read datasheets, and a constant desire to learn.</p>
<p>For the last two years, I&#8217;ve been supplementing that with a formal background from my university&#8217;s EE department, taking first one and recently two classes per semester.  The education is interesting and enlightening, but it does take its toll &#8212; at least forty hours a week of work, six hours of classes, and (say) twenty hours of study and homework, plus some volunteer work unrelated to those, doesn&#8217;t leave me with a lot of free time; and you can see it by the decline in my hobby activity.</p>
<p>I don&#8217;t want to lose sight of what I love, though; and I hope to make a small business of electronics and make a few products available for sale.  So this summer I&#8217;m devoting every spare moment to get some projects off the ground.  And my ally in that plan is <a href="http://batchpcb.com/index.php/AboutUs">BatchPCB</a>.</p>
<h3>Why Have Boards Manufactured?</h3>
<p>In the past, I&#8217;ve done a lot of circuit prototyping on breadboards.  For some types of circuits, though, the needed prototyping has more to do with physical form factor and less to do with circuit validation.  (I hope to show some examples in the coming weeks.)  I&#8217;ve etched my own circuit boards; I&#8217;ve imposed on friends to mill prototype boards for me; and I&#8217;ve hoped to build my own milling machine to prototype my own boards at home.</p>
<p>The drawback of all of these methods is the lack of plated through-holes.  I&#8217;ve heard of DIY hole-plating methods, but I found them to require a prohibitive setup for chemical processing.  I&#8217;ve asked everyone I know whether they can think of any source for 1.5-ish mm (60 mil) OD copper or silver tubing, thinking of making a small riveting press to flare tubing onto the PCB surface both top and bottom &#8212; and even found very small silver crimp tubes used in beadwork and jewely-making, but none as small as 1.5 mm OD, nor in a consistently appropriate length.</p>
<p>I&#8217;ve worked around the lack of plated through holes by laying out boards that don&#8217;t require them, always carrying a signal from top to bottom using a component lead that can be soldered on both sides.  But this means no vias (soldering pins top and bottom just to change layers is a pain) and only crossing layers at resistors and diodes.  It means always routing connections to electrolytic capacitors on the bottom, &#8217;cause you can&#8217;t get to the top side of the board to solder unless you stand the capacitors way up on their leads.  It means routing traces to headers only on the bottom, or sliding the plastic guide up on the pins to solder the top side and then sliding it back down.  It means a dozen little design compromises <em>for a prototype board</em> that don&#8217;t need to be made for a board I&#8217;m going to have commercially manufactured later.  It means not only extra effort to accommodate my prototyping methods but also extra effort to undo that work before going to manufacturing.</p>
<p>SparkFun Electronics created BatchPCB as an offshoot of their own PCB prototyping contract.  They aggregate orders from multiple users, tile them together onto standard-sized panels, upload the panels to Gold Phoenix, get the boards manufactured, receive the shipment from Gold Phoenix, sort out the boards, and send them back.  They charge $2.50 per square inch, which is higher than you&#8217;d pay if you were ordering 100 square inches &#8212; but far less than you can pay anywhere else if you only want a few square inches of prototype.  And they charge a flat $10 handling fee <em>per order</em>, regardless of how many designs you include in your order.</p>
<p>They suggest it&#8217;ll take about three weeks to get your order.  My experience has been two weeks.  It sounds like a long wait, but as they say:</p>
<blockquote><p>As we develop projects, we always get at least one PCB design onto the week&#8217;s batch panel. While one design is being fabbed, we have new PCBs for another design already arriving from a previous batch &#8211; we always have new PCBs to play with!</p></blockquote>
<h3>My Summer with BatchPCB</h3>
<p>I&#8217;m trying to place an order every two weeks and to order boards for multiple projects each time.  I&#8217;ve received two batches so far and I submitted a third this weekend.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2012/06/17/DSCN8886.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2012/06/17/DSCN8886_mid.jpg" alt="Circuit boards from BatchPCB" /></a></p>
<p>I&#8217;ll say more about these designs as I work on the projects, but starting at the top and progressing in reading order:</p>
<ul>
<li>Logic gate boards to help bridge the huge gap between what happens in the digital design lecture and lab.  My classmates with no prior experience did not gain much academic value from poking opaque ICs into breadboards.</li>
<li>A Freeduino-derived board for my personal use, manufactured as a proof-of-concept that I have the right components and schematic to embed an Arduino-compatible core into projects of my own.  (I will of course publish all source files for designs that I distribute to anyone other than myself.)</li>
<li>The first half of a pair of boards to breakout a headphone cable and jack for breadboarding, to plug an iPod&#8217;s headphone output into op-amp filter circuits and listen to the results.</li>
<li>A board for testing component lead fit against through-hole sizes.  To date, I&#8217;ve used calipers for measuring lead sizes for PCB design.  I&#8217;m curious whether testing against a physical board gives me any different expenditure of time or quality of results.</li>
</ul>
<p>The logic gate boards were my first batch.  I ordered four each of two variants of the boards, assembled a few, and discovered that I don&#8217;t like soldering 0603 SMT as much as I thought I did; so if I make more, I&#8217;ll be changing the boards to use 0805 components.</p>
<p><strong>Lesson learned:  Order only one of your first prototype, regardless of how sure you <em>think</em> you are that you&#8217;ve finalized the design.</strong></p>
<p>So why so many of the other boards?  I <em>did</em> order only one of each &hellip; but SparkFun, bless their hearts, appears to fill wasted space in each panel with small customer boards that they give back to their customers as a bonus; and I happened to have small designs in this batch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1505</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Solar Charging and Switching Circuit for Outdoor Sculpture Installation</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1365</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1365#comments</comments>
		<pubDate>Sun, 29 May 2011 19:28:46 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[Inside]]></category>
		<category><![CDATA[TechArt]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1365</guid>
		<description><![CDATA[Over the winter, my friend Steve Atwood got a commission for a sculpture to be installed in the Wichita Falls, TX Kemp Center for the Arts &#8220;Art on the Green&#8221; sculpture garden from May 2011 &#8211; 2012. He had in mind to continue a series of his sculptures based on the form of a fishing [...]]]></description>
			<content:encoded><![CDATA[<p>Over the winter, my friend <a href="http://www.atwoodstudio.com/">Steve Atwood</a> got a commission for a sculpture to be installed in the Wichita Falls, TX <a href="http://www.kempcenter.org/SculptureGarden.php">Kemp Center for the Arts &#8220;Art on the Green&#8221; sculpture garden</a> from May 2011 &#8211; 2012.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/255032_2017478126138_1519426531_32194551_489004_n.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/255032_2017478126138_1519426531_32194551_489004_n_mid.jpg" alt="Lure 22 V2.0 by Stephen Atwood at Kemp Center for the Arts, Wichita Falls, TX" /></a></p>
<p>He had in mind to continue a series of his sculptures based on the form of a fishing lure but wanted to enhance this sculpture with one or more LEDs, preferably that would come on only at night.  We discussed a wide variety of options that we hope to develop for another installation in the future; but in the end, in the interest of time for this project, Steve found control modules that flash up to five LEDs at random and installed them behind a set of cones protruding from a recessed panel.</p>
<p>He asked how to make the LEDs turn on at night and also wondered whether he could power them for a year from a primary battery or whether he should use rechargeables.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/255487_2017475646076_1519426531_32194549_3873647_n.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/255487_2017475646076_1519426531_32194549_3873647_n_mid.jpg" alt="Lure 22 V2.0 by Stephen Atwood at Kemp Center for the Arts, Wichita Falls, TX" /></a></p>
<p>About seven years ago, I had come into possession of some discarded solar yard lights, and out of curiosity had reverse-engineered their charging and control circuits.  Since yard lights accomplish both functions &#8212; charging and switching &#8212; I figured the circuit would be perfect for the sculpture.  I was able to find one and instruct Steve how to modify it for his needs.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/solar-yard-light-sch.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/solar-yard-light-sch.png" alt="Solar yard light schematic" /></a></p>
<p>The circuit is very simple and I find it rather elegant.  During the day, the solar panel assembly (left &#8212; for want of a proper schematic symbol, I just drew another battery) charges two AA cells through a diode that prevents the battery from damaging the panel with reverse voltage at night.  Additionally, through the R<sub>1</sub> &#8211; R<sub>2</sub> voltage divider, the solar panel pulls up the base of Q<sub>1</sub>, switching it off and allowing R<sub>3</sub> to pull up the base of Q<sub>2</sub>, switching it off and switching off the load LED<sub>1</sub>.</p>
<p>At night, the panel&#8217;s output approaches 0V and R<sub>2</sub> pulls down Q<sub>1</sub>&#8216;s base, causing Q<sub>1</sub> to conduct and pull down Q<sub>2</sub>&#8216;s base (in a Darlington-like arrangement &#8212; I don&#8217;t know whether it&#8217;s still considered a proper Darlington with R<sub>3</sub> pulling up the Q<sub>1</sub> emitter &#8211; Q<sub>2</sub> base connection), switching on Q<sub>2</sub> and LED<sub>1</sub>.  In fact, depending on the panel&#8217;s exact voltage, the load may switch on even before full darkness, and R<sub>1</sub> &#8211; R<sub>2</sub> can be tweaked to tune the turn-on point.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/solar-module.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/solar-module_mid.jpg" alt="Control board from solar yard light, modified" /></a></p>
<p>Steve removed the LED from the control board and replaced it and the fly wires for the solar panel and battery with screw-terminal connectors for ease of installation inside the sculpture.  He bought a new solar panel with a higher output voltage to charge the higher-voltage battery for the white LEDs he wanted to use (the yellow LEDs in my yard lights didn&#8217;t require as high a forward voltage) and milled a Lexan cover for it to protect the panel from hail, with an O-ring groove to protect it from rain as well.</p>
<p>With higher battery and solar panel voltages, Steve indicated the load was turning on before the ambient light got as dark as he wanted, so I told him how to locate R<sub>1</sub> and replace it with fly wires to a 100K pot.  After the swap, he said he was able to tune it perfectly and he was delighted.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/253079_2017479646176_1519426531_32194552_3162450_n.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/20/253079_2017479646176_1519426531_32194552_3162450_n_mid.jpg" alt="Lure 22 V2.0 by Stephen Atwood at Kemp Center for the Arts, Wichita Falls, TX, night view" /></a></p>
<p>I&#8217;ve not had a chance to visit the sculpture garden and probably won&#8217;t while Lure 22 is installed.  If anyone&#8217;s in the area, I&#8217;d love to hear from you how well it&#8217;s working and how well the electronics hold up over the course of a year outdoors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1365</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modifying a Car USB Adapter to (Finally) Charge My Cell Phone</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1345</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1345#comments</comments>
		<pubDate>Sat, 28 May 2011 14:25:28 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Inside]]></category>
		<category><![CDATA[Repairs]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1345</guid>
		<description><![CDATA[A couple of years ago, I received this automotive USB-connector power adapter as a promotion at a conference. I use it to keep my iPod nano charged in the car, but I&#8217;ve noticed it doesn&#8217;t charge my Blackberry well. To be precise, it doesn&#8217;t charge my Blackberry. In fact, I&#8217;ve never been clear whether it [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago, I received this automotive USB-connector power adapter as a promotion at a conference.  I use it to keep my iPod nano charged in the car, but I&#8217;ve noticed it doesn&#8217;t charge my Blackberry well.  To be precise, it doesn&#8217;t charge my Blackberry.  In fact, I&#8217;ve never been clear whether it even slows the rate of discharge, and sometimes it seems like it speeds it.  The Blackberry shows the lightning bolt charging symbol (The charging symbol is a <em>lightning bolt</em>, srsly? Ben Franklin is personally charging my phone?) but nobody&#8217;s home.</p>
<p>Note that I don&#8217;t blame the vendor whose logo happens to be on it &#8212; I&#8217;m sure they didn&#8217;t manufacture it.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1443.JPG"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1443_mid.jpg" alt="Automotive USB power adapter" /></a></p>
<p>After driving two and a half hours a week ago starting with a half charge on my BlackBerry, plugging it in midway through the trip, and arriving to have the BlackBerry finally shut off its radio due to depleted charge; and due to being in the presence of Cort; I decided it was time to see why the adapter couldn&#8217;t provide enough charge for the BlackBerry.</p>
<h3>Inside the Power Adapter</h3>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/RT34063APS-step-down.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/RT34063APS-step-down_mid.png" alt="Sample step-down circuit using RT34063APS DC-DC converter" /></a></p>
<p><span id="more-1345"></span></p>
<p>After peering and squinting at the control IC, I deciphered the part number RT34063APS and found a datasheet for the DC-DC converter.  It contained no theory of operation but did provide one sample circuit for step-down conversion.  The IC maintains 1.25V across R<sub>1</sub>, so R<sub>2</sub> and R<sub>1</sub> (on this diagram &#8212; different part numbers in the device at hand) program the output voltage by dividing V<sub>OUT</sub>.  The values of 3.6K&Omega; and 1.1K&Omega; should program it for 5V operation.</p>
<p>R<sub>SC</sub> is supposed to program a current limit (SC is &#8220;sense current,&#8221; perhaps?), with the IC maintaining 330mV across V<sub>CC</sub> to V<sub>IPK</sub>.  I&#8217;m not clear on how that limits the current, but I&#8217;ll take their word for it.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1433.JPG"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1433_mid.jpg" alt="Automotive USB power adapter, interior" /></a></p>
<p>Having found the IC datasheet, the next order of business was creating a schematic of my power adapter.  I examined the PCB and positioned all the components in EAGLE, substituting a couple of four-pin connectors for the IC that doesn&#8217;t exist in my library.  After verifying I had captured all the connections, I rearranged the components on the schematic from their positions on the PCB to this more logical placement.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/USB-adapter-sch.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/USB-adapter-sch_mid.png" alt="Schematic of automotive USB power adapter" /></a></p>
<p>While I was working on that, Cort had hooked up the adapter to his bench power supply and fed it 12-13V.  He measured the output and got about 4.64V with no load around the same time I was finding that R<sub>2</sub> = 3.0K&Omega; and R<sub>3</sub> = 1.00K&Omega;, programming the circuit for 5.0V operation.</p>
<p>The issue is that the series diode D2 drops the output voltage by somewhere in the .6V &#8211; .8V range (from the 1N4007 datasheet, in the no-load to 200mA load range); and Cort measured 5.29V &#8211; 5.30V at D2&#8242;s anode.</p>
<p>Grrrrreat!  We&#8217;re calling this a 5V output, but due to the protection diode, feeding the output scarcely over 4.6V, and thinking that devices expecting 5V will charge on it!</p>
<h3>Works Fine with No Output Protection</h3>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1439.JPG"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/15/IMG_1439_mid.jpg" alt="Automotive USB power adapter under load test" /></a></p>
<p>The first thing we did was pull D2 and replace it with a jumper wire.  No D2, no voltage drop.  5.30V output.  Great!</p>
<p>But then my conscience got the better of me.  D2 is obviously there to protect the DC-DC converter from a higher voltage where it&#8217;s expecting a load; and although I don&#8217;t <em>intend</em> to connect such a thing, who knows what may happen.</p>
<h3>Change the Voltage Divider?</h3>
<p/>
<table border=1 cellspacing=0 cellpadding=5 align=center>
<tr>
<th></th>
<th>Original</th>
<th>Change R3</th>
<th>Change R2</th>
<th colspan=3>Change Both</th>
</tr>
<tr>
<td colspan=7></td>
</tr>
<tr>
<td>R2</td>
<td>1000</td>
<td>1000</td>
<td><em>850</em></td>
<td>1200</td>
<td><em>935</em></td>
<td><em>1134</em></td>
</tr>
<tr>
<td>R3</td>
<td>3000</td>
<td><em>3528</em></td>
<td>3000</td>
<td><em>4234</em></td>
<td>3300</td>
<td>4000</td>
</tr>
<tr>
<td colspan=7></td>
</tr>
<tr>
<td>V(REG)</td>
<td>5</td>
<td>5.66</td>
<td>5.66</td>
<td>5.66</td>
<td>5.66</td>
<td>5.66</td>
</tr>
<tr>
<td>V(OUT)</td>
<td>4.34</td>
<td>5</td>
<td>5</td>
<td>5</td>
<td>5</td>
<td>5</td>
</tr>
<tr>
<td colspan=7></td>
</tr>
<tr>
<td>V(D1)</td>
<td>0.66</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<p>My next thought was to change the resistor values to regulate the voltage to 5.66V so the post-diode output would be 5V.  I made a spreadsheet and played around with substitutions for R<sub>2</sub> and R<sub>3</sub> but didn&#8217;t come up with any combination I loved using standard values.</p>
<h3>Diode in voltage regulation circuit</h3>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/27/DSCN8145.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/27/DSCN8145_mid.jpg" alt="Automotive USB power adapter with diode compensation in voltage regulation circuit" /></a></p>
<p>Finally I had a better idea, the one we stuck with.  We inserted a diode (a small-signal diode &#8217;cause it was easier to fit in place) between the regulated voltage and the top of the voltage divider.  It drops .6V &#8211; .7V from the regulated voltage before it gets sampled for the feedback circuit, so the voltage is regulated to about 5.6V &#8211; 5.7V, then D2 takes its .6V &#8211; .7V, and we get about 5.0V &#8211; 5.1V at the output like we oughtta.</p>
<table border=1 cellspacing=0 cellpadding=5 align=center>
<tr>
<th>Configuration</th>
<th>Load (Est)</th>
<th>Voltage</th>
</tr>
<tr>
<td>Internal 1.2K&Omega; drain</td>
<td>4.4mA</td>
<td>5.25V</td>
</tr>
<tr>
<td>560&Omega;</td>
<td>14mA</td>
<td>5.21V</td>
</tr>
<tr>
<td>2x 120&Omega;</td>
<td>90mA</td>
<td>5.13V</td>
</tr>
<tr>
<td>3x 120&Omega;</td>
<td>132mA</td>
<td>5.11V</td>
</tr>
<tr>
<td>5x 120&Omega;</td>
<td>216mA</td>
<td>5.09V</td>
</tr>
<tr>
<td>6x 120&Omega;</td>
<td>258mA</td>
<td>5.08V</td>
</tr>
<tr>
<td>15&Omega;</td>
<td>342mA</td>
<td>5.07V</td>
</tr>
<tr>
<td>10&Omega;</td>
<td>508mA</td>
<td>5.04V</td>
</tr>
<tr>
<td>8&Omega;</td>
<td>549mA</td>
<td>4.36V</td>
</tr>
</table>
<p>We were curious about the accuracy of its regulation, so Cort grabbed a resistor, hooked it up to the outputs with gator wires, and measured the output voltage.  It was a bit high but the load was very light, so we tried a lower-valued resistor to increase the load.  Then two, then more, and more, and more; and by the time we got to the 8&Omega; sand resistor we were giddy and cackling for no reason I can figure out in retrospect.</p>
<p>Looks like it has pretty good regulation up to about 500mA load, and we haven&#8217;t even monkeyed with R<sub>SC</sub> yet.  That should be plenty good to charge my phone.</p>
<h3>The Trial</h3>
<p>I drove two and a half hours home with my phone plugged in all the way.  I deliberately didn&#8217;t fully charge it the night before, so I started the trip with half a charge and ended with no charge.</p>
<p>You gotta be kidding me.</p>
<h3>USB Power Negotiation</h3>
<p>I&#8217;m familiar with the formal power negotiation a device is supposed to do with a USB hub (using a maximum of 100mA unless it negotiates more), but I also know that most devices can charge from power sources I&#8217;m pretty sure don&#8217;t have full-fledged negotiation in them.  And I started thinking about <a href="http://www.ladyada.net/make/mintyboost/icharge.html">Adafruit&#8217;s great writeup of charging iPhones with a MintyBoost</a>.</p>
<p>The bottom line is that iPhones want the USB data lines strapped to certain voltages to tell them &#8220;I&#8217;m not really USB but I&#8217;ll give you power.&#8221;  Not only that, but in later iPhones, different voltages inform the device of different amounts of current it&#8217;s allowed to draw.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/27/DSCN8150.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/05/27/DSCN8150_mid.jpg" alt="Automotive USB power adapter circuit board, back" /></a></p>
<p>I was back at Cort&#8217;s house Wednesday night and mentioned that I wanted the data lines strapped to 3.3V.  He asked whether I wanted him to fix my power adapter while I finished proofreading my conference presentation for Thursday, and we had a deal.</p>
<p>Looks like he used 10K&Omega; and 15K&Omega; on the 5Vish output to give me 3V on the data lines.  We weren&#8217;t sure whether we needed a separate voltage divider on each data line like the MintyBoost uses, but when we plugged in my Blackberry the current draw (as registered by the power supply) jumped from 72mA to 290mA.</p>
<p>I&#8217;d forgotten my USB charging cable at home so didn&#8217;t get a chance to charge the Blackberry on the return trip, but the huge increased draw on the adapter&#8217;s supply side is a pretty good sign that I&#8217;m really finally charging.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1345</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Monitoring Battery Voltage</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1235</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1235#comments</comments>
		<pubDate>Sat, 12 Feb 2011 16:16:41 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Circuits]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1235</guid>
		<description><![CDATA[Hey, real EE types out there, is there any reason I can&#8217;t monitor 12V battery voltage using a simple voltage divider into an A/D input of a microcontroller that&#8217;s powered by a voltage regulator on that same battery? This seems straightforward, but I ask because there seem to be a lot of fancy circuits and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/12/power-circuit.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/12/power-circuit_mid.png" alt="Battery and voltage regulator schematic" /></a></p>
<p>Hey, real EE types out there, is there any reason I can&#8217;t monitor 12V battery voltage using a simple voltage divider into an A/D input of a microcontroller that&#8217;s powered by a voltage regulator on that same battery?</p>
<p>This seems straightforward, but I ask because there seem to be a lot of fancy circuits and devices out there for monitoring supply voltage.  It seems to me they all revolve around monitoring the device&#8217;s own V<sub>CC</sub> and where to get a reliable A<sub>REF</sub> when you don&#8217;t trust your own supply.</p>
<p>In the case of monitoring a battery voltage that will always be much higher than the dropout of the voltage regulator powering the microcontroller which generates its own A<sub>REF</sub>, I can&#8217;t think of any reason to get fancier than this.</p>
<p>I would Just Do It but I don&#8217;t have a good test setup for this and I&#8217;m getting ready to commit it to a board layout.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1235</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Temperature Deviation Alarm Board for PID Crockpot Controller</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1222</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1222#comments</comments>
		<pubDate>Fri, 11 Feb 2011 23:05:22 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1222</guid>
		<description><![CDATA[After assembling my PID crockpot controller, I successfully cooked a couple of medium KC strips at 60&#176;C. When I tried to cook medium-rare at 55&#176;C, though, I kept finding the temperature at 59&#176;C. Not believing that I&#8217;m destined to eat medium steaks for the rest of my life, I want to fix this. My first [...]]]></description>
			<content:encoded><![CDATA[<p>After assembling my <a href="?p=1199">PID crockpot controller</a>, I successfully cooked a couple of medium KC strips at 60&deg;C.  When I tried to cook medium-rare at 55&deg;C, though, I kept finding the temperature at 59&deg;C.  Not believing that I&#8217;m destined to eat medium steaks for the rest of my life, I want to fix this.</p>
<p>My first guess about what&#8217;s happening is that the crockpot is well-enough insulated that the controller&#8217;s longest delay for how often it turns on the heat is still too short.  If so, I may get better control using the crockpot on its (dumb) low heat setting, which could be activated more frequently without driving the temperature as high.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7713.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7713_mid.jpg" alt="PID crockpot controller with temperature deviation alarm LEDs" /></a></p>
<p>Regardless, if I can&#8217;t trust the controller to control, I need a monitor external to the controller to let me know when the temperature has gone out of range so I know I don&#8217;t yet have a satisfactory system.  Although the immediate problem was overheating, I should also like to know about undertemperature problems as well.  Happily, the controller has temperature deviation alarms; but less happily, they are momentary and only show when the temperature is <em>currently</em> out of range.  Enter the alarm latch.</p>
<p><span id="more-1222"></span></p>
<h3>Alarm Latch Board</h3>
<p>I want to capture when the PID controller alerts that the actual temperature is above or below the target temperature by more than a threshold, and I want to latch the fact that the deviation occurred until I come pay attention to it and reset the alarm in preparation for the next error.</p>
<p>A simple S-R latch suffices for my needs and I had 74*279s in my parts bin.  When a 74*279&#8242;s <span style="text-decoration: overline">S</span> (set) input goes low, the Q output goes high; when the <span style="text-decoration: overline">R</span> (reset) input goes low, the Q output goes low.</p>
<p>An S-R latch produces indeterminate output when both <span style="text-decoration: overline">S</span> and <span style="text-decoration: overline">R</span> are asserted at the same time &#8212; but as this would only happen if I were trying to reset the alarm while the deviant condition was still occurring, I don&#8217;t mind so much.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/temp-alarm-rs-latch.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/temp-alarm-rs-latch_mid.png" alt="SR latch schematic" /></a></p>
<p>The PID controller has three pins for output alarms, labeled as ALM1 and ALM2 (both normally open) and common.  From the sound when an alarm actuates, I believe these are implemented by small electromechanical relays.</p>
<p>In order to pull down the latch&#8217;s <span style="text-decoration: overline">S</span> input when the alarm triggers, I connected the PID controller&#8217;s alarm common pin to ground and put a pull-up resistor on each alarm line.</p>
<p>In order to pull down the latch&#8217;s <span style="text-decoration: overline">R</span> input when I press the reset button, I connected one side to ground and put a pull-up resistor on the reset line.</p>
<p>Milled, tinned, and assembled:</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/DSCN7676.JPG"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/DSCN7676_mid.jpg" alt="PID controller deviation alarm latch board, front side" /></a></p>
<p>The outward-facing side of the board has the components that protrude through the front panel: the LEDs and reset button.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/DSCN7668.JPG"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/01/DSCN7668_mid.jpg" alt="PID controller deviation alarm latch board, back side" /></a></p>
<p>The inward-facing side of the board has everything else.</p>
<p><strong>Lesson learned:  Use bigger pads and smaller holes on milled boards.</strong>  The small trace isolation and lack of soldermask make for <em>very</em> easy solder bridging; and the large, untinned gap between the pad and the component lead sitting inside an unplated hole occasionally makes for very difficult solder bridging.</p>
<p>Because of the bridging problem, I tested for (inappropriate) continuity after soldering every joint &#8212; it&#8217;s much easier to fix problems when I know exactly where the problems must be.</p>
<h3>Rebuilding the Front Panel</h3>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7679.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7679_mid.jpg" alt="PID crockpot controller with new front panel layout (open)" /></a></p>
<p>I tried marking panel drill locations through the PCB&#8217;s holes with a center punch, but I&#8217;m a pretty poor machinist; zoom on the loose panel&#8217;s lower right mounting screw for a glimpse of only one of my many transgressions.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7687.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7687_mid.jpg" alt="PID crockpot controller new front panel layout" /></a></p>
<p>In an attempt to pretend I&#8217;m better than that (or, to reconcile my high standards with my low abilities), I laid out the front panel in OpenOffice Draw, printed it at 1:1 scale, and rubber-cemented it to a new piece of plastic.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7692.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/02/DSCN7692_mid.jpg" alt="Vertical milling plastic control panel" /></a></p>
<p>Rather than cut the PID controller&#8217;s mounting hole by running a knife against a rule (over and over and over and over) like last time, I ran the panel along a fence clamped to my Dremel drill press table in an impromptu vertical milling setup.  (Yes, that is a routing bit.)</p>
<p>I knew that moving the workpiece from right to left would produce the cleanest cut but forgot it would also cause the bit&#8217;s rotation to pull the workpiece away from the fence.  I practiced on a scrap piece (also known as the previous panel) and ended up making a L-R pass to cut and a R-L pass to clean.</p>
<p>I was able to drill my precisely-marked holes quite adequately on the mini drill press.</p>
<p>I <em>so</em> need a CNC mill.</p>
<h3>Controller (Re)assembly</h3>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/06/DSCN7742.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2011/02/06/DSCN7742_mid.jpg" alt="PID crockpot controller interior" /></a></p>
<p>The TTL latch board necessitated the addition of a 5V power supply and the addition of a cutie 5V switcher module from eBay necessitated reorganization of the controller&#8217;s contents.  Everything is now nicely hot-glued down and all the AC wiring is replaced with new 16-gauge.  (I was surprised no one commented on the temporary undersized wiring in my first assembly.)</p>
<p>The PID controller&#8217;s ratcheting collar that&#8217;s supposed to clamp it to the panel is a little too big to fit inside the case, so the controller wasn&#8217;t quite rigid with respect to the panel.  A couple of rubber feet stuck to the interior of the case top and bottom grip it in position quite nicely.</p>
<p>I also bought some thermocouple jacks so I no longer have to screw its connector pins into the old barrier strip every time I use the crockpot.  Need to design and print a nice panel-mount bracket for the jack.</p>
<h3>So?</h3>
<p>Erm.  Yes.  Does it work well.</p>
<h4>Forgot to update inputs</h4>
<p>The schematic shown here is not in fact what I constructed.  Because I still remember when ICs could sink more current than they could source, I&#8217;m in the habit of wiring LEDs between V<sub>CC</sub> and an output rather than between an output and ground, and that&#8217;s how I initially drew this circuit.  Consequently the alarm lines were then connected to the <span style="text-decoration: overline">R</span> inputs so that the alarms would reset the outputs to low, turning on the LEDs.</p>
<p>Then I had the presence of mind to test whether the 74*279&#8242;s outputs were predictably high or low after being powered up and before inputs were applied (the power-up state is not guaranteed); and lo!, they boot low.</p>
<p>How sharper than a serpent&#8217;s tooth would it be to have to press reset every time I powered on the controller, methinks, knowing that I could have wired it so I had not have had to.  So exeunt LEDs to V<sub>CC</sub> and enter LEDs to ground.</p>
<p>Alas, I failed to exeunt omnes and instead left the <span style="text-decoration: overline">S</span> and <span style="text-decoration: overline">R</span> inputs as they were; so now my controller powers up with the LEDs off, I press reset, the LEDs come on, and I curse the fool who laid out the alarm board.</p>
<h4>Actual PID controller alarm capabilities</h4>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/03/DSCN3662.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/03/DSCN3662_mid.jpg" alt="PID controller" /></a></p>
<p>Lo!, were this my only shortcoming, I would praise the day of my good fortune; but some fool also neglected to compare the actual model of PID controller he owned with the capability list in the datasheet &#8212; the list, that is, of which of the controller&#8217;s copious <em>possible</em> capabilities are actually present in the particular controller owned by the fool.</p>
<p>Such as, for example, the presence of (oh, I shudder even to type these words) <em>only one alarm implemented</em> in my controller.</p>
<p>Some fool also failed to <em>test</em> the alarm feature before building an external latching board.  Had he done so, he might have discovered that in spite of the controller being quite clearly labeled as a model with &#8220;Deviation high alarm,&#8221; <em>not</em> &#8220;Deviation high alarm with hold action,&#8221; it appears in practice to have hold action.</p>
<p>That&#8217;s right &#8212; not only are the LEDs on when they should be off; but one of them will never do anything; and the entire latch board is superfluous because the controller&#8217;s onboard LEDs, in spite of the designation on the datasheet, latch.</p>
<p>Sigh.</p>
<p>At least after all this, I can still know &#8212; as planned &#8212; when the temperature climbs above the target.  I am cooking some lukewarm water for dinner right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1222</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Transistor-Based Variable Current Drive for LED Calculator</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=1145</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=1145#comments</comments>
		<pubDate>Mon, 06 Sep 2010 22:20:53 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Circuits]]></category>
		<category><![CDATA[LEDs]]></category>
		<category><![CDATA[Products]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=1145</guid>
		<description><![CDATA[I&#8217;ve put off working on my LED calculator project for far too long, at first trying to find the right handheld case to put it in and then later hoping to be able to manufacture a case myself. I&#8217;m not having any luck with that right now and if I keep waiting I&#8217;ll wait forever; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve put off working on my <a href="?p=248">LED calculator project</a> for far too long, at first trying to find the right handheld case to put it in and then later hoping to be able to manufacture a case myself.  I&#8217;m not having any luck with that right now and if I keep waiting I&#8217;ll wait forever; so I&#8217;m resurrecting the project with the intention of selling it as a kit sans case.</p>
<p>The idea is to expand on a simple LED tester by allowing the user to plug in an LED, dial in the LED brightness, and then read information on an LCD showing the LED voltage drop, the current current, and the value of current-limiting resistor to use in a target circuit.</p>
<p>A microcontroller determines this information by <a href="?p=218">measuring the voltage drop across a series current-sense resistor</a> to calculate the current and <a href="?p=218">measuring the voltage drop across the LED</a> to calculate how much voltage will drop across the current-limiting resistor in the target circuit and what that resistor value should be.</p>
<h3>Variable Resistor Drive</h3>
<p><a href="http://www2.neufeld.newton.ks.us/files/electronics/led-calculator/breadboard-noduino.png"><img src="http://www2.neufeld.newton.ks.us/files/electronics/led-calculator/breadboard-noduino.png" alt="LED calculator drive circuit" /></a></p>
<p>Until now, all of my prototyping has used a variable resistor in series with the LED to set the current.  After subtracting the LED&#8217;s forward voltage drop from the supply voltage, the variable resistor dominates the resistance of the remaining series chain (which includes the current-sense resistor), thereby setting the series current.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/05/DSCN7407.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/05/DSCN7407_mid.jpg" alt="LED calculator prototype with direct potentiometer drive" /></a></p>
<p>This does give control over the LED current and brightness, but the problems with this method are:</p>
<ul>
<li>A small-valued potentiometer doesn&#8217;t provide enough resistance to dial down to low enough LED currents.  For example, a 1K pot with the circuit running on 9V won&#8217;t deliver less than 6mA, depending on the LED color (and voltage drop); and modern, high-efficiency LEDs are surprisingly bright at 6mA.</li>
<li>A large-valued potentiometer has an extremely non-linear current response, with all the &#8220;action&#8221; at the very end of its rotation.</li>
</ul>
<p>Here&#8217;s the response of two different LEDs with a 10K potentiometer:</p>
<table align=center border=1 cellspacing=0 cellpadding=5>
<tr>
<th>Position</th>
<th>Green LED Current</th>
<th>Blue LED Current</th>
</tr>
<tr>
<td>0</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>1</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>2</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>3</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>4</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>5</td>
<td>2mA</td>
<td>2mA</td>
</tr>
<tr>
<td>6</td>
<td>3mA</td>
<td>2mA</td>
</tr>
<tr>
<td>7</td>
<td>4mA</td>
<td>3mA</td>
</tr>
<tr>
<td>8</td>
<td>5mA</td>
<td>6mA</td>
</tr>
<tr>
<td>9</td>
<td>34mA</td>
<td>21mA</td>
</tr>
<tr>
<td>10</td>
<td>100mA</td>
<td>89mA</td>
</tr>
</table>
<p>Very slow response until near the end of the potentiometer&#8217;s rotation, at which point the response is so rapid that it&#8217;s very difficult to control<br />
And of course this makes sense, as it&#8217;s the hyperbolic curve of I = V/R.</p>
<h3>Transistor Drive</h3>
<p>Last week I started looking at improving the range and linearity of the LED current.  I&#8217;m <em>not</em> looking for a perfectly flat response curve nor for a true constant-current drive; I just want a somewhat better response.  What came to mind was this simple PNP transistor circuit &#8212; actually an even simpler version without R1 and R3, but I&#8217;ll explain their purposes in a bit.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/06/drive-circuit.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/06/drive-circuit.png" alt="Transistor LED current control circuit" /></a></p>
<p>The theory is that R2 (or R1 + R2 + R3) acts as a voltage divider across the power supply, linearly setting a drive voltage.  R4 (nearly) linearly turns this voltage into a current sink across the PNP transistor&#8217;s emitter-base junction; and because R4 >> R2, R2 presents a &#8220;stiff&#8221; voltage source to R4, meaning we can largely ignore R4&#8242;s effects on the voltage division.</p>
<p>Thus R2 provides (nearly) linear control of the emitter-base current.  In the common-emitter configuration, the PNP transistor amplifies the current by the transistor&#8217;s &beta; (about 150-200 for a small, general-purpose PNP like the 3906) for a correspondingly higher emitter-collector current</p>
<blockquote><p>
I<sub>EC</sub> = &beta; I<sub>EB</sub>
</p></blockquote>
<p>which goes through the LED and the sense resistor, providing (nearly) linear control of the LED brightness by turning R2.</p>
<p>Well, that&#8217;s the theory, anyway.  This weekend I dug out the prototype and built up the transistor control to test it in practice.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/05/DSCN7412.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2010/09/05/DSCN7412_mid.jpg" alt="LED calculator prototype with transistor current drive" /></a></p>
<p>(70s decor courtesy Radio Shack.)</p>
<p>The first thing I noticed was a section at the CCW end of R2&#8242;s travel in which nothing happened, because R2 wasn&#8217;t providing more than the transistor&#8217;s cut-in voltage &#8212; that is, although V<sub>B</sub> was less than V<sub>E</sub>, it wasn&#8217;t enough less to overcome to emitter-base forward voltage drop and bias the transistor down into the active region.</p>
<p>I tried installing a small-signal diode &#8220;above&#8221; the potentiometer so that V<sub>B</sub> would always be at least .6V below V<sub>E</sub> and eliminate R2&#8242;s dead region, but the diode&#8217;s forward voltage drop was a little too high (it did <em>too</em> good a job) and the resulting minimum LED current was a little higher than I liked.  I settled on adding R3 in that position, selecting 68&Omega; as a value that worked well with both traditional and high-power / high-efficiency LEDs and with both 9V and 7.2V supplies.</p>
<p>With a 9V supply and R3 = 68&Omega;, I tried three different values of the base resistor R4.</p>
<table align=center border=1 cellspacing=0 cellpadding=5>
<tr>
<th rowspan=2>R2 Position</th>
<th colspan=2>R4 = 10k&Omega;</th>
<th colspan=2>R4 = 22k&Omega;</th>
<th colspan=2>R4 = 47k&Omega;</th>
</tr>
<tr>
<th>Green</th>
<th>Blue</th>
<th>Green</th>
<th>Blue</th>
<th>Green</th>
<th>Blue</th>
</tr>
<tr>
<td>7:00</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
</tr>
<tr>
<td>8:00</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
<td>0mA</td>
</tr>
<tr>
<td>9:00</td>
<td>8mA</td>
<td>7mA</td>
<td>3mA</td>
<td>2mA</td>
<td>1mA</td>
<td>1mA</td>
</tr>
<tr>
<td>10:00</td>
<td>30mA</td>
<td>30mA</td>
<td>15mA</td>
<td>13mA</td>
<td>7mA</td>
<td>6mA</td>
</tr>
<tr>
<td>11:00</td>
<td>46mA</td>
<td>42mA</td>
<td>24mA</td>
<td>22mA</td>
<td>13mA</td>
<td>11mA</td>
</tr>
<tr>
<td>12:00</td>
<td>56mA</td>
<td>47mA</td>
<td>34mA</td>
<td>32mA</td>
<td>17mA</td>
<td>17mA</td>
</tr>
<tr>
<td>1:00</td>
<td>60mA</td>
<td>48mA</td>
<td>42mA</td>
<td>40mA</td>
<td>24mA</td>
<td>22mA</td>
</tr>
<tr>
<td>2:00</td>
<td>62mA</td>
<td>49mA</td>
<td>49mA</td>
<td>44mA</td>
<td>29mA</td>
<td>26mA</td>
</tr>
<tr>
<td>3:00</td>
<td>62mA</td>
<td>49mA</td>
<td>53mA</td>
<td>46mA</td>
<td>32mA</td>
<td>30mA</td>
</tr>
<tr>
<td>4:00</td>
<td>63mA</td>
<td>49mA</td>
<td>55mA</td>
<td>47mA</td>
<td>34mA</td>
<td>31mA</td>
</tr>
<tr>
<td>5:00</td>
<td>63mA</td>
<td>49mA</td>
<td>55mA</td>
<td>47mA</td>
<td>34mA</td>
<td>32mA</td>
</tr>
</table>
<p>The table shows a similar effect at the other end of R2&#8242;s travel in which the LED current was pretty well maxed out and not increasing any further.  I think I was hitting the knee between the transistor&#8217;s linear region and saturation, meaning increasing I<sub>EB</sub> was no longer increasing I<sub>EC</sub>.  Experimentation gave me R1 of 200&Omega; keeps the transistor pretty well out of saturation and gives a satisfyingly more-linear response than what I measured here.</p>
<p>The 0mA readings at the beginning of the table, by the way, are a bit deceptive &#8212; some of my test LEDs are actually lit in that region.  I&#8217;ve updated the Arduino code to show tenths of a milliamp when the reading is below 10mA, and I can see LEDs glowing with as little as .1mA.  Probably not a value of interest for most people, but it could be effective for making flickering gas lamps for model railroads.</p>
<h3>Choosing Values</h3>
<p>R4 = 22k&Omega; looks like a pretty good compromise between providing a near-linear response and covering the range of LED currents I expect most people would be interested in testing, so I&#8217;ve tentatively settled on it.</p>
<p>I&#8217;m still fiddling with values to give good performance at both 9V (alkaline battery) and 7.2V (NiMH), because I use rechargeables almost exclusively and want to make this work well on rechargeables to encourage other people to do the same.  The problem is,</p>
<blockquote><p>V<sub>supply</sub> = 7.2V<br />
V<sub>EC</sub> &asymp; .8V<br />
V<sub>blue LED</sub> &asymp; 3.5V</p>
<p>V<sub>R5</sub> = V<sub>supply</sub> &#8211; V<sub>EC</sub> &#8211; V<sub>LED</sub> = 7.2V &#8211; .8V &#8211; 3.5V = 2.9V</p>
<p>I<sub>LED</sub> = I<sub>R5</sub> = V<sub>R5</sub> / R5 = 2.9V / 100&Omega; = 29mA</p></blockquote>
<p>In other words, running on a 7.2V battery, with the transistor saturated, a blue LED with a 3.5V forward drop maxes out at 29mA; and it gets worse with a battery that&#8217;s not straight out of the charger and some white LEDs with a higher forward voltage drop.  I&#8217;d like to enable people to test up to 50mA, to cover high-brightness LEDs, so I&#8217;d like to push this maximum current a little higher.</p>
<p>R5 = 68&Omega; gives I<sub>LED</sub> up to about 42mA, which isn&#8217;t as high as I like; but the tradeoff is that a smaller R5 gives me a smaller voltage range to sample in the A/D converter, hence lower resolution for the display.  68&Omega; seems like a good compromise.  And I&#8217;m already thinking about a DPDT switch to change the resistor and alert the microcontroller about battery chemistry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=1145</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Gold Phoenix for EasyBright PCB Manufacturing</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=620</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=620#comments</comments>
		<pubDate>Tue, 25 May 2010 01:17:02 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[Products]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=620</guid>
		<description><![CDATA[Two and a half weeks ago, I finished up the CAM files for my first set of EasyBright LED driver PC boards and sent them off to have boards made. While shopping around for board houses, I had narrowed my choices to two. Here&#8217;s how I made the final selection of Gold Phoenix &#8212; not, [...]]]></description>
			<content:encoded><![CDATA[<p>Two and a half weeks ago, I <a href="?p=983">finished up the CAM files</a> for my first set of EasyBright LED driver PC boards and sent them off to have boards made.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2010/05/22/DSCN6925.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2010/05/22/DSCN6925_mid.jpg" alt="PC board order from Gold Phoenix" /></a></p>
<p>While shopping around for board houses, I had narrowed my choices to two.  Here&#8217;s how I made the final selection of Gold Phoenix &#8212; not, as it turns out, whom I thought at first I was going to pick.</p>
<p><span id="more-620"></span></p>
<h3>PCB Express</h3>
<p><a href="http://www.pcbexpress.com/">PCB Express</a> was initially my strongest contender.  They offer a range of options, including copper only (no solder mask or silkscreen), two-layer with silkscreen, and four- and six-layer boards.  They also partner with <a href="http://www.screamingcircuits.com/">Screaming Circuits</a> (read their blog for amazingly insightful, real-world ruminations on how to [and not to] design boards for manufacturability) for PCB assembly &#8212; something I don&#8217;t need now but might want in the future.</p>
<p>PCB Express&#8217;s pricing is <a href="http://www.pcbexpress.com/products/prices.php">a matrix of board size and quantity</a>, with pretty appealing prices for moderate quantities of largish boards.  They <a href="http://www.pcbexpress.com/technical/faq.php#fab">don&#8217;t mind if you panelize</a> (tile a plane with multiple copies of your board &#8212; some board houses refuse to accept panelized orders) and will even route perforated lines to break apart your smaller boards, but won&#8217;t route complete cuts to separate your boards for you.</p>
<p>The EasyBright came out to be 1.75&#8243; x .8&#8243;, and I wanted either about twenty (test/samples) or about a hundred (first production run) of them.  My <a href="http://www.pcbexpress.com/products/prices.php#2pricing">&#8220;E2&#8243; order</a> would have cost $166 to get two boards without panelization and with double-sided silkscreening ($83 per board) or the same $166 to get 12 panelized boards that I&#8217;d have to break apart ($13.83 per board).  $478 would get me 90 panelized boards, again with double-sided silk &#8212; about $5.31 per board.</p>
<h3>Gold Phoenix</h3>
<p><a href="http://www.goldphoenixpcb.biz/">Gold Phoenix</a> was my underdog, in part because I hadn&#8217;t studied their pricing and capabilities closely enough.  They have a <a href="http://www.goldphoenixpcb.biz/quote2.php">prototype offer</a> of 100 square inches for $100 or 155 square inches for $110 &#8212; each for two-sided boards with solder mask and top silkscreening.  This rate includes shipping.</p>
<p>It also includes free &#8220;step and repeat&#8221; &#8212; that is to say, they will automatically panelize your design for you; and although this took me a while to figure out for sure, they cut them apart for you, too.  Bottom-side silkscreen is an additional $20, as is electrical testing to discard boards with manufacturing defects impacting the copper connections.</p>
<p>So for $130, I could get 155 square inches worth of boards, plus $20 for electrical testing so I didn&#8217;t have to worry about clinkers.  I guesstimated a kerf of .1&#8243; to cut apart the boards, so the 10&#8243; x 14.5&#8243; panel they mention should give me 11 x 7 = 77 or 5 x 16 = 80 boards &#8212; in the neighborhood of $1.88 per board.  That sounded fantastic!</p>
<h3>Ordering from Gold Phoenix</h3>
<p>To <a href="http://www.goldphoenixpcb.biz/placeorder.php">place my order</a>, I ran an EAGLE CAM export and zipped up the files along with an index listing what layer each file represented.  I then emailed the zip file to goldphoenixtech@yahoo.ca, indicating that I wanted 155 square inches of panelized boards with standard PCB material and copper weight, green solder mask, and double-sided silkscreen.</p>
<p>I got back a prompt quote for 110 boards instructing me to PayPal them, which I did, and my order was underway.  110 boards &#8212; obviously they cut the boards apart with a smaller kerf than I had envisioned.</p>
<p>And then after my order was placed, <a href="?p=983&#038;cpage=1#comment-25036">Asmodeus noticed that I had dropped a trace on one of the current-sense resistors</a> while I was playing with eagle3d.  Drat!</p>
<p>I quickly corrected the mistake in EAGLE and emailed Gold Phoenix asking whether they could restart the process with my fixed file.  They had already &#8220;processed the job,&#8221; but for a $50 fee were willing to start over.  That was a no-brainer &#8212; 110 boards I&#8217;d have to fix by hand or fifty bucks to fix them &#8212; so I sent the money and they started over.</p>
<h3>Boards from Gold Phoenix</h3>
<p>Just over a week later, they sent me a note indicating that my boards had shipped, and I received the package a few days after that.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2010/05/22/DSCN6922.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2010/05/22/DSCN6922_mid.jpg" alt="PCBs" /></a></p>
<p>113 adorable little boards, all cut apart and stacked and sealed up in plastic (and packed carefully in a box, not shown here).  Woo-hoo!</p>
<p>Wait, 113 boards?  I was estimating 77 to 80, they quoted me 110, and they delivered 113?  What&#8217;s up with that???</p>
<p>Entirely ignoring the kerf and envisioning the 10&#8243; x 14.5&#8243; panel they list as their maximum size,, the .8&#8243; x 1.75&#8243; boards could fit 12 x 8 = 96 one way or 18 x 5 = 90 boards the other way.  Neither one of these gets me 110 boards, much less 113.</p>
<p>Let&#8217;s go about this another way.  113 is prime; so if we assume that they made me a single rectangular panel, they must have discarded some boards after electrical testing.  How would nearby numbers factor and what panel sizes would that imply?</p>
<ul>
<li>114 boards = 6 * 19 <br/> 6 * 1.75&#8243; = 10.5&#8243; and 19 * .8&#8243; = 15.2&#8243; <br/> 10.5&#8243; x 15.2&#8243; = 159.6 sq-in (plus kerfs)</li>
<li>115 = 5 * 23 <br/> 23 * .8&#8243; = 18.4&#8243;, which I rule out since they claim the maximum dimension is 14.5&#8243;</li>
<li>116 = 4 * 29, which gets us nowhere useful</li>
<li>117 boards = 9 x 13 <br/> 9 * 1.75&#8243; = 15.75&#8243; and 13 * .8&#8243; = 10.4&#8243; <br/> 15.75&#8243; x 10.4&#8243; = 163.8 sq-in, which is quite a bit larger than promised</li>
</ul>
<p>So I don&#8217;t know quite what to think &#8212; other than that I like getting 113 boards at $1.33 each (plus my $50 screwup).</p>
<h3>Quality</h3>
<p>All of the boards I&#8217;ve examined look really good, and I was delighted with the legibility of the silkscreen and my fairly small type.  The top-side silkscreen registration was low by about .01&#8243; (click one of the pictures above), which makes a bigger difference to the appearance of the board than you might guess, but it&#8217;s quite acceptable.</p>
<p>A sample board measures .796&#8243; x 1.748&#8243; &#8212; certainly close enough for me.  Its upper left corner is cut in a bit of a diagonal, I&#8217;m guessing the last place the router touched when it cut loose.  I should point out that I&#8217;m mentioning every little thing I&#8217;ve noticed while looking at the board with a critical eye for several days.</p>
<p>All in all, I&#8217;m tremendously pleased.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=620</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>VGA Dongles for Mac Mini Headless Booting</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=632</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=632#comments</comments>
		<pubDate>Sun, 23 Aug 2009 21:45:12 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>
		<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=632</guid>
		<description><![CDATA[At work we&#8217;re placing Mac Minis as network appliances into backbone wiring closets, in part to decentralize DHCP and DNS services so they survive partial failures (or scheduled outages) of the network any time the local backbone drop also survives, in part to run local proxy service for WCCP because our backbone doesn&#8217;t support GRE. [...]]]></description>
			<content:encoded><![CDATA[<p>At work we&#8217;re placing Mac Minis as network appliances into backbone wiring closets, in part to decentralize DHCP and DNS services so they survive partial failures (or scheduled outages) of the network any time the local backbone drop also survives, in part to run local proxy service for WCCP because our backbone doesn&#8217;t support GRE.</p>
<p>We reinstall the Minis with OpenBSD; and whether this would be true with OS X on them or not, at least with OBSD, they don&#8217;t like to boot without a monitor connected.  A few weeks ago I made a batch of VGA &#8220;dongles&#8221; to trick the Minis into thinking a monitor was present.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5336.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5336_mid.jpg" alt="VGA dongles, sloped pyramid" /></a></p>
<p><span id="more-632"></span></p>
<p>Comment 14 by TasDevil on <a href="http://erdelynet.com/tech/openbsd/openbsd-on-intel-mac-mini/">this blog post</a> summarizes the problem and the solution &#8212; put a resistor in the range of 75&Omega; across the analog green signal pins (analog green signal to coax shield / ground).  Some computers apparently want all the analog lines terminated and some even the sync lines, but the Mini is happy with just green.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5309.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5309_mid.jpg" alt="VGA dongle, first test" /></a></p>
<p>I didn&#8217;t have any 75&Omega; resistors on hand, but a number of sources suggested that the Mini wasn&#8217;t particular, so I made up a test dongle with a 100&Omega; resistor.  The plugs for these came from cables I cut off a batch of dead VGA monitors; the remainder of the cable makes a nice supply of stranded wire and lightweight coax for.</p>
<p>This particular cable had red, grey, and blue coaxes in it.  Since they&#8217;re supposed to be for the RGB signals, the grey coax had to be green.  Rather than continuity-test it against the pins, I lazily slopped the first one together  and took it to Andy in the Unix group to try out.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5315.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5315_mid.jpg" alt="VGA dongle, resistor view" /></a></p>
<p>He said it worked fine, so I cleaned up the resistor placement,</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5320.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5320_mid.jpg" alt="VGA dongle, heatshrunk" /></a></p>
<p>heatshrinked it, and gave it back to him to confirm before making more.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5325.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/10/DSCN5325_mid.jpg" alt="VGA dongles, end view" /></a></p>
<p>After hearing that the first one still worked after the rebuild, I made up the other four, which all also tested good.</p>
<p>That&#8217;ll do, pig.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=632</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Constant-Current LED String Driver</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=475</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=475#comments</comments>
		<pubDate>Sat, 01 Aug 2009 22:02:28 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=475</guid>
		<description><![CDATA[As mentioned previously, I was contacted this spring by Amanda McClellan of Coordinate It about an LED design project. Amanda is a civil engineer turned wedding planner and needs about a hundred lighted paper lanterns for a large reception on Labor Day weekend. There don&#8217;t seem to be (m)any LED lighting solutions for paper lanterns, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="?p=559">As mentioned previously</a>, I was contacted this spring by Amanda McClellan of <a href="http://www.coordinate-it.net/homepage.html">Coordinate It</a> about an LED design project.  Amanda is a civil engineer turned wedding planner and needs about a hundred lighted paper lanterns for a large reception on Labor Day weekend.</p>
<p>There don&#8217;t seem to be (m)any LED lighting solutions for paper lanterns, and Amanda was interested in the lower power consumption of LEDs without having to go around to each lantern to e.g. hook up LED throwies.  She also indicated a willingness to advise me on packaging the system/solution to sell to other event planners out there, which sounds pretty good to me.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5228.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5228_mid.jpg" alt="LED string driver, all LEDs on" /></a></p>
<p>Between distractions, I&#8217;ve been working on a design for her.  The prototype looks okay, and I think it&#8217;s about ready to send out to have boards manufactured.</p>
<h4>Specifications</h4>
<ul>
<li>Make LED drivers to power 10 lanterns with 2-3 white or warm white LEDs each, with some combination of parallel-series wiring.</li>
<li>Cost should be not more than $2.50 per lantern, or possibly somewhat more if the system is completely reusable.</li>
<li>Use constant-current drive, for the initial application in the 20mA range but ideally expandable to as high as 100mA.</li>
<li>Ideally make the string(s) dimmable through optional analog and/or PWM input &#8212; but full-brightness when no dimming input is present.</li>
<li>For Amanda&#8217;s use, pack 100 lanterns&#8217; worth of drivers into a monolithic case for the sake of aesthetics and convenience.</li>
<li>If easily done, make the same driver boards fit into fob-sized cases for smaller applications &#8212; Jeremy&#8217;s basement, interior lighting for CNC plastic-extrusion machines, etc.</li>
<li>LEDs supplied separately.  I don&#8217;t want to be in the business of soldering and testing LED strings that are going to get used by other people.  It&#8217;s up to the customer to determine and meet their own LED requirements.</li>
<li>If possible, run from 48VDC source, as I have several hundred 48VDC .38A power supplies I&#8217;d love to get rid of for the right price.</li>
</ul>
<h4>Driver Selection</h4>
<p>I looked over a lot of LED string drivers before making my selection.  Here are some drivers I considered and application notes I looked through:</p>
<ul>
<li><a href="http://www.st.com/stonline/products/literature/ds/13415.htm">STCS1</a>
<ul>
<li>40V max input</li>
<li>no samples</li>
</ul>
</li>
<li><a href="http://www.maxim-ic.com/appnotes.cfm/an_pk/4393">Maxim application note on high-brightness LED driver selection</a></li>
<li><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5165">MAX16805/6 high-current linear drivers</a>
<ul>
<li>5-40V input / 39V LED drive</li>
<li>35 &#8211; 350mA capacity</li>
<li>I<sup>2</sup>C and analog dimming</li>
<li>single string drive</li>
</ul>
</li>
<li><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5274">MAX16819/20 step-down drivers</a>
<ul>
<li>inductive step-down</li>
<li>requires external inductors and MOSFET</li>
<li>single string</li>
</ul>
</li>
<li><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5828">MAX16822A/B step-down drivers</a>
<ul>
<li>inductive step-down</li>
<li>requires external inductors</li>
<li>6.5 &#8211; 65V input</li>
<li>single string</li>
</ul>
</li>
<li><a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5286">Maxim MAX16823</a> 3-channel linear driver
<ul>
<li>5.5-40V supply</li>
<li>70mA/channel capacity</li>
<li>per-channel PWM dimming</li>
<li>3-channel</li>
<li>linear</li>
<li>ultra-low external component requirement</li>
</ul>
</li>
<li><a href="http://www.national.com/news/item/0,1735,1104,00.html">National press release</a></li>
<li><a href="http://www.national.com/pf/LM/LM3502.html">LM3502</a> and <a href="http://www.national.com/pf/LM/LM3503.html">LM3503</a> step-up converters
<ul>
<li>inductive boost converters</li>
<li>require external inductor</li>
<li>2.5 &#8211; 5.5V input</li>
<li>single string</li>
</ul>
</li>
</ul>
<p>Given that Amanda wants 100 lanterns with 2 or 3 LEDs each, the 3-channel MAX16823 really leaped out at me.  Even though some of the other drivers could support higher drive voltages hence more LEDs per string, the 16823&#8242;s three strings trump the higher voltages in the &#8220;power more LEDs per driver&#8221; category, hence providing a lower overall cost to drive large numbers of LEDs.</p>
<p>Because so many of the drivers have a maximum input of 40V, I gave up on using my 48V power supplies and looked for power supplies in the 24-36V range.  I&#8217;m having a hard time finding power supplies in that voltage range whose price I consider reasonable, and it&#8217;s <em>much</em> worse for anything other than 24V, so it looks like that&#8217;s what it&#8217;ll be.  I&#8217;d welcome suggestions on sources for inexpensive 24-40V ~1A power supplies, if you know of any.</p>
<p>With a white LED forward voltage drop at 3.4-3.6V and the MAX16823&#8242;s dropout voltage of .3-.7V, a 24V power supply could comfortably run 6 LEDs per string or 18 LEDs per driver.  With 2 LEDs per lantern, that&#8217;s 9 lanterns; with 3 per lantern, it&#8217;s 6 lanterns per driver.  It&#8217;d be nice to have an even 10 lanterns per driver, but I can live with this.</p>
<p>One nice thing about the MAX16823&#8242;s circuit is that it doesn&#8217;t require a fixed supply voltage or number of LEDs.  Just leave a little headroom between your LED string series forward voltage and your supply voltage and you&#8217;re good to go.  This means I can set it up for Amanda on 24V with 6 white LEDs per string, but Jeremy could use 12V with 3 LEDs per string, and someone with a 40V source wanting to power red LEDs at ~2V each could connect about 20 LEDs per string.  That indifference to the details &#8212; as long as you don&#8217;t make the linear current controller sink <em>way</em> too much current &#8212; is really handy.</p>
<h4>Circuit Design</h4>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/03/driver-prototype-sch.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/03/driver-prototype-sch_mid.png" alt="MAX16823 LED driver board schematic" /></a></p>
<p>The schematic is pretty straightforward &#8212; some decoupling capacitors, current-sense resistors for the LED strings, and inputs for PWM dimming.  Because I&#8217;d like the same board to work in a fob or plugged into a backplane in a larger case, I included dual power supply and PWM dimming inputs.</p>
<p>I figure if you have a large case of these (at least one I make), you&#8217;re more likely to want to dim all of the LEDs at the same time than to dim individual strings, so I used resistor-diode logic to tie the three dimming inputs together to a single dimming input pin on the backplane connector.</p>
<p>I also ran the &#8220;LEDGOOD&#8221; indicator output to the backplane, to invert and provide &#8220;LEDBAD&#8221; indicators on the monolithic case to show which strings are disconnected or having trouble.  Having discussed it extensively with Jeremy (my first fob presale), I didn&#8217;t bother to provide LEDGOOD/LEDBAD indication on the board itself for the fob version &#8212; if you&#8217;re using the fob to power one to three strings, you can just <em>look</em> to see whether the LED strings are working or not.</p>
<h4>Circuit Board</h4>
<p>After laying out the circuit board, I tried my usual iron-on toner transfer to set up PCB etch resist, but I had much worse luck than usual and gave up.  Tom McGuire graciously agreed to mill me a couple of boards at work and even provided pictures of their awesome commercial PCB mill doing its thing.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0845.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0845_mid.jpg" alt="PCB mill, wide" /></a></p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0844.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0844_mid.jpg" alt="PCB mill, table" /></a></p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0843.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/06/100_0843_mid.jpg" alt="PCB mill, cutterhead" /></a></p>
<p>Here are my sad iron-on attempts shown next to Tom&#8217;s awesome milled boards.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/07/DSCN4054.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/07/DSCN4054_mid.jpg" alt="Circuit boards: Iron-on transfer attempts, milled" /></a></p>
<p>Tom &#8220;peeled&#8221; the waste copper from the top side of one of the boards, because he&#8217;s CRAZY.<br />
<a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/07/DSCN4060.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/06/07/DSCN4060_mid.jpg" alt="Two milled circuit boards, one peeled" /></a></p>
<p>With Tinnit, verra nice.</p>
<h4>Completed Prototype</h4>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5236.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5236_mid.jpg" alt="LED string driver" /></a></p>
<p>I assembled this a while back and actually don&#8217;t remember for sure whether I used the <a href="?p=537">hotplate</a> or hand-soldered and used braid to soak up solder bridges.  Given the lack of waste flux around the driver IC, I think I did it on the hotplate.</p>
<p>I intend to use standard 1206 (or smaller) SMT diodes; but these cute round SMT diodes were on hand (salvaged from something) and they fit well enough.  Sadly, I couldn&#8217;t find any .203V sense voltage / 20mA target current &asymp; 10&Omega; current-sense SMT resistors in my bin; so as you can see, I improvised.</p>
<p>For now, I&#8217;ve populated only the connectors I need to test the prototype, and not even with the type of connectors to be used in the production versions.  I bodged this together to work on a breadboard; but the real thing will have right-angle male headers for all the connectors.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5228.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5228_mid.jpg" alt="LED string driver, all LEDs on" /></a></p>
<p>The LEDs stay exactly the same brightness with a supply of 12-19V (as high as my slightly broken bench power supply will go),</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5227.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/08/01/DSCN5227_mid.jpg" alt="LED string driver with LEDs shorted" /></a></p>
<p>and also stay the same brightness with several of the LEDs shorted out to simulate a string of fewer LEDs.  Looks like pretty good current regulation to me.</p>
<h4>Next Steps</h4>
<p>Right now I need to get boards built quickly for Amanda, so I&#8217;ll probably order a batch of 20 boards (enough for 120 or 180 lanterns) just like this, plus silkscreen labels for the connectors.  But for the fob version, I want to include a power switch; so I already know there&#8217;ll be revisions coming.</p>
<p>I think when the time comes, I&#8217;ll print the fob cases using my <a href="http://store.makerbot.com/cupcake-cnc.html">CupCake</a>.</p>
<h4>Availability</h4>
<p>I&#8217;d like to sell these to anyone who wants them, and I think they&#8217;re going to come to $20-25 each by the time I have the PCB, driver, passives, and connectors.  (That feels like a lot to me; but in batches of 100, I think that&#8217;s about what it&#8217;s going to be.)  I&#8217;m by no means ready to take orders, but I&#8217;d take a straw poll.  If you think you might be interested, drop me a comment indicating</p>
<ul>
<li>likely quantity</li>
<li>PC board only, fob version, or case with lots of boards</li>
<li>configured for 20mA drive, something else, or you want to supply your own current-sense resistor</li>
<li>or &#8220;$20-25 is just way too darn much for an LED string driver&#8221;</li>
</ul>
<p>I promise I won&#8217;t hold you to it, unless you give me answer #4. <img src='http://www.neufeld.newton.ks.us/electronics/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=475</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>Simple LED Brightness Tester</title>
		<link>http://www.neufeld.newton.ks.us/electronics/?p=559</link>
		<comments>http://www.neufeld.newton.ks.us/electronics/?p=559#comments</comments>
		<pubDate>Mon, 25 May 2009 21:40:00 +0000</pubDate>
		<dc:creator>Keith Neufeld</dc:creator>
				<category><![CDATA[Circuits]]></category>

		<guid isPermaLink="false">http://www.neufeld.newton.ks.us/electronics/?p=559</guid>
		<description><![CDATA[Back in March, I was contacted by Amanda McClellan of Coordinate It wedding planning. She&#8217;s interested in LED lighting for paper party lanterns; and although she has an engineering degree, electronics is not specifically her forte. She wondered whether I help her figure out how to drive the LEDs, and, well, you know how I [...]]]></description>
			<content:encoded><![CDATA[<p>Back in March, I was contacted by Amanda McClellan of <a href="http://www.coordinate-it.net/homepage.html">Coordinate It</a> wedding planning.  She&#8217;s interested in LED lighting for paper party lanterns; and although she has an engineering degree, electronics is not specifically her forte.  She wondered whether I help her figure out how to drive the LEDs, and, well, you know how I feel about LEDs. <img src='http://www.neufeld.newton.ks.us/electronics/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   So of course I was interested.</p>
<p>The challenge, of course, is that LEDs need a constant-current drive; and it&#8217;s <a href="?p=462">not easy to drive a string of LEDs at a constant current (hence constant brightness) using a simple current-limiting resistor</a>.  I&#8217;ve looking at constant-current LED driver ICs, and am close to putting together a simple but useful LED driver circuit, with intention to both open-source the design and offer the hardware for sale.  More on that soon.</p>
<h4>LED Tester</h4>
<p>Meanwhile, as I&#8217;ve researched driver chips, Amanda and I have been talking about how many LEDs (and indirectly how many mA) it takes to light a paper lantern.  She wants the lanterns for decoration, not illumination &#8212;   Last weekend I assembled and shipped her a simple LED tester to allow her to try some LEDs inside lanterns and see how many LEDs and how much current she&#8217;s going to want.</p>
<p>My idea was to make something that could:</p>
<ul>
<li>run off a 9V battery (enough to power a series string of two white LEDs at ~3.4V each)</li>
<li>allow her to vary the LED brightness for testing</li>
<li>allow her to measure the LED current without having to stick an ammeter in the circuit</li>
</ul>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/led-lanterns/led-tester-sch.png"><img src="http://www2.neufeld.newton.ks.us/images/electronics/led-lanterns/led-tester-sch.png" alt="LED tester schematic" /></a></p>
<p>Regarding that last point &#8212; ammeters have to be connected in series with the circuit under test, so the LEDs would go dark when the meter wasn&#8217;t connected.  Instead, I used a 1.0&Omega; current-sensing resistor in series with the LED string.  Across the 1&Omega; resistor one can measure 1mV for each 1mA of LED current; and removing the voltmeter from the circuit has no effect on the LED operation.</p>
<p>R1 (20&Omega;) is there to save things if the potentiometer is turned to its minimum value of (theoretically) 0&Omega;.  With two 3.4V LEDs in series, the combined LED voltage drop is 6.8V and the voltage remaining across the various resistors is 2.2V (or .4V with the NiMH &#8220;9V&#8221; battery I use at home).  2.2V / 21&Omega; &asymp; 105mA, which is way too high for a normal LED and puts almost a quarter watt across R1.  Not great; but it&#8217;s a last resort instead of a dead short, not a desired operating mode.</p>
<h4>The Board</h4>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/14/DSCN3862.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/14/DSCN3862_mid.jpg" alt="PC board with iron-on 'silkscreen' layer" /></a></p>
<p>I used the laser printer and household iron to do toner transfer for etch resist, and also to transfer the &#8220;silkscreen&#8221; on the top side.  I get best results <em>on the silkscreen side</em> peeling off the paper while everything is still hot, and I was particularly pleased with the transfer quality here.  Not perfect, but it&#8217;s pretty legible for 70-mil text.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3948.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3948_mid.jpg" alt="LED tester PC board" /></a></p>
<p>Here&#8217;s the populated board, sized the same as the battery it runs from.  In retrospect, I should have moved the potentiometer further down or the LED connector further up, but I was intending to use a right-angle connector that would lay flat on the board.  Couldn&#8217;t find any in my parts bin when I went to assemble it.</p>
<p>The test points at the bottom are wire loops sized to friction-fit my voltmeter probes.  They&#8217;ll also work well for clips or gator wires.</p>
<h4>In Use</h4>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3954.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3954_mid.jpg" alt="LED tester" /></a></p>
<p>Here it is in action with a couple of amber LEDs plugged in.  They don&#8217;t look bright enough to me &#8212; but letting Amanda determine that is the whole point of this exercise.  She&#8217;s the expert on event planning; and it&#8217;s her assessment that matters, not mine.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3961.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3961_mid.jpg" alt="Paper lantern with LED lighting" /></a></p>
<p>This is two warm white LEDs inside a paper lantern.  Under normal room lighting, you can tell there&#8217;s light inside, but it doesn&#8217;t look dramatically lighted and diffused as I think one would want it to.</p>
<p><a href="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3964.jpg"><img src="http://www2.neufeld.newton.ks.us/images/electronics/2009/05/17/DSCN3964_mid.jpg" alt="Paper lantern with LED lighting in the dark" /></a></p>
<p>In evening darkness, the lighting is more noticeable.  And in spite of having set white balance carefully before taking the shot, my old camera changes the warm yellowish white light into cold blueish white light.  Ach, what can a fellow do.  Looks good in person, though &#8212; if not necessarily bright enough (to me).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neufeld.newton.ks.us/electronics/?feed=rss2&#038;p=559</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
