<?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>Rayshobby</title>
	<atom:link href="http://rayshobby.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://rayshobby.net</link>
	<description>Ray&#039;s DIY Electronics Hobby Projects</description>
	<lastBuildDate>Wed, 19 Jun 2013 01:49:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>New Toy: NeoDen TM-240A Automatic Pick and Place Machine</title>
		<link>http://rayshobby.net/?p=6596</link>
		<comments>http://rayshobby.net/?p=6596#comments</comments>
		<pubDate>Tue, 18 Jun 2013 05:15:54 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Learning Electronics]]></category>
		<category><![CDATA[Tools and equipment]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6596</guid>
		<description><![CDATA[Yes, there have been lots of new updates recently. Among them is a new toy I received in the mail today: a NeoDen TM-240A automatic desktop pick and place machine! I&#8217;ve kept my eyes on this baby for a quite a while, and finally decided to make a purchase last week. The shipping was very [...]]]></description>
				<content:encoded><![CDATA[<p>Yes, there have been lots of new updates recently. Among them is a new toy I received in the mail today: a NeoDen TM-240A automatic desktop pick and place machine! I&#8217;ve kept my eyes on this baby for a quite a while, and finally decided to make a purchase last week. The shipping was very fast: DHL from China, a total of 4 days from shipping to delivery. The package is quite heavy: 65kg with the box, and 45kg just the machine itself. The DHL courier and I moved it together to my workshop. Some unboxing pictures:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2664.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2664-1024x683.jpg" alt="IMG_2664" width="300" class="alignnone size-large wp-image-6604" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2668.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2668-1024x683.jpg" alt="IMG_2668" width="300" class="alignnone size-large wp-image-6603" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2671.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2671-1024x683.jpg" alt="IMG_2671" width="300" class="alignnone size-large wp-image-6601" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2672.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2672-1024x683.jpg" alt="IMG_2672" width="300" class="alignnone size-large wp-image-6600" /></a></p>
<p>So what&#8217;s a pick and place machine? Simply speaking, it&#8217;s a machine that can quickly and accurately place SMT components onto a PCB. As our orders keep increasing, we need better tools to significantly improve the manufacturing productivity. It&#8217;s true that the major manufacturing needs can be outsourced to companies like SeeedStudio, but you will always have to prepare for unexpected delays. Also, small production runs are not worth outsourcing to China. So it&#8217;s crucial to have in-house manufacturing capability to meet small production needs. </p>
<p>The basic tools for small-scale PCB assembly include a stencil printing machine, a pick and place machine, and a reflow oven. The pick and place machine is probably the most expensive among the three. The <a href="http://www.neodentech.com/bbx/996360-996360.html?id=26798&#038;pid=761183" target="_blank"><b>NeoDen TM-240A</b></a> is a relatively low-cost model. It&#8217;s desktop-size, so it&#8217;s light-weight and doesn&#8217;t take a huge amount of space. It has built-in suction pump, 28 feeders, two placement heads, speed of 7000 components per hour, and a maximum PCB area of 400mm x 360mm. It costs about $5000, which is significantly cheaper than machines at similar specs. I&#8217;ve seen machines that cost at least 10K, and even at that price you have to buy feeders separately.  There is a sister model to TM-240A, which is TM-220A. It&#8217;s cheaper (~$3600), but with less feeders and smaller PCB area. The downside of TM-240A is that it does not have a vision-based system, so it&#8217;s not as accurate as the more expensive machines. But considering its price and capability, I decided it&#8217;s a good investment. </p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2675.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2675-1024x683.jpg" alt="IMG_2675" width="300" class="alignnone size-large wp-image-6598" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2674.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2674-1024x683.jpg" alt="IMG_2674" width="300" class="alignnone size-large wp-image-6599" /></a></p>
<p>I bought the machine directly from the Chinese website <a href="http://item.taobao.com/item.htm?spm=a230r.1.14.25.TmAe4v&#038;id=19943724706&#038;_u=ipqtld05f35" target="_blank">Taobao</a>, which is the equivalent eBay in China. Shipping is 3000RMB (~$490). Considering it took only 4 days from China to the US, it&#8217;s not a bad price. All together I paid about $5500, including the machine and shipping cost.</p>
<p>As soon as I got the machine, I couldn&#8217;t wait to open it and give it a try. The user manuals are pretty minimal, but there is an SD card that contains several tutorial videos which are very helpful. For example, the user manual does not explain how to install the component tapes, and it took some careful watching and rewinding of the tutorial video to figure it out. The package came with a sample PCB and a bunch of double-sided tape. Using these I could quickly set up a test run without applying solder paste at all. The video below shows a demonstration. It&#8217;s very exciting to see the machine in action! It&#8217;s also quite fast. I am looking forward to using this machine in real production. I am glad that this machine has sufficient number of feeders to handle OpenSprinkler in one pass (i.e. no need to change tapes in the middle). There will be quite a bit of learning involved, but I am hopeful <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><iframe width="640" height="480" src="http://www.youtube.com/embed/R9u_8NcgUIs" frameborder="0" allowfullscreen></iframe></p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6596</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Announcing OpenSprinkler Pre-Release v2.0s (assembled version)</title>
		<link>http://rayshobby.net/?p=6528</link>
		<comments>http://rayshobby.net/?p=6528#comments</comments>
		<pubDate>Mon, 17 Jun 2013 19:41:07 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Product News]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6528</guid>
		<description><![CDATA[After a few weeks of shipping these &#8216;underground&#8217;, I am finally happy to spread the words around: the OpenSprinkler Pre-Release v2.0s is officially available for sale! Note that this is the SMT assembled version &#8212; we don&#8217;t have DIY 2.0 yet. As usual, the first question to ask is what&#8217;s new in this version? Upgraded [...]]]></description>
				<content:encoded><![CDATA[<p>After a few weeks of shipping these &#8216;underground&#8217;, I am finally happy to spread the words around: the OpenSprinkler Pre-Release v2.0s is officially available for sale! Note that this is the SMT assembled version &#8212; we don&#8217;t have DIY 2.0 yet. As usual, the first question to ask is what&#8217;s new in this version?</p>
<ul>
<li><b><u>Upgraded MCU</u></b>: OpenSprinkler 2.0 uses <a href="http://www.atmel.com/devices/atmega644.aspx" target="_blank">ATmega644</a>, which is twice as much as ATmega328 in all aspects (i.e. flash memory size, GPIO pins, RAM, EEPROM, perhaps price as well <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). This makes it possible to add new features that I have planned ahead (e.g. weather-based control, logging, interfacing with wireless devices etc.) We will no longer be constrained by the flash memory size, well, at least for a while.</li>
<li><b><u>Upgraded Switching Regulator</u></b>: the switching regulator (for 24VAC->5VDC conversion) has been upgraded from MC34063 to <a href="http://www.ti.com/product/lm2596" target="_blank">LM2596</a>, which is less noisy and capable of outputting higher current. As more users are powering WiFi adapters through OpenSprinkler&#8217;s USB port, it&#8217;s important to make the power conversion section robust. The same circuitry is now also used in OpenSprinkler Pi. Details about this change can be found in <a href="http://rayshobby.net/?p=6002" target="_blank">this blog post</a>.</li>
<li><b><u>Added microSD Card Slot</u></b>: microSD card is useful for expanding the storage size of a microcontroller. This s great for a lot of purposes, such as logging, storing a lot of sprinkler programs, Javascript files etc. A standard microSD card shares the SPI interface and requires only one extra GPIO pin to operate. Hence adding microSD card support is a no brainer!</li>
<li><b><u>Expansion Board Detection</u></b>: this allows the main controller to automatically detect the number of zone expansion boards linked to the controller. Not so crucial, but neat. The implementation is actually quite simple: it uses a pull-up resistor on the main controller and one pull-down resistor on each expansion board to form a voltage divider. By checking the voltage using an analog pin, the mcu can easily calculate how many boards are linked. </li>
<li><b><u>Other Features</u></b>: given the plentiful GPIO pins available on ATmega644, I&#8217;ve added support to adjust LCD contrast and backlight (using two PWM pins), a set of pin headers for plugging in an off-the-shelf RF transmitter (for interfacing with wireless devices). The other un-used pins are made available in the pinout area (including three analog pins, two interrupt pins, two digital pins, as well as TXD, RXD, SDA and SCL).</li>
</ul>
<p>OK, that&#8217;s quite a detailed list of new features. Here is an annotated diagram of the actual hardware:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os20_component_diagram.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os20_component_diagram-1024x599.jpg" alt="os20_component_diagram" width="600" class="alignnone size-large wp-image-6571" /></a></p>
<p>Also, just for fun, a diagram that shows each module of the circuit and where they are located on the PCB:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os20_module_diagram.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os20_module_diagram-1024x767.jpg" alt="os20_module_diagram" width="500" class="alignnone size-large wp-image-6572" /></a></p>
<p>The reason I call this the <b>Pre-Release</b> 2.0 is that the official 2.0 will use the injection molded enclosures I blogged about <a href="http://rayshobby.net/?p=5583" title="Custom OpenSprinkler Enclosure using Injection Modeling" target="_blank">in this post</a>. While that is already in production at SeeedStudio, I can&#8217;t give a reliable estimate of how long it will take for the final products to arrive. There have already been multiple delays, so I won&#8217;t be surprised if there are more&#8230; Other than the difference in the enclosure design, the pre-release 2.0 hardware is the same as the final 2.0.</p>
<p>If you are wondering what I mean by &#8216;shipping these underground&#8217; at the beginning of the post &#8212; we&#8217;ve been automatically upgrading the recent orders of assembled OpenSprinkler v1.4s to v2.0s. Why not make it public? Well, there are several reasons. The first is that due to the Maker Faire and the vacation after that, I haven&#8217;t had time to finish the documentations, and I&#8217;m reluctant to officially release a product when the documentations are not ready yet. Second, I&#8217;ve been experimenting with minor changes of the 2.0 design, and we&#8217;ve been shipping several small batches, each with slight different hardware design. This is an important process to get user feedback, and to iron out all engineering issues before the official release. Finally, as many users have been waiting for 2.0, I don&#8217;t want to suddenly get into an overload situation, where the number of orders exceed our capacity to process them. </p>
<p>In terms of software, OpenSprinkler 2.0 is currently flashed with firmware 2.0.0, which is functionally the same as firmware 1.8.3, except for the additional options such as LCD contrast and backlight, and the support for a higher number of expansion boards and programs. More exciting firmware features will be gradually added over time. Also, starting from firmware 2.0.0, the source code can be compiled in Arduino 1.x (latest stable version is 1.0.5), and this is also the recommended Arduino version to compile OpenSprinkler code. I will continue to provide a <a href="http://rayshobby.net/?p=6149" title="A VirtualBox Image for Compiling OpenSprinkler Source Code" target="_blank">VirtualBox image</a> which has everything needed for compilation set up and ready to go.</p>
<p>The final bit of news: if you are interested in DIY 2.0, unfortunately that won&#8217;t be available for at least a couple of months. The delay is partly because the new injection molded enclosures are not ready yet (there is no space in the current enclosure to fit all through-hole components), and partly because there are a few design decisions I haven&#8217;t ironed out yet. So at least for a couple of months we will keep offering DIY 1.42u for anyone who wants to build OpenSprinkler from scratch.</p>
<p>So much for the announcement of OpenSprinkler Pre-Release 2.0. Feel free to leave your comments and suggestions below, or at the <a href="http://rayshobby.net/phpBB3" target="_blank">Rayshobby Forum</a>. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6528</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Mobile Web App for OpenSprinkler and OpenSprinkler Pi</title>
		<link>http://rayshobby.net/?p=6409</link>
		<comments>http://rayshobby.net/?p=6409#comments</comments>
		<pubDate>Mon, 17 Jun 2013 05:04:36 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[Product News]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6409</guid>
		<description><![CDATA[I am very excited to announce that a mobile web app for OpenSprinkler and OpenSprinkler Pi is now available, thanks to the generous contributions by Samer Albahra. After playing with the app for a while, I am quite pleased with the polished user interface. The only thing I want to say is it&#8217;s absolutely amazing! [...]]]></description>
				<content:encoded><![CDATA[<p>I am very excited to announce that a mobile web app for OpenSprinkler and OpenSprinkler Pi is now available, thanks to the generous contributions by Samer Albahra. After playing with the app for a while, I am quite pleased with the polished user interface. The only thing I want to say is it&#8217;s absolutely amazing! I would highly recommend those who are interested in a mobile app to give it a try. This blog post is a brief introduction to the app. For details, please refer to Samer&#8217;s write-up:</p>
<ul>
<li><a href="http://albahra.com/journal/2013/06/opensprinkler-with-custom-web-app" target="_blank">OpenSprinkler with Custom Web App</a></li>
<li><a href="https://github.com/salbahra/OpenSprinkler-Controller" target="_blank">GitHub Repository of the App</a></li>
<li><a href="http://rayshobby.net/phpBB3/viewtopic.php?f=2&#038;t=154" target="_blank">Ongoing forum discussion about this app</a></li>
</ul>
<p>Before I begin, let me summarize some of the highlights of this development:</p>
<ul>
<li><b>Cross-platform</b>: the same web app runs on iOS, Android, as well as Desktop browsers. Also, the app is <b>self-contained</b> and does not rely on external Javascripts (so you can use it to access OpenSprinkler without Internet connection).</li>
<li>Supports the <b>complete set of features</b> in OpenSprinkler firmware 1.8.3 (and equivalently 2.0.0 for v2.0 hardware). Supports both OpenSprinkler and OpenSprinkler Pi (running the <a href="http://rayshobby.net/?p=6339" title="OpenSprinkler Interval Program is now available for OSPi" target="_blank">interval_program ported by Dan</a>).</li>
<li>Supports additional features including <b>logging</b> and <b>days selection in program preview</b>.</li>
</ul>
<p>The main requirement to enable this web app is an HTTP server with PHP support. You can either use a desktop server, or a Raspberry Pi (instructions given below), or an external server. For OpenSprinkler Pi users: the same RPi that drives your OSPi can be used as the HTTP server, so <b>no additional RPi needed</b>!</p>
<p></p>
<h5><b>What&#8217;s a Mobile Web App?</b></h5>
<p>Since the beginning of OpenSprinkler, requests for an iPhone or Android app have never stopped. To be frank, I have never written a mobile app myself. When writing the firmware for OpenSprinkler, I did consider a few tricks to make the webpage look a little nicer on a mobile browser, but the interface is still evidently written by an engineer, namely me <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So far there have been a couple of efforts, mostly by OpenSprinkler users, to write iPhone apps (which I will blog about later). I am not aware of any effort to write Android apps.</p>
<p>So what&#8217;s a mobile web app? Simply speaking, it&#8217;s a webpage which appears like an app. Mobile webpages are not a new thing: when you use your phone or any mobile device to browse webpages, such as a bank&#8217;s homepage, the server will automatically detect what kind of device you are using, and return a page that&#8217;s optimized for mobile browsing experience. For example, the pages may have fewer elements than the desktop version, and buttons may appear larger, etc. </p>
<p>With the emergence of HTML5, mobile webpages are becoming fancier and more dynamic. Almost any feature you can find in a standard iPhone or Android app can be implemented in a web app. Speaking of that, the main difference of a standard app with a mobile web app is that the former is a native application that runs on an iOS or Android device, while the latter is a webpage that runs in a browser. This brings the biggest benefit of a web app, namely it&#8217;s <b><u>cross-platform</u></b> &#8212; you write one app and it instantly runs on almost any device, thanks to the universal support of HTML5 on modern browsers. No more learning how to write an iPhone app, no more messing with the Apple store. Everything is unified <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Of course there are certain things you can&#8217;t do with a web app vs. a native app, such as accessing hardware (e.g. cameras, bluetooth etc.) Actually even these I am not entirely sure if they are absolutely impossible. For example, I&#8217;ve heard about accessing phone cameras in HTML5. I need to do some more research on these. The other downside is that a web app is slower than a native app, but there are lots of applications where the speed is not critical. In any case, one can argue that in the future web apps can replace most native apps, and this will be a big win for developers as they don&#8217;t have to maintain multiple implementations of the same app.</p>
<p></p>
<h5><b>The OpenSprinkler Mobile Web App</b></h5>
<p>Now let me go back to talk about the OpenSprinkler mobile web app that Samer wrote. Here are a few screenshots from his blog:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp1.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp1-576x1024.png" alt="os_webapp1" width="150" class="alignnone size-large wp-image-6425" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp3.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp3-576x1024.png" alt="os_webapp3" width="150" class="alignnone size-large wp-image-6427" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp2.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp2-576x1024.png" alt="os_webapp2" width="150" class="alignnone size-large wp-image-6426" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp4.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp4-576x1024.png" alt="os_webapp4" width="150" class="alignnone size-large wp-image-6428" /></a></p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp5.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp5-576x1024.png" alt="os_webapp5" width="150" class="alignnone size-large wp-image-6429" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp8.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp8-576x1024.png" alt="os_webapp8" width="150" class="alignnone size-large wp-image-6432" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp9.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp9-576x1024.png" alt="os_webapp9" width="150" class="alignnone size-large wp-image-6433" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp10.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp10-576x1024.png" alt="os_webapp10" width="150" class="alignnone size-large wp-image-6434" /></a></p>
<p>Very sleek and clean. Gotta love it! The app currently supports the complete set of features in OpenSprinkler firmware 1.8.3 (and equivalently 2.0.0 for OpenSprinkler v2.0s users). You do probably need to refer to the <a href="http://rayshobby.net/?page_id=192" title="OpenSprinkler Online User Manual" target="_blank"><b>OpenSprinkler Online User Manual</b></a> for detailed explanations of specific settings, but the app itself is quite intuitive to use and self-explanatory. </p>
<p>Not only does it support the complete set of firmware features, it offers additional ones, notably:</p>
<ul>
<li>A <b>logging</b> feature (i.e. records of watering events).</li>
<li>The ability to <b>select an arbitrary day in program preview</b>.</li>
<li>The app is self-contained (implemented using PHP) and <b>does not rely on external Javascripts</b>, so you can use it to access OpenSprinkler locally without Internet connection.</li>
</ul>
<p>These really help improve the user interface significantly. Also, as mentioned before, the app is <b>cross-platform</b>: the same app runs on iOS, Android, as well as Desktop browsers.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp12.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp12-576x1024.png" alt="os_webapp12" width="150 "class="alignnone size-large wp-image-6436" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp13.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/os_webapp13-576x1024.png" alt="os_webapp13" width="150"  class="alignnone size-large wp-image-6437" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_1239.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_1239.png" alt="IMG_1239" width="178" class="alignnone size-full wp-image-6454" /></a></p>
<p></p>
<h5><b>How to Set it Up (using Raspberry Pi as example)</b></h5>
<p>To set up the web app, you need to have an HTTP server with PHP support. There are many options, for example, a desktop server running Ubuntu Linux, a Raspberry Pi, or an external server. In the following I will use Raspberry Pi (RPi) as an example since it can be used as a low-cost web server. The steps should be the same for desktop servers. For details, please refer to Samer&#8217;s GitHub repository (link given above). In addition, you will need an OpenSprinkler running firmware 1.8.3 or above, or OpenSprinkler Pi running the <a href="http://rayshobby.net/?p=6339" title="OpenSprinkler Interval Program is now available for OSPi" target="_blank">interval_program ported by Dan</a>.</p>
<p><font size=2><i><b>Step 1. Install the necessary packages</b></i></font></p>
<ul>
<li><font size=2><tt>sudo apt-get update</tt></font></li>
<li><font size=2><tt>sudo apt-get install apache2 php5 libapache2-mod-php5 git</tt></font></li>
</ul>
<p><font size=2><i><b>Step 2. Create direcotry</b></i></font></p>
<ul>
<li><font size=2><tt>sudo mkdir -m 777 /var/www/sprinklers</tt></font></li>
</ul>
<p><font size=2><i><b>Step 3. Clone Samer&#8217;s GitHub repository</b></i></font></p>
<ul>
<li><font size=2><tt>sudo git clone https://github.com/salbahra/OpenSprinkler-Controller.git /var/www/sprinklers/</tt></font></li>
</ul>
<p>This will download and copy necessary files to the <tt>/var/www/sprinklers/</tt> directory. Once these steps are completed, you can open a web browser (either desktop browser or mobile browser), and type in the IP address of your RPi, followed by <tt>/sprinklers</tt>. For example, my RPi&#8217;s IP address is 192.168.1.147, so I type in:</p>
<ul>
<li><font size=2><tt>http://192.168.1.147/sprinklers/</tt></font></li>
</ul>
<p>You should then see a setup page that requires you to type in some necessary information. In particular,</p>
<ul>
<li>An account including user name and password.</li>
<li>Your OpenSprinkler&#8217;s IP address (including port number if it&#8217;s not the default 80).</li>
<li>Your OpenSprinkler&#8217;s access password (&#8216;opendoor&#8217; by default).</li>
<li><b>Un-check the &#8216;Force SSL&#8217; checkbox</b>, unless if you are sure you server has the proper SSL setup.</li>
</ul>
<p>Once your settings are saved, you will be automatically directed to a login page (or if not, you can directly type in the web url again: <tt>http://192.168.1.147/sprinklers/</tt>). Type in the account you created above, and then you should be directed to the app&#8217;s homepage. I recommend you to <b>bookmark this page to your home screen</b> (most mobile browsers support this), so that next time you can simply click on the home screen icon to access the web app. From this point on, you can feel free to play with the app, and check all the features it supports. I will probably make a video demo at some point to give you a visual walk-through of the app.</p>
<p>In case your settings are changed, you can open <tt>/var/www/sprinklers/config.php</tt> to change the information there accordingly. Since this is a un-encrypted text file, you probably want to restrict its access right for security reasons (e.g. <tt>sudo chmod o-r /var/www/sprinklers/config.php</tt>) </p>
<h5><b>For OpenSprinkler Pi Users</b></h5>
<p>If you are an OpenSprinkler Pi user, you don&#8217;t need to install any additional RPi or HTTP server: the same RPi that drives your OSPi can be used to serve the web app! Just follow the instructions above to install apache2, php5 and the other goodies. Your Python-based interval_program can run in conjunction with the HTTP server in the background. </p>
<p>At some point it will make sense to combine the Python-based program and PHP-based web app into a single program that serves both the front-end (UI) and back-end (scheduling algorithms). This would be awesome for the OpenSprinkler Pi in the future.</p>
<p></p>
<h5><b>Acknowledgement</b></h5>
<p>Finally, a big thank-you again to Samer Albahra, who wrote this app and made it available to the public. This is yet another evidence of the spirit of open-source development. </p>
<p>Keep in mind that the web app is continuously being improved and supported, and we can use your feedback and suggestions for making it better and fixing bugs. Please leave your comments and suggestions at the <a href="http://rayshobby.net/phpBB3/viewforum.php?f=2" target="_blank"><b>Rayshobby Forum</b></a>. Thanks!</p>
<p></p>
<hr /></p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6409</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>OpenSprinkler Interval Program is now available for OSPi</title>
		<link>http://rayshobby.net/?p=6339</link>
		<comments>http://rayshobby.net/?p=6339#comments</comments>
		<pubDate>Sun, 09 Jun 2013 00:31:20 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Product News]]></category>
		<category><![CDATA[Raspi]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6339</guid>
		<description><![CDATA[Good news to the OpenSprinkler Pi users: the same interval program firmware that runs on the latest OpenSprinkler has now been ported to OpenSprinkler Pi! This is due entirely to the generous contributions by Dan Kimberling, who ported the OpenSprinkler&#8217;s Arduino code to Python. The code is available for download at: Interval program demo for [...]]]></description>
				<content:encoded><![CDATA[<p>Good news to the OpenSprinkler Pi users: the same interval program firmware that runs on the latest OpenSprinkler has now been ported to OpenSprinkler Pi! This is due entirely to the generous contributions by Dan Kimberling, who ported the OpenSprinkler&#8217;s Arduino code to Python. The code is available for download at:</p>
<ul>
<li><a href="https://github.com/rayshobby/opensprinkler/tree/master/OpenSprinkler%20Pi/software/demos/interval_program" target="_blank">Interval program demo for OpenSprinkler Pi</a></li>
</ul>
<p>For anyone who is unfamiliar with RPi, here are some basic instructions to follow:</p>
<ul>
<li>First, <font size=2><tt>ssh</tt></font> to your RPi (or connect your RPi to a monitor and open a Terminal), and type in run the following command in one single line(i.e. the &#8216;wget&#8217; command, space, and the very long link): <tt><b>wget https://github.com/rayshobby/opensprinkler/raw/master/OpenSprinkler%20Pi/software/demos/interval_program/ospi.tar.gz</b></tt></li>
<li>Next, run <tt><b>tar zvxf ospi.tar.gz</b></tt>. This will unzip the file to a subfolder named <tt><b>OSPi</b></tt> in your current directory.</li>
<li>Now, <tt><b>cd OSPi</b></tt>, and then run <tt><b>sudo python ospi.py</b></tt> (note that you will need to type in your RPi account password). This will start the web server.</li>
<li>Open a browser on your computer or any device that&#8217;s connected to the same network as your RPi, and type in your RPi&#8217;s IP address, followed by colon, and the default port number 8080. For example, for my RPi, the address is <tt>http://192.168.1.147:8080</tt>. You should now see the homepage of the interval program demo. Note that the port number can be changed to other values, in which case you need to check the source files to figure out how to make the change (or post a message on the forum and I am sure someone will help you).</li>
</ul>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/interval_program_ospi.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/interval_program_ospi-237x300.jpg" alt="interval_program_ospi" width="237" height="300" class="alignnone size-medium wp-image-6371" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2011/08/ospi_header.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2011/08/ospi_header-300x225.jpg" alt="ospi_header" width="300" height="225" class="alignnone size-medium wp-image-5327" /></a></p>
<p>This demo program is the same as OpenSprinkler 1.8.2 firmware. So you can follow the <a href="http://rayshobby.net/?page_id=192" target="_blank">OpenSprinkler Online User Manual</a> for usage instructions. I believe all features of the firmware are supported. Keep in mind that this is still work in progress, so there are glitches and bugs that will be ironed out over time. If you are a developer, you are welcome to improve the code or help fixing bugs. The backbone of the software is based on <a href="http://webpy.org/" target="_blank">web.py</a>, a popular and easy-to-use web framework for Python.</p>
<p>Also keep in mind that if you have RPi rev. 2 (which is the current model), you need to open <tt>ospi.py</tt> and edit a port number. Details can be found in the <a href="https://github.com/rayshobby/opensprinkler/blob/master/OpenSprinkler%20Pi/software/demos/interval_program/README.txt" target="_blank">README.txt file</a>. P.S., it&#8217;s generally a good idea to read the README.txt first before you start doing anything. </p>
<p>These will be the basics to get you started. If you have any questions, feel free to post a message on the forum.</p>
<p>Finally, a big thank-you again to Dan Kimberling for his time and efforts in making this available to the public. This is an example of the true spirit of open-source development and community support. I am very excited to see additional user contributions to the OpenSprinkler Pi project!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6339</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Annoying ribbon cable problem with recent orders of OpenSprinkler Pi</title>
		<link>http://rayshobby.net/?p=6324</link>
		<comments>http://rayshobby.net/?p=6324#comments</comments>
		<pubDate>Sat, 08 Jun 2013 20:31:34 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Product News]]></category>
		<category><![CDATA[Raspi]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6324</guid>
		<description><![CDATA[Hi, this is an alert to users who recently ordered OpenSprinkler Pi: we&#8217;ve found an annoying problem with the 8-pin ribbon / rainbow cable that comes with the package. Apparently many of the cables have disconnected crimp wires, causing the OSPi to not respond to RPi, or even worse, causing all stations to turn on [...]]]></description>
				<content:encoded><![CDATA[<p>Hi, this is an alert to users who recently ordered OpenSprinkler Pi: we&#8217;ve found an annoying problem with the 8-pin ribbon / rainbow cable that comes with the package. Apparently many of the cables have disconnected crimp wires, causing the OSPi to not respond to RPi, or even worse, causing all stations to turn on at the same time. I estimated that there are potentially up to 60 orders that might be affected. We&#8217;ve proactively taken actions to send a replacement cable to everyone who ordered OSPi recently (within the last 2 weeks). If you are seeing an issue of your OSPi not responding to RPi, try to use a multimeter to measure the connection on each of the 8 wires of the cable. If any wire is not connected, please email to rayshobbyshop@gmail.com and we will send you a replacement cable right away.</p>
<p>Here is a closer look at the cause of the problem. When I take the wire out of the crimp connector, you can clearly see that the good ones (shown on the left below) have metal wires tightly secured by the crimps, while the bad ones (shown on the right below) have the metal wires cut from the cable, resulting in disconnection. This is probably due to a defective wire stripper or crimp tool, or incorrect operation that causes the metal wires to be completely cut through. In any case, I&#8217;ve informed the supplier and complained about the the quality, and will never order from them again.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2963.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2963-300x225.jpg" alt="IMG_2963" width="300" height="225" class="alignnone size-medium wp-image-6325" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2965.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/IMG_2965-300x225.jpg" alt="IMG_2965" width="300" height="225" class="alignnone size-medium wp-image-6326" /></a></p>
<p>So the lesson to learn here is that when testing OSPi, we really should use the individual cable that goes with each board, instead of using a common testing cable. Another lesson to learn is to never overlook any part, even something as simple as a cable!</p>
<p>I became aware of the cable issue when a couple of users reported that their OSPi did not work. This is very puzzling because every single board has been tested and verified, so the chance of DOA is very small. I&#8217;ve asked two of them to send their boards back to me, and after testing, I couldn&#8217;t find any obvious problem &#8212; the board works fine, and all demo programs work fine. However, until yesterday, I have apparently overlooked the problem with the cable: when testing, we have always used a common testing cable, instead of the user&#8217;s cable. Partly it&#8217;s because I never thought the cable would have any problem at all. Now I&#8217;ve learned a lesson, and it&#8217;s a good lesson to learn!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6324</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2013 Bay Area Maker Faire Summary</title>
		<link>http://rayshobby.net/?p=6311</link>
		<comments>http://rayshobby.net/?p=6311#comments</comments>
		<pubDate>Sat, 08 Jun 2013 05:38:39 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Maker Faire]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6311</guid>
		<description><![CDATA[First off, my apology for not updating the blog for a while. Right after the Bay Area Maker Faire on May 18 and 19, I went to a trip to the UK for about ten days. Then as I came back, I was faced with a load of orders that need to be processed immediately. [...]]]></description>
				<content:encoded><![CDATA[<p>First off, my apology for not updating the blog for a while. Right after the Bay Area Maker Faire on May 18 and 19, I went to a trip to the UK for about ten days. Then as I came back, I was faced with a load of orders that need to be processed immediately. My friend Don and I spent three days non-stop shipping out packages. Now that all the back orders have been processed, I finally felt relieved and can come back to take care of the blog.</p>
<p>As a quick summary of the 2013 Maker Faire: we had a great show. A big thumb-up to Aaron Newcomb for helping me out. Without him, I would not have made it to the Maker Faire. Lots of people came by, chatted with us, provided valuable comments and suggestions, and expressed appreciation and love <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I took pictures with Chris Anderson, and Eben Upton and Liz Upton. I also met and chatted with Laen from OSH Park, Ian Lesnet from Dangerous Prototypes, Mark Frauenfelder (Editor-in-Chief of the Make Magazine), Jason Babler (Creative Director of Maker Media), Michael Caster from the Maker Shed, and many others. This is such a fantastic event, and a great opportunity to meet and make connections with other makers.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/20130518_120701.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/20130518_120701-300x225.jpg" alt="20130518_120701" width="300" height="225" class="alignnone size-medium wp-image-6312" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/20130519_151115.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/06/20130519_151115-300x225.jpg" alt="20130519_151115" width="300" height="225" class="alignnone size-medium wp-image-6313" /></a></p>
<p>This year we didn&#8217;t bring many physical goods sell at the Maker Faire, but instead directed people to place orders online. This way we can devote more time to talk to people. Two interesting things I learned this year: First, <a href="http://aasaver.rayshobby.net" target="_blank">AASaver</a> is surprisingly popular and received much interest, but unfortunately I didn&#8217;t foresee this and hence did not prepare any new stock. What a pity! If I end up going to the New York Maker Faire later this year, I will make sure to take a batch of AASavers there. Second, kids really enjoy playing with flashing LEDs. We&#8217;ve set out a table with coin batteries and self-flashing LEDs, and provided simple instructions to make an LED throwie so people can make one right at the booth and take it away as a gift. This was hugely popular, and all the LEDs and batteries were consumed in no time. Apparently I should prepare more of these next time!</p>
<p>Of course the primary focus of the audience at our booth is on OpenSprinkler and OpenSprinkler Pi (OSPi). Since the release of OSPi just a couple of months ago, it has started gaining significant interest and has become the fastest growing product on my site. So far there have been more than 350 OpenSprinkler Pis out there in the wild. And as you can see from the <a href="http://rayshobby.net/phpBB3/viewforum.php?f=28" target="_blank">forum</a>, lots of people have been keenly working on developing their own software, using different programming languages and implementing advanced features such as weather-based control and sensor-based control. As I will talk about in the next post, the same firmware that&#8217;s running on the microcontroller-based OpenSprinkler has now been ported to OSPi, thanks to the generous contribution by Kimberling. So now you can run the same full-featured interval program on OSPi as in the standard OpenSprinkler.</p>
<p>But if you think the microcontroller-based OpenSprinkler is losing its charm, you couldn&#8217;t be more wrong <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Although not growing as fast as OSPi, it&#8217;s still selling extremely well. Anyone who recently ordered the assembled OpenSprinkler has probably found out that we&#8217;ve been `secretly&#8217; upgrading your order to a pre-release version of OpenSprinkler 2.0. As I will talk about in a follow-up post, OpenSprinkler 2.0 has an upgraded mcu (ATmega644), microSD card slot, the ability of adjusting LCD backlight brightness and contrast, more available pins to interface with external sensors and actuators, and pin headers to directly plug in an RF transmitter in order to interface with remote devices. The only difference of the pre-release version with the final version of 2.0 is in the enclosure design: the pre-release uses the current enclosure, and the final version (which is in production at SeeedStudio) will be using the new injection molded enclosure. There are many good reasons to prefer the microcontroller-based OpenSprinkler over OSPi: it is pre-flashed and works out of the box, so no hassle with installing raspbian, doing ssh, or dealing with Linux; it has LCD, buttons, and a  number of analog pins to interface with external sensors; also I personally really like microcontrollers because of their simplicity and the fact that the controller is instant on when you need to restart it. </p>
<p>Uhh, I think my thoughts are already drifting away from the Maker Fairem which is supposed to be the focus of this post. So let me conclude this post here, and more exciting posts about recent updates will follow next!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6311</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preparing for Bay Area Maker Faire 2013</title>
		<link>http://rayshobby.net/?p=6257</link>
		<comments>http://rayshobby.net/?p=6257#comments</comments>
		<pubDate>Fri, 17 May 2013 04:13:28 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Maker Faire]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6257</guid>
		<description><![CDATA[Contrary to what I mentioned in a previous post, I have made the very last-minute decision to attend the Bay Area Maker Faire 2013. I will be flying out of Massachusetts early tomorrow morning, and get to the Maker Faire ground in the afternoon to do initial setup. Aaron Newcomb has kindly volunteered to help [...]]]></description>
				<content:encoded><![CDATA[<p>Contrary to what I mentioned in a <a href="http://rayshobby.net/?p=5998" title="Maker Faire 2013 OpenSprinkler Booth Call for Help">previous post</a>, I have made the very last-minute decision to attend the Bay Area Maker Faire 2013. I will be flying out of Massachusetts early tomorrow morning, and get to the Maker Faire ground in the afternoon to do initial setup. Aaron Newcomb has kindly volunteered to help me at the booth. If you are planning to come to the Maker Faire, be sure to drop by our booth (exhibit 3375, Expo Hall with commercial makers), and watch our demos.</p>
<p>We will be showing most products I&#8217;ve developed so far: OpenSprinkler (including DIY 1.42u, the new assembled OpenSprinkler 2.0, and new injection molded enclosure), OpenSprinkler Pi, SquareWear (with lots of pictures of wearable electronics workshops I&#8217;ve hosted int he past, and SquareWear demos), AASaver (including the upcoming AASaver 2.0 I <a href="http://rayshobby.net/?p=6223" title="New Development PCB in the Mail Today">just blogged about</a> earlier tonight). So it will be quite a show!</p>
<p>It has been fun to prepare the demos, and a lot of work too. Below are my sketches for two of the OpenSprinkler demos:<br />
<a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2713.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2713-300x212.jpg" alt="IMG_2713" width="300" height="212" class="alignnone size-medium wp-image-6260" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2714.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2714-300x209.jpg" alt="IMG_2714" width="300" height="209" class="alignnone size-medium wp-image-6261" /></a></p>
<p>and some real gears to go with the two demos:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2715.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2715-168x300.jpg" alt="IMG_2715" width="168" height="300" class="alignnone size-medium wp-image-6262" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2712.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2712-300x229.jpg" alt="IMG_2712" height="300" class="alignnone size-medium wp-image-6259" /></a></p>
<p>In terms of promotional materials, new this year I have made a banner and some business cards to be distributed at the table:<br />
<a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2718.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2718-300x168.jpg" alt="IMG_2718" width="300" height="168" class="alignnone size-medium wp-image-6263" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2719.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2719-300x168.jpg" alt="IMG_2719" width="300" height="168" class="alignnone size-medium wp-image-6264" /></a></p>
<p>These were made in the last minute, so they are not as professionally looking as I wanted, but the essential information is there <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Also, I will have lots of colorful info pages and pictures at the table.</p>
<p>Time to go to sleep and prepare for the trip tomorrow. Hope to see you at the Maker Faire OpenSprinkler booth!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6257</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Development PCB in the Mail Today</title>
		<link>http://rayshobby.net/?p=6223</link>
		<comments>http://rayshobby.net/?p=6223#comments</comments>
		<pubDate>Fri, 17 May 2013 01:55:33 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[LED Projects]]></category>
		<category><![CDATA[Product News]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6223</guid>
		<description><![CDATA[Yup, I opened my mail box and found the lovely purple envelope from OSHPark. What&#8217;s in it? Ah ha, it&#8217;s the new AASaver 2.0 prototype PCB. I can&#8217;t help getting my hands on it, so I quickly assembled two. Here is what the assembled board looks like (without and with AA batteries): AASaver 2.0 is [...]]]></description>
				<content:encoded><![CDATA[<p>Yup, I opened my mail box and found the lovely purple envelope from OSHPark. What&#8217;s in it?<br />
<a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2720.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2720-300x169.jpg" alt="IMG_2720" width="300" height="169" class="alignnone size-medium wp-image-6224" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2721.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2721-300x168.jpg" alt="IMG_2721" width="300" height="168" class="alignnone size-medium wp-image-6225" /></a></p>
<p>Ah ha, it&#8217;s the new AASaver 2.0 prototype PCB. I can&#8217;t help getting my hands on it, so I quickly assembled two. Here is what the assembled board looks like (without and with AA batteries):</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2722.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2722-300x168.jpg" alt="IMG_2722" width="300" height="168" class="alignnone size-medium wp-image-6226" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2723.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2723-300x168.jpg" alt="IMG_2723" width="300" height="168" class="alignnone size-medium wp-image-6227" /></a></p>
<p>AASaver 2.0 is sort of a &#8216;mega&#8217; version of <a href="http://rayshobby.net/aasaver" target="_blank">AASaver 1.0</a>: like 1.0, it takes two AA batteries and serves dual functions as both an LED flashlight and breadboard power supply. But it can do much more. First of all, I&#8217;ve added a LiPo charger circuitry so that you can use two AA batteries to charge an external LiPo battery:<br />
<a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2728.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2728-300x169.jpg" alt="IMG_2728" width="300" height="169" class="alignnone size-medium wp-image-6232" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2726.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2726-300x168.jpg" alt="IMG_2726" width="300" height="168" class="alignnone size-medium wp-image-6230" /></a></p>
<p>I&#8217;ve also added an SMT potentiometer (trimmer) to adjust the charge current (see the picture on the right above), anywhere from 20mA to 100mA. This is not a random addition &#8212; there is a good reason to have this feature, which you shall see in a minute.</p>
<p>Another BIG addition is the functionality to charge USB devices like cell phones. Yup, you heard it right: there is a built-in type A USB receptacle that allows you to plug in a USB charging cable to add juice to your phone, MP3 player etc. </p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2725.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2725-300x168.jpg" alt="IMG_2725" width="300" height="168" class="alignnone size-medium wp-image-6229" /></a></p>
<p>So this is similar to Adafruit&#8217;s <a href="http://www.ladyada.net/make/mintyboost/" target="_blank">MintyBoost</a>, except that there is a catch: on MintyBoost, you use a pair of fresh battery to charge the phone, but with AASaver the whole point is to harvest the remaining energy in used or old batteries. How does this affect anything? Well, used batteries typically cannot supply a high amount of current, so you can&#8217;t use them directly to charge the phone &#8212; it simply won&#8217;t provide enough current to charge. The trick is to dump the energy <b>slowly</b> into a LiPo battery, then charge the phone through the LiPo battery later! Essentially the LiPo battery serves as a &#8216;water bucket&#8217;, which accumulates charges slowly (like water drops), so that even used AA batteries can charge it; once the &#8216;water bucket&#8217; has accumulated enough charges, it can dump the &#8216;water&#8217; at much faster rate. This is the same idea as how solar chargers work: solar cells are too weak to charge phones directly, but you can build up the charges by leveraging a battery. Now you see why there is a built-in LiPo charger!</p>
<p>The picture below shows where the LiPo battery should be plugged in when you want to use it to charge USB devices. In sum, if you have a fresh pair of AA batteries, you can charge USB devices directly; otherwise you first charge the LiPo battery with a controllable charging current (20mA recommended), then use the LiPo to charge USB devices. The circuit of AASaver 2.0 accepts either AA or LiPo as the source of its boost converter, and directs the boosted 5V to either USB port, or LiPo charger, selectable through the &#8216;Target&#8217; switch at the right-end of the board. On top of these, there is a separate switch for turning on the flashlight LEDs, and there are pin headers spaced appropriately to match a standard breadboard, so you can use it as a battery-based breadboard 5V power supply. As you can see, it has a load of new features to provide better and more flexible ways to save your AA batteries <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2727.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2727-300x168.jpg" alt="IMG_2727" width="300" height="168" class="alignnone size-medium wp-image-6231" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2728.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2728-300x169.jpg" alt="IMG_2728" width="300" height="169" class="alignnone size-medium wp-image-6232" /></a></p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2727.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2727-300x168.jpg" alt="IMG_2727" width="300" height="168" class="alignnone size-medium wp-image-6231" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2724.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2724-300x168.jpg" alt="IMG_2724" width="300" height="168" class="alignnone size-medium wp-image-6228" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6223</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A VirtualBox Image for Compiling OpenSprinkler Source Code</title>
		<link>http://rayshobby.net/?p=6149</link>
		<comments>http://rayshobby.net/?p=6149#comments</comments>
		<pubDate>Sat, 11 May 2013 15:22:28 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6149</guid>
		<description><![CDATA[I know, it has been a pain to compile OpenSprinkler source code, mainly because the firmware has grown to the point that you can only compile it successfully (i.e. within 32KB size) under a particular version of avr-gcc (4.5.3) in a particular version of Linux. This is very annoying for users who want to modify [...]]]></description>
				<content:encoded><![CDATA[<p>I know, it has been a pain to compile OpenSprinkler source code, mainly because the firmware has grown to the point that you can only <a href="http://rayshobby.net/?page_id=732#compile" target="_blank">compile it successfully</a> (i.e. within 32KB size) under a particular version of avr-gcc (4.5.3) in a particular version of Linux. This is very annoying for users who want to modify the source code and experiment with new features. That&#8217;s why I have decided to create a VirtualBox image with all the necessary software and settings that you need to easily compile it, without having to install a separate Linux system yourself.</p>
<p><font size=2><b>Wait, What?</b></font><br />
<a href="https://www.virtualbox.org/" target="_blank">VirtualBox</a> is a free software that you can use to install and run a virtual operating system (OS) on your existing OS. Let&#8217;s say your computer runs Windows (i.e. the <i>host</i> OS). With VirtualBox, you can run a virtual OS (e.g. Linux) under the host OS, as if it is a Windows application but it&#8217;s a fully functional Linux system. This makes it easy to switch between different OS without having to restart your computer. VirtualBox is quite mature now. It makes use of hardware virtualization features available on most modern CPUs to provide fast speed. So even though you are running a virtual OS, it feels just as fast as a native OS.</p>
<p>One of the benefits of virtual OS is that the entire OS and all settings are stored in a single file &#8212; the VirtualBox Image &#8212; on your host system. So you can easily replicate the same virtual OS on different hosts by a simple copy-paste of the image file.</p>
<p><font size=2><b>Download</b></font><br />
To make it easy to compile OpenSprinkler code, I created a VirtualBox Image for <b>Linux Mint 13</b> with all the necessary software installed. You can download the virtual image file from here:</p>
<ul>
<li><a href="https://docs.google.com/file/d/0B2351auV-OEaeGlaSDRtb0xaMGM/edit?usp=sharing" target="_blank"><b>Linux Mint 13 VirtualBox Image</b></a></li>
</ul>
<p><b><u>Warning</u>:</b> the file size is 2.1GB, so it will take some time to download. Meanwhile, you can read the instructions below.<br />
<b><u>User and Password</u>:</b> the virtual OS has a default sudo user <b>opensprinkler</b> and the password is the same as the user name.<br />
<b><u>VMWare Users</u>:</b> check this <a href="http://rayshobby.net/phpBB3/viewtopic.php?f=2&#038;t=119#p473" target="_blank">forum post</a> for instructions of converting VirtualBox image to VMWare image.<br />
<b><u>Unzip in Windows</u>:</b> do not use the built-in zip/unzip tool of Windows because it seems unable to recognize the correct file size. Use a third-party software such as 7-Zip or WinRAR.</p>
<p>
<hr /></p>
<p><font size=3><b>Instructions</b></font><br />
<b>Step 1. Install VirtualBox</b></p>
<p>Download and install the latest version of <b>VirtualBox</b> from its <a href="https://www.virtualbox.org/wiki/Downloads" target="_blank">official website</a>. You should install the version corresponding to your host OS (Windows, Mac etc.). In the following I will use Windows as an example. After installing the software, you also need to install the <b>VirtualBox Extension Pack</b>. This is platform independent.</p>
<p><b>Step 2. Add a New Virtual OS</b><br />
Unzip the file you downloaded to a local folder. I recommend creating a folder named <b>VirtualBox VMs</b> in your home directory, and unzip everything there. Next, run VirtualBox you just installed, and click on menu <i><b>Machine -> Add</b></i>. Navigate to the folder <i>VirtualBox VMs \ LinuxMint13</i> and select the <i>LinuxMint13.vbox</i> file. Then click on <i>Open</i> to add the file. Now you should see an item named <b>LinuxMint13</b> in the virtual OS list.</p>
<p>Click on <i><b>Settings</b></i> and make sure the default settings are compatible with your system. In particular, you should check if the <i><b>Base Memory</b></i> allocated to your virtual OS is not too large (it defaults to 2GB but depending on how much physical memory you have you may need to reduce it to 1GB). </p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_new.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_new-300x228.jpg" alt="virtualbox_new" height="250" class="alignnone size-medium wp-image-6198" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_settings.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_settings-300x226.jpg" alt="virtualbox_settings" height="250" class="alignnone size-medium wp-image-6199" /></a></p>
<p>Now you can click on <i><b>Start</b></i> to start the virtual OS. There will be a bunch of dialog boxes popping up with various information. If this is the first time you are using VirtualBox, you should read them thoroughly. Once the virtual OS boots up, you should see the desktop as shown in the following. If you want, you can press <i><b>Ctrl-F</b></i> to quit full screen mode, so the virtual OS will look like a normal Windows application running alongside with other applications.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_desktop.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_desktop-300x253.jpg" alt="virtualbox_desktop" width="300" height="253" class="alignnone size-medium wp-image-6197" /></a></p>
<p><b>Step 3. Compile OpenSprinkler Code</b><br />
Arduino 0023 is pre-installed in the virtual OS. So you can just double click on the desktop icon to run it. Also, firmware 1.8.3 source code is pre-installed. So all you need to do to get started is to go to menu <i><b>File -> Examples -> OpenSprinkler -> interval_program</b></i> and then you can compile the code directly. If you need to change and file, or update to new firmware source code, everything is located in the <i>arduino-0023/libraries/OpenSprinkler</i> folder on the desktop.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_arduino.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_arduino-300x250.jpg" alt="virtualbox_arduino" width="300" height="250" class="alignnone size-medium wp-image-6196" /></a></p>
<p><b><u>Note</u></b>: the following two steps are revelent:</p>
<ul>
<li>Specify your hardware version by opening file <font size=2><tt>arduino-0023/libraries/OpenSprinkler/defines.h</tt></font>, and <b>uncomment one</b> of the lines <font size=2><tt>#define SVC_HW_VERSION</tt></font> that corresponds to your hardware version. To identify your hardware version, check the version number printed at the top of your OpenSprinkler circuit board. The current version is 1.4.</li>
<li>If you own OpenSprinkler v1.0 or 1.1, you can no longer upload a program through FTDI. Instead, you need an external ISP programmer. An inexpensive USBtiny programmer is available at <a href="http://rayshobby.net/?page_id=562#acc" target="_blank">Rayshobby Shop</a>.
</li>
</ul>
<p><b>Step 4. Upload Compiled Code</b><br />
To upload the compiled code to your OpenSprinkler controller, first connect OpenSprinkler to your computer through the USB port. Then go to the VirtualBox software, and click (in the menu) <i><b>Devices -> USB Devices -> USBtinySPI</b></i>. This will allow the OpenSprinkler&#8217;s built-in USBtiny programmer to pass through directly to the virtual Linux and appear as a native device. Finally, click on the <i>Upload</i> button in Arduino and you are all set.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_usbtiny.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/virtualbox_usbtiny-300x235.jpg" alt="virtualbox_usbtiny" width="300" height="235" class="alignnone size-medium wp-image-6200" /></a></p>
<p>That&#8217;s all. Hope my effort is helpful for those who want to compile OpenSprinkler source code. Feel free to leave comments, and enjoy playing with the virtual Linux!</p>
<p>
<hr /></p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6149</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>24VAC to 5VDC Conversion</title>
		<link>http://rayshobby.net/?p=6002</link>
		<comments>http://rayshobby.net/?p=6002#comments</comments>
		<pubDate>Fri, 10 May 2013 16:46:09 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Learning Electronics]]></category>
		<category><![CDATA[Power switch]]></category>
		<category><![CDATA[Sprinkler Projects]]></category>

		<guid isPermaLink="false">http://rayshobby.net/?p=6002</guid>
		<description><![CDATA[Voltage conversion from 24VAC to 5VDC is quite useful, because a lot of home automation devices use 24VAC, including sprinkler solenoids, home surveillance systems etc. Having a conversion module makes it easy to use a single power supply, without a separate 5V adapter for your control circuit. There are plenty of resources you can find [...]]]></description>
				<content:encoded><![CDATA[<p>Voltage conversion from 24VAC to 5VDC is quite useful, because a lot of home automation devices use 24VAC, including sprinkler solenoids, home surveillance systems etc.  Having a conversion module makes it easy to use a single power supply, without a separate 5V adapter for your control circuit. There are plenty of resources you can find online about it. But these resources are rather scattered. So in this blog post I will summarize and discuss the common choices.</p>
<p>
<hr /></p>
<h5><b>AC to DC Rectification</b></h5>
<p>Before we begin, the first step is to have a rectifier that converts voltage from AC to DC. The common choices are half-wave rectifier (which requires just one diode) or full-wave rectifier (which requires four diodes). For simplicity, I will use half-wave rectifier as an example. The typical schematic of a half-wave rectifier is as follows:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/half-wave-rectifier.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/half-wave-rectifier-300x155.png" alt="half-wave-rectifier" width="300" height="155" class="alignnone size-medium wp-image-6006" /></a></p>
<p>It&#8217;s simply a diode followed by a capacitor to smooth out the rectified AC waves. As we know, diode only allows current to flow in one direction, so after the AC voltage passes through the diode, only positive voltage remains. The diode must be selected based on the maximum reverse voltage and the maximum current. One thing easy to forget is that when we talk about 24VAC, we mean the RMS (root-mean squared) magnitude of the voltage is 24V. Since AC voltage is a sine wave, the peak voltage is actually 24 * sqrt(2) = 34V, which is quite a bit higher. The maximum reverse voltage applied on the diode is therefore 34 &#8211; (-34) = 68V, which is when the AC voltage runs to the negative peak. So a diode with 70V peak reverse voltage is sufficient.</p>
<p>In practice, transformers that are rated 24VAC usually have a higher no-load voltage, which can vary between 26VAC up to 28VAC. This is typical, and the voltage is supposed to drop close to 24VAC under maximum load (i.e. the current rating of the transformer). As a result, when the circuit is powered on, the transformer can output a peak instantaneous voltage of up to 28 * sqrt(2) = 39.6V. </p>
<p>In the schematic above, I&#8217;ve picked a 1N4002 diode (70V reverse voltage, 1A current) and a 100uF/50V capacitor. These should work well for common scenarios. Note that the voltage output on the capacitor is approximately 34V &#8211; 1V (diode&#8217;s forward drop voltage) = 33VDC. Again, when the transformer is well below maximum load, the output voltage can go as high as 39.6V &#8211; 1V = 38.6V. </p>
<p>So next time if you see a power transformer rated 24VAC, after rectification, gives 39VDC, don&#8217;t be surprised!!</p>
<p>
<hr /></p>
<p>Now that we have a DC voltage, the next part is to step it down to 5VDC. We want it to be regulated, so that the voltage won&#8217;t fluctuate much. There are a variety of solutions:</p>
<h5><b>1. Zener Diode</b></h5>
<p>Probably the simplest solution is to use a <a href="http://en.wikipedia.org/wiki/Zener_diode" target="_blank">Zener diode</a>. As we know, a Zener diode can force the voltage across it to remain constant (break-down voltage) when it&#8217;s in the <i>break-down</i> condition. This condition is met when the current flowing through it (in reverse direction) is at least a few milli-amps (5mA typical) but less than the maximum current allowed (e.g. the diode&#8217;s power rating divided by its break-down voltage). For example, a 5V/1W Zener will remain in break-down condition when the reverse current is between 5mA and 1W/5V = 200mA. The typical schematic is shown as follows:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/zener_regulator.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/zener_regulator-300x178.png" alt="zener_regulator" width="300" height="178" class="alignnone size-medium wp-image-6027" /></a></p>
<p>Here resistor R1 is used for current limiting. Assume D2 is a 5V Zener diode, and the circuit on the right-hand side draws about 180mA current. R1 must be selected such that the current flowing through it is 180mA plus at least 5mA to keep D2 in break-down condition. So we have R1 = (33 &#8211; 5) / 0.185 = 150 ohm. Note that D2 should be rated at least 1W, because in case of open-circuit, it needs to absorb the entire 185mA without burning out. </p>
<p>Now let&#8217;s take a look at the power rating of the resistor R1. Since the current flowing through it is 185mA, the power is 0.185 A * 0.185 A * 150 ohm = 5.1 Watt. Wholly crap &#8212; this is gotta be a big resistor, isn&#8217;t it <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Well, this is the unfortunate drawback of a Zener diode based regulator, that is, it can waste a lot of power and require a bulky resistor. Fundamentally, it regulates the voltage by converting the voltage differential to heat. In this case, the voltage differential is quite big (33V vs. 5V), and the current draw is fairly large (180mA) too, so it ends up wasting a lot of power in heat. </p>
<p>Another drawback is that to increase the current draw, we must decrease R1. Otherwise, if the output circuit starts to draw, say 250mA, that will take D2 out of its break-down condition, and the output voltage is not regulated any more. So overall it is only suitable if the current draw is constant and small (e.g. tens of milliamps).</p>
<p>
<hr /></p>
<h5><b>2. Linear Regulator</b></h5>
<p>Another simple solution is to use a linear regulator, such as the popular <a href="http://en.wikipedia.org/wiki/78xx" target="_blank">7805</a>. The typical schematic is as follows:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/linear_regulator.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/linear_regulator-300x165.png" alt="linear_regulator" width="300" height="165" class="alignnone size-medium wp-image-6040" /></a></p>
<p>The circuit is quite simple, and the output current can vary across a wider range. However, linear regulator shares the same drawback with Zener diodes, that is, it fundamentally works by converting voltage differential to heat. As a result, it wastes the same amount of energy (5.1 Watt in this case) in heat. This is not only a matter of waste, but also it requires a large heat sink to dissipate the heat, otherwise the regulator will burn and smoke. So clearly not an efficient solution. In fact, the efficiency of a linear regulator is the ratio between the output and input voltages. In this case, it is 5 / 33 = 15.15%, which is very poor.</p>
<p>
<hr /></p>
<h5><b>3. Switching Regulator</b></h5>
<p>Now we have come to my favorite topic: switching regulator, also known as switching converter, or switch-mode power supply (SMPS). It uses transistors and a reactive component, namely inductor, to convert voltages much more efficiently. Ideally the switching converter works by simulating the following:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/smps_ideal.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/smps_ideal-300x138.png" alt="smps_ideal" width="300" height="138" class="alignnone size-medium wp-image-6072" /></a></p>
<p>That is, imagine there is an automated switch between the input and output. When the switch is turned on, it connects the input to output, and when it turns off, the input and output are disconnected. This essentially generates a square wave with 33V peak voltage, and the duty cycle is determined by the switch. Suppose the duty cycle is 15.15%, as long as the switching frequency is sufficiently high, at the output it would seem as if you have a constant voltage of 33 * 15.15% = 5V. That&#8217;s it, simple! </p>
<p>The main advantage of switching regulator is that since there is no resistive element, theoretically there is no energy loss at all, so the conversion efficiency is 100%! Of course in practice there will be some energy loss due to the imperfections of electronic components. Still, even at 75% efficiency, we are talking about a power waste of only (5V * 0.18A / 0.75) &#8211; (5V * 0.18A) = 0.3 Watt, much better than the 5.1 Watt waste you saw previously with a linear regulator.</p>
<p>The schematic above may look very simple. But it doesn&#8217;t tell the whole story. Implementing the switch is more complicated than you might think. That brings out the drawback of a switching regulator, namely cost and circuit complexity. It typically involves a transistor or MOSFET that functions as a digitally controlled switch, an oscillator circuit that generates a control square wave, a voltage reference and feedback module that monitors the output voltage, and finally a current sensing or thermal shutdown module that protects the regulator. That&#8217;s why switching regulators are typically provided as integrated circuits.</p>
<p><font size=3><b>MC34063</b></font><br />
Probably the cheapest and most widely used switching regulator is <a href="http://www.onsemi.com/pub_link/Collateral/MC34063A-D.PDF" target="_blank">MC34063</a>. The volume pricing (quantity 100+) is only 20 to 30 cents. Dave Jones at the EEVblog has a nice <a href="http://www.youtube.com/watch?v=qGp82xhybs4" target="_blank">video tutorial</a> about how to use MC34063. Also, there are a lot of <a href="http://dics.voicecontrol.ro/tutorials/mc34063/" target="_blank">MC34063 calculators</a> you can find online, which will help you figure out the component values and parameters.</p>
<p>The schematic on the left below shows what I have been using for <a href="http://www.opensprinkler.com" target="_blank">OpenSprinkler</a>. MC34063 has a maximum input voltage of 40V (and some manufacturers make it 45V), so it&#8217;s perfect for our purpose. The main peripheral elements include inductor L1 (150uH), Schottky diode D2 (1N5819), timing capacitor CT (which controls the switching frequency), current limiting resistors Rsc (0.5 ohm), and feedback resistors RT and RB. This circuit can provide 5V 300mA output. The image on the right below shows a picture of the switching regulator section on OpenSprinkler 1.42u DIY kit.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/mc34063_sch.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/mc34063_sch.png" alt="mc34063_sch" width="300" class="alignnone size-medium wp-image-6081" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/04/IMG_2627.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/04/IMG_2627-300x168.jpg" alt="IMG_2627" width="300" height="168" class="alignnone size-medium wp-image-5748" /></a></p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2666.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2666-300x168.jpg" alt="IMG_2666" width="300" height="168" class="alignleft size-medium wp-image-6091" /></a>On <a href="http://pi.opensprinkler.com" target="_blank">OpenSprinkler Pi</a>, Rsc is reduced to 0.33 ohm (three 1 ohm resistors in parallel) in order to provide higher current required by RPi. The picture on the left shows the switching regulator section on OpenSprinkler Pi, which uses all surface mount components.</p>
<p>MC34063 is quite flexible. It&#8217;s not only useful for step-down voltage conversion, but it can also do step-up conversion (i.e. the output voltage is higher than input voltage), and voltage inversion. On the other hand, it requires a number of peripheral components, and picking the right component values can be tricky, especially if the output current can vary across a wide range. It&#8217;s also prone to noise (remember those annoying humming noise from cheap power adapters), and its maximum current is limited to 1.5A.</p>
<p>Overall if you want a cheap switching regulator, and your circuit draws roughly a fixed amount of current well below 1.5A, then MC34063 is a great choice to consider.</p>
<p><font size=3><b>LM2596</b></font><br />
More recently I&#8217;ve started using <a href="http://www.ti.com/lit/ds/symlink/lm2596.pdf" target="_blank">LM2596</a> as a replacement for MC43063. I came across it when I was shopping for a modular step-down converter and noticed this one from <a href="http://www.amazon.com/LM2596-Converter-Module-Supply-1-23V-30V/dp/B008BHAOQO/" target="_blank">Amazon.com</a>. LM2596 provides up to 3A output current, requires only a small number of peripheral components, and is more reliable and less noisy. In fact, when I started working on OpenSprinkler, I have used a similar product LM2574 for a while, but that has a current limit ot 500mA, and the switching frequency is much lower.</p>
<p>Here is the new design of the voltage conversion section in the upcoming OpenSprinkler 2.0 and OpenSprinkler Pi 1.1:</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/lm2596_sch.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/lm2596_sch.png" alt="lm2596_sch" width="400" class="alignnone size-medium wp-image-6110" /></a><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2709.jpg"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/IMG_2709-300x240.jpg" alt="IMG_2709" height="168" class="alignnone size-medium wp-image-6147" /></a></p>
<p>It uses LM2596-5.0, which has a fixed output voltage of 5.0V. The number of peripheral elements is minimal, and the circuit design is very clean. The main downside is that it is considerably more expensive than MC34063. So the extra capabilities don&#8217;t come for free <img src='http://rayshobby.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Still, for reliability and clean design, I have decided to adopt it for all future circuits.</p>
<p>
<hr /></p>
<h5><b>4. Other Solutions</b></h5>
<p>The above has summarized the common choices I&#8217;ve learned through my experience. There are certainly other solutions as well. For example, you can use a <b>transformer</b> to step 24VAC down to 5VAC, then from that point on you can use a rectifier followed by a linear regulator to convert it further to 5VDC. This is fairly efficient because transformers can have high efficiency, and the linear regulator in this case is also efficient because the voltage differential is small. However, transformers are bulky and expensive. and this solution is not suitable if the input voltage varies across a wide range.</p>
<p>Another choice is to use a <b>capacitor</b> for current limiting, in conjunction with a rectifier and a 5.6V Zener diode for voltage regulation. The idea is similar to solution 1 above, except it uses the capacitor&#8217;s <a href="https://en.wikipedia.org/wiki/Electrical_reactance" target="_blank">reactance</a> (instead of resistor&#8217;s resistance) to limit current. Since there is little energy loss, this is very efficient and is similar to the <a href="https://en.wikipedia.org/wiki/Electrical_reactance" target="_blank">transformerless power supply</a> design, which is frequently found in small wall adapters. Unfortunately, to provide sufficiently high output current (more than tens of milliamps), you will a capacitor that has high capacitance (e.g. 100uF) and is non-polarized. This is not easy to find in real life.</p>
<p><a href="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/transformerless_sch.png"><img src="http://rayshobby.net/wordpress/wp-content/uploads/2013/05/transformerless_sch-300x139.png" alt="transformerless_sch" width="300" height="139" class="alignnone size-medium wp-image-6133" /></a></p>
<p>Finally, you may be wondering why not use a <b>resistor-based voltage divider</b> to split 5VDC out of the 33V rectified input? Well, this is a terrible idea in almost any circumstance I can think of. The reason is that the output voltage will fluctuate considerably depending on the current draw. In other words, it is not regulated. So I can&#8217;t think of any real use of it other than providing voltage reference. </p>
<p>That&#8217;s all. I hope this blog post provides useful information for your own power supply design.</p>
<p>
<hr /></p>
]]></content:encoded>
			<wfw:commentRss>http://rayshobby.net/?feed=rss2&#038;p=6002</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
