<?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>danielsenhwong.com &#187; Projects</title>
	<atom:link href="http://blog.danielsenhwong.com/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.danielsenhwong.com</link>
	<description></description>
	<lastBuildDate>Tue, 22 Feb 2011 01:54:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Setting up Ruby on Rails in OS X</title>
		<link>http://blog.danielsenhwong.com/2011/01/setting-up-ruby-on-rails-in-os-x/</link>
		<comments>http://blog.danielsenhwong.com/2011/01/setting-up-ruby-on-rails-in-os-x/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 00:54:01 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=96</guid>
		<description><![CDATA[I consulted quite a few sources online to try and figure out how to do this, and ran into a few problems that took entirely too much time to solve. Now that I&#8217;ve figured them out, I&#8217;m writing the solutions here in the event I need them again. Hopefully they&#8217;ll be useful to a few [...]]]></description>
			<content:encoded><![CDATA[<p>I consulted quite a few sources online to try and figure out how to do this, and ran into a few problems that took entirely too much time to solve. Now that I&#8217;ve figured them out, I&#8217;m writing the solutions here in the event I need them again. Hopefully they&#8217;ll be useful to a few other people as well.</p>
<p><strong>Goals</strong></p>
<p>Create a Ruby on Rails development environment with Apache, MySQL, and PHP.</p>
<p>There are several possible ways of doing this, but since OS X is a Unix-based platform, I don&#8217;t see any reason to use pre-compiled packages like MacPorts and replacing the built-in software. Plus, this is supposed to be a learning experience.</p>
<p><strong>Sources</strong></p>
<p><a href="http://maestric.com/doc/mac/apache_php_mysql_snow_leopard">http://maestric.com/doc/mac/apache_php_mysql_snow_leopard</a></p>
<p><a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/">http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/</a></p>
<p><span id="more-96"></span></p>
<p><strong>Basic Setup</strong></p>
<p>OS X comes with Apache, Ruby, Rails, and PHP pre-loaded; the specific versions of each are dependent upon the installed version of OS X. In my case, I am starting with a fresh installation of Snow Leopard (10.6), and beginning by downloading all available System Updates, which brings my system to version 10.6.5, with Apache version 2.2.15, Ruby 1.8.7, Rails 2.3.5 , and PHP 5.3.3.</p>
<p>In order to use the pre-loaded Apache installation, go to &#8220;System Preferences&#8221; &gt; &#8220;Sharing&#8221;  and check &#8220;Web Sharing&#8221;. This will enable the Apache web server. If you ever need to restart the server, either uncheck and re-check this box, or use the command &lt;code&gt;sudo apachectl restart&lt;/code&gt; from the command line.</p>
<p>Next, we need a compiler, so we&#8217;ll install Apple&#8217;s Xcode Developer Tools, which can be found on the OS X installation CD/DVD and also online directly from Apple (<a href="http://developer.apple.com/technologies/tools/xcode.html">http://developer.apple.com/technologies/tools/xcode.html</a>). I have version 3.2.3 installed. I&#8217;m writing this up after having performed all of the updates, so the initial version may have been different.</p>
<p><strong>MySQL</strong></p>
<p>MySQL doesn&#8217;t come installed as part of the normal OS X distribution; just OS X Server. No problem; just download an OS X *.dmg package for MySQL Community Server: <a href="http://www.mysql.com/downloads/mysql/#downloads">http://www.mysql.com/downloads/mysql/#downloads</a></p>
<p>Note: OS X Snow Leopard (10.6) and later compile in 64-bit C, so be sure to download the 64-bit version of MySQL (x86_64 suffix). This took me a while to figure out, as I had downloaded the 32-bit version for my 32-bit kernel. I thought it made sense. Version 5.1 should work just fine; I didn&#8217;t try 5.5.</p>
<p>Anyway, the MySQL *.dmg contains three files: the MySQL installer, the MySQL Startup Item installer, and the Preference Pane item. Install them in the order I have listed here. Once it&#8217;s installed, go ahead and try starting the server. The indicator in the Preference Pane item should turn green.</p>
<p>Edit /etc/profile and add &#8220;PATH=$PATH:/usr/local/mysql/bin&#8221;, otherwise you&#8217;ll have to type the full path to the mysql and mysqladmin executables in order to use them.</p>
<p><strong>PHP</strong></p>
<p>You&#8217;ll need to enable PHP by un-commenting a line beginning with &#8220;LoadModule php5_module&#8230;&#8221; in your Apache configuration file, typically found at /private/etc/apache2/apache2.conf.</p>
<p>Additionally, you&#8217;ll have to create a php.ini file in /etc/, which is most easily done by making a copy of &#8220;/etc/php.ini.default&#8221;. While you&#8217;re doing that, un-comment the line for your time zone, and enter a valid value. Additionally, change the three occurrences of &#8220;/var/mysql/mysql.sock&#8221; to &#8220;/tmp/mysql.sock&#8221; in order to point PHP at your MySQL installation.</p>
<p>I like using phpMyAdmin to manage my MySQL databases, so I&#8217;ll need to install this. The process is straightforward and well-documented. However, once you do this, you&#8217;ll notice that you&#8217;ll need PHP to have been compiled with the mcrypt extension, and the OS X distribution hasn&#8217;t been. Not to worry, Michael Gracie has a solution to that problem (<a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/">http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/</a>).  Be sure to update the version numbers of the different software packages accordingly.</p>
<p>Restart the Apache server so these changes to php.ini take effect.</p>
<p><strong>Ruby on Rails</strong></p>
<p>I&#8217;m going to be using Rails 3.0, so I&#8217;ll need to update RubyGems with &#8220;sudo gem update &#8211;system&#8221; followed by &#8220;sudo gem update&#8221; to update all installed gems.</p>
<p>I&#8217;ll need to install a database adapter so that RoR can interface with MySQL. Rails 3 defaults to the mysql2 gem for MySQL databases, so we&#8217;ll install that with &#8220;sudo gem install mysql2 &#8212; &#8211;with-mysql-config=/usr/local/mysql/bin/mysql_config&#8221;.</p>
<p>I want to use the devise plugin for user authentication, so I&#8217;ll install that and its dependent gem, warden.</p>
<p>Finally, I want to use passenger to deploy my Rails application just to make my life easier: &#8220;sudo gem install passenger&#8221; followed by &#8220;sudo passenger-install-apache2-module&#8221; and follow the directions.</p>
<p><strong>Done!</strong></p>
<p>I was going to write more about configuring virtual hosts, but this post languished with &#8220;draft&#8221; status for over a week already.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2011/01/setting-up-ruby-on-rails-in-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Counting records by category [RoR]</title>
		<link>http://blog.danielsenhwong.com/2010/10/counting-records-by-category-ror/</link>
		<comments>http://blog.danielsenhwong.com/2010/10/counting-records-by-category-ror/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 18:10:09 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=94</guid>
		<description><![CDATA[In my Rails application, I have an inventory of items described by three models: the items (cryovials), the place they&#8217;re stored (dewar), and the information about which vials is stored where (ln2_locations). The reason I used three models, rather than rolling the attributes of the third (ln2_locations) into the actual item was that in reality, [...]]]></description>
			<content:encoded><![CDATA[<p>In my Rails application, I have an inventory of items described by three models: the items (<strong>cryovials</strong>), the place they&#8217;re stored (<strong>dewar</strong>), and the information about which vials is stored where (<strong>ln2_locations</strong>).</p>
<p>The reason I used three models, rather than rolling the attributes of the third (<strong>ln2_locations</strong>) into the actual item was that in reality, we normally freeze down multiple vials with the same content at the same time.  I would like to implement this kind of mass assignment at a later time.</p>
<p>Anyway, it is often useful to be able to determine what we have stored, and how much of each different type of content is present. It&#8217;s one thing to know what the SQL code would be to retrieve these records; it&#8217;s another to convert that to an ActiveRecord query when you&#8217;re just learning.</p>
<p>What I would like to do is look at my items (<strong>cryovials</strong>), and pull out the unique content values (e.g. cell types), then go back and count how many vials I have with that content. It would be pretty easy to accomplish this as two separate statements, but that would involve iteration and two separate SQL queries. Best to leave it as one query where I count and select unique fields simultaneously:</p>
<p>Rails:</p>
<pre class="brush: ruby; title: ;">@summary = Ln2Location.select(&amp;quot;count(*) count, contents&amp;quot;).joins(:cryovial).where(:present =&gt; true).group(:contents)</pre>
<p>SQL:</p>
<pre class="brush: sql; title: ;">SELECT count(*) count, contents FROM `ln2_locations` INNER JOIN `cryovials` ON `cryovials`.`id` = `ln2_locations`.`cryovial_id` WHERE (`ln2_locations`.`present` = 1) GROUP BY contents</pre>
<p>I&#8217;m selecting on Ln2Locations because there&#8217;s a property, &#8220;present,&#8221; which I&#8217;m using to select only the vials which haven&#8217;t been physically removed from the collection. Additionally, the relationship between the models is as follows:</p>
<pre class="brush: ruby; title: ;">class Cryovial &lt; ActiveRecord::Base
# Relationships
belongs_to :user
has_many :dewars, :through =&gt; :ln2_location
has_many :ln2_locations
accepts_nested_attributes_for :ln2_locations
</pre>
<pre class="brush: ruby; title: ;">class Dewar &lt; ActiveRecord::Base
# Relationships
belongs_to :laboratory
belongs_to :location
has_many :cryovials, :through &lt; :ln2_locations</pre>
<pre class="brush: ruby; title: ;">class Ln2Location &lt; ActiveRecord::Base
# Relationships
belongs_to :dewar
belongs_to :cryovial</pre>
<p>So only the child model, Ln2Locations, contains the foreign key that would be used to generate the join table.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2010/10/counting-records-by-category-ror/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails: Integrating Devise</title>
		<link>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-integrating-devise/</link>
		<comments>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-integrating-devise/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 03:57:26 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/2010/10/ruby-on-rails-integrating-devise/</guid>
		<description><![CDATA[It is possible to integrate devise into your rails app as part of your user model in order to provide authentication support. - add desired attributes to migration file - make added attributes accessible in model file - either roll your own views or add fields to generated views That&#8217;s it. It really isn&#8217;t difficult [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible to integrate devise into your rails app as part of your user model in order to provide authentication support.</p>
<p>- add desired attributes to migration file<br />
- make added attributes accessible in model file<br />
- either roll your own views or add fields to generated views</p>
<p>That&#8217;s it. It really isn&#8217;t difficult or different than making any other model.</p>
<p>I was worried that it would be complicated, and spent a lot of time reading about devise to be sure. It&#8217;s so easy, no one writes about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-integrating-devise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Optimization: Indexing</title>
		<link>http://blog.danielsenhwong.com/2010/10/database-optimization-indexing/</link>
		<comments>http://blog.danielsenhwong.com/2010/10/database-optimization-indexing/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 14:26:38 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=92</guid>
		<description><![CDATA[After installing devise, I was looking through the migration file, and noticed a couple add_index commands. Reading up on what this actually does, I came across a couple interesting articles about database optimization: Optimizing your MySQL Application Indexing for DB performance details: http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001468&#38;name=add_index I don&#8217;t plan to build a giant Rails application, but Rails is [...]]]></description>
			<content:encoded><![CDATA[<p>After installing devise, I was looking through the migration file, and noticed a couple add_index commands. Reading up on what this actually does, I came across a couple interesting articles about database optimization:</p>
<p><a href="http://articles.sitepoint.com/print/optimizing-mysql-application">Optimizing your MySQL Application</a></p>
<p><a href="http://weblog.jamisbuck.org/2006/10/23/indexing-for-db-performance">Indexing for DB performance</a></p>
<p>details: <a href="http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001468&amp;name=add_index">http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001468&amp;name=add_index</a></p>
<p>I don&#8217;t plan to build a giant Rails application, but Rails is known to have scalability issues. Still good to be aware of these points.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2010/10/database-optimization-indexing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails: on shared hosting, user authentication</title>
		<link>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-on-shared-hosting-user-authentication/</link>
		<comments>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-on-shared-hosting-user-authentication/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 20:23:44 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[customer service]]></category>
		<category><![CDATA[lab]]></category>
		<category><![CDATA[lithium hosting]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tech support]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=89</guid>
		<description><![CDATA[* As usual, this post on Ruby on Rails is more documentation of my development process to supplement my notebook and memory. I can try to answer questions, but please keep in mind that I&#8217;m learning too. I&#8217;ve bought the eBook version of the 4th edition of the Pragmatic Programmers&#8217; Agile Web Development with Rails. [...]]]></description>
			<content:encoded><![CDATA[<p><em>* As usual, this post on Ruby on Rails is more documentation of my development process to supplement my notebook and memory. I can try to answer questions, but please keep in mind that I&#8217;m learning too.</em></p>
<p>I&#8217;ve bought the eBook version of the 4th edition of the Pragmatic Programmers&#8217; <span style="text-decoration: underline;"><a href="http://pragprog.com/titles/rails4/agile-web-development-with-rails">Agile Web Development with Rails</a></span>. It&#8217;s still in beta, but my main goal is to see how things have changed between Rails 2.x and Rails 3. The book also covers some basic user authentication, but it&#8217;s very simplistic. In the interest of getting my project up and going quickly, I looked into <a href="http://github.com/binarylogic/authlogic">authlogic</a> and <a href="http://github.com/plataformatec/devise">devise/warden</a>.</p>
<p>Both authlogic and devise/warden were <a href="http://www.themomorohoax.com/2009/02/21/rails-2-3-authentication-comparison">highly recommended by mischa</a> after building an application that did some direct comparisons of several different RoR user authentication solutions. Good enough for me. devise appears to be more lightweight, so I&#8217;ll try that one first.</p>
<p>A little bit about my server setup: I&#8217;m hosted with <a href="https://www.lithiumhosting.com/billing/aff.php?aff=070">Lithium Hosting</a>, which is a great deal and has fantastic customer service. They&#8217;re not paying me to pitch the service, though clicking the link above and then signing up for a plan gives me referral credits or something. It&#8217;s a shared hosting service, so I manage my site with cPanel if I need/want to, and I&#8217;ve added on SSH access to my account so I don&#8217;t really need to use cPanel.</p>
<p>Once the server upgraded to Rails 3.0/Ruby 1.8.7, a couple things happened: my rails apps stopped starting automatically (cPanel feature), cPanel could no longer start my rails apps, and I couldn&#8217;t create a new Rails app with a MySQL database.</p>
<p>Solutions:</p>
<p>1) install the <a href="http://rubygems.org/gems/mysql2">mysql2 gem</a>, which is the new mysql database adapter used by Rails 3. The compilers are disabled on my host, so this was done via support ticket.</p>
<p>2) add mongrel to my Gemfile,</p>
<p><code lang="ruby">#project/Gemfile<br />
gem 'mongrel'</code></p>
<p>Mongrel isn&#8217;t automatically started in development mode. cPanel still won&#8217;t start my application, so starting the server is done via SSH with</p>
<p><code lang="rails">rails server --port=[port]</code></p>
<p>So now I can create a new project</p>
<p><code lang="rails">rails new project --database=mysql</code></p>
<p>and start the server. However, I don&#8217;t have a good way of authenticating users.</p>
<p>So, back to the support tickets to have both authlogic and devise installed. Once tech support has done that (seven minutes. really.), check if they&#8217;re installed for me:</p>
<p><code lang="ruby">gem server --port=[port]</code></p>
<p>and navigate to mysite.com:[port]. They&#8217;re not, run a couple commands from the command line:</p>
<p><code lang="rails">gem install devise<br />
gem install authlogic</code></p>
<p>Which should install the gems and make them available to me. Checking again as above, and both devise and authlogic are present. Add the appropriate lines to my Gemfile. Then, since I&#8217;m trying out devise first, install it:</p>
<p><code lang="rails">rails generate devise:install</code></p>
<p>That&#8217;s all for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2010/10/ruby-on-rails-on-shared-hosting-user-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Clock Project, Additional Thoughts</title>
		<link>http://blog.danielsenhwong.com/2009/11/word-clock-project-additional-thoughts/</link>
		<comments>http://blog.danielsenhwong.com/2009/11/word-clock-project-additional-thoughts/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 02:00:43 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[word clock]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=53</guid>
		<description><![CDATA[Examining the posted schematic, PCB layout, and parts list for the Word Clock at Instructables, there appear to be several inconsistencies.  I believe that this is due to the fact that the project was revised a few times after the schematic was drawn. Improvements It should be possible to swap out the PIC16F877 that Doug [...]]]></description>
			<content:encoded><![CDATA[<p>Examining the posted schematic, PCB layout, and parts list for the <a href="http://www.instructables.com/id/A-Word-Clock/">Word Clock at Instructables</a>, there appear to be several inconsistencies.  I believe that this is due to the fact that the project was revised a few times after the schematic was drawn.  <span style="text-decoration: underline;"><strong>Improvements</strong></span></p>
<ul>
<li>It should be possible to swap out the PIC16F877 that Doug used for a PIC16F887, which has the same pinouts, with minimal changes to the code, should you decide to rebuild his clock without any modifications aside from upgrading the microcontroller.  And added benefit of using the 887 versus the 877 is that the 887 has a built-in oscillator with a default frequency of 4MHz, so an external oscillator is no longer needed.</li>
</ul>
<p><strong><span style="text-decoration: underline;">Inconsistencies</span></strong></p>
<ul>
<li>The parts list supplied by Doug lists the power regulator as a 78L05, whereas the outline on the PCB layout is for an LM7805.</li>
</ul>
<p>I had a few other things in mind, but I originally drafted this post a while ago, and now no longer remember what else I was going to write.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2009/11/word-clock-project-additional-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Word Clock Project, Initial Impressions</title>
		<link>http://blog.danielsenhwong.com/2009/10/word-clock-project-initial-impressions/</link>
		<comments>http://blog.danielsenhwong.com/2009/10/word-clock-project-initial-impressions/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 16:36:56 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[word clock]]></category>

		<guid isPermaLink="false">http://blog.danielsenhwong.com/?p=47</guid>
		<description><![CDATA[A while ago, Sumeet and Ashley came across a clock which displayed time using words rather than numbers.  It&#8217;s nice, but expensive at €885 or €1,099 for the new stainless steel version. Someone named Doug from Australia (?) came up with an Instructable detailing how to build your own Word Clock for significantly less money, [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, Sumeet and Ashley came across <a href="http://blog.makezine.com/archive/2009/09/qlocktwo_clock_tells_time_with_word.html">a clock which displayed time using words rather than numbers</a>.  It&#8217;s nice, but expensive at €885 or €1,099 for the new stainless steel version.</p>
<div id="attachment_48" class="wp-caption aligncenter" style="width: 414px"><img class="size-full wp-image-48" title="qlocktwo" src="http://blog.danielsenhwong.com/wp-content/uploads/2009/10/qlocktwo.png" alt="Nice, but not €889 nice." width="404" height="534" /><p class="wp-caption-text">Nice, but not €889 nice.</p></div>
<p>Someone named Doug from Australia (?) came up with an <a href="http://www.instructables.com/">Instructable</a> detailing how to <a href="http://www.instructables.com/id/A-Word-Clock/">build your own Word Clock</a> for significantly less money, though it may take some refining to make it pretty.</p>
<div id="attachment_49" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-49" title="InstructablesWordClock" src="http://blog.danielsenhwong.com/wp-content/uploads/2009/10/InstructablesWordClock.jpg" alt="InstructablesWordClock" width="500" height="332" /><p class="wp-caption-text">I don&#39;t know Doug or Megan.</p></div>
<p>This guy Doug also redesigned the faceplate for the clock to include both his name and I&#8217;m assuming the name of his significant other, Megan.  Since I already plan to change the circuit, I&#8217;ll probably change this too, since I don&#8217;t have any good friends named Doug or Megan, and certainly not a Doug or Megan who I&#8217;m both friends with and are significant to one another.</p>
<p><span style="text-decoration: underline;">Proposed Modifications:</span></p>
<p>It seems that the new version have four extra LEDs, one at each corner, to provide more accurate time.  The original clock could be accurate to within five minutes, displaying something like, &#8220;It is five past one&#8221;.  The new clock should keep track of exactly which minute in that five minute interval it actually is, e.g. 0 = x:x0 or x:x5, 1 = x:x1 or x:x6, 2 = x:x2 or x:x7, etc.  This should be relatively easy to implement &#8212; the easiest would be to use one of the pinouts from the PIC microcontroller to send a digital signal to either a series of transistors that would essentially count to five and reset.  Since I don&#8217;t have a whole lot of experience designing that kind of a circuit, the fastest way for me would probably to use a shift register to virtually expand the number of pinouts and address each LED for the minute counting individually.</p>
<div id="attachment_51" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-51" title="InstructablesSchematic" src="http://blog.danielsenhwong.com/wp-content/uploads/2009/10/InstructablesSchematic-300x205.png" alt="You can't turn it off." width="300" height="205" /><p class="wp-caption-text">You can&#39;t turn it off.</p></div>
<p>David suggested that an extra button be added in order to disable illumination of the clock by the LEDs, in case you know, you wanted to actually go to sleep in the same room as that clock.  This would maybe need a pusbutton connected to a comparator that would be connected to an input pin on the micrcontroller, then using one of the pinouts from the microcontroller connected to a transistor to turn on and off the power connection for the LEDs.</p>
<p>In addition, the original clock has 110 characters in an 18&#8243;x18&#8243; square frame with a fairly large border around the text area.  I&#8217;m guessing each letter in the text area has a square inch to itself, for a text area dimension of 11&#8243;x10&#8243; (WxH).  A problem I see with the clock made according to the Instructable is that there are a few more letters, 117 total, in what seems to be either the same or a smaller area (likely smaller), which results in some light leakage between and around characters being backlit.  Therefore, sufficient spacing between characters for dividers to segregate the various words from one another will be necessary.  One possible root of the problem for the Instructables clock is spare PCB panels were used as baffles, and if these spare pieces were etched to remove the copper first, then they would be translucent, leading to light leakage.</p>
<p><span style="text-decoration: underline;">Cost Issues</span></p>
<p>The single largest component cost for this project would probably be the circuit board &#8212; turns out they&#8217;re really expensive, either to have printed or even if you&#8217;re going to use a generic board and do all the wiring yourself.  Looking just at the circuit board needed to mount the LEDs for the display, the costs are pretty high, and this doesn&#8217;t even include the etched circuit board used as a face for the clock, or the controller board.  For example, this 10.5&#8243;x10.5&#8243; <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=V1001-ND">circuit board</a> would be perfect as a surface to mount the LEDs and necessary transistors and resistors, but it&#8217;s $62, or $1.78/sq. in.</p>
<p>It is also possible to etch your own board, and at least for the display portion of the clock, this would require something 10&#8243; square or larger.  <a href="http://www.digikey.com/">Digi-Key</a> has 12&#8243; square unpunched, copper-clad boards starting at $19 single-sided, 1 oz. copper, or $21.50 for double-sided.  The price goes up significantly for pre-punched boards that are copper-clad.</p>
<p>Thinking about this more, it should be possible to shrink the face of the clock, as long as the size of the letters were shrunk as well, which would also reduce the cost quote a bit.</p>
<p>In any case, the third circuit board option would be to design it with some CAD software and have it professionally printed, like from any of these places: <a href="https://www.barebonespcb.com/!BB1.asp">barebonespcb.com</a>, <a href="http://expresspcb.com/">expresspcb.com</a>, or <a href="http://www.batchpcb.com/">batchpcb.com</a> to name a few.</p>
<div id="attachment_52" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-52" title="ASMN-DBLE END-STYLE 6" src="http://blog.danielsenhwong.com/wp-content/uploads/2009/10/ASMN-DBLE-END-STYLE-6-300x300.jpg" alt="ASMN-DBLE END-STYLE 6" width="300" height="300" /><p class="wp-caption-text">Why use screw terminals?</p></div>
<p style="text-align: left;">It seems the best option would be to divide the project between hand-wired parts on a board and a professionally-printed board.  The controller board should be professionally printed, and the LED backing for the clock should be wired by hand, with ribbon cable used to connect the two halves via the screw terminals, or better yet, a pair of sockets.  The face of the clock could be etched as before, though I&#8217;m sure there&#8217;s a better way.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielsenhwong.com/2009/10/word-clock-project-initial-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

