<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUAEQn8yeyp7ImA9WhBbGU0.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649</id><updated>2013-05-18T15:01:43.193-04:00</updated><category term="AVR ATTiny RGB mood lamp PWM" /><category term="Electronics" /><category term="sew bow tie sewing machine" /><category term="christmas story mannequin leg lamp" /><title>Pete's Blog</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://petemills.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/fSUJk" /><feedburner:info uri="blogspot/fsujk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;A0AAQXc9fip7ImA9WhBSE0w.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-274254004226649704</id><published>2013-02-16T11:20:00.002-05:00</published><updated>2013-02-19T19:22:20.966-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-19T19:22:20.966-05:00</app:edited><title>Learning to fly and Perl for METAR Decoding</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-cplt8w4LrMk/URm6oZe5cyI/AAAAAAAADdI/xHZhafZ0soo/s1600/DSCN3883.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="137" src="http://2.bp.blogspot.com/-cplt8w4LrMk/URm6oZe5cyI/AAAAAAAADdI/xHZhafZ0soo/s320/DSCN3883.jpeg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
One of the ways I have been occupying myself is with flight training for a private pilot license or more correctly called a private pilot certificate.&amp;nbsp; It's been off and on lately because I have had to take some time off to focus on other projects, but next month I will be resuming at as fast of a pace as my pocketbook will allow.&amp;nbsp; Since I needed some pilot/flying related activities to keep my interest during this down time I decided to write a Perl parsing script for aviation weather reports called METAR's.&amp;nbsp; But, first how did I find myself in the left seat of an airplane for the first time?&amp;nbsp; Well, read on.&lt;br /&gt;
&lt;br /&gt;
About a year ago as a birthday present I was given a "discovery flight" by my parents.&amp;nbsp; A discovery flight is where a certified flight instructor sticks you in the pilot seat, guides you to take off and fly a plane&amp;nbsp; around for about an hour before landing at the airport where you took off from.&amp;nbsp; This is akin to the "visitation" rooms at the humane society where they let you play with the puppies and cats, all the while knowing that the puppy ( or aircraft, rather ) that you have been playing with is soon to become your highest priority.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Ud_mskOwP-0/UJR1ZHUX4KI/AAAAAAAADcA/m8O6IrmoYiQ/s1600/Bit+Slayer_000627.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-Ud_mskOwP-0/UJR1ZHUX4KI/AAAAAAAADcA/m8O6IrmoYiQ/s320/Bit+Slayer_000627.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
That's how it happened with me anyway.&amp;nbsp; On my discovery flight I pushed the throttle forward.&amp;nbsp; We soon accelerated to 50 knots and when I pulled the yoke toward my chest, the Cessna 152 parted the runway and I became speechless; my breath had been taken thru amazement of the reality of flight.&amp;nbsp; It is one thing to understand the physics of flight and totally different to experience it.&amp;nbsp; General aviation or small aircraft flight isn't anything like the experience of large commercial airplanes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-LGyXefTfMdo/UJR1Vg-IvVI/AAAAAAAADb4/iJ36QmkMLbw/s1600/Bit+Slayer_000593.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-LGyXefTfMdo/UJR1Vg-IvVI/AAAAAAAADb4/iJ36QmkMLbw/s320/Bit+Slayer_000593.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
In fact, I was so taken by this flying that I decided to continue flight lessons, working towards a private pilot certificate.&amp;nbsp; As I mentioned above I have experienced quite a few training delays along the way including taking time off to start &lt;a href="http://lakesideelectronics.net/"&gt;Lakeside Electronics, LLC&lt;/a&gt;, so in the interim I wanted to come up with some activities related to flying. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-3oH8ZOnRYk4/UJR1b40fYhI/AAAAAAAADcI/vLXPqUBOyfI/s1600/Bit+Slayer_000630.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-3oH8ZOnRYk4/UJR1b40fYhI/AAAAAAAADcI/vLXPqUBOyfI/s320/Bit+Slayer_000630.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-qs_6MziNwrc/URm7eLCvBgI/AAAAAAAADdU/eEs9ncGfgRk/s1600/DSCN3888.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="125" src="http://2.bp.blogspot.com/-qs_6MziNwrc/URm7eLCvBgI/AAAAAAAADdU/eEs9ncGfgRk/s320/DSCN3888.jpeg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
Early on in my flight training I recognized the impact and importance of weather on general aviation or I should say, aviation in general.&amp;nbsp; There are even aviation specific weather reports such as METARs that pilots access for preflight weather planning.&amp;nbsp; You can look up a report for an airport near you using their ICAO station identifier code here &lt;a href="http://aviationweather.gov/adds/metars/"&gt;http://aviationweather.gov/adds/metars/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Here is an example METAR string from the airport I fly out of in Ann Arbor, Michigan: &lt;span style="font-family: Monospace,Courier;"&gt;KARB 021653Z 34015G23KT 10SM OVC033 04/M03 A2996 RMK AO2 SLP150 T00441033.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Monospace,Courier;"&gt;&lt;br /&gt;&lt;/span&gt;
As you read the above report you can probably make out what some of the sub-strings mean.&amp;nbsp; For example, before researching I postulated that " OVC033 " meant overcast, but I did not fathom that the second half was referring to cloud height in 100's of feet.&amp;nbsp; Could " SLP150 " be something to do with slip?&amp;nbsp; Nope, Sea Level Pressure - in tens, units and tenths to be added to 1000 hPa no less.&amp;nbsp; In other words, 15.0 hPa + 1000 hPa = 1015.0 hPa.&amp;nbsp; However, if the string were a high number like SLP965 you would add that value ( 96.5hPa ) to 900 hPa instead for a reading of 996.5 hPa.&amp;nbsp; Yes, its a strange little protocol...&lt;br /&gt;
&lt;br /&gt;
Almost certainly I needed to study up on how to interpret this METAR report.&amp;nbsp; Fortuitously, it would seem, I had concurrently begun learning the programming language Perl.&amp;nbsp; A perfect storm, it would seem, to write a Perl based parsing script for METAR weather reports and display these data in a more human readable format was afoot.&lt;br /&gt;
&lt;br /&gt;
The goal of course is two fold.&amp;nbsp; A) To learn Perl and B) to memorize a method of METAR interpretation for when I need to read the raw string.&amp;nbsp; Quite obviously there are numerable ways to accomplish these tasks.&amp;nbsp; There also exists METAR decoders and even a &lt;a href="http://jeremy.zawodny.com/perl/Geo-METAR/"&gt;Perl Module&lt;/a&gt; for this task, but this would violate my goals as set forth and thus decided to write my own Perl METAR parsing script. &lt;br /&gt;
&lt;br /&gt;
When I turned to Google for information about the METAR protocol I found this page &lt;a href="http://www.met.tamu.edu/class/metar/quick-metar.html"&gt;http://www.met.tamu.edu/class/metar/quick-metar.html&lt;/a&gt; helpful indeed.&amp;nbsp; If you recall, we discussed the sub-string for sea level pressure above.&amp;nbsp; There are too, other little gotchas along the way when trying to programmatically decode METAR reports.&amp;nbsp; For instance, some data are always reported, some data are optionally reported and within the raw string as a whole, the sometimes reported data is intermingled with the always reported data.&amp;nbsp; I also have reason to believe that the information contained in the remarks ( RMK ) section can partially exist as plain English, and so that is where my parsing stops - before we get to the optional remarks.&amp;nbsp; I may look into further coding of the remarks, but for now I am satisfied with the script.&lt;br /&gt;
&lt;br /&gt;
This &lt;a href="http://en.wikipedia.org/wiki/Perl"&gt;Perl&lt;/a&gt; script uses &lt;a href="http://en.wikipedia.org/wiki/CURL"&gt;Curl&lt;/a&gt; to fetch a &lt;a href="http://en.wikipedia.org/wiki/METAR"&gt;METAR&lt;/a&gt; string from weather.noaa.gov.&amp;nbsp; Then it parses the string, does some formatting and a couple of calculations for Celsius to Fahrenheit conversion then writes the data to a text file.&amp;nbsp; Using a program on my macbook called &lt;a href="http://projects.tynsoe.org/en/geektool/"&gt;GeekTools&lt;/a&gt; I am able to display the contents of the Perl generated text file on my desktop.&amp;nbsp; It looks like this on my desktop.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-v6nbqdgYH30/URm8b9nWxMI/AAAAAAAADdg/tPxh14kWFGU/s1600/Screen+Shot+2013-02-09+at+11.32.48+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://2.bp.blogspot.com/-v6nbqdgYH30/URm8b9nWxMI/AAAAAAAADdg/tPxh14kWFGU/s320/Screen+Shot+2013-02-09+at+11.32.48+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Before continuing, I must say that you shouldn't use this script for flight planning and also, that it is largely untested.&amp;nbsp; Please report any bugs that you may find.&amp;nbsp; Part of my ongoing memorization of METAR syntax is to read the string and my scripts output and look for errors. &lt;br /&gt;
&lt;br /&gt;
If you want to play along, install Geektools from the link in the previous paragraph.&amp;nbsp; You will also want to copy the Perl script from below.&amp;nbsp; Save the Perl script in a folder somewhere on your computer.&amp;nbsp; I named my folder "metar" and located in ~/Documents/Weather/.&amp;nbsp; Start up GeekTools and configure like so...&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-rX_QRZPWpYw/URm4fFrlGlI/AAAAAAAADc0/HM0QDFsYJ7Y/s1600/Screen+Shot+2013-02-11+at+10.34.35+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="217" src="http://4.bp.blogspot.com/-rX_QRZPWpYw/URm4fFrlGlI/AAAAAAAADc0/HM0QDFsYJ7Y/s320/Screen+Shot+2013-02-11+at+10.34.35+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The command in the above screen cap is "cat ~/Documents/Weather/metar/metar_datafile.txt" without quotes.&amp;nbsp; Change this as required for your particular path and file name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is the code.&amp;nbsp; It is definitely a work in progress.&amp;nbsp; Every time I spot an error I correct it but I haven't seen any errors in a while now.&amp;nbsp; Let me know if you do.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="cpp" name="code"&gt;  
#!/usr/bin/perl -w

# this program gathers METAR data from NOAA, decodes it and does some formatting before writing the data to a text file
# this file is monitored and displayed on my macbook desktop using GeekTools
#
# Under no circumstances should you use this for flight planning.  Also, no guarantee is made that this software even works at all.
#
# Below is an example of the metar_datafile.txt after the curl command.  There are 2 lines as you can see.
#
# 2012/10/27 11:53
# KARB 300153Z AUTO 35018G34KT 10SM OVC095 06/M05 A2978 RMK AO2 PK WND 35034/0144 SLP090 T00561050
#
#

#while( 1 ){
my $ICAO_STATION = "KARB"; # airport nearby

my $raw_metar_data = `curl --silent http://weather.noaa.gov/pub/data/observations/metar/stations/$ICAO_STATION.TXT`;

chomp $raw_metar_data;

my  ( $date_time, $current_metar_line ) = split /\n/,$raw_metar_data;

chomp $date_time;
chomp $current_metar_line;

# put the METAR string into an array 
my @metar_array = split / /, $current_metar_line;
my $array_index = 0;

open (MYFILE, '&gt;metar_datafile.txt'); #open for write &gt;&gt; would be for apend

#
# print the full array we are about to decode separated by spaces
print MYFILE "@metar_array\n";

#
# print the station ID as read
print MYFILE "ICAO Station ID: $metar_array[ $array_index ]\n";
++$array_index;

#
# print the day of the metar transmission
my $day = substr( $metar_array[ $array_index ], 0, 2 );
print MYFILE "Day: $day";

# print ^st, ^nd, ^rd or ^th at the end of the date just for a bit of fun
#my $right_digit = substr( $day, 1, 1 );

#$day = "3";



if( ( scalar $day == 1 ) || ( scalar $day == 21 ) || ( scalar $day == 31 ) ){
 print MYFILE "st\n";
}
elsif( ( scalar $day == 2 ) || ( scalar $day == 22 ) ){
 print MYFILE "nd\n";
}
elsif( ( scalar $day == 3 ) || ( scalar $day == 23 ) ){
 print MYFILE "rd\n";
}else{
 print MYFILE "th\n";
}


#
# print the time of the metar transmission in zulu time aka 0 GMT
my $zulu_hours = substr( $metar_array[ $array_index ], 2, 2 );
my $zulu_minutes = substr( $metar_array[ $array_index ], 4, 2 );
print MYFILE "Report Time ( Zulu ): $zulu_hours:$zulu_minutes\n";

++$array_index;


#
# decode and print report type ( auto or corrected or none )
#
# test String
# $metar_array[ $array_index ] = "COR";


if( $metar_array[ $array_index ] eq "AUTO" ){
 print MYFILE "Report Autonomy: Automatic - No human intervention.\n";
 ++$array_index;
 }
elsif( $metar_array[ $array_index ] eq "COR" ){
 print MYFILE "Report Autonomy: Corected observations.\n";
 ++$array_index;
 } 
else{
 print MYFILE "Report Autonomy: Human observer or Automatic with human oversight.\n";
}


#
# decode and print wind data

print MYFILE "Wind Condition: ";

# the first three characters are either VBR or they contain wind direction
my $wind_direction = substr( $metar_array[ $array_index ], 0, 3 );

# the next two characters always contain wind speed
my $wind_speed = substr( $metar_array[ $array_index ], 3, 2 );

if( $wind_direction eq "VBR" ){
 print MYFILE "Direction variable at $wind_speed knots.\n";
 ++$array_index;
}
# else if the string contains a 'V' for variable wind over 6 knots...
elsif( $metar_array[ $array_index ] =~ /V/ ){
 print MYFILE "Wind from $wind_direction degrees at $wind_speed knots - ";
 my $dir1 = substr( $metar_array[ $array_index ], 9, 3 );
 my $dir2 = substr( $metar_array[ $array_index ], 13, 3 );
 print MYFILE "Variable between $dir1 and $dir2 degrees.\n";
 ++$array_index;
} 
# else if the string contains a 'G' for gust
elsif( $metar_array[ $array_index ] =~ /G/ ){
 print MYFILE "Wind from $wind_direction degrees at $wind_speed knots - ";
 my $gust_speed = substr( $metar_array[ $array_index ], 6, 2 );
 print MYFILE "Gusts to $gust_speed knots.\n";
 ++$array_index; 
}
else{
 print MYFILE "Wind from $wind_direction degrees at $wind_speed knots.\n";
 ++$array_index;
}


#
# decode and print visibility

print MYFILE "Visibility: ";

# remove "SM" from the end of the string leaving the visibility in statute miles
my $visibility = $metar_array[ $array_index ];
chop $visibility;
chop $visibility;

# if the string still contains an 'M' after the chops there is a special case
if( $visibility =~ /M/ ){
 print MYFILE "Less than 1/4 statute miles.\n";
} 
elsif( $visibility eq 9999 ){
 print MYFILE "Greater than maximum recorded value.\n";
}
else{
 print MYFILE "$visibility statute miles.\n";
}
++$array_index;



#
# decode and print runway visual range if reported
# this string should contain a forward slash if it contains runway visual data
#
# test string
# $metar_array[ $array_index ] = "R16/P20000VM211FT";

if( $metar_array[ $array_index ] =~ /\// ){
 
 print MYFILE "Runway Visual Range: ";
 
 my( $runway, $range ) = split /\//, $metar_array[ $array_index ];
 
 # remove the 'R' from the runway number
 $runway =~ s/.//;
 
 # remove "FT" from the range(s)
 chop $range;
 chop $range;
 
 # there is a 'V' in $range_a if the visual range is variable
 if( $range =~ /V/ ){
  my( $range_a, $range_b ) = split /V/, $range;
  print MYFILE "Runway $runway has a visual range between ";
  
  # check for the M or P modifier
  if( $range_a =~ /M/ ){
   #remove the 'M'
   $range_a =~ s/.//;
   print MYFILE "less than $range_a and ";
  }
  elsif( $range_a =~ /P/ ){
   # remove the 'P'
   $range_a =~ s/.//;
   print MYFILE "greater than $range_a and ";
  }
  else{
   print MYFILE "$range_a and ";
  }
  
  if( $range_b =~ /M/ ){
   #remove the 'M'
   $range_b =~ s/.//;
   print MYFILE "less than $range_b feet.\n";
  }
  elsif( $range_b =~ /P/ ){
   # remove the 'P'
   $range_b =~ s/.//;
   print MYFILE "greater than $range_b feet.\n";
  }
  else{
   print MYFILE "$range_b feet.\n";
  }
  
  
  
 }
 else{
  print MYFILE "Runway $runway has a visual range of ";
  
  # check for the M or P modifier
  if( $range =~ /M/ ){
   #remove the 'M'
   $range =~ s/.//;
   print MYFILE "less than $range feet.\n";
  }
  elsif( $range =~ /P/ ){
   # remove the 'P'
   $range =~ s/.//;
   print MYFILE "greater than $range feet.\n";
  }
  else{
   print MYFILE "$range feet.\n";
  }
    
 }
 ++$array_index;
}



#
# decode and print weather phenomena if it exists
#
# test string
#$metar_array[ $array_index ] = "+RAPRTS-DRPL";

my $weather_phenom = $metar_array[ $array_index ];

# if the current string does not contain cloud cover data then it is weather phenomena

if( $weather_phenom !~ "SCK" &amp; $weather_phenom !~ "CLR" &amp; $weather_phenom !~ "FEW" &amp; $weather_phenom !~ "SCT" &amp;
 $weather_phenom !~ "BKN" &amp; $weather_phenom !~ "OVC" &amp; $weather_phenom !~ "VV" )
 {
  print MYFILE "Weather Phenomena: ";
  
  my $string_index = 0;
  my $string_length = length $weather_phenom;
  
  while( $string_index &lt; $string_length ){
  
   my $sub_string = substr( $weather_phenom, $string_index, 2 ); 
   
   if( $sub_string =~ /\+/ ){    
    print MYFILE "Heavy ";
    ++$string_index;
   }
   elsif( $sub_string =~ /\-/ ){
    print MYFILE "Light ";
    ++$string_index;
   }
   #else{
   # print MYFILE "Moderate ";
   #}
   
   $sub_string = substr( $weather_phenom, $string_index, 2 );
   
   # hash lookup
   
   %weather_type = ( "VC" =&gt; "Vicinity ",
        "MI" =&gt; "Shallow ",
        "PR" =&gt; "Partial ",
        "BC" =&gt; "Patches ",
        "DR" =&gt; "Low Drifting ",
        "BL" =&gt; "Blowing ",
        "SH" =&gt; "Showers ",
        "TS" =&gt; "Thunderstorm ",
        "FZ" =&gt; "Freezing ",
        "DZ" =&gt; "Drizzle ",
        "RA" =&gt; "Rain ",
        "SN" =&gt; "Snow ",
        "SG" =&gt; "Snow grains ",
        "IC" =&gt; "Ice crystals ",
        "PL" =&gt; "Ice Pellets ",
        "GR" =&gt; "Hail ",
        "GS" =&gt; "Small hail ",
        "UP" =&gt; "Unknown ",
        "BR" =&gt; "Mist ",
        "FG" =&gt; "Fog ",
        "FU" =&gt; "Smoke ",
        "VA" =&gt; "Volcanic ash",
        "DU" =&gt; "Widespread dust ",
        "SA" =&gt; "Sand ",
        "HZ"  =&gt; "Haze ",
        "PY" =&gt; "Spray ",
        "PO" =&gt; "Well developed dust/sand swirls ",
        "SQ" =&gt; "Squalls ",
        "FC" =&gt; "Funnel clouds including tornadoes or waterspouts ",
        "SS" =&gt; "Sandstorm ",
        "DS"  =&gt;  "Duststorm ",
        );
        
   print MYFILE "$weather_type{ $sub_string }";
   
   # see if there is another weather code
   $string_index += 2;
  }
  
  print MYFILE "\n";
  ++$array_index;
}


#
# decode and print the cloud cover data ( always present )
#
# test string
#$metar_array[ $array_index ] = "BKN120";

print MYFILE "Cloud cover: ";

# if there are multiple cloud conditions which can occur...
while( $metar_array[ $array_index ] =~ /(SCK|CLR|FEW|SCT|BKN|OVC|VV)/ ){
my $sky = 0;
my $cloud_height = 0;
 

if( $metar_array[ $array_index ] =~ /VV/ ){

 $sky = substr( $metar_array[ $array_index ], 0, 2 );
 $cloud_height = substr( $metar_array[ $array_index ], 2, 3 );
}
else{

 $sky = substr( $metar_array[ $array_index ], 0, 3 );
 $cloud_height = substr( $metar_array[ $array_index ], 3, 3 );
}


%sky_condition = ( "SCK" =&gt; "Sky Clear ",
     "CLR" =&gt; "Clear sky",
     "FEW" =&gt; "Few clouds ",
     "SCT" =&gt; "Scattered clouds ",
     "BKN" =&gt; "Broken clouds ",
     "OVC" =&gt; "Overcast clouds ",
     "VV" =&gt; "Vertical visibility ",
     );
     
print MYFILE "$sky_condition{ $sky }";

# if $sky has clouds in it then report the cloud height.
# if skies are clear, do not report cloud height

if( $sky =~ /(FEW|SCT|BKN|OVC|VV)/ ){
# cloud height is given in hundreds of feet
$cloud_height *= 100;

print MYFILE " at $cloud_height feet. ";
}
++$array_index;
}   

#
# decode and print the temperature and dewpoint ( always present )

my( $temperature_c, $dewpoint_c ) = split /\//, $metar_array[ $array_index ];

# if it is a negative number
if( $temperature_c =~ /M/ ){
 # remove the 'M' from the temperature
 $temperature_c =~ s/.//;
 $temperature_c *= -1; # and make it a negative number
}

if( $dewpoint_c =~ /M/ ){
 # remove the 'M' from the dewpoint
 $dewpoint_c =~ s/.//;
 $dewpoint_c *= -1; # and make it a negative number
}

my $temperature_f = $temperature_c * 1.8 + 32;
my $dewpoint_f = $dewpoint_c * 1.8 + 32;

print MYFILE "\nTemperature: $temperature_c degrees C / Dewpoint: $dewpoint_c degrees C.\n";
print MYFILE "Temperature: $temperature_f degrees F / Dewpoint: $dewpoint_f degrees F.\n";

++$array_index;


#
# decode and print atmospheric pressure ( always present )
#
# test_string
#$metar_array[ $array_index ] = "Q1234"; 
#$metar_array[ $array_index ] = "A1234"; 

my $atm = $metar_array[ $array_index ];

# if our pressure is reported in mb aka hPa
if(  $atm =~ /Q/ ){

 # remove the 'Q' from the pressure
 $atm =~ s/.//;
 print MYFILE "Atmospheric Pressure: $atm hPa\n";

}

# if our pressure is reported in mb aka hPa
elsif(  $atm =~ /A/ ){

 # remove the 'A' from the pressure
 $atm =~ s/.//;
 
 my $whole_inhg = substr( $atm, 0, 2 );
 my $frac_inhg = substr( $atm, 2, 2 );
 
 print MYFILE "Atmospheric Pressure: $whole_inhg.$frac_inhg inHg\n";

}

++$array_index;



#
# decode and print


close (MYFILE); 

#sleep( 60 );
#}






















&lt;/pre&gt;
&lt;br /&gt;
Ok, onward and upward.&amp;nbsp; Clear for takeoff.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/GItGsR6fcFU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/274254004226649704/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=274254004226649704" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/274254004226649704?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/274254004226649704?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/GItGsR6fcFU/learning-to-fly-and-perl-for-metar.html" title="Learning to fly and Perl for METAR Decoding" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-cplt8w4LrMk/URm6oZe5cyI/AAAAAAAADdI/xHZhafZ0soo/s72-c/DSCN3883.jpeg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2013/02/learning-to-fly-and-perl-for-metar.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MERXs-eCp7ImA9WhJUFEo.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-5177872917326321609</id><published>2012-09-12T14:39:00.000-04:00</published><updated>2012-09-12T14:43:24.550-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-12T14:43:24.550-04:00</app:edited><title>KD8TBW - My HAM Radio Call Sign</title><content type="html">I recently took an FCC Exam for radio broadcast privileges.&amp;nbsp; I passed and as the title suggests my HAM or Amateur Radio Call Sign is &lt;a href="http://wireless2.fcc.gov/UlsApp/UlsSearch/license.jsp?licKey=3408537"&gt;KD8TBW&lt;/a&gt; or in the &lt;a href="http://en.wikipedia.org/wiki/NATO_phonetic_alphabet"&gt;NATO Phonetic Alphabet&lt;/a&gt;&amp;nbsp; Kilo, Delta, Eight, Tango, Bravo, Whiskey.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
I decided to take the test after I reading the April 2012 issue of &lt;a href="http://www.nutsvolts.com/"&gt;Nuts and Volts Magazine&lt;/a&gt;.&amp;nbsp; On page 68 was an article on how to get your HAM license and the opening question was " If you are interested in electronics and radio communications, why aren't you a HAM? ".&amp;nbsp; Well I couldn't answer that question and the article had a very compelling list of&amp;nbsp; "10 things you can do as a HAM " so I set out to change my unlicensed status.&lt;br /&gt;
&lt;br /&gt;
If you are wondering what HAM radio is, why you need a license or what cool things you can do as a HAM then head over to the &lt;a href="http://www.arrl.org/what-is-ham-radio"&gt;American Radio Relay League ( ARRL ) website&lt;/a&gt; and take a look.&amp;nbsp; You'll discover many interesting activities that becoming a HAM will open up to you such as talking to &lt;a href="http://www.nasa.gov/mission_pages/station/main/index.html"&gt;astronauts aboard the ISS&lt;/a&gt;, bouncing radio signals off the moon or meteor showers and &lt;a href="http://en.wikipedia.org/wiki/Transmitter_hunting"&gt;fox hunts&lt;/a&gt; with &lt;a href="http://www.ccars.org/Projects/TapeYagi/index.htm"&gt;Tape Measure Yagi Antennas&lt;/a&gt; for radio direction finding.&lt;br /&gt;
&lt;br /&gt;
You may also discover loosely related projects that don't require a HAM radio license.&amp;nbsp; For instance, together with my Dad, we have recently begun construction of a &lt;a href="http://w2du.com/r2ch22.pdf"&gt;Quadrifilar Helicoidal Antenna&lt;/a&gt; for recieving&lt;a href="http://en.wikipedia.org/wiki/Automatic_Picture_Transmission"&gt; APT messages&lt;/a&gt; from NOAA Weather Satellites, but more on that one in a later post.&lt;br /&gt;
&lt;br /&gt;
I'm still pretty wet behind the ears with all this HAM radio stuff, but it is providing a good bit of entertainment so far.&amp;nbsp; I picked up a &lt;a href="http://www.kenwoodusa.com/Communications/Amateur_Radio/Portables/TH-F6A"&gt;Kenwood TH-F6A Radio&lt;/a&gt; and I even joined a local HAM radio club called ARROW Communications in Ann Arbor.&amp;nbsp; I'm pretty sure I want to get into a mobile radio for my car so let me know if you have any suggestions on mobile setups.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/VJK8Y-NWPKQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/5177872917326321609/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=5177872917326321609" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5177872917326321609?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5177872917326321609?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/VJK8Y-NWPKQ/kd8tbw-my-ham-radio-call-sign.html" title="KD8TBW - My HAM Radio Call Sign" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/09/kd8tbw-my-ham-radio-call-sign.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkABRHY8eyp7ImA9WhJVF0s.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-4455801260032177713</id><published>2012-09-04T09:19:00.000-04:00</published><updated>2012-09-04T09:19:15.873-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-04T09:19:15.873-04:00</app:edited><title>Thor - A Programmable Brake Light Modulator</title><content type="html">I have been rather busy developing products for my new company &lt;a href="http://lakesideelectronics.net/"&gt;Lakeside Electronics, LLC&lt;/a&gt; and as such, haven't had much time to post anything in the way of projects over here.&amp;nbsp; This is OK however, because despite the massive amount of work involved in bringing a product like &lt;a href="http://lakesideelectronics.net/products-page/product-category/thor-a-programmable-brake-light-modulator/"&gt;Thor&lt;/a&gt; to market, it turns out to be pretty fun too.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Of course, I still have a few irons in the hobby fire, and with Halloween coming up there are bound to be some scary, or at a minimum, vaguely direful ideas cropping up in my yet-to-be-zombified mind.&amp;nbsp; But, first, I have some microcontrollers to program for a Boy Scout Troop.&amp;nbsp; I was recently contacted by (them) and I am quite pleased to help them out making&lt;a href="http://petemills.blogspot.com/2011/08/halloween-spooky-eyes.html"&gt; Halloween Spooky Eyes&lt;/a&gt;.&amp;nbsp; Anytime someone is interested in learning new things I think it is fantastic.&lt;br /&gt;
&lt;br /&gt;
Ok, so back to &lt;a href="http://lakesideelectronics.net/products-page/product-category/thor-a-programmable-brake-light-modulator/"&gt;Thor - A Programmable Brake Light Modulator&lt;/a&gt; and Lakeside Electronics.&amp;nbsp; If you have been reading my recent posts you are probably already aware of what a &lt;a href="http://lakesideelectronics.net/technology/"&gt;brake light modulator is&lt;/a&gt;.&amp;nbsp; If you have any feedback, &lt;a href="http://lakesideelectronics.net/about-us/"&gt;I'd like to hear it&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
And finally here is the video for Thor.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object width="320" height="266" class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://3.gvt0.com/vi/fjrDrNV6ZOs/0.jpg"&gt;&lt;param name="movie" value="http://www.youtube.com/v/fjrDrNV6ZOs&amp;fs=1&amp;source=uds" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/fjrDrNV6ZOs&amp;fs=1&amp;source=uds" type="application/x-shockwave-flash" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/NDDR7IxzBjM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/4455801260032177713/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=4455801260032177713" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4455801260032177713?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4455801260032177713?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/NDDR7IxzBjM/thor-programmable-brake-light-modulator.html" title="Thor - A Programmable Brake Light Modulator" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/09/thor-programmable-brake-light-modulator.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkACRXoyfip7ImA9WhJQGEo.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8726127512117153426</id><published>2012-08-01T21:20:00.000-04:00</published><updated>2012-08-01T21:26:04.496-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-01T21:26:04.496-04:00</app:edited><title>More Flashing Brake Lights</title><content type="html">It seems like summer is the season for brake light flashers and Greg, a reader of &lt;a href="http://petemills.blogspot.com/"&gt;Pete's Blog&lt;/a&gt; just emailed me to show me what he has been up to.&amp;nbsp; After reading my original post &lt;a href="http://petemills.blogspot.com/2012/04/tenty-led-brake-lights.html"&gt;Tenty LED Brake Lights&lt;/a&gt; which is a brake light modulator and LED light engine integrated onto perf board, Greg set out to make a version for his Yamaha V-Star 1100.&lt;br /&gt;
&lt;br /&gt;
I'm impressed with Greg's craftsmanship which you can see in the photos below, but what you can't see is that he used an Arduino to program the ATTiny85 with the original code which can be &lt;a href="http://petemills.blogspot.com/2012/04/tenty-led-brake-lights.html"&gt;found here.&lt;/a&gt;&amp;nbsp; This is cool because if you have an Arduino laying around, but no programmer, you can still make a modulating LED brake light for yourself.&amp;nbsp; Greg said the following links were useful to him in using his Arduino as a programmer &lt;a href="http://hlt.media.mit.edu/?p=1229"&gt;http://hlt.media.mit.edu/?p=1229&lt;/a&gt; and &lt;a href="http://hlt.media.mit.edu/?p=1695"&gt;http://hlt.media.mit.edu/?p=1695&lt;/a&gt; but ended up not changing the default 1 Mhz clock on the ATTiny85 and instead changed the delay between flashes in the code from 25 mS to 75 milliseconds.&lt;br /&gt;
&lt;br /&gt;
Have a look at video and pics&amp;nbsp; below to see for yourself how cool Greg's flashing LED brake light turned out.&amp;nbsp; I really like the pattern the LED's make on the tail light lens.&amp;nbsp; If you have any pictures or video of a project you have made with the help of Pete's blog, send me an email, I'd like to see!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/ElhI2xmy4HY/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/ElhI2xmy4HY?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/ElhI2xmy4HY?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-VNuEWLZFqGs/UBnTL4lv_FI/AAAAAAAADZ0/omGfGFXDDCo/s1600/SAM_3283.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-VNuEWLZFqGs/UBnTL4lv_FI/AAAAAAAADZ0/omGfGFXDDCo/s320/SAM_3283.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-3qHtj53MwaY/UBnTK4P-MDI/AAAAAAAADZk/j6RB52r8x0A/s1600/SAM_3281.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-3qHtj53MwaY/UBnTK4P-MDI/AAAAAAAADZk/j6RB52r8x0A/s320/SAM_3281.JPG" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-n_soR3W1CcY/UBnTNHZecJI/AAAAAAAADZ8/qa_FVvkO69I/s1600/SAM_3352.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-n_soR3W1CcY/UBnTNHZecJI/AAAAAAAADZ8/qa_FVvkO69I/s320/SAM_3352.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-iqo2-wIkreY/UBnTLaGdGOI/AAAAAAAADZs/2IbfogijozA/s1600/SAM_3282.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-iqo2-wIkreY/UBnTLaGdGOI/AAAAAAAADZs/2IbfogijozA/s320/SAM_3282.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-UQWCiHl-Zqg/UBnTMeJw15I/AAAAAAAADZ4/aO5iyAACpL4/s1600/SAM_3284.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-UQWCiHl-Zqg/UBnTMeJw15I/AAAAAAAADZ4/aO5iyAACpL4/s320/SAM_3284.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-el6VhlZiUbs/UBnTNlPkg5I/AAAAAAAADaA/g8hv5_chwHk/s1600/SAM_3353.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-el6VhlZiUbs/UBnTNlPkg5I/AAAAAAAADaA/g8hv5_chwHk/s320/SAM_3353.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-iWuq4moqd74/UBnTN9pxWPI/AAAAAAAADaE/pffxVLCR6tE/s1600/SAM_3354.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-iWuq4moqd74/UBnTN9pxWPI/AAAAAAAADaE/pffxVLCR6tE/s320/SAM_3354.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-cOKkb84Zga4/UBnTOr7HqnI/AAAAAAAADaI/WlUyRRNSZA8/s1600/SAM_3355.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-cOKkb84Zga4/UBnTOr7HqnI/AAAAAAAADaI/WlUyRRNSZA8/s320/SAM_3355.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/A_0hj3Bp8-c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8726127512117153426/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8726127512117153426" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8726127512117153426?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8726127512117153426?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/A_0hj3Bp8-c/more-flashing-brake-lights.html" title="More Flashing Brake Lights" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-VNuEWLZFqGs/UBnTL4lv_FI/AAAAAAAADZ0/omGfGFXDDCo/s72-c/SAM_3283.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/08/more-flashing-brake-lights.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4CQ30_eSp7ImA9WhJQEk8.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8413473698264539313</id><published>2012-07-25T08:43:00.002-04:00</published><updated>2012-07-25T10:02:42.341-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-25T10:02:42.341-04:00</app:edited><title>Betelgeuse Brake Light flasher by Lakeside Electronics, LLC</title><content type="html">It's been a couple months since I have posted anything and that's because I've been hard at work &lt;a href="http://lakesideelectronics.net/products-page/product-category/betelguese-a-programmable-led-brake-lamp/"&gt;developing a product&lt;/a&gt; and starting a company called &lt;a href="http://lakesideelectronics.net/"&gt;Lakeside Electronics, LLC&lt;/a&gt;.&amp;nbsp; The first product available thru Lakeside Electronics is a brake light flasher to add conspicuity to motorcycles primarily, but also cars, trucks, trailers or even custom vehicles.&amp;nbsp; Actually, &lt;a href="http://lakesideelectronics.net/products-page/product-category/betelguese-a-programmable-led-brake-lamp/"&gt;Betelgeuse - A Programmable LED Brake Lamp&lt;/a&gt; is an LED brake light using 4 Cree X-Lamp LED's with an integrated flash pattern controller.&lt;br /&gt;
&lt;br /&gt;
Check out the video below to see some of the different flash or strobe patterns Betelgeuse ( pronounced BeetleJuice or Betel Juice ) can display.&amp;nbsp; Betelgeuse can even modulate the LED light in a way to look like old school filament bulbs.&amp;nbsp; If you are interested in purchasing Betelgeuse you can head over to the &lt;a href="http://lakesideelectronics.net/products-page/product-category/betelguese-a-programmable-led-brake-lamp/"&gt;product page at LakesideElectronics.net&lt;/a&gt; and hit "add to cart".&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://1.gvt0.com/vi/WtoHFpIVaIU/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/WtoHFpIVaIU&amp;fs=1&amp;source=uds" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/WtoHFpIVaIU&amp;fs=1&amp;source=uds" type="application/x-shockwave-flash" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Betelgeuse is really cool because it requires no wiring modifications, you just twist the bulb in and you are done.&amp;nbsp; It is fully configurable by using only your brake lever for changing and storing the flash pattern.&amp;nbsp; It also has a recording feature where you can record your own flash or strobe pattern by recording your brakes.&amp;nbsp; The recording time is fixed at 10 seconds which is plenty of time to tap a brake light message in &lt;a href="http://en.wikipedia.org/wiki/Morse_code"&gt;Morse Code&lt;/a&gt;.&amp;nbsp; Of course, Betelgeuse can also act as a traditional LED brake light with no flashing too.&lt;br /&gt;
&lt;br /&gt;
If you are interested in the full details you can &lt;a href="http://lakesideelectronics.net/Betelgeuse_User_Manual_2012.07.10.pdf"&gt;download the Betelgeuse owners manual&lt;/a&gt; from the &lt;a href="http://lakesideelectronics.net/downloads/"&gt;downloads page&lt;/a&gt; to see how capable this modulating brake light really is.&lt;br /&gt;
&lt;br /&gt;
Currently Betelgeuse&amp;nbsp; comes in type 1157 dual filament type bases.&amp;nbsp; Of course, dual filament bulbs fit is several bases in addition to the 1157.&amp;nbsp; There are a couple versions of Betelgeuse brake light strobes in the works, so if you are interested keep checking back to see what's new.&amp;nbsp; I'm really excited about &lt;a href="http://lakesideelectronics.net/products-page/product-category/betelguese-a-programmable-led-brake-lamp/"&gt;Betelgeuse - A Programmable LED Brake Lamp&lt;/a&gt; and I hope you are too.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/Fonf1oN60tw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8413473698264539313/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8413473698264539313" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8413473698264539313?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8413473698264539313?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/Fonf1oN60tw/betelgeuse-brake-light-flasher-by.html" title="Betelgeuse Brake Light flasher by Lakeside Electronics, LLC" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/07/betelgeuse-brake-light-flasher-by.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EDRH49eip7ImA9WhVbEU4.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-157108525570231186</id><published>2012-05-27T13:19:00.004-04:00</published><updated>2012-05-27T13:27:55.062-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-27T13:27:55.062-04:00</app:edited><title>LED Stroboscope from a Clapper Lamp Prototype</title><content type="html">&lt;br /&gt;
A little while ago a writer for Popular Science magazine approached me asking if I would be interested in collaborating with them write a " How To " article based on my &lt;a href="http://petemills.blogspot.com/2012/01/clever-clapper.html"&gt;Clever Clapper post&lt;/a&gt; the other month.&amp;nbsp; Well, of course I would, that sounds awesome! And so, I made another Clapper lamp, this time leaving out the laser activated moon lamp so as to better fit the magazine space.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
Clapper Demo&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/6clRa7tZMVk/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/6clRa7tZMVk?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;


&lt;param name="bgcolor" value="#FFFFFF" /&gt;


&lt;embed width="320" height="266"  src="http://www.youtube.com/v/6clRa7tZMVk?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
Party Mode Demo&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/obkR_kocgxU/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/obkR_kocgxU?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;


&lt;param name="bgcolor" value="#FFFFFF" /&gt;


&lt;embed width="320" height="266"  src="http://www.youtube.com/v/obkR_kocgxU?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Fast forward a few months and you can find in the June 2012 issue, the " Diy Clapper " article on page 80.&amp;nbsp; You can see an online version of the article and links to software etc on the &lt;a href="http://www.popsci.com/diy/article/2012-05/how-build-homemade-clapper-adjust-lights-and-set-mood"&gt;Popular Science page here.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
All in all, it was a pretty cool experience, but I am left with another clapper lamp now.&amp;nbsp; And worse, dueling clapper lamps that have no mechanism by which to synchronize themselves.&amp;nbsp; Two claps may or may not turn on both the new clapper lamp and original Clever Clapper leaving me with flip flopping lights until I have to resort to manual control of one or the other lamp.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-mV_9sRmHqKs/T8Jg9-0EcII/AAAAAAAADZQ/1nO4KtnhMZo/s1600/WP_000520.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/-mV_9sRmHqKs/T8Jg9-0EcII/AAAAAAAADZQ/1nO4KtnhMZo/s320/WP_000520.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The non-necessity of having multiple clap activated lamps in my house prompted me to make an LED Stroboscope with the latest lamp - utilizing as much of the hardware as possible.&amp;nbsp; I only added a potentiometer to set the strobe frequency.&lt;br /&gt;
&lt;br /&gt;
I would not design a stroboscope with this hardware from scratch, but it is a good reuse of the lamp and circuit that would otherwise sit idle.&amp;nbsp; For instance, a fairly big drawback is the 8-bit timer in the ATTiny85.&amp;nbsp; The frequency step changes are quite noticeable and I would prefer a 16-bit timer like the ATMega328 has.&lt;br /&gt;
&lt;br /&gt;
And of course with those extra uC pins I could add a display to show the frequency rather than relying on an oscilloscope for measuring the output frequency.&amp;nbsp; Having said that however, with a lack of crystal on the ATTiny85, using the internal RC oscillator instead, it is probably better to measure the frequency externally rather than an internally calculated frequency display.&lt;br /&gt;
&lt;br /&gt;
You can see the hardware changes from the Clapper lamp outlined in the schematic below.&amp;nbsp; I disconnected a few connections and added a potentiometer, that's about it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-gKvtng4pRCg/T8JSJ-Z7I_I/AAAAAAAADY4/0AJZfbRKjgQ/s1600/Screen+Shot+2012-05-27+at+12.09.59+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="215" src="http://3.bp.blogspot.com/-gKvtng4pRCg/T8JSJ-Z7I_I/AAAAAAAADY4/0AJZfbRKjgQ/s320/Screen+Shot+2012-05-27+at+12.09.59+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The software for the stroboscope can be downloaded &lt;a href="https://sites.google.com/site/pemills2011/file/stroboscope_v1.0.c?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&amp;nbsp; It isn't the prettiest of code as, but it should suffice until I can build another stroboscope with a more concentrated effort.&lt;br /&gt;
&lt;br /&gt;
To operate the stroboscope you just turn it on and the lamp is strobing somewhere between ~4 Hz and ~31.3 kHz.&amp;nbsp; The maximum flash rate is high enough so as not to be noticed.&amp;nbsp; So you can use it as a reading lamp.&amp;nbsp; Pressing the tactile switch shuffles thru a loop, changing the timer presets thus decreasing the flash rate by 2 times, each press until it loops back to the beginning.&amp;nbsp; Find your range with the tact switch then turn the potentiometer to set the exact frequency required to stop motion.&lt;br /&gt;
&lt;br /&gt;
In the video below,&amp;nbsp; there are on screen comments noting the points where the strobe frequency is a multiple of the fan speed.&amp;nbsp; It is advantageous to use a mark on symmetrical parts to determine when the strobe frequency is a multiple of the part frequency or spot on.&amp;nbsp; I marked this fan blade with a sharpie so I know that if the rotational motion appears stopped and I see two arrows ( sharpie marks ) then the strobe frequency is 2x the fan speed.&amp;nbsp; It should follow that one sharpie mark showing means the strobe is 1x the fan speed.&amp;nbsp; This is the basic principle of stroboscopes, but for a more in depth look have a look at this &lt;a href="http://en.wikipedia.org/wiki/Stroboscope"&gt;wikipedia entry&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/XALfAD7fWuA/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/XALfAD7fWuA?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;


&lt;param name="bgcolor" value="#FFFFFF" /&gt;


&lt;embed width="320" height="266"  src="http://www.youtube.com/v/XALfAD7fWuA?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I am pretty pleased with the results and knowing the limitations of this stroboscope I can still see it being useful to me.&amp;nbsp; Of course I look forward to making a more full featured model with improved timer hardware etc, but for now I can inspect all kinds of rotating or oscillating mechanical bits in pseudo slow motion.&amp;nbsp; I can also measure the speed of unknown objects easily as well as prototype some zoetropes or similar.&lt;br /&gt;
&lt;br /&gt;
As an aside, have a look at this scope my Mother bought me out of the blue the other day - just in time to use it for this project too!&amp;nbsp; How cool is that?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-YCbSNohelXo/T8Jc5cQ9gAI/AAAAAAAADZE/D9b89iEtrnE/s1600/Bit+Slayer_001033.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-YCbSNohelXo/T8Jc5cQ9gAI/AAAAAAAADZE/D9b89iEtrnE/s320/Bit+Slayer_001033.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/J_IASShCpB4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/157108525570231186/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=157108525570231186" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/157108525570231186?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/157108525570231186?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/J_IASShCpB4/led-stroboscope-from-clapper-lamp.html" title="LED Stroboscope from a Clapper Lamp Prototype" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-mV_9sRmHqKs/T8Jg9-0EcII/AAAAAAAADZQ/1nO4KtnhMZo/s72-c/WP_000520.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/05/led-stroboscope-from-clapper-lamp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4MRX4_fCp7ImA9WhJRFUk.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-7474307834392813602</id><published>2012-04-15T21:39:00.000-04:00</published><updated>2012-07-17T12:53:04.044-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-17T12:53:04.044-04:00</app:edited><title>Tenty LED Brake Lights</title><content type="html">&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Z-gu0ihC-Xs/T4sr-9IZluI/AAAAAAAADW0/xBVMKsBaJJA/s1600/Bit+Slayer_000788.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-Z-gu0ihC-Xs/T4sr-9IZluI/AAAAAAAADW0/xBVMKsBaJJA/s320/Bit+Slayer_000788.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
UPDATE:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This project was so overwhelmingly well received that it has spawned a commercial interest.&amp;nbsp; The version available for purchase varies somewhat in it's flash patterns and also in the ability to record and play back your own flash patterns.&amp;nbsp; If you would like to check it out take a look at &lt;a href="http://lakesideelectronics.net/?wpsc-product=betelguese-a-programmable-led-brake-lamp"&gt;Betelgeuse - A Programmable LED Brake Lamp&lt;/a&gt; at my new company Lakeside Electronics, LLC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I Purchased a motorcycle about two weeks ago.&amp;nbsp; Interestingly, whenever I tell someone this news, they immediately proceed to tell me the most gruesome injuries and stomach turning plights that they or someone they know, has fallen victim to while motorcycling.&amp;nbsp; In some cases, these raconteur's briefly pause to look over their shoulder, presumably scanning for small children or otherwise offendable ears, before delivering the goriest details.&lt;br /&gt;
&lt;br /&gt;
One commonality in these stories, aside from the macabre and arguably poor timing involved in telling them to me is that many accidents come down to a lack of visibility of motorcycles and their riders.&amp;nbsp; Less than Argus-eyed motorists often pull out into the path of a motorcycle and with insufficient time for evasive action, that quickly an accident has occurred.&amp;nbsp; Other times, drivers may focus on the car ahead of the motorcycle and in the event of stopping at a red light or similar, fail to leave enough room for the motorcycle, unfortunately rear ending him or her.&lt;br /&gt;
&lt;br /&gt;
In the photo below, you can see that I am in one piece and the bike is also.&amp;nbsp; Let's see what we can do to help keep things that way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-mMJNl_Plu90/T4ssV34adoI/AAAAAAAADW8/_KboFkqUw1c/s1600/Bit+Slayer_000709.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-mMJNl_Plu90/T4ssV34adoI/AAAAAAAADW8/_KboFkqUw1c/s320/Bit+Slayer_000709.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To partially combat the lack of visibility I decided to make a replacement brake light for my bike; one that would strobe briefly when I applied the brakes then stay solid on.&amp;nbsp; I got this idea when I noticed a similar strobing effect to the brake lights on an ambulance that I was following near to, but not immediately behind.&amp;nbsp; Those lights really got me to notice the ambulance which I had largely ignored up until that point.&lt;br /&gt;
&lt;br /&gt;
I would also want a way to be able to disable the brief flash before the brake light stays solid on.&amp;nbsp; This could be useful if the flash was ever to cause a safety hazard to other drivers or if I am ever stopped by the police for having this system I can easily disable the strobe part and still have a functioning brake light; I do not want to be stranded.&amp;nbsp; I wrote the software so that if you turn the key on while you have the brakes applied, the flash is disabled.&amp;nbsp; You must turn the key off, then back on, without the brake applied to restore the flash functionality.&lt;br /&gt;
&lt;br /&gt;
Here is a video of the prototype Tenty LED Brake Light installed and operating.&amp;nbsp; In the video, I demonstrate the flashing brake light 3 times and then key off.&amp;nbsp; Then I disable the strobing part by turning the key on while holding the brake on, demonstrate that several times and key off again.&amp;nbsp; Finally I re-enable the strobing functionality by key on with the brake off.&amp;nbsp; For the purposes of the video, I lengthened the duration of the flash on and off times.&amp;nbsp; This is so the camera can better capture the flashes.&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/bsCtKpdZ1XY/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/bsCtKpdZ1XY?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;




&lt;param name="bgcolor" value="#FFFFFF" /&gt;




&lt;embed width="320" height="266"  src="http://www.youtube.com/v/bsCtKpdZ1XY?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to keep this system reversible should I ever have the need to put it back to stock, here is how I mounted the circuit board inside the tail light lens.&amp;nbsp; I bought some replacement bulbs at a local auto parts store, broke out the glass and desoldered the filament.&amp;nbsp; I replaced the filament by soldering wires to the tail light power, brake light power and ground.&amp;nbsp; I ran a file over the solder blobs just enough to level them out so they would make good contact with the socket.&amp;nbsp; I then filled the bayonet base with epoxy and inserted an 8-32 stainless steel screw into the base being careful not to touch the screw to any metal,&amp;nbsp; accidentally making the screw a conductor.&amp;nbsp; Below are a few pictures of this process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-bgISktoia3k/T4sv0ZR1OOI/AAAAAAAADXE/LBPT3Zu3SYU/s1600/Bit+Slayer_000683.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-bgISktoia3k/T4sv0ZR1OOI/AAAAAAAADXE/LBPT3Zu3SYU/s320/Bit+Slayer_000683.jpg" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-2UKNMTdSJ6w/T4swImrXecI/AAAAAAAADXM/TL6m1xX62pQ/s1600/Bit+Slayer_000686.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-2UKNMTdSJ6w/T4swImrXecI/AAAAAAAADXM/TL6m1xX62pQ/s320/Bit+Slayer_000686.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-nad85RltZ3I/T4swk-6hobI/AAAAAAAADXc/todizU_BbCs/s1600/Bit+Slayer_000701.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/-nad85RltZ3I/T4swk-6hobI/AAAAAAAADXc/todizU_BbCs/s320/Bit+Slayer_000701.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;After installing the modified bayonet screw mounts I threaded two nuts on each and jammed them together.&amp;nbsp; This is what the back of the circuit board will rest on.&amp;nbsp; You can see several pictures of the final assembly below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ouvGj4Zb1dI/T4tpFJ9xP0I/AAAAAAAADX0/9JW8Py26c_8/s1600/Bit+Slayer_000785.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-ouvGj4Zb1dI/T4tpFJ9xP0I/AAAAAAAADX0/9JW8Py26c_8/s320/Bit+Slayer_000785.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-HuB69VSNgL0/T4tpV0MMMbI/AAAAAAAADX8/K9fjhmb-QWg/s1600/Bit+Slayer_000796.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-HuB69VSNgL0/T4tpV0MMMbI/AAAAAAAADX8/K9fjhmb-QWg/s320/Bit+Slayer_000796.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-Fqq-CSgmdF4/T4totrKBNqI/AAAAAAAADXs/2KfqPUb6eDo/s1600/Bit+Slayer_000745.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-Fqq-CSgmdF4/T4totrKBNqI/AAAAAAAADXs/2KfqPUb6eDo/s320/Bit+Slayer_000745.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-6W-DVOj4aI4/T4tpv6BU9iI/AAAAAAAADYE/l4-DhKkAV0c/s1600/Bit+Slayer_000799.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-6W-DVOj4aI4/T4tpv6BU9iI/AAAAAAAADYE/l4-DhKkAV0c/s320/Bit+Slayer_000799.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Circuit:&lt;br /&gt;
&lt;br /&gt;
The circuit is basically a large array of 
really bright red LED's ( Light Engine ) and an ATTiny85 microcontroller to tell the LED 
light engine how to behave.&amp;nbsp; There are also two high brightness LED's 
that shine downward onto the license plate.&amp;nbsp; They are solid on all the 
time as required by the Michigan vehicle code.&amp;nbsp; The &lt;a href="http://www.mouser.com/ProductDetail/Optek/OVFSRAC8/?qs=UY4NetwcvwlN6dUy2%2f5NtA%3d%3d"&gt;red LED's&lt;/a&gt;,
 made by Optek have a 100 degree viewing angle and output 8000 mlm each -
 there are 16 of them.&amp;nbsp; The brake light switch delivers it's ~12 V 
signal translated thru an 2n3904 transistor to pull a microcontroller 
pin low.&amp;nbsp; I usually use 14.4 V when doing calculations for operating voltage on 12V systems like this.&amp;nbsp; Total current draw with all LED's at maximum brightness is less than 500 mA.&amp;nbsp; I ordered the logic level mosfet &lt;a href="http://www.mouser.com/ProductDetail/International-Rectifier/IRLU3410PBF/?qs=9%252bKlkBgLFf09xnqw0semuw%3d%3d"&gt;IRLU3410PBF&lt;/a&gt; from mouser.com also, which is used for the PWM control of the light engine.&amp;nbsp; Below you will find a screen cap pic of the schematic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-BAEwmOhty5k/T4tgB2_ri4I/AAAAAAAADXk/eZ5juaaZFoI/s1600/LED+Brake+Light+Schematic+v1.0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="262" src="http://2.bp.blogspot.com/-BAEwmOhty5k/T4tgB2_ri4I/AAAAAAAADXk/eZ5juaaZFoI/s320/LED+Brake+Light+Schematic+v1.0.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Software&lt;br /&gt;
&lt;br /&gt;
There are two modes of operation to this brake light - flashing and non flashing.&amp;nbsp; The non flashing brake light is activated by turning the key on while holding the brake and behaves just like a stock brake light would.&amp;nbsp; Flashing mode is enabled by default so key on with brake off and you are good to go.&amp;nbsp; In this mode, the LED light engine strobes briefly upon initial application of the brake then is a steady on light.&amp;nbsp; I set the period of the flashes to be higher for the videos so the camera could pick them up, you can see in the code below that the flash period is twice as fast in the operational version of the software.&amp;nbsp; Feel free to use the code as you see fit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/*
Program Description: 

This program controls an LED light engine used as a brake light on a motorcycle.
When the brakes are applied the tail light flashes several times off then on before
being a steady on brake light.

The program also has a feature to disable the flashing brake light and the brake light will
behave like a standard lamp ie no flashing.  This mode is enabled ( flash mode disabled )
by turning the motorcycles key on while holding the brake on.  The state is reset after a power 
cycle.

Legal Note:  I read the entire vehicle code for my state.  It does not address brake light flashers, but
does prohibit " rotating, oscillating or flashing red lights ".  I believe a brake light flasher
differs from " rotating, oscillating and flashing " lights in the implied duration of operation.  
My state did not respond to emails I sent requesting clarification.  
Basically, modify your vehicle at your own risk.

Change Log
2012.4.21 - added 1 mS debounce to brake switch in main loop - Pete


A circuit description and other details can be found at http://petemills.blogspot.com

Filename: led_brakelight_main.c
Author: Pete Mills
petemills.blogspot.com
2012.4.15

Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms

*/



//********** Includes **********

#include &amp;lt;avr/io.h&amp;gt;     
#include &amp;lt;util/delay.h&amp;gt;   



//********** Definitions **********

// Output to LED Light Engine

#define LED   PB0  
#define LED_PORT PORTB
#define LED_DDR  DDRB


// Input for Brake Switch

#define BRAKE_SWITCH  PINB4  // bit is clear when brake switch is pressed
#define BRAKE_SWITCH_PORT PINB
#define BRAKE_SWITCH_DDR DDRB



// PWM Preset Values

#define TAIL_LIGHT_PWM  25
#define BRAKE_LIGHT_PWM  255



//********** Function Prototypes **********

void setup( void );
void brake_alert( uint8_t number_of_flashes );



//********** Global Variables **********

uint8_t disable_flash = 0; // if 1, the flashing part of the brake light will be disabled


int main(void)
{


setup();

_delay_ms( 5 );



// if the brake light is held on during boot up, disable the flashing
// flashing can only be disabled during boot up ( key on ) and is reset after power down ( key off )
// this could be useful if you suddenly learn your flashing light is causing a problem for other motorists 
// or citizens employed to monitor the adherence to legislation and cite violations for deviation from such 


if ( bit_is_clear( BRAKE_SWITCH_PORT, BRAKE_SWITCH ) )
{
 disable_flash = 1; 
}



 while(1)
 { 
  
  
  if ( bit_is_clear( BRAKE_SWITCH_PORT, BRAKE_SWITCH ) )  // if the brakes are applied
  {

   _delay_ms( 1 ); // filter time aka debounce

   if ( bit_is_clear( BRAKE_SWITCH_PORT, BRAKE_SWITCH ) )  // if the brakes are actually applied
   {  

   // if we are allowed to flash, do
   
   if( disable_flash == 0 ) 
   {
    brake_alert( 5 );
   }
  

   // if the brakes are still applied, hold the LED light engine to a brighter output
   // until you release the brakes
   
   while( bit_is_clear( BRAKE_SWITCH_PORT, BRAKE_SWITCH ) )
   {
    OCR0A = BRAKE_LIGHT_PWM;
   }
   
   _delay_ms( 100 ); // debounce the brake switch release ( break )
   
   }   

  }
  
  OCR0A = TAIL_LIGHT_PWM;  // restore the tail light on
  
  
  
  /*
  // demo mode
  for( ;; )
  {
  brake_alert(6);
  OCR0A = BRAKE_LIGHT_PWM;
  _delay_ms(2000);
  OCR0A = TAIL_LIGHT_PWM;
  _delay_ms(4000);
  }
  */
   
 }
}




//********** Functions **********

void setup(void)
{



 //********* Port Config *********

 LED_DDR |= ( 1 &amp;lt;&amp;lt; LED);   // set PB0 to "1" for output 
 LED_PORT &amp;amp;= ~( 1 &amp;lt;&amp;lt; LED );   // turn the led light engine off

 BRAKE_SWITCH_DDR &amp;amp;= ~( 1 &amp;lt;&amp;lt; BRAKE_SWITCH );   // set BRAKE_SWITCH pin to 0 for input
 BRAKE_SWITCH_PORT |= ( 1 &amp;lt;&amp;lt; BRAKE_SWITCH );   // write a 1 to BRAKE_SWITCH to enable the internal pullup



 //********** PWM Config *********
 
 TCCR0A |= ( ( 1 &amp;lt;&amp;lt; COM0A1 ) | ( 1 &amp;lt;&amp;lt; WGM01 ) | ( 1 &amp;lt;&amp;lt; WGM00 ) ); // non inverting fast pwm
 TCCR0B |= ( 1 &amp;lt;&amp;lt; CS00 ); // start the timer
 
 
}




void brake_alert( uint8_t number_of_flashes )
{
 // here we create a visual alert that the brakes have been applied
 // pass this function the number of flashes desired ( off then on = 1 )
 
 //uint8_t delay_between_flashes = 50; // for video demonstration purposes ( video aliasing issues ) 
 uint8_t delay_between_flashes = 25; // every day use
 uint8_t alert_pwm_min = 2;   // minimum and max values to flash between during the alert
 uint8_t alert_pwm_max = 255;
 
 
 for( int i = 0; i &amp;lt; number_of_flashes; i++ )
 {
  OCR0A = alert_pwm_min;
  _delay_ms( delay_between_flashes );
  OCR0A = alert_pwm_max;
  _delay_ms( delay_between_flashes );
 }

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Legal Note:&lt;br /&gt;
&lt;br /&gt;
I'm not too sure what to say about the legality of this project.&amp;nbsp; I read the entire vehicle code for my state.&amp;nbsp; There was no reference to brake light flashers for cars or motorcycles.&amp;nbsp; The vehicle code for Michigan does prohibit " rotating, oscillating or flashing lights " on non-emergency vehicles, however I believe my brake light does not qualify as the clear intent in the vehicle code was " rotating, oscillating or flashing " lights that continue to do so for an extended period of time as emergency or police vehicles do. Really, my device is no different than tapping your brake pedal several times before stopping your motorcycle.&amp;nbsp; In the end, I did send an email to the state of Michigan requesting clarification.&amp;nbsp; At the time of this writing there has been no response.&amp;nbsp; I think the bottom line is, don't modify your vehicle unless you are willing to accept full responsibility for any outcome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are a couple pictures of the build process.&amp;nbsp; The abstract looking pictures are of the LED light engine shining thru my desk magnifier onto the ceiling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-U58tTu_kwDM/T4tuOJZ6E-I/AAAAAAAADYM/QmcKAK0N4K0/s1600/Bit+Slayer_000773.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-U58tTu_kwDM/T4tuOJZ6E-I/AAAAAAAADYM/QmcKAK0N4K0/s320/Bit+Slayer_000773.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-UH4DsW6Xd2o/T4tuo92q9SI/AAAAAAAADYU/j__70DBB4X8/s1600/Bit+Slayer_000763.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-UH4DsW6Xd2o/T4tuo92q9SI/AAAAAAAADYU/j__70DBB4X8/s320/Bit+Slayer_000763.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-st-MUnWH-hk/T4tvML28mXI/AAAAAAAADYc/eGNzMu_8afg/s1600/Bit+Slayer_000752.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/-st-MUnWH-hk/T4tvML28mXI/AAAAAAAADYc/eGNzMu_8afg/s320/Bit+Slayer_000752.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-cpldTY_ajvk/T4t1d0baiII/AAAAAAAADYk/8FQ-cKuMhG4/s1600/Bit+Slayer_000802.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-cpldTY_ajvk/T4t1d0baiII/AAAAAAAADYk/8FQ-cKuMhG4/s320/Bit+Slayer_000802.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-sgCTGYyvdrs/T4t1l8S4iLI/AAAAAAAADYs/e1xyVonPLCs/s1600/Bit+Slayer_000804.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-sgCTGYyvdrs/T4t1l8S4iLI/AAAAAAAADYs/e1xyVonPLCs/s320/Bit+Slayer_000804.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/ARccdk27ULk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/7474307834392813602/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=7474307834392813602" title="25 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7474307834392813602?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7474307834392813602?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/ARccdk27ULk/tenty-led-brake-lights.html" title="Tenty LED Brake Lights" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-Z-gu0ihC-Xs/T4sr-9IZluI/AAAAAAAADW0/xBVMKsBaJJA/s72-c/Bit+Slayer_000788.jpg" height="72" width="72" /><thr:total>25</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/04/tenty-led-brake-lights.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkANR344fip7ImA9WhRbFUs.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-2094762146898586673</id><published>2012-02-05T10:17:00.000-05:00</published><updated>2012-02-06T16:46:36.036-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-06T16:46:36.036-05:00</app:edited><title>ATTiny Candle</title><content type="html">&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-nM3vYXr3zj8/Ty4KWCCYVKI/AAAAAAAADTA/XkHn54BLKPI/s1600/WP_000356.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-nM3vYXr3zj8/Ty4KWCCYVKI/AAAAAAAADTA/XkHn54BLKPI/s320/WP_000356.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The ATTiny Candle is an LED candle.&amp;nbsp; It uses a high brightness LED and some software to mimic the look of a traditional candle without the dangers associated with an open flame.&amp;nbsp; I imagine they could be useful as movie props where you cannot afford to have a candle go out during a take or in your home in places not suitable for traditional candles such as in a wall niche or alcove. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-eXNYLG-3YHQ/Ty6GYe-xniI/AAAAAAAADTg/15AlE1KjdXU/s1600/WP_000381.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-eXNYLG-3YHQ/Ty6GYe-xniI/AAAAAAAADTg/15AlE1KjdXU/s320/WP_000381.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have wanted to make an LED candle for some time now, so when I was approached by a work colleague about making one, I was provided the yeast to give it a go.&amp;nbsp; I figured the hardest part of this project would be making the flicker look realistic, so I decided to let nature do that part for me.&amp;nbsp; I made this candle with a Light Detecting Resistor ( LDR ) and a fixed resistor acting as a voltage divider.&amp;nbsp; This is fed to one of the ATTiny85's ADC inputs and sampled at discrete time intervals.&amp;nbsp; At this time, the sample rate is 100mS.&amp;nbsp; These 8-bit light level values are then stored to EEPROM so that the candle can recall the flicker pattern to play back on the LED that is connected to a PWM channel after being turned off.&amp;nbsp; You only need to program the pattern once, but you can program it over and over again with just the push of a button.&lt;br /&gt;
&lt;br /&gt;
What I have really created here is a datalogger for light levels.&amp;nbsp; Albeit, a datalogger with fairly small storage space of 500 bytes for the ATTiny85.&amp;nbsp; Never the less, 500 bytes @ 100mS sample rate gives me a loop of ~50 Seconds.&amp;nbsp; This is sufficiently long to not see a pattern repeating in the flicker pattern.&amp;nbsp; I guess there is a transformation that occurs when you jam the whole thing into the middle of a candle it becomes an electronic LED Candle instead.&amp;nbsp; Below is a picture of the aforementioned transformation process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-fCZl8qUfyQw/Ty4M_gswSBI/AAAAAAAADTI/IbmbR3HLgqw/s1600/WP_000352.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-fCZl8qUfyQw/Ty4M_gswSBI/AAAAAAAADTI/IbmbR3HLgqw/s320/WP_000352.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I did not mention yet, that I used a perfectly functional LED candle as the housing for my ATTiny Candle.&amp;nbsp; It was about 50c from the thrift store, so it is a cheap enclosure.&amp;nbsp; I also scavenged the high brightness LED from the original circuit.&amp;nbsp; Not knowing the specs on the led I set out to measure the forward voltage.&amp;nbsp; I lit the LED with a high value resistor in series.&amp;nbsp; In the picture below you can see I am using an LED tester I made that has probably an R860 or 1k0 resistor in it.&amp;nbsp; The LED plugs into some female header sockets.&amp;nbsp; Measuring the voltage across the LED legs shows I have a forward voltage of 2.01v.&amp;nbsp; I will assume 20mA max and select my series resistor based on 3, 1.5v ( nominal ), AA batteries.&amp;nbsp; So, ( ( 3*1.5v ) - 2.01Vf ) / 0.02mA = R124.5.&amp;nbsp; I guess the closest value I had on had was an R220 because that is what I used so the LED current is now ~11mA.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-bk9eIbysTZc/Ty4Ny9KHR_I/AAAAAAAADTY/eG8RurbSnrc/s1600/WP_000321.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-bk9eIbysTZc/Ty4Ny9KHR_I/AAAAAAAADTY/eG8RurbSnrc/s320/WP_000321.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a picture of the schematic and one of the assembled circuit about to be installed ( hot glued ) into the inside of a candle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-2RH5bEy-o1U/Ty6HmGzSc6I/AAAAAAAADTo/bQ3v0EYmEF0/s1600/WP_000345.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-2RH5bEy-o1U/Ty6HmGzSc6I/AAAAAAAADTo/bQ3v0EYmEF0/s320/WP_000345.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-30jmqYqTiD8/Ty6IRNballI/AAAAAAAADTw/x1UYRqmoY2g/s1600/ATTiny+Candle+Sch.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-30jmqYqTiD8/Ty6IRNballI/AAAAAAAADTw/x1UYRqmoY2g/s320/ATTiny+Candle+Sch.jpg" width="311" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-eXNYLG-3YHQ/Ty6GYe-xniI/AAAAAAAADTg/15AlE1KjdXU/s1600/WP_000381.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
//Software &amp;amp;c&lt;br /&gt;
&lt;br /&gt;
Here is a listing of the current working code.&amp;nbsp; I have several improvements I would like to add in the future, but I will outline them later.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/*
Program Description: This program reads a light detecting resistor thru an internal ADC and stores the value, 
after scaling it, to eeprom.  This ADC value is sent to a PWM channel with attached led.  This is essentially a data logger
for light and replay by LED.  If, if you aim the LDR at a flickering candle during its recording phase, you have a flickering 
led candle.  

A circuit description and other details can be found at http://petemills.blogspot.com

Filename: ATTiny_Candle_v1.0.c
Author: Pete Mills

Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms

*/



//********** Includes **********

#include &amp;lt;avr/io.h&amp;gt;     
#include &amp;lt;util/delay.h&amp;gt;   
#include &amp;lt;avr/eeprom.h&amp;gt;




//********** Definitions **********

// LED for flame simulation

#define LED   PB0  
#define LED_PORT PORTB
#define LED_DDR  DDRB



// Light Detecting Resistor for recording a live flame

#define LDR   PINB3 
#define LDR_PORT PINB
#define LDR_DDR  DDRB



// Tactile Switch Input

#define SW1   PINB4
#define SW1_PORT PINB
#define SW1_DDR  DDRB


#define ARRAY_SIZE 500  // size of the flicker array
#define SAMPLE_RATE 100  // ms delay for collecting and reproducing the flicker



//********** Function Prototypes **********

void setup(void);
void toggle_led(void);
void program_flicker(void);
void led_alert(void);
void eeprom_save_array(void);
void eeprom_read_array(void);
void scale_array(void);
uint8_t get_adc(void);
uint8_t scale( uint8_t input, uint8_t inp_low, uint8_t inp_hi, uint8_t outp_low, uint8_t outp_hi);
uint8_t is_input_low(char port, char channel, uint8_t debounce_time, int input_block);




//********** Global Variables **********

uint8_t flicker_array[ ARRAY_SIZE ] = { 0 };
uint8_t EEMEM ee_flicker_array[ ARRAY_SIZE ] = { 0 };


int main(void)
{

uint16_t replay = 0;

setup();

eeprom_read_array();



 while(1)
 { 
 
  
  
  
  if( is_input_low( SW1_PORT, SW1, 25, 250 ) )
  {
   
   // program the flicker
   // after entering and upon completion, a predetermined flash pattern will occur as described in led_alert()  
   // aim the ldr at a flickering candle or any other light source ( like a laser ) you want to record during this time
   // and upon completion the values are stored to eeprom.  They are played back immediately as well 
   // as being recalled from eeprom upon first start up
   
   led_alert();
   program_flicker();
   scale_array();
   eeprom_save_array();
   led_alert();
  }
  
  
  
  // replay the recorded flicker pattern 
  
  OCR0A = flicker_array[ replay ];
  ++replay;
  
  if( replay &amp;gt;= ( ARRAY_SIZE - 13 ) ) // if the end of the stored array has been reached
  { 
   replay = 0;          // start again from the beginning
   //led_alert();
  }
  
  _delay_ms( SAMPLE_RATE );
  _delay_ms( 3 );    // ADC Conversion time
   
 }
}




//********** Functions **********

void setup(void)
{



 //********* Port Config *********

 LED_DDR |= ( 1 &amp;lt;&amp;lt; LED);   // set PB0 to "1" for output 
 LED_PORT &amp;amp;= ~( 1 &amp;lt;&amp;lt; LED );   // turn the led off

 LDR_DDR &amp;amp;= ~( 1 &amp;lt;&amp;lt; LDR );   // set LDR pin to 0 for input
 LDR_PORT |= ( 1 &amp;lt;&amp;lt; LDR );   // write 1 to enable internal pullup

 SW1_DDR &amp;amp;= ~( 1 &amp;lt;&amp;lt; SW1 );   // set sw1 pin to 0 for input
 SW1_PORT |= ( 1 &amp;lt;&amp;lt; SW1 );   // write a 1 to sw1 to enable the internal pullup



 //********** PWM Config *********
 
 TCCR0A |= ( ( 1 &amp;lt;&amp;lt; COM0A1 ) | ( 1 &amp;lt;&amp;lt; WGM01 ) | ( 1 &amp;lt;&amp;lt; WGM00 ) ); // non inverting fast pwm
 TCCR0B |= ( 1 &amp;lt;&amp;lt; CS00 ); // start the timer
 
 
 
 //********** ADC Config **********
 
 ADMUX |= ( ( 1 &amp;lt;&amp;lt; ADLAR ) | ( 1 &amp;lt;&amp;lt; MUX1 ) | ( 1 &amp;lt;&amp;lt; MUX0 ) );  // left adjust and select ADC3
 ADCSRA |= ( ( 1 &amp;lt;&amp;lt; ADEN ) | ( 1 &amp;lt;&amp;lt; ADPS2 ) | ( 1 &amp;lt;&amp;lt; ADPS1 ) ); // ADC enable and clock divide 8MHz by 64 for 125khz sample rate
 DIDR0 |= ( 1 &amp;lt;&amp;lt; ADC3D ); // disable digital input on analog input channel to conserve power

}




void toggle_led()
{
    LED_PORT ^= ( 1 &amp;lt;&amp;lt; LED );
}




uint8_t is_input_low( char port, char channel, uint8_t debounce_time, int input_block )
{

/*
This function is for debouncing a switch input
Debounce time is a blocking interval to wait until the input is tested again.
If the input tests low again, a delay equal to input_block is executed and the function returns ( 1 )
*/
        
 if ( bit_is_clear( port, channel ) )
 {
  _delay_ms( debounce_time );
   
   if ( bit_is_clear( port, channel ) ) 
   {
    _delay_ms( input_block );
    return 1;
   }
 
 }

 return 0;
}




uint8_t get_adc()
{
 ADCSRA |= ( 1 &amp;lt;&amp;lt; ADSC );   // start the ADC Conversion
 
 while( ADCSRA &amp;amp; ( 1 &amp;lt;&amp;lt; ADSC ));  // wait for the conversion to be complete
 
 return ~ADCH; // return the inverted 8-bit left adjusted adc val

}




void program_flicker()
{ 
 // build the flicker array
 
 for( int i = 0; i &amp;lt; ARRAY_SIZE; i++ )
 {
  flicker_array[ i ] = get_adc();  
  _delay_ms( SAMPLE_RATE );
 }

}




void led_alert()
{
 // this is a function to create a visual alert that an event has occured within the program
 // it toggles the led 10 times.
 
 for( int i = 0; i &amp;lt; 10; i++ )
 {
  OCR0A = 0;
  _delay_ms( 40 );
  OCR0A = 255;
  _delay_ms( 40 );
 }

}




void eeprom_save_array()
{ 
 for( int i = 0; i &amp;lt; ARRAY_SIZE; i++ )
 {
  eeprom_write_byte( &amp;amp;ee_flicker_array[ i ], flicker_array[ i ] );
  
 }
}




void eeprom_read_array()
{
 for( int i = 0; i &amp;lt; ARRAY_SIZE; i++ )
 {
  flicker_array[ i ] = eeprom_read_byte( &amp;amp;ee_flicker_array[ i ] );
  
 }
}




uint8_t scale( uint8_t input, uint8_t inp_low, uint8_t inp_hi, uint8_t outp_low, uint8_t outp_hi)
{
return ( ( ( input - inp_low ) * ( outp_hi - outp_low ) ) / ( ( inp_hi - inp_low ) + outp_low ) );
}




void scale_array()
{
 uint8_t arr_min = 255;
 uint8_t arr_max = 0;
 uint8_t out_low = 20;
 uint8_t out_high = 255;
 
 
 
 // find the min and max values
 
 for( int i = 0; i &amp;lt; ARRAY_SIZE; i++ )
 {
  if( flicker_array[ i ] &amp;lt; arr_min )
   arr_min = flicker_array[ i ];
   
  if( flicker_array[ i ] &amp;gt; arr_max )
   arr_max = flicker_array[ i ];
 }
 
 
 
 // now that we know the range, scale it
 
 for( int i = 0; i &amp;lt; ARRAY_SIZE; i++ )
 {
  flicker_array[ i ] = scale( flicker_array[ i ], arr_min, arr_max, out_low, out_high );
 }
 
}&amp;nbsp;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
After I programmed a flickering candle to the EEPROM using the above code I read back the data.&amp;nbsp; Below is 500 bytes of candle flicker data just in case you don't care to have a reprogrammable flicker you could use this static one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;:10000000777B7D7B78BA95535E3E3E4352353E7595
:100010004B657B5263586B5562777287858C5D7A2E
:10002000535D5062556F6758784E55956B6D7D7373
:100030007D5B6B686A6A606B7777987A87605B6BC9
:10004000534A5368453B65679C6067537375638A81
:100050007F8388806358586B7A787B838A878A8508
:1000600083888A8A8A8A8A8C8A8A8A8A8A88837F0B
:100070007D7B7A78777570707270704D416D6860B5
:1000800035353D3B4145525E41535D60656A5048A0
:100090004B4E3535313333363B40504E525D605315
:1000A000564B352D2E2E353838393B383158406077
:1000B0004D505A5D434053585A554E31312B2E33D3
:1000C0003136353638393938404A413B506240364E
:1000D000292D455E5D523E333B433545383531333E
:1000E00036363936383B4136363039332B29335A98
:1000F0006356413D5052556065553B302E303B4E66
:10010000362E2B3B393D4A503D45584E4B4E4A45C5
:10011000584B555D5B56585E60775E385A52464B79
:10012000504A4A354E412E363638524B463B3340C4
:100130004E605A504D434A504B48403D4046525BFA
:100140006263635B52465B43554526353B5B434DDB
:100150004056585A5D50464545413B437287908A08
:100160008F979D9573656B4D464555554156555531
:10017000565A5A5B5E56625565585A62686D6D6B89
:10018000686A6F656D316F55485055675A41555EC5
:100190006065686863606A60676A7F838C8788923D
:1001A0008D8F888C8C85826A4E35231119433B4193
:1001B000674A4A3B2E3045414A5848705B6D72622F
:1001C0007567565A5E554D77532D36415D55404003
:1001D0004040403E415E82928888909488857B634F
:1001E000555356555053550334013A7EFF01603E36
:1001F0003E28018EFFFFFFFFFFFFFFFFFFFFFFFF16
:00000001FF


&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a video of a LDR programmed candle flicker.&amp;nbsp; I was blowing gently on the candle flame during recording so that it would be a lively flicker for the video.&amp;nbsp; It reminds me of a candle on the porch when a storm is coming in.&amp;nbsp; Of course, it can be reprogrammed with a more subtle flame, the light from a bonfire or fire place, a laser pointer or even your hand shading light from the LDR.&amp;nbsp; You could take a walk thru the woods and record the sunlight shining thru and shadows coming from the treetops.&amp;nbsp; I have found the best results when programming the ATTiny Candle in a darkened room.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/5qKXFkSmUbo/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/5qKXFkSmUbo?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;



&lt;param name="bgcolor" value="#FFFFFF" /&gt;



&lt;embed width="320" height="266"  src="http://www.youtube.com/v/5qKXFkSmUbo?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The list of improvements...&lt;br /&gt;
&lt;br /&gt;
A) I would get the lower power version of the ATTiny85 to allow operation from 2 AA batteries.&amp;nbsp; I only had ATTiny85-20PU in stock so I had to use 3 batteries.&amp;nbsp; The black box external to the candle is the battery box.&amp;nbsp; Unsatisfactory, really.&lt;br /&gt;
&lt;br /&gt;
B) Once the batteries are tucked away and the switch is no longer accessible it may be a good idea to put the candle to sleep instead of switching it off.&amp;nbsp; It could, for example, turn itself off after an hour or two of operation too.&amp;nbsp; Then it could wake up with an external interrupt.&amp;nbsp; And what would interrupt it? Improvement C of course.&lt;br /&gt;
&lt;br /&gt;
C) A "blow" detector to be able to blow "out" and back "on",&amp;nbsp; the candle.&amp;nbsp; I did some quick experimentation with a piezo to detect a "blow" ( I guess ), although it worked, I abandoned the idea, saving it for later iterations.&amp;nbsp; I couldn't find a location for the large piezo speakers I have, so I will have to order some smaller ones.&lt;br /&gt;
&lt;br /&gt;
D) If you have any ideas please leave a comment!&lt;br /&gt;
&lt;br /&gt;
Here are a couple more photos.&amp;nbsp; Let me know if you have any success building an ATTiny Candle yourself.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-zWqSXTAwVCE/Ty6REMddPHI/AAAAAAAADT4/mwmmyuswWZ4/s1600/WP_000376.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-zWqSXTAwVCE/Ty6REMddPHI/AAAAAAAADT4/mwmmyuswWZ4/s320/WP_000376.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-pOp5wxXtAgc/Ty6RmkCpx5I/AAAAAAAADUA/PeWwWAjkHD0/s1600/WP_000370.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-pOp5wxXtAgc/Ty6RmkCpx5I/AAAAAAAADUA/PeWwWAjkHD0/s320/WP_000370.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/wdXNtRCGlt8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/2094762146898586673/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=2094762146898586673" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2094762146898586673?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2094762146898586673?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/wdXNtRCGlt8/attiny-candle.html" title="ATTiny Candle" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-nM3vYXr3zj8/Ty4KWCCYVKI/AAAAAAAADTA/XkHn54BLKPI/s72-c/WP_000356.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/02/attiny-candle.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMEQXg_cSp7ImA9WhRbGUw.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-232571224126390222</id><published>2012-01-14T22:49:00.000-05:00</published><updated>2012-02-10T18:43:20.649-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-10T18:43:20.649-05:00</app:edited><title>The Clever Clapper</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/--oPR2CgMtOU/TxI59EwkdAI/AAAAAAAADPI/y3DkYWHjeKY/s1600/WP_000247.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/--oPR2CgMtOU/TxI59EwkdAI/AAAAAAAADPI/y3DkYWHjeKY/s320/WP_000247.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The other day when I was at the reuse center I came across a few ikea lamps.&amp;nbsp; I picked up two low voltage spot lights for $2 total.&amp;nbsp; I think they came from &lt;a href="http://www.ikea.com/gb/en/catalog/products/40091847/"&gt;this lamp&lt;/a&gt;.&amp;nbsp; I also bought a &lt;a href="http://www.ikea.com/us/en/catalog/products/70010840/"&gt;moon lamp&lt;/a&gt; for $0.86 and I am still not sure why they charged such an odd amount for it.&amp;nbsp; I wasn't too sure about the moon lamp, but I knew right away what I would do with the spot lights.&amp;nbsp; It wasn't even 12 hours prior that I was trying to sketch up an idea on my slate chalkboard in low light conditions and thought I needed some task lighting.&amp;nbsp; That distraction was what spawned this project.&lt;br /&gt;
&lt;br /&gt;
Surely these lights would do great on their own with just an on/off toggle switch, but where is the fun in that?&amp;nbsp; So, I decided to make a clapper circuit that turned out to be something a little more too.&lt;br /&gt;
&lt;br /&gt;
A &lt;a href="http://en.wikipedia.org/wiki/The_Clapper"&gt;"Clapper"&lt;/a&gt; is a device that will turn on or off an AC appliance that is plugged into it, such as a lamp or fan when it "hears" you clap twice in approximate succession.&amp;nbsp; They were originally sold in the mid eighties and it appears you can still &lt;a href="http://www.google.com/products/catalog?q=the+clapper&amp;amp;hl=en&amp;amp;safe=off&amp;amp;client=firefox-a&amp;amp;hs=47F&amp;amp;rls=org.mozilla:en-US:official&amp;amp;prmd=imvns&amp;amp;bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&amp;amp;biw=1400&amp;amp;bih=798&amp;amp;um=1&amp;amp;ie=UTF-8&amp;amp;tbm=shop&amp;amp;cid=13601606191737059431&amp;amp;sa=X&amp;amp;ei=t_cQT9m-N4Lg0QG28LD9Ag&amp;amp;ved=0CHYQxBUwAA"&gt;buy&lt;/a&gt; them today.&lt;br /&gt;
&lt;br /&gt;
In my version of the clapper if you clap twice within one second, the circuit toggles the lamp output.&amp;nbsp; On becomes off and vice versa. If you clap three times within one second, the lamps begin dimming up and down via PWM until a fourth clap is detected or a one minute timeout occurs, whichever comes first.&amp;nbsp; The brightness value is then stored and restored for subsequent toggling of the lights on/off with the two clap event.&amp;nbsp; I also added a relay output to turn on and off the moon lamp.&amp;nbsp; To trigger this relay, you shine a laser beam at the circuit to toggle it.&amp;nbsp; Laser beams begets moon beams.&amp;nbsp; It's science.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a video of the Clever Clapper in action.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/kaP7LGRPf_I/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/kaP7LGRPf_I?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;embed width="320" height="266"  src="http://www.youtube.com/v/kaP7LGRPf_I?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
In case you are confused by the title of this post being the Clever Clapper and the text on the chalk board that says The Dandy Dapper Clapper you should know that the Clever Clapper is the hardware that a Dandy Dapper Clapper uses to clap his or her way to optimal lighting conditions.&lt;br /&gt;
&lt;br /&gt;
These spot lamps didn't come with anything other than the lamp and holder.&amp;nbsp; I needed a way to hold the holder so I banged a couple of nails into a some poplar wood to attach the lamp holder to.&amp;nbsp; Ok, so I didn't "bang" these framing nails into the 1" x 2" bit of poplar wood so much as I drilled a hole slightly smaller than the O.D. of the nail and pressed them in, but you get the idea.&amp;nbsp; This is not a finished installation; just the prototyping stage.&lt;br /&gt;
&lt;br /&gt;
Here is a pic of the lamp, lamp holder, lamp holder holder and the lamp holder holder holder ( aka wall ).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-q24GC8mivyk/TxGLR1oFB_I/AAAAAAAADOQ/wLC-0g6BRts/s1600/WP_000187.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-q24GC8mivyk/TxGLR1oFB_I/AAAAAAAADOQ/wLC-0g6BRts/s320/WP_000187.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since we are talking about mechanical stuff, below is a picture of how the circuit and moon lamp are mounted to a piece of red oak.&amp;nbsp; The wood board was drilled and tapped to accept aluminum standoffs to screw the circuit board and TIP120 heatsinks to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-d7gvBnpiZfY/TxGMi9oiRXI/AAAAAAAADOY/YHsAsV_hszM/s1600/WP_000232.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-d7gvBnpiZfY/TxGMi9oiRXI/AAAAAAAADOY/YHsAsV_hszM/s320/WP_000232.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are a couple of pictures showing the inside of the moon lamp.&amp;nbsp; I added this black box with relay inside to control the hot AC line of this lamp with a microcontroller.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-5quXe-rXwUw/TxGOvMoVyQI/AAAAAAAADOg/228AKsicS9M/s1600/WP_000235.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-5quXe-rXwUw/TxGOvMoVyQI/AAAAAAAADOg/228AKsicS9M/s320/WP_000235.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-0QUmaw-ZXeE/TxGPAy8jztI/AAAAAAAADOo/3S_LI927Ow0/s1600/WP_000117.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-0QUmaw-ZXeE/TxGPAy8jztI/AAAAAAAADOo/3S_LI927Ow0/s320/WP_000117.jpg" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download a .rar of the ATTiny2313 code and Clever Clapper circuit schematic &lt;a href="https://sites.google.com/site/pemills2011/file/Clever_Clapper.rar?attredirects=0&amp;amp;d=1"&gt;here.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There isn't much to say about the software except that there may be some "legacy" code in it still.&amp;nbsp; That is, variables and the like that I didn't delete when changing things around or removing functionality so the program would fit into the available program space.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the schematic.&amp;nbsp; Starting at the top left you can see an electret microphone and it's filtered power supply.&amp;nbsp; This is fed into one half of an LM358 Op-amp setup for 100x amplification.&amp;nbsp; The 100k0 potentiometer is used for clap detection sensitivity adjustment.&amp;nbsp; There is a connection to PD3 here that is no longer used, but more on that later.&amp;nbsp; Then, the signal, or more accurately, part of the signal passes thru a low pass filter and on to the other half of the LM358 setup as a comparator.&amp;nbsp; The output of this comparator stage is fed to the ATTiny2313.&amp;nbsp; Otherwise the circuit is pretty straight forward, standard 7805 power supply and uC accoutrements, TIP120 darlington transistor with pulldown resistors.&amp;nbsp; Oh, and don't forget that 1n4004 flywheel diode across the relay coil or you will be replacing your uC in very short order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-TElBspatm2A/TxGSDBINZ4I/AAAAAAAADOw/xGs5IujA6pg/s1600/clever+clapper+v1.3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="172" src="http://1.bp.blogspot.com/-TElBspatm2A/TxGSDBINZ4I/AAAAAAAADOw/xGs5IujA6pg/s320/clever+clapper+v1.3.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
Here is a close up of the circuit.&amp;nbsp; You can see the electret mic in the lower middle.&amp;nbsp; There are two phototransistors on the board but only one is connected.&amp;nbsp; They are the clear things with one at the center top of the ATTiny2313. There is also a red tactile switch who's input to the microcontroller is interpreted as two hand claps.&amp;nbsp; This is used in the event you want to be quiet and still toggle the lights on and off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-pXGA4IQ55TA/TxGccIbGhbI/AAAAAAAADPA/ZW4cLQY9fUQ/s1600/WP_000238.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-pXGA4IQ55TA/TxGccIbGhbI/AAAAAAAADPA/ZW4cLQY9fUQ/s320/WP_000238.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
When I first started this project I knew that I wanted to detect hand claps.&amp;nbsp; As a human, I am quite good at this but, I had no idea how to describe a hand clap to a microcontroller.&amp;nbsp; So, to "see" as a digital device would, I opened &lt;a href="http://audacity.sourceforge.net/"&gt;Audacity &lt;/a&gt;and started clapping my hands.&amp;nbsp; Below is a picture of the spectrum analysis.&amp;nbsp; To help prevent false triggers, it appears I can easily block non-clapping frequencies above ~5khz.&amp;nbsp; This significantly improved the reliability of the circuit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-vjtIYaSRWxg/TxGZ6ATI9BI/AAAAAAAADO4/193sNnvm1uA/s1600/F_Plot+Hand+Clap.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="278" src="http://3.bp.blogspot.com/-vjtIYaSRWxg/TxGZ6ATI9BI/AAAAAAAADO4/193sNnvm1uA/s320/F_Plot+Hand+Clap.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
As I alluded to earlier I was not able to implement all of the features I wanted in my clapper.&amp;nbsp; This is because I ran out of program memory.&amp;nbsp; The last build used 100.0% of the available space.&amp;nbsp; Of course I could have re-written the code trying to optimize for space or more likely I will just use a different uC in subsequent hardware iterations, should I decide the current implementation is prosaic.&amp;nbsp; I feel code and hardware optimizations are a worthy subject of focus, but too, sometimes you just want to get the job done.&lt;br /&gt;
&lt;br /&gt;
Here is a video of one feature that didn't make the cut due to the lack of program memory space.&amp;nbsp; This mode would have been activated by a succession of four claps.&amp;nbsp; In this mode, the raw speaker input ( pre-lowpass filter ) is fed to the microcontroller and modulates the PWM output to the lamps.&amp;nbsp; The light looks like it is "talking" to you.&amp;nbsp; It is a little hard to see in the video as I think the automatic white balance function of the video camera takes some of the resolution away.&amp;nbsp; I was sad to see this feature go.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/A7XXPJOxyOs/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/A7XXPJOxyOs?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;embed width="320" height="266"  src="http://www.youtube.com/v/A7XXPJOxyOs?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Over all I am quite pleased with the Clever Clapper.&amp;nbsp; It is a lot of fun walking into a room and command-clapping lights to turn on - to your desired brightness value no less.&amp;nbsp; I have yet to decide if I want to remake the hardware to allow for more features.&amp;nbsp; I may, as one feature I wanted was clap programmable clap codes for instantly setting different lighting moods.&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
// clap off&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/sltnmfaIGeE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/232571224126390222/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=232571224126390222" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/232571224126390222?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/232571224126390222?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/sltnmfaIGeE/clever-clapper.html" title="The Clever Clapper" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/--oPR2CgMtOU/TxI59EwkdAI/AAAAAAAADPI/y3DkYWHjeKY/s72-c/WP_000247.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://petemills.blogspot.com/2012/01/clever-clapper.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUGRno-cCp7ImA9WhRQFks.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-4058177286825125909</id><published>2011-12-11T15:43:00.004-05:00</published><updated>2011-12-11T22:57:07.458-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-11T22:57:07.458-05:00</app:edited><title>Capricious Clock</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-KHFc0ozzaFc/TuTof7ZiG9I/AAAAAAAADNc/ALHphX7Dx8c/s1600/WP_000029.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-KHFc0ozzaFc/TuTof7ZiG9I/AAAAAAAADNc/ALHphX7Dx8c/s320/WP_000029.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
A couple of months ago I took a break from working on a precision pendulum clock project to build this.&amp;nbsp; I call it a capricious clock for reasons that will be obvious after watching the video below.&amp;nbsp; It ticks and tocks in an unnerving and aperiodic or spasmodic manner that anthropomorphically demands your attention.&amp;nbsp; Even as the author of the software, I find myself lured in, staring the capricious clock down, face to face, anticipating and wondering when and sometimes if, the next tick will occur.&amp;nbsp; Mercurial, you say? Precisely, but alliteration won out and "Capricious Clock" it is.&lt;br /&gt;
&lt;br /&gt;
The most marvelous part of all of this, of course, is that the clock keeps accurate time over the long term.&amp;nbsp; Neglecting inaccuracies inherent to quartz clocks, this clock could conceivably be off by no more than 8 seconds at any point in time.&amp;nbsp; However, at no point in time do you ever feel the displayed time is something to be believed.&amp;nbsp; I would like to place this clock in a public area to gauge peoples reactions.&amp;nbsp; For now, it is on a show and tell basis, hanging on a wall at home.&lt;br /&gt;
&lt;br /&gt;
Here is a video of the Capricious Clock running next to a regular AC wall clock.&amp;nbsp; In the video, I fast forward by 500% at &lt;a href="http://youtu.be/zQXS6WjeTdg?t=1m12s"&gt;1:12&lt;/a&gt; until near the very end.&amp;nbsp; This video is illustrative of the erratic ticking of the capricious clock on the right next to a smooth AC clock motor sweeping second hand.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/zQXS6WjeTdg/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/zQXS6WjeTdg?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/zQXS6WjeTdg?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The idea for a mind-melting ticking machine came from the author Terry Pratchett.&amp;nbsp; There is &lt;a href="http://en.wikipedia.org/wiki/Havelock_Vetinari#Appearance.2C_habits_and_miscellaneous"&gt;"Lord Vetinari's Clock"&lt;/a&gt; in the series &lt;a href="http://www.terrypratchettbooks.com/discworld/"&gt;Discworld&lt;/a&gt;.&amp;nbsp; I'm not exactly sure how, as it seems everyone around me is familiar with Discworld , but I am just finding out about it now.&amp;nbsp; Actually, it was a similar clock that &lt;a href="http://hackaday.com/2011/10/12/building-a-better-clock-to-drive-you-insane/"&gt;someone else built&lt;/a&gt; that got me thinking about how I would go about making something like this for myself.&lt;br /&gt;
&lt;br /&gt;
That is the what and why, now on to the how...&lt;br /&gt;
&lt;br /&gt;
In the pictures below you can see how the quartz clock movement was modified to intercept the 1pps signal and output my own clock "motor" drive pulse.&amp;nbsp; I cut the traces going to and from the "black blob" IC on the circuit board for the 1pps signal and motor drive pulse.&amp;nbsp; These were then soldered to fine gauge enameled wire and brought out to a strip PCB for later access.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-yvec9_QUw2c/TuLIvuMkJ4I/AAAAAAAADM0/lkB8rY7ESq4/s1600/IMAG2103.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-yvec9_QUw2c/TuLIvuMkJ4I/AAAAAAAADM0/lkB8rY7ESq4/s320/IMAG2103.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In the picture below you can see how the quartz clock movement works.&amp;nbsp; The black cylinder on the end of the white plastic gear is a magnet.&amp;nbsp; It's poles are aligned perpendicular to its axis of rotation.&amp;nbsp; When the movement is assembled, the copper wire electromagnet is pulsed once per second, alternating&amp;nbsp; polarity and consequently magnetic poles to drive the movement.&amp;nbsp; The relative location of the gear magnet and electromagnet ensure that the clock moves in the clockwise direction usually.&amp;nbsp; It is possible with different electromagnet pulse durations to sometimes generate an anticlockwise tick.&amp;nbsp; Nothing reliable enough for an open loop system like this though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-LUU5xsQNpQM/TuLIxYstH5I/AAAAAAAADM8/m6g5mHw7sZs/s1600/IMAG2107.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-LUU5xsQNpQM/TuLIxYstH5I/AAAAAAAADM8/m6g5mHw7sZs/s320/IMAG2107.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the quartz movement with enameled wire soldered to the cut PCB traces.&amp;nbsp; You may notice this is a different quartz movement than the one finally installed in the clock.&amp;nbsp; I had to modify a new movement after accidentally applying 5v to one of the black blob IC traces and consequently rendered it useless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-pOZYe-xc_z0/TuLIz3eCRWI/AAAAAAAADNE/sqprU1xuoWA/s1600/IMAG2111.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-pOZYe-xc_z0/TuLIz3eCRWI/AAAAAAAADNE/sqprU1xuoWA/s320/IMAG2111.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see the fine enameled wire brought out to some blank PCB for more robust attachment of wires that will be controlling the clock and receiving the 1 pps signal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-SpsnRaKX3QU/TuLI3BNsJmI/AAAAAAAADNM/OexwlF7w1i0/s1600/IMAG2123.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-SpsnRaKX3QU/TuLI3BNsJmI/AAAAAAAADNM/OexwlF7w1i0/s320/IMAG2123.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
At this point you could jumper the correct traces back together and the quartz motor would function as originally intended, but next a microcontroller comes in to modify the 1 pps to something a little less phlegmatic.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Here is the schematic for what we have done so far to the quartz movement and what is to come by adding a uC. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-NgdlbRLEUdE/TuV7Vae_6sI/AAAAAAAADN8/EMbKqD--Fzs/s1600/Capricious+Clock+Schematic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://3.bp.blogspot.com/-NgdlbRLEUdE/TuV7Vae_6sI/AAAAAAAADN8/EMbKqD--Fzs/s320/Capricious+Clock+Schematic.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;I mention in at least 4 places ( here included ) that after programming the chip you have to set the RSTDISBL fuse if you want to use PB5 as an IO pin.&amp;nbsp; Once you do this, you cannot use ISP programming and instead have to do high voltage programming to bring the reset line up to 12v.&amp;nbsp; For this reason, I have yet to test my code using PB5 as the intended "Mute" switch.&amp;nbsp; I want to use it to toggle on or off the ability for the uC to make a tick-tock sound with the piezo.&amp;nbsp; Until I am happy with the code, and I think I am nearly, I don't want to commit to the RSTDISBL fuse programming.&amp;nbsp; I guess this capricious clock is not currently mutable?... 0_0&lt;br /&gt;
&lt;br /&gt;
One way around the RSTDISBL / PB5 issue I describe is to use a boot loader on the ATtiny.&amp;nbsp; I may do this because I don't like the idea of not being able to easily change the firmware at a later date and I have never used a boot loader on an ATtiny before and it may be fun. &lt;br /&gt;
&lt;br /&gt;
A couple of other ideas I had for erratic ticking I had were to tick faster from 0s-30s and slower from 30s-60s as if the clock was operating in a larger gravitational field than its surroundings and the motor just barely keeps up.&amp;nbsp; Or, the same erratic ticking over a longer time though so that it drifts +/- 5 minutes an hour or so.&amp;nbsp; I think this will eventually catch someones attention, but it would take longer to notice.&amp;nbsp; For these reasons I think I have just convinced myself to remake this project with an added bootloader on the ATtiny85.&lt;br /&gt;
&lt;br /&gt;
Here are a couple of pictures from the inside of the clock.&amp;nbsp; This clock made it really easy to shoehorn the additional electronics inside.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-9TgZ9qM0g0E/TuTphWZdxZI/AAAAAAAADNk/F-Pu7Kw3yQ8/s1600/WP_000014.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-9TgZ9qM0g0E/TuTphWZdxZI/AAAAAAAADNk/F-Pu7Kw3yQ8/s320/WP_000014.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-G30UR2l0GiY/TuTplCj-KjI/AAAAAAAADNs/TAMLVpm3z7c/s1600/WP_000015.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/-G30UR2l0GiY/TuTplCj-KjI/AAAAAAAADNs/TAMLVpm3z7c/s320/WP_000015.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
// software&lt;br /&gt;
&lt;br /&gt;
The code keeps track of the 1pps pulses coming from the quartz clock movement, it delays for a random period of time then moves the second hand.&amp;nbsp; If the "Real Time" elapsed is greater than the displayed time the program will delay anywhere from 1-0.125s to catch up to the "Real Time".&amp;nbsp; If the display time is faster, the program will select a random time from 1-8s to slow down so that "Real Time" can catch up.&lt;br /&gt;
&lt;br /&gt;
Rather than just turning the thing on and letting it run in an endless loop I used external interrupts, nested interrupts and the watchdog timer with power down sleep mode to wake up from a sleep period to update the display.&lt;br /&gt;
&lt;br /&gt;
Using the aforementioned capabilities of the ATtiny85 was necessary for the reliability of counting the 1pps pulse and the ability to conserve battery power - a very important thing to do in battery powered devices.&amp;nbsp; You can see in the calculations below the clock will theoretically run for ~225 days or&amp;nbsp; ~61.6% of a year before needing new batteries.&amp;nbsp; Now, that is theoretical and does not account for sleep current, wake up current and time or battery self discharge.&amp;nbsp; However, in this case, where the ratio of active to sleep current is so great, you can safely ignore those calculations. By entering into power down sleep mode the battery life is extended by nearly 3 months.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-OL2hCzfNYms/TuUO---gI2I/AAAAAAAADN0/bhoAAu2gCYc/s1600/Power+Consumption.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="308" src="http://2.bp.blogspot.com/-OL2hCzfNYms/TuUO---gI2I/AAAAAAAADN0/bhoAAu2gCYc/s320/Power+Consumption.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the code.&amp;nbsp; As previously stated the switch on PB5 is commented out in the code so it will not work.&amp;nbsp; I did this because I am not done using the ISP and will probably use a bootloader in the end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/*

Program Title: Capricious Clock
Author: Pete Mills
Date: 2011.12.09
petemills.blogspot.com

Filename: capricious_clock_v1.0_main.c

Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms
ck div by 8 for 1MHz system clock

Set RSTDISBL fuse after programming to allow use of PB5
After setting RSTDISBL you will have to use HV programming to reprogram the AVR - no more ISP

*/

// Includes

#include &amp;lt;avr/io.h&amp;gt;     
#include &amp;lt;util/delay.h&amp;gt;    
#include &amp;lt;avr/interrupt.h&amp;gt;
#include &amp;lt;avr/sleep.h&amp;gt;


// Definitions

#define IO_PORT  PORTB
#define LED   PB0  // LED pin PORTB Pin 4
#define BUZZER   PB1  // piezo output buzzer
#define PPS_IN   PB2  // 1 Hz input signal
#define SEC_MOT_1 PB3  // output to drive seconds motor coil on quartz clock
#define SEC_MOT_2  PB4  // another output to seconds motor coil on quartz clock assy
#define MUTE_SW  PB5  // input switch for muting piezo and ...?


// function prototypes

void setup(void);
void toggle_led(void);
void inc_sec(void);
void tick_tock(void);



// Global Constants


volatile uint32_t rt_sec = 0; // actual time elapsed
volatile uint32_t my_sec = 0; // seconds displayed on the clock
volatile uint8_t  do_tick = 0; // decide to tick or not



int main(void)
{

setup();
sei(); 
set_sleep_mode(SLEEP_MODE_PWR_DOWN);



 while(1)
 { 
  /*
  // turn on or off the ticking sound
  if ( bit_is_clear( PINB, MUTE_SW ) ) 
  {
   ++do_tick;
   
   if( do_tick &amp;gt; 1 )
   {
    do_tick = 0;
   }
  
  }
  */
  
  asm("nop");  // ISR's return to main to execute a minimum of one instruction 
  asm("nop");  // before executing pending interrupts
  
  sleep_mode(); // go back to sleep
  
 }
 
}




// functions

void setup(void)
{

// Port Configuration

 DDRB |= ( ( 1 &amp;lt;&amp;lt; SEC_MOT_1 ) | ( 1 &amp;lt;&amp;lt; SEC_MOT_2 ) | ( 1 &amp;lt;&amp;lt; BUZZER ) | ( 1 &amp;lt;&amp;lt; LED ) ) ;  // set PB1::PB4 to "1" for output 
 IO_PORT &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; SEC_MOT_1 ) | ( 1 &amp;lt;&amp;lt; SEC_MOT_2 ) | ( 1 &amp;lt;&amp;lt; BUZZER ) | ( 1 &amp;lt;&amp;lt; LED ) ); // set the outputs low

 DDRB &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; PPS_IN ) | ( 1 &amp;lt;&amp;lt; MUTE_SW ) ); // set PB0 and PB5 to "0" for input
 IO_PORT |= ( 1 &amp;lt;&amp;lt; MUTE_SW );      // enable internal pullup on input switch
 

// Interrupt Configuration

 // External Interrupt INT0 ( INT0_vect )
 
 // low level on INT0 causes interrupt
 
 GIMSK |= ( 1 &amp;lt;&amp;lt; INT0 ); // enable external interrupt on INT0
 
 
 // Watchdog Timer Interrupt ( WDT_vect )
 
 WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDCE ) | ( 1 &amp;lt;&amp;lt; WDE ) );
 WDTCR &amp;amp;= ~( 1 &amp;lt;&amp;lt; WDE );
 
 WDTCR |= ( 1 &amp;lt;&amp;lt; WDIE ); // watchdog timeout interrupt enable
 WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP0 ) | ( 1 &amp;lt;&amp;lt; WDP2 ) ); // half second sleep

}


void toggle_led()
{
    IO_PORT ^= (1&amp;lt;&amp;lt;LED);
}



// function to drive the quartz clock motor
void inc_sec()
{

 if( my_sec % 2 == 0 )
 {
  IO_PORT |= ( 1 &amp;lt;&amp;lt; SEC_MOT_1 ); 
 }
 else
 {
  IO_PORT |= ( 1 &amp;lt;&amp;lt; SEC_MOT_2 ); 
 }
 
 _delay_ms(30); // empirically derived pulse duration
 
 IO_PORT &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; SEC_MOT_1 ) | ( 1 &amp;lt;&amp;lt; SEC_MOT_2 ) );

}



// making the tick tock escapement sound
void tick_tock()
{

 if( rt_sec % 2 == 0 )
 {
  IO_PORT |= ( 1 &amp;lt;&amp;lt; BUZZER );
  _delay_us(200);
  IO_PORT &amp;amp;= ~( 1 &amp;lt;&amp;lt; BUZZER ); 
 }
 else
 {
  IO_PORT |= ( 1 &amp;lt;&amp;lt; BUZZER );
  _delay_ms(1);
  IO_PORT &amp;amp;= ~( 1 &amp;lt;&amp;lt; BUZZER );  
 }
 
}




// this ISR is called once per second as the quartz clock movement outputs its pps signal 
ISR( INT0_vect )
{
 ++rt_sec;
 
 if( do_tick )
 {
  tick_tock();
  //toggle_led();
 }

 
 while( bit_is_clear( PINB, PPS_IN ) )
 {
  // stay in ISR until input signal is high again to stop multiple triggers
 }

}



// this ISR is called to update the output display
ISR( WDT_vect )
{
 sei(); // allow this interrupt to be interrupted...
 
 uint8_t rand_num = (uint8_t) rand();
 uint8_t case_sel = 0;

 ++my_sec;  // increment displayed time counter
 inc_sec();  // move the second hand
 
 rand_num = (uint8_t) rand();
  
  
  case_sel =  rand_num % 4 ;
  
  if( my_sec &amp;gt; rt_sec )
   case_sel += 3;
  
  
  switch (case_sel)   // set sleep time
  {
   case 0: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP2 ) ); 
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP1 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) );     // ~0.125s sleep
   break;
   
   case 1: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) ); 
    WDTCR |= ( 1 &amp;lt;&amp;lt; WDP2 );          // ~0.25s sleep
   break;
   
   case 2: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) ); 
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) );     // ~0.50s sleep
   break;
   
   case 3: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) ); 
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) );     // ~1.00s sleep
   break;
   
   case 4: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) ); 
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) ); // ~2.00s sleep
   break;
   
   case 5: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) ); 
    WDTCR |= ( 1 &amp;lt;&amp;lt; WDP3 );          // ~4.00s sleep
   break;
   
   case 6: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) ); 
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) );     // ~8.00s sleep
   break;
   
   default: 
    WDTCR &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; WDP3 ) | ( 1 &amp;lt;&amp;lt; WDP0 ) );      // should never occur
    WDTCR |= ( ( 1 &amp;lt;&amp;lt; WDP2 ) | ( 1 &amp;lt;&amp;lt; WDP1 ) );     // but set the WDT for 1s if it does
   
  }
  
}


&lt;/pre&gt;&lt;br /&gt;
&lt;div class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/D-mg0DOWJz8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/4058177286825125909/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=4058177286825125909" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4058177286825125909?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4058177286825125909?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/D-mg0DOWJz8/capricious-clock.html" title="Capricious Clock" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-KHFc0ozzaFc/TuTof7ZiG9I/AAAAAAAADNc/ALHphX7Dx8c/s72-c/WP_000029.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/12/capricious-clock.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMDQXY8fip7ImA9WhRbEEg.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8720017083704740171</id><published>2011-09-08T13:48:00.003-04:00</published><updated>2012-01-31T18:44:30.876-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-31T18:44:30.876-05:00</app:edited><title>Arcade Push Button Light Switch Redux</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-j-FwdmCwfRs/Tmj2KGMYIrI/AAAAAAAAB8M/ZrrLdRJ7RN0/s1600/IMAG1858.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-j-FwdmCwfRs/Tmj2KGMYIrI/AAAAAAAAB8M/ZrrLdRJ7RN0/s320/IMAG1858.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I got a lot of feedback on my post from a couple days ago about making an &lt;a href="http://petemills.blogspot.com/2011/09/arcade-pushbutton-light-switch.html"&gt;Arcade Push Button Light Switch&lt;/a&gt;.&amp;nbsp; Mostly that this task could be easily accomplished with a single DPDT 110VAC relay.&amp;nbsp; While this true, the original post was really about using what I had on hand at the moment to remake &lt;a href="http://www.etsy.com/listing/74059377/working-arcade-light-switch"&gt;something I saw online&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Never the less, while I was at Grainger this morning picking up supplies for another project I also grabbed a &lt;a href="http://www.grainger.com/Grainger/OMRON-Square-Base-General-Purpose-Relay-2W928"&gt;DPDT relay, part no. LY2-AC110/120&lt;/a&gt;, to make another version of the arcade button light switch.&amp;nbsp; This is how I would make the switch if I was going to be purchasing parts for it.&lt;br /&gt;
&lt;br /&gt;
Here is a schematic.&amp;nbsp; This sort of design has been around for ages.&amp;nbsp; I guess people used to use relays for all kinds of control applications and called it &lt;a href="http://en.wikipedia.org/wiki/Relay_logic"&gt;Relay Logic&lt;/a&gt;.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://sites.google.com/site/pemills2011/file/ACRelayFlipflop.pdf?attredirects=0&amp;amp;d=1"&gt;&lt;img border="0" height="194" src="http://4.bp.blogspot.com/-y9QAEXh82JQ/Tmj6nair1kI/AAAAAAAAB8U/-mC6ooqy3ls/s320/Untitled.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
* Update *&lt;br /&gt;
&lt;br /&gt;
A few people have asked for more pictures of what wires go where.&amp;nbsp; Unfortunately, I do not have any photographs that would be useful.&amp;nbsp; I did draw the picture below, though and I know of at least one person that built this switch based on it.&amp;nbsp; If you are unfamiliar with working with 120v household wiring be sure to ask someone who is in the know for some help.&amp;nbsp; Getting a shock from 120vac is unpleasant.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-0GMEm8DFWu0/Tyh7cHWHgVI/AAAAAAAADSk/A1MtBU1CaI0/s1600/WP_000140.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-0GMEm8DFWu0/Tyh7cHWHgVI/AAAAAAAADSk/A1MtBU1CaI0/s320/WP_000140.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the microswitches in the arcade pushbuttons.&amp;nbsp; As you can see they are more than capable of switching the voltage and current required for this design.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ga1N7ZxA01k/Tmj7tyVZl3I/AAAAAAAAB8Y/0JyyVDG9CLc/s1600/IMAG1845.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-ga1N7ZxA01k/Tmj7tyVZl3I/AAAAAAAAB8Y/0JyyVDG9CLc/s320/IMAG1845.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
So, wire it all up, apply some hot glue and drink some coffee.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-pxwO13maeBg/Tmj8nBK8cKI/AAAAAAAAB8c/h1RLL7KC5U8/s1600/IMAG1849.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-pxwO13maeBg/Tmj8nBK8cKI/AAAAAAAAB8c/h1RLL7KC5U8/s320/IMAG1849.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/--onJdHsTmjc/Tmj80pj_1CI/AAAAAAAAB8g/Q5NGSGQqhn0/s1600/IMAG1852.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/--onJdHsTmjc/Tmj80pj_1CI/AAAAAAAAB8g/Q5NGSGQqhn0/s320/IMAG1852.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-lemZISFQu5U/Tmj9A_wWOjI/AAAAAAAAB8k/Y6Hv6W5gsAI/s1600/IMAG1855.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-lemZISFQu5U/Tmj9A_wWOjI/AAAAAAAAB8k/Y6Hv6W5gsAI/s320/IMAG1855.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
And then take an action video.&amp;nbsp; I am switching my frequency counter in this video.&amp;nbsp; It is kind of handy anyway as the power switch for the counter is on the back of the unit.&amp;nbsp; I don't always use my frequency counter, but when I do, it's a pain to turn it on.&amp;nbsp; Well, not anymore.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/k7fpAzwMngw/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/k7fpAzwMngw?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;embed width="320" height="266"  src="http://www.youtube.com/v/k7fpAzwMngw?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/v1vnXiQ2mdo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8720017083704740171/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8720017083704740171" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8720017083704740171?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8720017083704740171?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/v1vnXiQ2mdo/arcade-push-button-light-switch-redux.html" title="Arcade Push Button Light Switch Redux" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-j-FwdmCwfRs/Tmj2KGMYIrI/AAAAAAAAB8M/ZrrLdRJ7RN0/s72-c/IMAG1858.jpg" height="72" width="72" /><thr:total>13</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/09/arcade-push-button-light-switch-redux.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMER3kyeCp7ImA9WhdWFU0.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-2976123930503882914</id><published>2011-09-06T20:16:00.006-04:00</published><updated>2011-09-08T13:53:26.790-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-08T13:53:26.790-04:00</app:edited><title>Arcade Pushbutton Light Switch</title><content type="html">&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;UPDATE:&amp;nbsp; If you would like to see different circuit design, have a look at &lt;a href="http://petemills.blogspot.com/2011/09/arcade-push-button-light-switch-redux.html"&gt;version 2&lt;/a&gt;. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-QmvySLBrwrk/Tmae_hiPkLI/AAAAAAAAB6Y/Leka7XB4Dws/s1600/IMAG1841.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-QmvySLBrwrk/Tmae_hiPkLI/AAAAAAAAB6Y/Leka7XB4Dws/s320/IMAG1841.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I was poking around the internets on Labor day when I came across &lt;a href="http://www.etsy.com/listing/74059377/working-arcade-light-switch"&gt;this&lt;/a&gt;.&amp;nbsp; It is a wall switch intended to replace a boring old toggle switch in your arcade room.&amp;nbsp; My single arcade machine does not warrant its own room, but I do like the idea of an arcade button light switch.&amp;nbsp; So, in an effort to get up and do something I made this arcade button switch for switching an extension cord.&amp;nbsp; I have it plugged into the &lt;a href="http://www.google.com/search?q=flourescent+magnifier&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a#q=fluorescent+magnifier&amp;amp;hl=en&amp;amp;safe=off&amp;amp;client=firefox-a&amp;amp;hs=cV5&amp;amp;sa=X&amp;amp;pwst=1&amp;amp;rls=org.mozilla:en-US:official&amp;amp;prmd=ivns&amp;amp;source=univ&amp;amp;tbm=shop&amp;amp;tbo=u&amp;amp;ei=g6RmTpDpO8TCqgGf-8miCQ&amp;amp;ved=0CFcQrQQ&amp;amp;bav=on.2,or.r_gc.r_pw.r_cp.&amp;amp;fp=5ee5b0df8e0cbfe6&amp;amp;biw=1400&amp;amp;bih=798"&gt;magnifier with fluorescent lamp&lt;/a&gt; on my electronics bench.&lt;br /&gt;
&lt;br /&gt;
Since it was a holiday, I wanted to use only parts I had on hand so that I could finish this project the same day.&amp;nbsp; Fortunately, I have a pretty large selection of bits that included &lt;a href="http://www.sparkfun.com/products/9341"&gt;arcade buttons&lt;/a&gt;.&amp;nbsp; Sadly, I had no triacs, though and settled for a relay instead.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
There are quite a few ways that you could make a set/reset flipflop circuit for this purpose.&amp;nbsp; I settled on a 555 timer setup with relay.&amp;nbsp; The flipflop could have just as easily been two NPN transistors, but I felt like reminiscing with the venerable &lt;a href="http://en.wikipedia.org/wiki/555_timer_IC"&gt;555 timer&lt;/a&gt;.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Download the schematic here if you like...&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://sites.google.com/site/pemills2011/file/ArcadePushbuttonLightswitchSchematic.pdf?attredirects=0&amp;amp;d=1"&gt;&lt;img border="0" height="194" src="http://1.bp.blogspot.com/-bVQ7b6lT43E/TmaupVwirEI/AAAAAAAAB6c/Hq2-pIWjn-A/s320/Untitled.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I very slowly drilled two holes in a cover plate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-_9UX4s7wt38/TmawAsq2UCI/AAAAAAAAB6g/Lmqgh1OnNb0/s1600/IMAG1809.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-_9UX4s7wt38/TmawAsq2UCI/AAAAAAAAB6g/Lmqgh1OnNb0/s320/IMAG1809.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Circuit assembly began with the relay I had on hand.&amp;nbsp; I soldered some leads to the normally open contacts on the relay and put heatshrink on the solder joints.&amp;nbsp; The unused, normally closed, pin on the relay was snipped off flush and insulated with a dab of hot glue.&amp;nbsp; Otherwise, this pin would have been an exposed hot leg of 110VAC.&amp;nbsp; Not a huge deal as everything is inside a plastic box, but it is a good idea to do.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-E3SNTcLFg_M/TmaxY8uNcnI/AAAAAAAAB6k/59R94zvxHiY/s1600/IMAG1822.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-E3SNTcLFg_M/TmaxY8uNcnI/AAAAAAAAB6k/59R94zvxHiY/s320/IMAG1822.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Circuit assembly continued on a piece of perf board and was hot glued to the top of the relay which, in turn, was hot glued betwixt the arcade push buttons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-tHY_dPpIcz4/TmayKjXdq8I/AAAAAAAAB6o/5IZFCsIxzfo/s1600/IMAG1823.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-tHY_dPpIcz4/TmayKjXdq8I/AAAAAAAAB6o/5IZFCsIxzfo/s320/IMAG1823.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In the picture below, you can see where the hot lead of the extension cord is interrupted by the normally open contacts on the relay.&amp;nbsp; You can also see a knot tied into the extension cord in the top left of the picture as strain relief.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-P3i8v_KDIps/Tmayx-LXlDI/AAAAAAAAB6s/gF-mJP6W96w/s1600/IMAG1835.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-P3i8v_KDIps/Tmayx-LXlDI/AAAAAAAAB6s/gF-mJP6W96w/s320/IMAG1835.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Below you can see everything fits into the box nicely.&amp;nbsp; What isn't too apparent is a pair of black wires coming out of the box too.&amp;nbsp; I chose to use a wall wart transformer to power my circuit instead of the 110VAC coming into the box as this is just a bench top installation and not an, in the wall, permanent fixture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-nfpZXuCktQU/Tmaze94deoI/AAAAAAAAB6w/RZhI5HRzkLM/s1600/IMAG1838.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-nfpZXuCktQU/Tmaze94deoI/AAAAAAAAB6w/RZhI5HRzkLM/s320/IMAG1838.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a video of the switch in action.&amp;nbsp; You can see the camera adjusting it's auto white balance as the lamp I have the switch plugged into is turning on and off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/hJLqrkK4mJA/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/hJLqrkK4mJA?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/hJLqrkK4mJA?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This project was a fun way to spend the afternoon.&amp;nbsp; It certainly adds some geek cred to my electronics bench.&amp;nbsp; I think I am more interested in a monostable 555 circuit attached to the relay output, however.&amp;nbsp; That way, I could turn things on for a period of time and have them turn off automatically, instead of returning a day or two later to find out I left my soldering station on again.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/vNKUA7wwyLo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/2976123930503882914/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=2976123930503882914" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2976123930503882914?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2976123930503882914?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/vNKUA7wwyLo/arcade-pushbutton-light-switch.html" title="Arcade Pushbutton Light Switch" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-QmvySLBrwrk/Tmae_hiPkLI/AAAAAAAAB6Y/Leka7XB4Dws/s72-c/IMAG1841.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/09/arcade-pushbutton-light-switch.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYCRHs_fSp7ImA9WhdXF00.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-5220066643487482788</id><published>2011-08-28T13:52:00.003-04:00</published><updated>2011-08-30T08:26:05.545-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-30T08:26:05.545-04:00</app:edited><title>Guitar Pickup Winder</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-p97s3yUOy5Q/Tlo4Nky1TII/AAAAAAAAByg/6JOV_WXFfSA/s1600/IMAG1664.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-p97s3yUOy5Q/Tlo4Nky1TII/AAAAAAAAByg/6JOV_WXFfSA/s320/IMAG1664.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-8OJxigfhzDg/TlpuOvUaNWI/AAAAAAAABzU/3tT-IAS12S0/s1600/IMAG1717.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-8OJxigfhzDg/TlpuOvUaNWI/AAAAAAAABzU/3tT-IAS12S0/s320/IMAG1717.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
This projected started in June of 2011.&amp;nbsp; Remember the &lt;a href="http://www.google.com/logos/2011/lespaul.html"&gt;Google Doodle&lt;/a&gt; commemorating Les Paul's 96th birthday?&amp;nbsp; Well, that got me thinking about how electric guitar pickups work.&amp;nbsp; I had a general idea about how they work, postulating they are essentially variable reluctance sensors,&amp;nbsp; but doing a bit of research, I kind of got bitten by the electric guitar bug and dove right into the research of solid body electric guitars as a whole.&lt;br /&gt;
&lt;br /&gt;
I have been primarily focused on guitar pickups and passive electronics at the moment.&amp;nbsp; In short order however, I would be requiring a test bed for these pickups.&amp;nbsp; That is why I made the decision from the very beginning that I would not only try my hand at building electric guitar pickups, but a complete scratch built guitar; &lt;a href="http://youtu.be/CwfPZNRoyf8"&gt;wood has been harvested&lt;/a&gt;.&amp;nbsp; Later posts will focus on other topics about solid body electric guitar building.&amp;nbsp; Here, I will try to stay on the topic of an electric guitar pickups, but more specifically the pickup winder I built to wind my own pickups.&lt;br /&gt;
&lt;br /&gt;
After announcing my new obsession to anyone who would listen, an electric guitar was given to me to experiment with.&amp;nbsp; It is a smaller than average guitar, possibly for a child, but it will do just fine to test my pickups with a full guitar still being built down the road.&amp;nbsp; Below is a picture of the pickguard with the old electronics installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-bDWyDcWOLMU/TllsaXpGGLI/AAAAAAAAByE/BGzH_syx-Zk/s1600/IMAG1712.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-bDWyDcWOLMU/TllsaXpGGLI/AAAAAAAAByE/BGzH_syx-Zk/s320/IMAG1712.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Since I was going to be using an microcontroller to count the turns and stop the machine when the predetermined number of turns has been reached, I could make this winder do more stuff too.&amp;nbsp; So, I made this pickup winder into more of a pickup winding station.&amp;nbsp; Here is a feature list:&lt;br /&gt;
&lt;br /&gt;
-Pickup Winding with turn counting, RPM, ETA and auto stop&lt;br /&gt;
-Stroboscopic guitar tuner&lt;br /&gt;
-Ohm meter for coil resistance measurement&lt;br /&gt;
-Gaussmeter for measuring polarity and magnetic flux density of pole pieces&lt;br /&gt;
&lt;br /&gt;
I decided to use an Arduino to control my guitar pickup winder.&amp;nbsp; I  figured it would be a good way to put it into use.&amp;nbsp; I bought the thing  years ago and have only used it a couple of times.&amp;nbsp; It really just gathers  (figurative) dust as was the graphic LCD I used here too.&amp;nbsp; I was glad to  put some inventory to use in this project.&lt;br /&gt;
&lt;br /&gt;
The code is ~850 lines so probably a bit much for inline posting with syntax highlighter.&amp;nbsp; Instead, you can download the arduino "sketch" (code) below.&amp;nbsp; Also, there is a link to a collection of free PDF's I came across while doing research for this project.&amp;nbsp; There is some good information in there about guitar pickups.&amp;nbsp; I also put a schematic for wiring my guitar in there too as I found the pictorial "schematics" confusing.&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
&lt;br /&gt;
You can download the pickup winder schematic &lt;a href="https://sites.google.com/site/pemills2011/file/GPW_v1.0.pdf?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&lt;br /&gt;
You can download the v1.5 Arduino code &lt;a href="https://sites.google.com/site/pemills2011/file/GPW_1_5.pde?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&lt;br /&gt;
You can download the guitar electronics schematic plus PDF collection &lt;a href="https://sites.google.com/site/pemills2011/file/GuitarPickupPDF%27s.rar?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
The need for a pickup winder is obvious when you take a look at the construction of an &lt;a href="http://en.wikipedia.org/wiki/Pickup_%28music_technology%29"&gt;electric guitar pickup&lt;/a&gt;.&amp;nbsp; Essentially, there is a bobbin made from AlNiCo rod magnets and insulating material.&amp;nbsp; Around this, there are ~6,000 to ~10,000 turns of 42 ga wire.&amp;nbsp; Depending on the pickup, the number of turns of wire and the wire gauge will differ, but this approximation will illustrate the need for a machine that can turn the bobbin and reliably count the completed turns.&lt;br /&gt;
&lt;br /&gt;
Here are some pictures showing the complete bobbins and&amp;nbsp; the &lt;a href="http://en.wikipedia.org/wiki/Eucalyptus_marginata"&gt;Jarrah wood&lt;/a&gt; spacers and tools for assembly.&amp;nbsp; Everything is sitting on my tree stump anvil that I collected while sawyering in the above youtube video.&amp;nbsp; The magnets are appropriately called "pole pieces" and this configuration is called "staggered".&amp;nbsp; The height of the pole piece corrects for volume as the fretboard is radiused.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-KH1mUmK4uqM/Tlo_nqkOZuI/AAAAAAAABys/5rh-hhWCmz0/s1600/IMAG1705.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-KH1mUmK4uqM/Tlo_nqkOZuI/AAAAAAAABys/5rh-hhWCmz0/s320/IMAG1705.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-PPwwZ55ArNU/TlpAVVATZBI/AAAAAAAAByw/lnrqgH5hvGc/s1600/IMAG1709.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-PPwwZ55ArNU/TlpAVVATZBI/AAAAAAAAByw/lnrqgH5hvGc/s320/IMAG1709.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Also, 42 ga wire is tiny and fragile!&amp;nbsp; Here is a microscopy photo showing the copper 42 ga wire on the right next to a hair from my head. &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-vNdgcXk88mM/Tlo9nUggY_I/AAAAAAAAByk/d8fOBBGX-E4/s1600/IMAG1737.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-vNdgcXk88mM/Tlo9nUggY_I/AAAAAAAAByk/d8fOBBGX-E4/s320/IMAG1737.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
O Kapton! My Kapton!&amp;nbsp; I wrapped the bobbins with &lt;a href="http://parts.digikey.com/1/parts-kws/kapton-tape"&gt;Kapton tape&lt;/a&gt; to prevent possible abrasion from wearing thru the wire insulation and shorting out the pickup.&amp;nbsp; I also super glued the inside joint where the alnico 5 rod magnets meet the flatwork to discourage pressing them thru and abrading the coil wire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-We2XzZ6PeVo/TlpE5w1-EpI/AAAAAAAABy8/Va-jCXgjVDM/s1600/IMAG1711.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-We2XzZ6PeVo/TlpE5w1-EpI/AAAAAAAABy8/Va-jCXgjVDM/s320/IMAG1711.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I looked up some commercially available &lt;a href="http://www.stewmac.com/shopby/item/1465?utm_source=google&amp;amp;utm_medium=shopping&amp;amp;utm_campaign=2011-08-gp"&gt;pickup winders&lt;/a&gt; to get an idea of what I was trying to make.&amp;nbsp; The speed ranges were all around 1000 RPM and variable.&amp;nbsp; Some of the commercial winders have a thru axle offering "reverse" winding capabilities.&amp;nbsp; I decided I can achieve "reverse" winding by mounting the pickup to wind "upside down" and the direction of wind will be opposite.&amp;nbsp; This way I do not have to worry about motor direction control.&lt;br /&gt;
&lt;br /&gt;
I found a variable speed motor in the form of a sewing machine motor  in one of my many junk boxes.&amp;nbsp; I made an infrared non-contact tachometer to  measure the no load speed of this motor and was rather surprised to find  that it turned at 10,000 RPM.&amp;nbsp; Clearly this is way too fast even with  the variable speed throttle pedal.&lt;br /&gt;
&lt;br /&gt;
I did not give up on sewing machine motors, though and went to the &lt;a href="http://www.recycleannarbor.org/"&gt;ReUse center&lt;/a&gt; and found an old &lt;a href="http://petemills.blogspot.com/2011/07/engineering-bow-tie.html"&gt;Remington sewing machine&lt;/a&gt;  for $5.&amp;nbsp; This machine was too sweet looking to hack apart so I decided  to keep it as a sewing machine after a bit of tuning it up and make up an adapter to make it work  for pickup winding too.&amp;nbsp; Also, leaving the sewing machine in tact gives  me the benefits of mechanical gear reduction, friction to help slow it  down, a flywheel and a face plate area to mount an adapter for putting the pickup  bobbins.&amp;nbsp; It's a win-win situation.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://sites.google.com/site/pemills2011/file/PT0066A-CoilWinderJigModel%281%29.pdf?attredirects=0&amp;amp;d=1"&gt;Here&lt;/a&gt;  is a drawing of the adapter jig.&amp;nbsp; It mounts in the flywheel on the end  of the sewing machine with three rare earth magnets as seen in the  picture below.&amp;nbsp; A ferrous piece of material, such as steel is screwed on  to the aluminum jig to allow the pickup bobbin to be mounted with it's  Alnico 5 magnets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-FU_gWo3s6gU/TlpG4hu0ZkI/AAAAAAAABzA/V7dyBxOvEXg/s1600/IMAG1632.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-FU_gWo3s6gU/TlpG4hu0ZkI/AAAAAAAABzA/V7dyBxOvEXg/s320/IMAG1632.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-rSXYfXOI3qo/TlpG8ZNmKTI/AAAAAAAABzE/MbujcvgZ5WU/s1600/IMAG1634.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-rSXYfXOI3qo/TlpG8ZNmKTI/AAAAAAAABzE/MbujcvgZ5WU/s320/IMAG1634.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I found that the pickup bobbin  mounted magnetically to the steel bar did not have a high enough  coefficient of static friction; it would rotate with a small amount of torque applied yet it had quite a strong magnetic attraction to the steel bar.&amp;nbsp; I tried a piece of duct tape, sticky side towards the steel plate, and it helped, but the real solution was gluing a couple pieces of sand paper on the outer edges of the steel bar, atop the duct tape as shown below.&amp;nbsp; This allows for secure winding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-_fuGlfpnEDA/TlpHal7BkjI/AAAAAAAABzI/eXleFirljlM/s1600/IMAG1690.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-_fuGlfpnEDA/TlpHal7BkjI/AAAAAAAABzI/eXleFirljlM/s320/IMAG1690.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Below you can see how I mounted the pickup bobbin in "standard" orientation.&amp;nbsp; This allows what is known as clockwise winding.&amp;nbsp; The picture also shows how I used a straight edge to line up the wire guide stops.&amp;nbsp; Those wire guide stops are mounted to a 3/8" diameter rod from the hardware store.&amp;nbsp; The rod is held in place by a magnetic base dial indicator stand.&amp;nbsp; All sewing machines that I am aware of have a flywheel on the side that rotates the same direction.&amp;nbsp; Using the picture below for reference, the top of the flywheel moves to the left.&amp;nbsp; This is anti-clockwise as you look at the front end of it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-XutNvQrGs1g/Tlo-lXwZwHI/AAAAAAAAByo/SvidUlqnvIM/s1600/IMAG1679.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-XutNvQrGs1g/Tlo-lXwZwHI/AAAAAAAAByo/SvidUlqnvIM/s320/IMAG1679.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In the following pictures you will see how I mounted the bobbin to the faceplate to allow "reverse" or anti-clockwise winding.&amp;nbsp; I pressed some rare earth magnets into a piece of Jarrah wood.&amp;nbsp; The pickup bobbin is charged magnetically so it's alnico 5 rod magnets are attracted to the opposite poles on the rare earth magnets.&amp;nbsp; The rare earth magnets hold the Jarrah wood spacer and bobbin to the steel bar on the faceplate.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-N4jzszL4pUo/TlpCQrhn_nI/AAAAAAAABy0/eojbWxRG3o4/s1600/IMAG1731.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-N4jzszL4pUo/TlpCQrhn_nI/AAAAAAAABy0/eojbWxRG3o4/s320/IMAG1731.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-vq0Tvp6KQiM/TlpCfAnHLAI/AAAAAAAABy4/PhNJCM8a4yI/s1600/IMAG1735.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-vq0Tvp6KQiM/TlpCfAnHLAI/AAAAAAAABy4/PhNJCM8a4yI/s320/IMAG1735.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Did you happen to notice a piece of black electrical tape across the flywheel in any of the pictures above?&amp;nbsp; That is for the infrared non-contact tachometer.&amp;nbsp; You can check the schematic for more details on that.&amp;nbsp; Since I am measuring rotation events over time (RPM), it is a trivial matter to count the total number of events (rotations) or coil winds.&amp;nbsp; I am also able to calculate estimated time to completion based on current RPM and number of winds left.&amp;nbsp; The software opens a relay when the number of winds is greater than or equal to the desired number of winds.&amp;nbsp; This cuts the power to the sewing machine so it stops when you have the correct number of winds.&amp;nbsp; Of course, inertia adds a few winds, but you can compensate for that by lowering the number of winds desired or just unwinding a few turns when you see how many over the machine went. It seems to overshoot by 10-15 turns due to inertia so I just set the desired turns number lower.&amp;nbsp; That is a pretty complete description of the coil winder operation.&amp;nbsp; There isn't much to it, but there is a lot of information on the internet and in books about coil winding that are worth a read.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
You can see a picture of the non-contact IR tach sensor below.&amp;nbsp; It has 2 magnets to attach to the cast iron sewing machine body.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-tz79_F6HwFg/TlGywq6F_lI/AAAAAAAABnA/AOp1Wz--Ozc/s1600/IMAG1650.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-tz79_F6HwFg/TlGywq6F_lI/AAAAAAAABnA/AOp1Wz--Ozc/s320/IMAG1650.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Even with the gear reduction offered by keeping the sewing machine in tact and the added friction, I found the flywheel where my adapter jig is mounted still rotated too fast.&amp;nbsp; I found it necessary to slow the motor down further and I did this by adding a "resistor" for the AC hot line of the sewing machine motor.&amp;nbsp; I used a 100-watt light bulb for this purpose and now the final speed at the flywheel is a manageable maximum of ~1000 RPM.&amp;nbsp; The throttle pedal still controls speed and the light bulb is inserted in the circuit with standard 110ac 2 prong plugs so it can be removed for high speed sewing. &amp;nbsp;&amp;nbsp; Below is a picture of the dimly glowing bulb acting as a resistor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-RA3dh93UT7Q/TlcAU-NWsUI/AAAAAAAABoE/G4014TfFGF4/s1600/IMAG1589.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-RA3dh93UT7Q/TlcAU-NWsUI/AAAAAAAABoE/G4014TfFGF4/s320/IMAG1589.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a short demo video.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/mhwhA7tNNbc/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/mhwhA7tNNbc?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/mhwhA7tNNbc?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stroboscopic tuner:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Dg5LwyBU5TQ/TlpsPhXZEaI/AAAAAAAABzQ/b9fmxd6cXZc/s1600/IMAG1757.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-Dg5LwyBU5TQ/TlpsPhXZEaI/AAAAAAAABzQ/b9fmxd6cXZc/s320/IMAG1757.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The stroboscopic guitar tuner works by flashing an LED at the resonant frequency of an in-tune guitar string.&amp;nbsp; I made a guitar pick with an led on it to pluck a guitar string.&amp;nbsp; An LED plectrum if you will.&amp;nbsp; The pick was etched using the sharpie and ferric chloride method.&amp;nbsp; It says "LED Guitar Tuner" on it.&amp;nbsp; You aim the led at the string while it vibrates and turn the tuning machines of the guitar until the string appears to be still.&amp;nbsp; Below is a picture of the LED pick and a video of the tuning in progress.&amp;nbsp; It is a little difficult to see in the video but in person, the strobe tuner is quite effective.&amp;nbsp; The video is taken after the pickups I made were installed in this guitar.&amp;nbsp; The sound you are hearing is coming from an LM386 audio amp I made for a different project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-JFBPfw9BaE0/TlG3hzsltxI/AAAAAAAABnE/ElJ9sWgYr7w/s1600/IMAG1652.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-JFBPfw9BaE0/TlG3hzsltxI/AAAAAAAABnE/ElJ9sWgYr7w/s320/IMAG1652.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/rdoBzNkqZ64/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/rdoBzNkqZ64?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/rdoBzNkqZ64?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;I have found in practice that the stroboscopic guitar tuner is much easier to use on the lower frequency strings.&amp;nbsp; Like the low-E at 82.41 Hz.&amp;nbsp; The video above is of the G string at 196 Hz and it is easy enough to see in person too.&amp;nbsp; I guess, as with anything, practice is helpful to getting it right.&amp;nbsp; You can use relative tone matching by ear for tuning the higher frequency strings.&amp;nbsp; There is nothing to say you cannot strobe tune all strings with the strobe tuner, however.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussmeter:&lt;br /&gt;
&lt;br /&gt;
I think it will be useful to know the relative Gauss strength of the pickup pole pieces and knowing the polarity, north or south, will be paramount to success.&amp;nbsp; Many websites on pickup making suggest using a &lt;a href="http://www.stewmac.com/shop/Electronics,_pickups/Tools:_Polarity_tester/Magnet_Polarity_Tester.html"&gt;polarity tester&lt;/a&gt; for determining polarity but, using a continuous, ratiometric hall effect sensor I can measure the magnetic flux density of the pickup pole pieces at 1.3mV/G as well as the polarity.&amp;nbsp; This is an uncalibrated value, but it is sufficient for my purposes.&amp;nbsp; The sensor I used is an &lt;a href="http://www.allegromicro.com/en/Products/Part_Numbers/1301/1301.pdf"&gt;Allegro A1302&lt;/a&gt; hall effect sensor.&amp;nbsp; In the gaussmeter mode, peak gauss values are recorded and instantaneous values are reported.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-XyugmSRSq_8/TlprcU6QJHI/AAAAAAAABzM/OzN-vXweLYs/s1600/IMAG1754.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-XyugmSRSq_8/TlprcU6QJHI/AAAAAAAABzM/OzN-vXweLYs/s320/IMAG1754.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
It is important to note that if the gaussmeter displays the polarity as "North", that means you have a "South" pole of a magnet facing it and your pickup is a "South" polarity pickup.&amp;nbsp; This is the same as how a compass would work. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ohm Meter:&lt;br /&gt;
&lt;br /&gt;
Not too much to say here.&amp;nbsp; There is a voltage divider circuit made with a 10k0 resistor and the guitar pickup under test.&amp;nbsp; The instantaneous ohmic value is reported and peak value stored and displayed.&amp;nbsp; I remember measuring the resistance of a coil right after winding.&amp;nbsp; It measured ~6k2.&amp;nbsp; After leaving it for some time it went down to 6k0.&amp;nbsp; I believe the friction from my hand when winding caused the temperature to rise enough to cause this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/--l7nO7r1lJw/TlpvOYP3cII/AAAAAAAABzY/0cYTY1uabAU/s1600/IMAG1744.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/--l7nO7r1lJw/TlpvOYP3cII/AAAAAAAABzY/0cYTY1uabAU/s320/IMAG1744.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I had originally planned to make this pickup winder have an automatic wire feed traversal so it could wind coils on its own.&amp;nbsp; I may get back to doing that at some point but for now I will "hand" wind them.&amp;nbsp; That is, feed the wire to the spinning bobbin by hand.&amp;nbsp; This seems to be the preferred method of winding of some musicians anyhow.&amp;nbsp; I left a PWM channel available to connect a servo motor to at some point for this purpose should I choose to implement it.&lt;br /&gt;
&lt;br /&gt;
Once the pickups are wound and wire ends soldered to the eyelets they are was potted.&amp;nbsp; I wrap one round of kapton tape around the coil wire before potting in 20% beeswax and 80% by mass of gulf wax.&amp;nbsp; I put the jar in a bath of ~160 Deg F water to melt the wax.&amp;nbsp; I put the pickup in the wax and wait for it to come up to temperature.&amp;nbsp; You can see in the video below that the pole pieces are that last to warm.&amp;nbsp; The whole thing locally cools the was and it solidifies.&amp;nbsp; Within about a minute, depending on the relative thermal masses the pickup is up to temperature and all the wax around it is remelted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/g7lybwCouDA/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/g7lybwCouDA?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/g7lybwCouDA?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Once they are up to temperature I apply a partial vacuum to the jar removing air and replacing it with wax in all the nooks and crannies of the coil winds.&amp;nbsp; Besides being good practice for durability of this tiny wire this also stops what guitar players refer to as &lt;a href="http://www.premierguitar.com/Magazine/Issue/2009/Apr/Microphonic_Pickups_Vintage_or_Modern_Sounds.aspx"&gt;microphonic pickups&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/Z-5rtvA3jxI/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Z-5rtvA3jxI?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/Z-5rtvA3jxI?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a shot of the pickups wax potted and ready to be installed into the guitar.&amp;nbsp; The black wire is the ground.&amp;nbsp; I make the ground wire whichever eyelet is the coil finish so that the outer coils of the pickup can act as a shield also.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Z5_OrIoKKNE/TlpyrKJZ48I/AAAAAAAABzc/2Oq56aQ3Qf4/s1600/IMAG1752.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-Z5_OrIoKKNE/TlpyrKJZ48I/AAAAAAAABzc/2Oq56aQ3Qf4/s320/IMAG1752.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I wound my middle pickup to be opposite of my neck and bridge pickup.&amp;nbsp; It will be reverse-wound, reverse-polarity for hum cancellation in guitar switch positions 2 and 4.&lt;br /&gt;
&lt;br /&gt;
As far as charging the pole pieces goes it's pretty easy.&amp;nbsp; Alnico is very coercive.&amp;nbsp; I bring the assembled and potted pickup into contact with one pole of a strong rare earth magnet.&amp;nbsp; I use a 3-inch diameter 400 lb pull magnet.&amp;nbsp; I suspect you can get away with a much smaller magnet, that is just what I had on hand.&amp;nbsp; So, if I want a "North" polarity pickup I bring the top of the pickup into contact with the "North" side of the charging magnet.&amp;nbsp; The approach and withdraw is axial.&amp;nbsp; Then I do the same on the other side bringing the bottom of the pickup close to the magnets' "South" pole.&amp;nbsp; This makes the top of the pickup "North" and thus attracts a compass "South" needle, thus a "North" polarity pickup.&lt;br /&gt;
&lt;br /&gt;
I installed the new pickups I made into the old pickguard.&amp;nbsp; I had to whittle away some of the bass wood of the body cavity to fit an extra tone potentiometer.&amp;nbsp; As I stated earlier, I have a reverse wound, reverse polarity middle pickup here.&amp;nbsp; I wired them up according the the schematic I drew up and linked to above. I think this is the standard "Strat 2-tone wiring". &amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
So, in the end, everything seems to have worked.&amp;nbsp; It makes noise anyway.&amp;nbsp; I am waiting for someone who knows how to play a guitar to come over and test it out, but I think I am off to a good start.&amp;nbsp; If you have any suggestions on how to improve my pickups let me know.&amp;nbsp; Or, if you have any tips on scratch building guitar bodies/necks that would be appreciated too.&amp;nbsp; I still need to make a better case for the Pickup winder electronics.&amp;nbsp; Probably a wooden box to set the plexiglass in to keep fingers and 110 vac separate.&lt;br /&gt;
&lt;br /&gt;
A final "finished product" picture... for now anyway.&amp;nbsp; Also, the missing string has been replaced already.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-dkteDp0Xk1E/Tlp_13a9ZeI/AAAAAAAABzg/S4KmmmDPUn8/s1600/IMAG1756.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-dkteDp0Xk1E/Tlp_13a9ZeI/AAAAAAAABzg/S4KmmmDPUn8/s320/IMAG1756.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-EKDa8b6NovI/Tlp_4iTcTSI/AAAAAAAABzk/u2phyZdZ59E/s1600/IMAG1763.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-EKDa8b6NovI/Tlp_4iTcTSI/AAAAAAAABzk/u2phyZdZ59E/s320/IMAG1763.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/7aOzW84mRVQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/5220066643487482788/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=5220066643487482788" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5220066643487482788?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5220066643487482788?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/7aOzW84mRVQ/guitar-pickup-winder.html" title="Guitar Pickup Winder" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-p97s3yUOy5Q/Tlo4Nky1TII/AAAAAAAAByg/6JOV_WXFfSA/s72-c/IMAG1664.jpg" height="72" width="72" /><thr:total>13</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/08/guitar-pickup-winder.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAHQ3s5fCp7ImA9WhdQGEo.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8432157543756982456</id><published>2011-08-19T09:14:00.001-04:00</published><updated>2011-08-20T16:55:32.524-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-20T16:55:32.524-04:00</app:edited><title>Halloween Spooky Eyes</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-w_Re49-R3g8/Tk5WMT_-zSI/AAAAAAAABi8/6tFndC4SMKQ/s1600/IMAG1613.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-w_Re49-R3g8/Tk5WMT_-zSI/AAAAAAAABi8/6tFndC4SMKQ/s320/IMAG1613.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
With Halloween approaching and a little bit of free time on my hands the other day, I decided to make a decoration to put in the bushes this Halloween.&amp;nbsp; They are large 10mm diameter LED's glued to popsicle sticks.&amp;nbsp; They are spaced apart to look like Halloween creature eyes hiding in the bushes stalking their prey.&amp;nbsp; Are they after the bags of candy or the trick-or-treaters themselves?&amp;nbsp; I hooked them up to a microcontroller to animate them by "blinking", not to be confused with flashing of course.&amp;nbsp; You certainly could do a re-design and use 555 timers etc, but it seems more and more these days I have more microcontrollers in stock than I do 555 timers and the like.&lt;br /&gt;
&lt;br /&gt;
I drew vertically elongated pupils with a sharpie on the LED's to add to the creature like effect.&amp;nbsp; They are a bit hard to see in the video but they look good in person.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-dHSVxPRngHI/Tk5YZCxtTMI/AAAAAAAABjA/t9z2iIPmW-g/s1600/IMAG1612.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-dHSVxPRngHI/Tk5YZCxtTMI/AAAAAAAABjA/t9z2iIPmW-g/s320/IMAG1612.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
These LED's came from some discount store I don't remember when and as such I didn't have any specs on them.&amp;nbsp; To find the forward voltage drop I applied 5v via a 1k0 resistor and measured the voltage across the LED leads.&amp;nbsp; I measured ~1.7v on all of them.&amp;nbsp; Here is a construction photo showing the current limiting resistors for the LED's.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-QqGCcYT-5bM/Tk5Zq0_vKMI/AAAAAAAABjE/ida650AD4PA/s1600/IMAG1607.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-QqGCcYT-5bM/Tk5Zq0_vKMI/AAAAAAAABjE/ida650AD4PA/s320/IMAG1607.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I connected the LED pairs to an ATtiny2313 microcontroller via some comms wire and some 2n3904 transistors for each pair.&amp;nbsp; You can see how spartan the circuit is in the picture below.&amp;nbsp; If you would like a schematic of the spooky Halloween eyes you can download it &lt;a href="https://sites.google.com/site/pemills2011/file/Spooky_Eyes_Schematic.pdf?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-0ZqaK1Gikxw/Tk5aeVQHShI/AAAAAAAABjI/ZORKKwS4ITc/s1600/IMAG1604.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-0ZqaK1Gikxw/Tk5aeVQHShI/AAAAAAAABjI/ZORKKwS4ITc/s320/IMAG1604.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Hot glue offers some protection in the form of electrical insulation and mechanical fastening.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-CoeP11RuPg0/Tk5bLBohMwI/AAAAAAAABjM/VPK7B8nstJc/s1600/IMAG1608.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-CoeP11RuPg0/Tk5bLBohMwI/AAAAAAAABjM/VPK7B8nstJc/s320/IMAG1608.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I have yet to install these eyes in the bushes, but initial bench testing suggests they are incredibly realistic creature eyes.&amp;nbsp; I walked by the room where I was testing them and I was overcome with fear and froze in my tracks.&amp;nbsp; The terror subsided when I remembered that the eyes are just a Halloween decoration; LED's and C code at that.&lt;br /&gt;
&lt;br /&gt;
Since humans blink at about 3-4 blinks per minute when concentrating I figured that would be a good blink frequency to use for my creature eyes.&amp;nbsp; The creatures could in fact have once been human before turning, we just don't know.&amp;nbsp; Blink duration is 350mS.&amp;nbsp; Here is the code to run 3 eyes.&amp;nbsp; Feel free to modify it for your own use.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/* 
Title:		Spooky Eyes v1.0
Filename:	spooky_eyes_1_0_main.c
Author:		Pete Mills
Website:	http://petemills.blogspot.com
Date:		2011.08.17
uC:			ATtiny2313 @ 8 MHz internal oscilator, no prescale
*/

/*
Program description:

This program blinks LED "eyes".  The led's are mounted on popsicle sticks about the distance apart as 
human eyes are.  Hide the LED's in the bushes and they look like halloween creatures stalking you.
The blink frequency is that of a concentrating human at 3-4 blinks per minute. Blink duration is 350ms.
These timings are non critical and as such timing is derived from the ATtiny's internal RC oscillator.

Circuit Description:

The uC is an ATtiny2313 running on its internal oscillator @ 8MHz with no internal prescale.
The 10mm diameter led's are connected to PB0::2 via a 2N3904 transistor for each pair.  The led's are 
on the high side.  Each LED has a 120 ohm current limiting resistor.  

A schematic is available at https://sites.google.com/site/pemills2011/file/Spooky_Eyes_Schematic.pdf?attredirects=0&amp;amp;d=1

*/


#include &amp;lt;avr/io.h&amp;gt;			// defines things like "PORTB" and "TCCR0" etc
#include &amp;lt;util/delay.h&amp;gt;		// delay functions
#include &amp;lt;avr/interrupt.h&amp;gt;

#define EYE_PORT PORTB		// hardware port for spooky eyes
#define RED_EYE PB0			// red eyes
#define YEL_EYE PB1			// yellow eyes
#define GRN_EYE PB2			// green eyes

// global variables

volatile uint16_t red_ctr = 0;
volatile uint16_t yel_ctr = 0;
volatile uint16_t grn_ctr = 0;


// function prototypes

void setup(void);
void blink_eye(int eye);


int main(void)
{

setup();

uint16_t red_delay = 0;
uint16_t yel_delay = 0;
uint16_t grn_delay = 0;
uint16_t min_time = 15000; 	// minimum amount of time between blinks


	while(1)
	{
		
		if( red_ctr &amp;gt;= red_delay )
		{
			blink_eye(RED_EYE);
			// random time from ~0-5 sec plus min_time = ~15-20 sec between blinks
			red_delay = ( ( (uint8_t) rand() ) * 20 ) + min_time;	
			red_ctr = 0;
		}
		
		if( yel_ctr &amp;gt;= yel_delay )
		{
			blink_eye(YEL_EYE);
			yel_delay = ( ( (uint8_t) rand() ) * 20 ) + min_time;	
			yel_ctr = 0;
		}
		
		if( grn_ctr &amp;gt;= grn_delay )
		{
			blink_eye(GRN_EYE);
			grn_delay = ( ( (uint8_t) rand() ) * 20 ) + min_time;	
			grn_ctr = 0;
		}

	}

}


// functions

void setup(void)
{

// port config

DDRB |= ( ( 1 &amp;lt;&amp;lt; 0 ) | ( 1 &amp;lt;&amp;lt; 1 ) | ( 1 &amp;lt;&amp;lt; 2 ) );		// set portB bits 0::2 to 1 for output
PORTB &amp;amp;= ~( ( 1 &amp;lt;&amp;lt; 0 ) | ( 1 &amp;lt;&amp;lt; 1 ) | ( 1 &amp;lt;&amp;lt; 2 ) );	// set the outputs low


// timer config

OCR1AH = 0;							// interrupt @ 1khz
OCR1AL = 124;						// decimal 124, one less than 125000/1000 because 0 and TOP are counted
TCCR1B |= ( ( 1 &amp;lt;&amp;lt; WGM12 ) | ( 1 &amp;lt;&amp;lt; CS10 ) | ( 1 &amp;lt;&amp;lt; CS11 ) );		// CTC mode, ck/div by 64 for 125000 Hz
TIMSK |= ( 1 &amp;lt;&amp;lt; OCIE1A );											// enable OCR1A match interrupt
sei();
}


void blink_eye(int eye)
{
	EYE_PORT &amp;amp;= ~( 1 &amp;lt;&amp;lt; eye );	// turn off eye
	_delay_ms(350);
	EYE_PORT |= ( 1 &amp;lt;&amp;lt; eye );  // turn eyes back on
}


ISR(TIMER1_COMPA_vect)
{
	red_ctr++;
	yel_ctr++;
	grn_ctr++;
}







// 
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Here are a couple videos of the eyes in action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/jKiqXwtdLyk/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/jKiqXwtdLyk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/jKiqXwtdLyk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In this video you can see some of the randomness in the trio of creature eyes.&amp;nbsp; There is a minimum of 15 seconds between each set of eyes blinks then a random amount of time from ~0-5 seconds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/TdCPrMGrst0/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/TdCPrMGrst0?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/TdCPrMGrst0?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This was a fun afternoon project and I think it will be a fun decoration too.&amp;nbsp; I hope the trick-or-treaters don't get too frightened and stay away...&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/lWPZuq3coPc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8432157543756982456/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8432157543756982456" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8432157543756982456?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8432157543756982456?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/lWPZuq3coPc/halloween-spooky-eyes.html" title="Halloween Spooky Eyes" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-w_Re49-R3g8/Tk5WMT_-zSI/AAAAAAAABi8/6tFndC4SMKQ/s72-c/IMAG1613.jpg" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/08/halloween-spooky-eyes.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkECQH0zeyp7ImA9WhdQEUo.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-853831572998995961</id><published>2011-08-12T14:44:00.000-04:00</published><updated>2011-08-12T14:44:21.383-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-12T14:44:21.383-04:00</app:edited><title>Bat Detector</title><content type="html">If you are a reader of Make Magazine you may remember seeing a "Bat Detector" as a &lt;a href="http://blog.makezine.com/archive/2006/09/make-podcast-weekend-proj-6.html"&gt;weekend project&lt;/a&gt;.&amp;nbsp; That was back in 2006.&amp;nbsp; In the summer of 2010 I ordered some circuit boards from &lt;a href="http://pw1.netcom.com/%7Et-rex/BatDetector.html"&gt;Tony Messina&lt;/a&gt; who designed this circuit.&amp;nbsp; And last night, in the summer of 2011, I finally put together 3 of these neat little ultrasonic frequency division bat detectors.&amp;nbsp; It took a while, but it was totally worth it.&lt;br /&gt;
&lt;br /&gt;
I wasn't able to record any bats as they were scarce last night, but here are a couple of sounds that have an ultrasonic component to them. &lt;a href="https://sites.google.com/site/pemills2011/file/fingers.mp3?attredirects=0&amp;amp;d=1"&gt;Rubbing fingers together&lt;/a&gt; and &lt;a href="https://sites.google.com/site/pemills2011/file/waterfaucet.mp3?attredirects=0&amp;amp;d=1"&gt;water running from a faucet&lt;/a&gt;.&amp;nbsp; The water faucet sound clip sounds very much like my Geiger counter in the presence of radiation.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
I don't have much to say about the construction of the bat detectors.&amp;nbsp; I really just wanted to post about them to help spread the word.&amp;nbsp; I think it is great when makers like Tony share their circuits for all to enjoy and I also appreciated buying the circuit board from him as I wanted to make several bat detectors for friends.&amp;nbsp; Below is a picture of an enclosure being modified to accept a bat detector circuit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-LG9fnwmmQ58/TkVuYxm4PEI/AAAAAAAABeA/sxODpcq9Vhc/s1600/IMAG1567.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-LG9fnwmmQ58/TkVuYxm4PEI/AAAAAAAABeA/sxODpcq9Vhc/s320/IMAG1567.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As for enclosures I just looked through my junk boxes until I found something that would work.&amp;nbsp; In the picture below you can see I used a slot car throttle for one of them.&amp;nbsp; It almost closes all the way but the 9v battery I put in the handle is just a touch too big.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-BHX51lFW3GM/TkVvbbTTKHI/AAAAAAAABeE/PtSW_tbIVsc/s1600/IMAG1572.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-BHX51lFW3GM/TkVvbbTTKHI/AAAAAAAABeE/PtSW_tbIVsc/s320/IMAG1572.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The other enclosures I used are a cell phone holster with the plastic box from a laser pointer inside it and just a plain old black otter box.&amp;nbsp; I think the otter box will be useful when camping because it is waterproof until you open it up to use it and the slotcar throttle is neat because it kind of looks like a ray gun from science fiction.&amp;nbsp; Future upgrades include bat like graphics to be applied.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-C4ZhG4HBCLY/TkVx7g5r4hI/AAAAAAAABeI/WBXgNk7WhIg/s1600/IMAG1575.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-C4ZhG4HBCLY/TkVx7g5r4hI/AAAAAAAABeI/WBXgNk7WhIg/s320/IMAG1575.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I am really pleased I finally put the time into making these.&amp;nbsp; It took about an evening for all three including enclosures.&amp;nbsp; Right after finishing the first one I took it outside and within 5 minutes I heard a clicking sound.&amp;nbsp; I looked to the dusky sky and there was a bat fluttering about before flying off over the roof.&amp;nbsp; I didn't see or hear anymore bats that night, but that one literally put a smile on my face.&amp;nbsp; Too fun! &lt;br /&gt;
&lt;br /&gt;
Final thought; Go do this, but don't drag it out for 5 years like I did.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/tgypJS8yYlE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/853831572998995961/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=853831572998995961" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/853831572998995961?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/853831572998995961?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/tgypJS8yYlE/bat-detector.html" title="Bat Detector" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-LG9fnwmmQ58/TkVuYxm4PEI/AAAAAAAABeA/sxODpcq9Vhc/s72-c/IMAG1567.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/08/bat-detector.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAMQng4eCp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-5710404764825207795</id><published>2011-07-25T11:52:00.008-04:00</published><updated>2011-08-19T19:49:43.630-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:49:43.630-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="sew bow tie sewing machine" /><title>Engineering a Bow Tie</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-jnN9Y-58iV0/Ti1IW0rPxBI/AAAAAAAABHk/5C8K0T-2Atc/s1600/IMAG1394.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://4.bp.blogspot.com/-jnN9Y-58iV0/Ti1IW0rPxBI/AAAAAAAABHk/5C8K0T-2Atc/s1600/IMAG1394.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-jnN9Y-58iV0/Ti1IW0rPxBI/AAAAAAAABHk/5C8K0T-2Atc/s320/IMAG1394.jpg" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
I purchased this sewing machine from the local recycle center a couple weekends ago for $5.&amp;nbsp; I bought it for another project I am working on that is unrelated to sewing, but I needed the motor.&amp;nbsp; Well, I was so impressed with how cool the machine looks I couldn't bear to scavenge the motor and discard the rest.&amp;nbsp; Instead, I decided to get the sewing machine to a working state and modify the design of my other project so that I could leave the machine intact.&amp;nbsp; I will still use this sewing machine for the intended project but now, after a couple of minor tune ups I also have a sweet looking sewing machine.&lt;br /&gt;
&lt;br /&gt;
All I really had to do to get the machine working was reinstall the thread tensioner, oil it and replace the motor brushes.&amp;nbsp; And with a little help from my &lt;a href="http://bellamiaonline.blogspot.com/2011/07/craft-night.html"&gt;Mom&lt;/a&gt; and a &lt;a href="http://beckyjoiner.blogspot.com/"&gt;friend&lt;/a&gt; of mine I was able to understand better what all of the different parts of the machine do.&amp;nbsp; Sewing machines are really incredible.&amp;nbsp; They have all kinds of interesting cams, connecting rods and leavers.&amp;nbsp; One source of amusement for me during this process has been learning the new terminology.&amp;nbsp; For instance I still have a tendency to call the "stitch length" "feed rate" instead.&amp;nbsp; If you are wondering what goes on beneath the bedplate of a sewing machine have a look at this &lt;a href="http://en.wikipedia.org/wiki/File:Lockstitch.gif"&gt;lock stitch gif&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Now that I have a working sewing machine what will I make?&amp;nbsp; Since I wanted to stitch something manly and easy and since I needed to get a bit fancy to go see my friend Linda in a play this weekend, I decided to make a bow tie.&amp;nbsp; Which got me thinking; bow ties are better!&amp;nbsp; Especially for hands on type people, comparing a bow tie to a neck tie the benefits are obvious.&amp;nbsp; Bow ties don't dangle down and get caught in rotating machinery or get soiled as they flap about in the breeze.&amp;nbsp; Bow ties don't have to be thrown over your shoulder to pee.&amp;nbsp; Bow ties send the message that you are fancy, but ready for action at any time.&amp;nbsp; Bow ties don't dangle into stove burners when you are cooking.&amp;nbsp; I have never burned a bow tie with acid.&amp;nbsp; And empirical evidence has proven I get more compliments wearing a bow tie than I do with neck ties.&lt;br /&gt;
&lt;br /&gt;
Before we make the bow tie I will offer this disclaimer.&amp;nbsp; I am not a seamster.&amp;nbsp; I felt much more at home working &lt;i&gt;on &lt;/i&gt;the machine than &lt;i&gt;with &lt;/i&gt;it.&amp;nbsp; In fact, this is my first time using a sewing machine really and as such there may be better ways to do things.&amp;nbsp; Probably like how to sew the left and right halves together for instance.&amp;nbsp; So, if you have any thoughts feel free to offer your suggestions in the comments below.&amp;nbsp; I'd love to hear them.&amp;nbsp; Also, I have made three bow ties now, some of the pictures I may use here are from different ties but were selected to best illustrate the steps.&amp;nbsp; Don't worry if the fabric print changes on us half way through the blog.&lt;br /&gt;
&lt;br /&gt;
A sewing pattern is a template used to cut out your fabric pieces prior to sewing.&amp;nbsp; I looked online for a bow tie pattern, but I found none suitable.&amp;nbsp; Instead I looked at an untied bow tie and a diagram of how to tie them.&amp;nbsp; This led me to conclude that the knot size is a function of the neck band width and the minimum distance between the two concave radii on the outer ends determines the bow "pleats" or how much it crunches down when you cinch it up.&amp;nbsp; With this in mind I fired up my favorite drafting program AutoCad and made some critical points.&amp;nbsp; I used the spline tool to connect them which is similar to a French curve for the old school drafters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
UPDATE:&lt;br /&gt;
In case you really want to get nerdy I made a new pattern.&amp;nbsp; I call it a "cosine function bow tie pattern" because the shape of the bow tie I designed is 2 cosines.&amp;nbsp; I wrote the functions on the pattern in case you want to know what they are.&amp;nbsp; You can download the cosine function bow tie pattern &lt;a href="https://sites.google.com/site/pemills2011/file/CosineBowTie.pdf?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&amp;nbsp; Both patterns use the same instructions outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download a PDF of the original pattern I made &lt;a href="https://sites.google.com/site/pemills2011/file/ButterflyBowTieModelv1.1.pdf?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&amp;nbsp; You will notice that there is one "bow tie end" and two neck templates.&amp;nbsp; I only needed one neck template, but there is another one included for larger necks.&amp;nbsp; Once everything is cut out, tape the neck template to the bow tie end where the arrow points to a line.&amp;nbsp; The arrow is coming from the text that reads "shirt collar in cm between here and other side".&amp;nbsp; Do tape it so that the neck template remains in line with the bow tie template.&amp;nbsp; Below is a picture of how I lined up the template.&amp;nbsp; Using a sheet of paper that touches a tangent point on the bow center and the intersection of the neck template line and the sew line on the neck template, the paper projects off to the right and makes a line to line up the neck template.&amp;nbsp; The extra sheet of paper is removed and I taped the two templates together.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-eGnF18spsWk/Ti1_uCwnCtI/AAAAAAAABIU/VrCzWcMKq_A/s1600/IMAG1373-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="149" src="http://4.bp.blogspot.com/-eGnF18spsWk/Ti1_uCwnCtI/AAAAAAAABIU/VrCzWcMKq_A/s320/IMAG1373-1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
From here you can mark your neck size.&amp;nbsp; My neck is 42cm circumferentially and since the pattern makes half of the bow tie, I marked 21cm on the template.&amp;nbsp; Er, pattern, I mean.&amp;nbsp; If we call this the left or right side, the 21cm mark marks a line of symmetry.&amp;nbsp; Each half of the bow tie should be sewn together at this line and it will fit your neck just right.&amp;nbsp; I decided against an adjustable neck strap because I feel my neck is probably done growing, I can make another one is necessary and ease of assembly with my limited sewing skills.&amp;nbsp; Here is a picture of the 21cm line marked and the neck template taped to the bow tie template.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-svkLg5U-6LI/Ti1mMdcUobI/AAAAAAAABHo/c4LY0WrGU7Y/s1600/IMAG1374.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-svkLg5U-6LI/Ti1mMdcUobI/AAAAAAAABHo/c4LY0WrGU7Y/s320/IMAG1374.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
A couple words on materials.&amp;nbsp; Firstly there is this stuff called &lt;a href="http://en.wikipedia.org/wiki/Interfacing"&gt;interfacing&lt;/a&gt;.&amp;nbsp; It is a horrible scratchy stiff material.&amp;nbsp; It feels like wax coated coffee filter papers or course &lt;a href="http://www2.dupont.com/Tyvek/en_US/index.html"&gt;tyvek&lt;/a&gt;.&amp;nbsp; I comes in an optional iron on version whose glue I presume would affect the color of your fabric.&amp;nbsp; The purpose of interfacing, to my knowledge, is to stiffen up your sewn piece so; it is supposed to be good for things like...bow ties.&amp;nbsp; I didn't use interfacing for interfacing and chose a fabric called &lt;a href="http://en.wikipedia.org/wiki/Muslin"&gt;muslin&lt;/a&gt; instead.&amp;nbsp; It is soft and pliable and with two layers of it in between my outer bow tie fabric, it stiffened it up just enough to hold its shape and still bend out of the way should your chin ever come in contact with your tie.&amp;nbsp; Safety first. &lt;br /&gt;
&lt;br /&gt;
The second thing to note about fabric is that it stretches more on the &lt;a href="http://en.wikipedia.org/wiki/Bias_%28textile%29"&gt;bias&lt;/a&gt;, 45 degrees from the fabric threads.&amp;nbsp; When you lay out the pattern on the fabric for cutting, place it so that it runs 45 degrees to the grain of the fabric.&amp;nbsp; Pin the &lt;strike&gt;template&lt;/strike&gt; pattern in place so it won't move when cutting.&amp;nbsp; I cut out all of the pieces at once.&amp;nbsp; This is probably not the best way to do it especially since my scissors are a bit dull from cutting a PCB days earlier.&amp;nbsp; Here is a picture of the pattern pinned in place, on the bias, ready for cutting.&amp;nbsp; In total there are 4 pieces of muslin and 4 pieces of outer fabric.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-2FfH7mI0RY4/Ti1wF_L-TEI/AAAAAAAABHs/-he1dGBT7C0/s1600/IMAG1377.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-2FfH7mI0RY4/Ti1wF_L-TEI/AAAAAAAABHs/-he1dGBT7C0/s320/IMAG1377.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Cut out the entire pattern outline.&amp;nbsp; You want to leave material beyond the neck circumference mark you made earlier so you can sew the halves together later.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-OpXYFe7eMWo/Ti1wwggQlzI/AAAAAAAABHw/4j1n3gT6564/s1600/IMAG1378.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-OpXYFe7eMWo/Ti1wwggQlzI/AAAAAAAABHw/4j1n3gT6564/s320/IMAG1378.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here are three versions of neck seams I made.&amp;nbsp; The brown one in the center is probably the best design wise but the yellow and blue are easier and covered by your shirt collar anyway.&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Iw44GiEpVeM/Ti10YtvkMfI/AAAAAAAABIA/LJ_RPkOxC2I/s1600/IMAG1416.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-Iw44GiEpVeM/Ti10YtvkMfI/AAAAAAAABIA/LJ_RPkOxC2I/s320/IMAG1416.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
For the yellow and blue I started by sewing the left and right halves first around their perimeter and turned them right side out.&amp;nbsp; For the blue one, I overlapped the halves at the neck seam mark I made on the neck template and ran it thru the machine then chopped off the "tag ends".&amp;nbsp; For the yellow, I laid the left and right halves on top of each other and ran it thru the machine at the neck seam mark, then ironed the tag ends flat.&amp;nbsp; For the brown one, I did not sew the left and right halves together first.&amp;nbsp; Instead I sewed the top or front, left and right halves together first, ironed that flat then sewed the perimeter.&amp;nbsp; Perhaps a photograph can best illustrate the brown neck seam.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-A2SFuDhBb24/Ti118f3kKdI/AAAAAAAABIE/8NlR3RezWkU/s1600/IMAG1381.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-A2SFuDhBb24/Ti118f3kKdI/AAAAAAAABIE/8NlR3RezWkU/s320/IMAG1381.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Still talking about the brown one, I then sewed the perimeter leaving the vertical slit open for turning the thing right side out and hand stitched it closed.&amp;nbsp; I guess it is a good time to mention you do all of the sewing possible inside out and turn it afterwards so it hides the stitches.&lt;br /&gt;
&lt;br /&gt;
Back to the yellow and blue ties and sewing the perimeter.&amp;nbsp; Prepare the left and right halves inside out so that the fabric sandwich has two pieces of muslin, one each on the outside and your two pieces of outer fabric, good side facing each other are on the inside.&amp;nbsp; Pin the whole thing together and sew around the perimeter.&amp;nbsp; I used the presser foot on the machine as a guide to know how far in to stitch.&amp;nbsp; Below is a picture of this step.&amp;nbsp; The photograph also shows the two concave radii that I was talking about earlier that will increase the pleats in the tied bow if you increase the distance between them.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-84Btb4sDfQE/Ti14lbIqBpI/AAAAAAAABII/B55ZL7zTTz4/s1600/IMAG1321.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-84Btb4sDfQE/Ti14lbIqBpI/AAAAAAAABII/B55ZL7zTTz4/s320/IMAG1321.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Once the perimeter is sewn you will want to cut incisions around the perimeter wherever there is up or down concavity and at inflection points.&amp;nbsp; That is, anywhere the sewn line is not intended to be straight, cut some incisions to help the flat fabric bend in the curves when you turn it right side out.&amp;nbsp; I imagine this is less necessary when you sew as close to the edge as I did, but I guess it is still good practice.&amp;nbsp; I also imagine I put more incisions than are necessary.&amp;nbsp; This is also a good time to trim fabric from what will be internal corners of the bow tie.&amp;nbsp; Just trim the fabric kind of close to the stitch line, but not too close that the fabric unravels, where the internal corners will be to reduce fabric bulk.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-1Qdbh5Hs5S0/Ti18M3teNSI/AAAAAAAABIQ/BYMt3zBMWMo/s1600/IMAG1387.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-1Qdbh5Hs5S0/Ti18M3teNSI/AAAAAAAABIQ/BYMt3zBMWMo/s320/IMAG1387.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now, whether you chose to do the brown bow tie neck seam or the easier blue or yellow style neck seam it is time to turn the tie right side out.&amp;nbsp; To do this I used a chopstick.&amp;nbsp; I also used said chopstick to poke the corners of the bow out to sharper points before ironing the thing flat.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-pxCgnGWjcCQ/Ti158G6tlcI/AAAAAAAABIM/1acIoR2u6qc/s1600/IMAG1390.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-pxCgnGWjcCQ/Ti158G6tlcI/AAAAAAAABIM/1acIoR2u6qc/s320/IMAG1390.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Once the bow tie is turned right side out I ironed it flat and turned to &lt;a href="http://www.youtube.com/results?search_query=tie+bow+tie&amp;amp;aq=f"&gt;youtube&lt;/a&gt; to learn how to tie a bow tie.&amp;nbsp; Turns out its pretty easy.&amp;nbsp; I'd say it was less difficult to learn to tie a bow tie than it was when I learned to tie a neck tie.&amp;nbsp; In fairness I was probably 8 back then and my only bow ties were clip on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-1HFDCRZUuKE/Ti2CR4N9WwI/AAAAAAAABIs/5CuTYU8BLEk/s1600/IMAG1418.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-1HFDCRZUuKE/Ti2CR4N9WwI/AAAAAAAABIs/5CuTYU8BLEk/s320/IMAG1418.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
So, if you feel like getting fancy and are tired of the limitations inherent to neck ties give bow ties a try!&amp;nbsp; Let me know if you give it a shot, I would be interested to get some feedback on the pattern as well as technique.&amp;nbsp; Here are a couple of action shots and one of my sewing 'rig' because I like the way it looks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-NRszeE8Kh6o/Ti2E53dmySI/AAAAAAAABIw/3eGOrd9Uses/s1600/IMAG1329.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-NRszeE8Kh6o/Ti2E53dmySI/AAAAAAAABIw/3eGOrd9Uses/s320/IMAG1329.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-6cKGBgg3KwI/Ti2FMVwMPfI/AAAAAAAABI0/TGGbMLI27BU/s1600/IMAG1398.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-6cKGBgg3KwI/Ti2FMVwMPfI/AAAAAAAABI0/TGGbMLI27BU/s320/IMAG1398.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-SdjiMx85YjE/Ti2JhqCkz2I/AAAAAAAABJQ/UB-EG3SSO5U/s1600/IMAG1423.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-SdjiMx85YjE/Ti2JhqCkz2I/AAAAAAAABJQ/UB-EG3SSO5U/s320/IMAG1423.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-uWUbu9jZW6Y/Ti2Jq9DbL2I/AAAAAAAABJU/YbQLmitLgd8/s1600/IMAG1422.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-uWUbu9jZW6Y/Ti2Jq9DbL2I/AAAAAAAABJU/YbQLmitLgd8/s320/IMAG1422.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-tcPj1SOveDU/Ti2J_-sj13I/AAAAAAAABJY/vknayftMTFU/s1600/IMAG1311.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-tcPj1SOveDU/Ti2J_-sj13I/AAAAAAAABJY/vknayftMTFU/s320/IMAG1311.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-PQ2ulVtJcA0/Ti2B3HVYcPI/AAAAAAAABIo/MY_LNpBNB04/s1600/IMAG1418.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/rIYxSO2b0sE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/5710404764825207795/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=5710404764825207795" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5710404764825207795?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5710404764825207795?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/rIYxSO2b0sE/engineering-bow-tie.html" title="Engineering a Bow Tie" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-jnN9Y-58iV0/Ti1IW0rPxBI/AAAAAAAABHk/5C8K0T-2Atc/s72-c/IMAG1394.jpg" height="72" width="72" /><thr:total>13</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/07/engineering-bow-tie.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ARXsyfyp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8046262345398920033</id><published>2011-06-26T22:01:00.001-04:00</published><updated>2011-08-19T19:50:44.597-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:50:44.597-04:00</app:edited><title>SpinArt Desk</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-r0nnettghCk/TgeiXWnIF0I/AAAAAAAAA4s/MZ7P7QKvDJA/s1600/IMAG1143.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-r0nnettghCk/TgeiXWnIF0I/AAAAAAAAA4s/MZ7P7QKvDJA/s1600/IMAG1143.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-r0nnettghCk/TgeiXWnIF0I/AAAAAAAAA4s/MZ7P7QKvDJA/s320/IMAG1143.jpg" width="191" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-r0nnettghCk/TgeiXWnIF0I/AAAAAAAAA4s/MZ7P7QKvDJA/s1600/IMAG1143.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Making things is just so much fun and taking on new projects is a rewarding experience where you can learn something new.&amp;nbsp; Take this SpinArt machine for example.&amp;nbsp; I went to the local &lt;a href="http://www.blogger.com/"&gt;ReUse &lt;/a&gt;center last week and as usual, I didn't know what I was going to find.&amp;nbsp; I didn't have the desire to make a SpinArt machine at the time, but the idea came to me when I found an old school desk there for $10.&amp;nbsp; I thought it would be a great "ReUse" to put a rotating platter inside the flip up top and call it a SpinArt machine.&amp;nbsp; Of course, the "Art" part of the name as it relates to the methodology is subjective and I really want to call it a "Centrifugal Pigment Accelerator", but in the name of effective communication I will reluctantly call it a SpinArt Machine.&lt;br /&gt;
&lt;br /&gt;
Now, a SpinArt machine, no matter how good it looks, really isn't a piece of furniture I need around my house.&amp;nbsp; It was great fun to make and even the first few paintings were fun, but it should find a new home and I know just the place where this will be right at home and that is the &lt;a href="http://www.mtelliottmakerspace.com/"&gt;Mt Elliot Makerspace&lt;/a&gt; in Detroit.&amp;nbsp; I have been spending a fair amount there recently helping my friend John setting up the wood shop.&amp;nbsp; There is a lot of work to do still, but it is nice to see progress being made.&amp;nbsp; This weekend we were painting the ceiling in the wood shop.&amp;nbsp; I also took a break to paint the SpinArt machine desktop when I was there.&amp;nbsp; I plan on taking the SpinArt machine down there next time I ride in a truck and hopefully I will be able to get some video of the thing in action.&amp;nbsp; It is a little hard to film and operate it at the same time.&lt;br /&gt;
&lt;br /&gt;
According to the Wikipedia entry for &lt;a href="http://en.wikipedia.org/wiki/Spin_art"&gt;Spin Art&lt;/a&gt;, this method of painting has been documented since 1958.&amp;nbsp; The way "SpinArt" works is that you have, whatever it is that you want to paint, attached to the platter, then you turn on the machine to spin the platter and when it is up to speed, you drop paint onto whatever it is that you are painting.&amp;nbsp; If the platter is spinning fast enough, the coefficient of friction between the paint and painted surface is high enough and the viscosity of your paint is low enough, the centrifugal force acting on the rotating paint will draw itself out radially from the center of rotation.&amp;nbsp; Several things will affect the pattern as it is painted.&amp;nbsp; Most notable are the aforementioned angular velocity and paint viscosity ,but also, the rate of change in angular velocity will impact the finished painting.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HPn5UTlbqIM/Tge9oAWWgCI/AAAAAAAAA4w/D_KriVKXB_k/s1600/IMAG1080.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-HPn5UTlbqIM/Tge9oAWWgCI/AAAAAAAAA4w/D_KriVKXB_k/s320/IMAG1080.jpg" width="191" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Here is the "before" pic of the desk as it sits outside the ReUse Center&lt;/td&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
I think the picture below will give you a good idea of everything that is going on here.&amp;nbsp; There is a motor underneath the wooden disk inside the desk.&amp;nbsp; Outside is the speed control (more on this later) attached to the side.&amp;nbsp; You can also see a lamp and the cord to power it all on the ground.&amp;nbsp; It really is that simple, but I will go into some details in a moment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-PF-b8mIGmJg/TgfC5hkMwfI/AAAAAAAAA48/Ftt0_LhbRlc/s1600/IMAG1174.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-PF-b8mIGmJg/TgfC5hkMwfI/AAAAAAAAA48/Ftt0_LhbRlc/s320/IMAG1174.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-qyBLqF12xtQ/TgfAZsq80fI/AAAAAAAAA40/qQYRBNAwfvQ/s1600/IMAG1171.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;The motor came from a box fan.&amp;nbsp; I mounted it to the inside of the desk using a couple of pieces of poplar wood.&amp;nbsp; Where the poplar wood makes contact with the ribs in the desk, I cut out some neoprene sheet to put in between.&amp;nbsp; This is not so much for vibration dampening as it is to keep things from slipping and subsequently loosening the screws.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-I2jZ1bexogE/TgfERquJd5I/AAAAAAAAA5A/t2-_u_Ibfow/s1600/IMAG1118.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-I2jZ1bexogE/TgfERquJd5I/AAAAAAAAA5A/t2-_u_Ibfow/s320/IMAG1118.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The fan motor is an induction motor and as such, cannot be speed controlled with an ordinary incandescent dimmer switch.&amp;nbsp; I confirmed this to be true by trying to use a lamp dimmer to control the speed of the motor with nothing attached to the output shaft.&amp;nbsp; Then, I tried adding a 60W light bulb in series with the motor.&amp;nbsp; This allowed me to have the speed control I desired using a cheap ~$8 triac chopper dimmer (aka ordinary incandescent lamp dimmer).&amp;nbsp; I believe this changes the power factor of the motor allowing the necessary speed control.&lt;br /&gt;
&lt;br /&gt;
So, the wiring goes like this.&amp;nbsp; The hot leg of the 110VAC coming into the blue speed control box on the side goes to one lead of the lamp dimmer.&amp;nbsp; The other lead of the lamp dimmer goes to one lead of the lamp base cord, I chose the center pin lead to be consistent with conventional wiring and not the threaded part of the lamp base.&amp;nbsp; The other leg of the lamp cord goes to what used to be the hot side of the motor switch and the neutral side of the fan switch goes to the neutral lead of the wall power.&amp;nbsp; Turn the 3-way power switch that came with the box fan to the highest setting and pack it all neatly in a plastic 2-gang switch box making sure all wires are properly and securely connected.&lt;br /&gt;
&lt;br /&gt;
Here is the original motor speed selector switch getting wired up to be put in the blue speed control box.&amp;nbsp; I set it to the highest setting before connecting the dimmer and closing up the box. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Iyo8CmwR1VM/TgfIOZDlgbI/AAAAAAAAA5E/hcaF8pZmxgM/s1600/IMAG1102.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-Iyo8CmwR1VM/TgfIOZDlgbI/AAAAAAAAA5E/hcaF8pZmxgM/s320/IMAG1102.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I made the rotating platter by cutting a disk from a piece of 3/4" birch face plywood then cleaning up the cuts on an upright belt sander.&amp;nbsp; A thru hole was drilled for the diameter of my motor shaft and a counterbore was made for the left hand motor shaft nut to sit in.&amp;nbsp; This way the motor shaft nut will not protrude above the surface and "dome" your painting.&amp;nbsp; I chose 13.9" as O.D. (outside diameter) of the platter because Pythagoras told me to.&amp;nbsp; That is the "hypotenuse" of a standard sheet of paper 8.5"x11" thus, a piece of printer paper will fit just right on the platter.&amp;nbsp; You can download a drawing I made of the platter &lt;a href="https://sites.google.com/site/pemills2011/file/SpinArtPlatter.pdf?attredirects=0&amp;amp;d=1"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
After installing the platter on the motor shaft I measured the runout on the O.D. to be no more than 0.01".&amp;nbsp; It is important to remember that this platter is going to be spinning pretty fast so you want it to be well balanced.&amp;nbsp; Mine actually has a vertical deflection when it rotates and I need to look into this as it creates a vibration at a particular speed.&amp;nbsp; Currently, I just don't run it at that speed instead, going faster or slower. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-o67eOW6wHqk/TgfMy8QH_3I/AAAAAAAAA5I/sWmQTu28qPY/s1600/IMAG1121.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-o67eOW6wHqk/TgfMy8QH_3I/AAAAAAAAA5I/sWmQTu28qPY/s320/IMAG1121.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
And speaking of mounting the platter to the motor shaft, it was necessary for me to buy a motor shaft collar from the hardware store.&amp;nbsp; You can see it on the motor shaft in the picture below.&amp;nbsp; I set it so that the distance from the top of the shaft to the top of the shaft collar was less than the thickness of my wooden platter (3/4") and then turned the grub screw with an allen key to lock it in place.&amp;nbsp; In the picture below the collar is not set to the correct height yet, it is intentionally set too high for the sake of picture clarity.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-GVbQ6vEF7Sc/TgfN3rPdBnI/AAAAAAAAA5M/Q_owcwWIHvw/s1600/IMAG1119.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-GVbQ6vEF7Sc/TgfN3rPdBnI/AAAAAAAAA5M/Q_owcwWIHvw/s320/IMAG1119.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I decided to paint the top of the desk "SpinArt" style before mounting the motor in place.&amp;nbsp; I found a couple of cans of house paint in the woodshop at the &lt;a href="http://www.blogger.com/"&gt;Mt Elliot Makerspace&lt;/a&gt; so, that is how the color was decided.&amp;nbsp; I quickly found out that I needed to thin the paint with water instead of using it straight out of the can to help it flow better and fling out.&amp;nbsp; To spin the top I very carefully measured the center of the desktop and mounted the box fan propeller to the underside of the desktop with 3 screws.&amp;nbsp; I slipped this onto the motor shaft and with paint applied set it spinning.&amp;nbsp; You can see how that all went in the raw and unedited footage below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-5-po1sdb_Xg/TgfSto_TeqI/AAAAAAAAA5Y/8VCG92X48Hw/s1600/IMAG1113.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-5-po1sdb_Xg/TgfSto_TeqI/AAAAAAAAA5Y/8VCG92X48Hw/s320/IMAG1113.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Weird stuff happens in the end of the first video here.&amp;nbsp; I think the way the camera draws the lines of each frame of video and the rotating of the desk lid makes it look like it is morphing into a different shape.&amp;nbsp; I assure you it is not.&amp;nbsp; There are some pics below of the same phenomenon. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/Dke2x42rWgk/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Dke2x42rWgk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/Dke2x42rWgk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/I6dlwJvKVpo/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/I6dlwJvKVpo?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/I6dlwJvKVpo?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
After the spinning stopped this is what the desk lid looked like.&amp;nbsp; I can see where some of the paint started drying before it got all the way out to the edge.&amp;nbsp; I think it looks pretty neat and it figuratively says "I am a SpinArt desktop", but as you can see in some later pics it literally says "SpinArt" on it because my mother was nice enough to cut out a custom stencil and stencil the word on there for me.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-MoOqArlbd1k/TgfRJy3oj0I/AAAAAAAAA5Q/9Ldyi6W2BlU/s1600/IMAG1128.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-MoOqArlbd1k/TgfRJy3oj0I/AAAAAAAAA5Q/9Ldyi6W2BlU/s320/IMAG1128.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a pic I took while the desktop was spinning and paint was getting on my leg hairs.&amp;nbsp; There is a pretty interesting digital photography anomaly going on here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-XKGjuWevtfQ/TgfSPzdG0LI/AAAAAAAAA5U/fqoeXk1fhCs/s1600/IMAG1127.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-XKGjuWevtfQ/TgfSPzdG0LI/AAAAAAAAA5U/fqoeXk1fhCs/s320/IMAG1127.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
For a finishing touch I bent a coat hanger and put some heatshrink on the ends to hold this wire basket for the paint bottles.&amp;nbsp; As far as paint goes, I have both washable and Tempera paint.&amp;nbsp; Again, thin it out before use.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-afiST9uUmUw/TgfVC_Js4XI/AAAAAAAAA5c/0b5yDnuWTSk/s1600/IMAG1135.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-afiST9uUmUw/TgfVC_Js4XI/AAAAAAAAA5c/0b5yDnuWTSk/s320/IMAG1135.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I use "Removable Mounting Putty" to stick the paper to the platter.&amp;nbsp; It seems to work pretty well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-H03x7ZtTUd0/TgfXxlIvmOI/AAAAAAAAA5g/oGKCrSAOjZk/s1600/IMAG1162.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-H03x7ZtTUd0/TgfXxlIvmOI/AAAAAAAAA5g/oGKCrSAOjZk/s320/IMAG1162.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As an extra precaution, I decided to make a cardboard paint guard to stop stray paint exiting the desk cavity.&amp;nbsp; It also keeps the inside of the desk a bit cleaner and you can just throw the cardboard away when it gets to much paint on it and make another one.&amp;nbsp; It folds up when you are done and can be stored inside the desk.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-6KGWzxWpYnI/TgfZrZJDb1I/AAAAAAAAA5k/yis5s01G7dk/s1600/IMAG1175.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-6KGWzxWpYnI/TgfZrZJDb1I/AAAAAAAAA5k/yis5s01G7dk/s320/IMAG1175.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
So, this was a pretty fun project and I think a good "ReUse" of the school desk.&amp;nbsp; It took about two days and ~$30 to make but I did have a lot of materials already.&amp;nbsp; There isnt much more to say about it so I think I'll just bang a few more photos up here and maybe a vid and call it a day.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-UdA9gnS8g7U/Tgfby8FH_BI/AAAAAAAAA5o/nsLhus8OSRk/s1600/IMAG1152.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-UdA9gnS8g7U/Tgfby8FH_BI/AAAAAAAAA5o/nsLhus8OSRk/s320/IMAG1152.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ye0n6UGLAbo/TgfcxvExSeI/AAAAAAAAA5w/sR0WdYhWMx4/s1600/IMAG1161.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-ye0n6UGLAbo/TgfcxvExSeI/AAAAAAAAA5w/sR0WdYhWMx4/s320/IMAG1161.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-HQOIECMaFEY/TgfcDIxyfqI/AAAAAAAAA5s/3CRyAytNz60/s1600/IMAG1151.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-HQOIECMaFEY/TgfcDIxyfqI/AAAAAAAAA5s/3CRyAytNz60/s320/IMAG1151.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
In this video, you can hear the paint splattering off and hitting the cardboard.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/z4xXBP4z1Fs/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/z4xXBP4z1Fs?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266"  src="http://www.youtube.com/v/z4xXBP4z1Fs?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-UPg3xsY41XI/Tgfc06Mxa5I/AAAAAAAAA50/fkI4OwxXMIE/s1600/IMAG1165.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-UPg3xsY41XI/Tgfc06Mxa5I/AAAAAAAAA50/fkI4OwxXMIE/s320/IMAG1165.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-6Ekmy8yEP9U/Tgfc3eXmEsI/AAAAAAAAA54/3AMSwenb41o/s1600/IMAG1167.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-6Ekmy8yEP9U/Tgfc3eXmEsI/AAAAAAAAA54/3AMSwenb41o/s320/IMAG1167.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-8l09q4f594M/Tgfc7Y6VNvI/AAAAAAAAA58/maZ-2eR-VHY/s1600/IMAG1169.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-8l09q4f594M/Tgfc7Y6VNvI/AAAAAAAAA58/maZ-2eR-VHY/s320/IMAG1169.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/MdwUCt8skOc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8046262345398920033/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8046262345398920033" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8046262345398920033?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8046262345398920033?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/MdwUCt8skOc/spinart-desk.html" title="SpinArt Desk" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-r0nnettghCk/TgeiXWnIF0I/AAAAAAAAA4s/MZ7P7QKvDJA/s72-c/IMAG1143.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/06/spinart-desk.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4BQHg9fSp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-4180024396521027599</id><published>2011-05-19T23:21:00.001-04:00</published><updated>2011-08-19T19:52:31.665-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:52:31.665-04:00</app:edited><title>Real Time Clock - Part 1</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-6tAnNNPn9fY/TdMSt-vsyLI/AAAAAAAAAzQ/adjV5iGsQhc/s1600/IMAG0694.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-z5ciEt-1xD0/TdMS8jEgYXI/AAAAAAAAAzU/OWxnKhKf7L4/s1600/IMAG0694.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-z5ciEt-1xD0/TdMS8jEgYXI/AAAAAAAAAzU/OWxnKhKf7L4/s320/IMAG0694.jpg" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;I'm not sure why it is, but electronic hobbyists like to make clocks.&amp;nbsp; We seem to be thrust towards them like electrons to a phosphor coated screen in a cathode ray tube.&amp;nbsp; Although, at a much lower velocity.&amp;nbsp; Nevertheless, I somewhat recently decided it was time to make a clock for myself.&amp;nbsp; I quickly came up with several ideas of the physical implementation e.g. alarm clock, ceiling projected display etc., but as I found out that is the easy part.&amp;nbsp; I was able to distill every clock design down to the need for an (acceptably [more on acceptable accuracy later]) accurate time base, most likely 1Hz and that is what this post "Part 1" will focus on.&amp;nbsp; I will attempt to offer rational explanations as to why I decided to do things the way I did because, in case you didn't know, there are more ways to make a time base than there are numbers on a clock's face.&amp;nbsp; Here's how I cut my teeth skinning this kitten.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-6KDljTa6sns/TdMV3cyAN7I/AAAAAAAAAzY/jqKIF91Z1G8/s1600/IMAG0798.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/-6KDljTa6sns/TdMV3cyAN7I/AAAAAAAAAzY/jqKIF91Z1G8/s320/IMAG0798.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Firstly, this is going to be a microcontroller based implementation of a real time clock.&amp;nbsp; Here, "Real Time Clock (RTC)" means only: a device used to keep track of time in human readable units.&amp;nbsp; Basically, its a clock clock.&amp;nbsp; Since my finished clock will have other tasks to perform in addition to keeping track of time, such as sounding an alarm or initiating an elaborate rube goldberg machine responsible for starting my car in the winter months, making my 1Hz timebase on the uC is a logical choice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Independent RTC IC's:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
I didn't immediately dismiss the idea of separate IC RTC's.&amp;nbsp; They look so promising! They keep track everything one could hope for!&amp;nbsp; The last statement is A) wrong and B) misleading if it were true.&amp;nbsp; From the DS1307 product page: "Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month,  Month, Day of the week, and Year with Leap-Year Compensation Valid Up  to 2100".&amp;nbsp; But, wait a minute, if I have an accurate timebase inside my microcontroller, several lines of code later you can have all that functionality, without adding an extra part or adding the arguably small price to the project.&amp;nbsp; I think the DS1307 is about $1.00.&amp;nbsp; Besides, I am making a clock; if I wanted an off the shelf solution I'd hop in my &lt;a href="http://www.koenigsegg.com/"&gt;Koenigsegg &lt;/a&gt;and head over to &lt;a href="http://www.ikea.com/us/en/"&gt;IKEA &lt;/a&gt;for a &lt;a href="http://www.ikea.com/us/en/catalog/products/80154531"&gt;Slabang &lt;/a&gt;and some &lt;a href="http://www.ikea.com/ms/en_US/IKEA_Food/restaurant.html"&gt;meatballs&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
Another nail in the separate IC RTC coffin is that the DS1307 uses a standard 32768 Hz watch crystal to run it.&amp;nbsp; If I really wanted to use a watch crystal (which I don't, particularly), it would seem obvious to hook it up to the asynchronous timer on the ATMega328 that I am using for clock development.&amp;nbsp; The accuracy of the DS1307 is dependent on the accuracy of the watch crystal being used and matching the load capacitance on the board and the load caps with the spec in the crystal datasheet.&amp;nbsp; In other words, that 32768 Hz crystal is not going to be ticking over at 32768 Hz and there is no way to compensate (calibrate) for that except using a trimmer cap and a frequency counter to adjust the frequency, at the temperature of the crystal during calibration.&amp;nbsp; If instead you had a watch crystal on the asynchronous timer of the ATMega328 you could implement a software calibration, but more on that later.&lt;br /&gt;
&lt;br /&gt;
I am picking on the DS1307 because it appears to be so popular.&amp;nbsp; There are many other RTC IC's but for illustrative purposes that is the one I chose.&amp;nbsp; To get around some of the issues of accuracy outlined above you could use the DS3231.&amp;nbsp; It has a TCXO and claims accuracy of +/- 2 ppm.&amp;nbsp; +/- 2 ppm is getting pretty good (we can do better).&amp;nbsp; That equates to about +/- 1 second in 6 days.&amp;nbsp; But, they are expensive.&amp;nbsp; At about $9 they are twice what an ATMega328 costs.&amp;nbsp; And for some of the same reasons the DS1307 isn't that great of a deal, neither is the DS3231.&amp;nbsp; Basically, the allure of the DS3231 is in its accuracy of +/- 2 ppm; as way to avoid having to write some time keeping code it too goes against my geeky DIY nature.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Daylight Savings Time:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Daylight savings time is a pain in the neck for a clock designer.&amp;nbsp; Within the US not all states abide by daylight savings time and international protocols for DST do not, to my knowledge, exist.&amp;nbsp; The text from &lt;a href="http://aa.usno.navy.mil/faq/docs/daylight_time.php"&gt;http://aa.usno.navy.mil/faq/docs/daylight_time.php&lt;/a&gt; that says "Starting in 2007, daylight time begins in the United States on the second Sunday in March and ends on the first Sunday in November." illustrates the difficulty in programmatically adjusting for DST, but more notability, the fact that DST protocols can and do change.&amp;nbsp; Imagine having recently finished your clock design.&amp;nbsp; One where it will dutifully adjust for DST for you, only to find out the accepted standard for when DST changes, has itself, changed.&amp;nbsp; You are then faced with rewriting your code for the new standard or adjusting, no longer twice a year for DST, but four times, assuming both the adjustment forward and backward have changed dates.&amp;nbsp; Because of these issues, I have decided to forgo automatic updating of DST on clocks that are self contained, that is, on clocks with no external time synchronization such as NTP, GPS, WWVB, etc, I will instead, adjust the clocks time manually on DST.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Leap seconds:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Leap seconds are adjustments made to UTC (Coordinated Universal Time) because cesium fountain time standards in use are more stable than the Earth's rotation around the sun.&amp;nbsp; This Copernican anomaly may ruffle the feathers of geocentrists, but every year on June 30 and December 31, the &lt;a href="http://www.iers.org/nn_10910/IERS/EN/IERSHome/home.html?__nnn=true"&gt;International Earth Rotation and Reference System Service&lt;/a&gt; may or may not issue a leap second depending on necessity.&amp;nbsp; The last one was added December 31, 2008.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a highly gratuitous photo of some nerd bling aka LED edge lit plexi glass. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-26XMl1SbWFk/TdMcCFmcgSI/AAAAAAAAAzk/4kHuX7nnDB4/s1600/IMAG0800.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://4.bp.blogspot.com/-26XMl1SbWFk/TdMcCFmcgSI/AAAAAAAAAzk/4kHuX7nnDB4/s320/IMAG0800.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With these constraints in mind I decided it is better to have a stand alone clock that you are able to adjust the time on rather than have a clock with high accuracy, set to run an entire life cycle,&amp;nbsp; only to find that some adjustment outside of my control adjusts UTC.&amp;nbsp; Which brings me to acceptable accuracy.&lt;br /&gt;
&lt;br /&gt;
I define acceptable accuracy as some balance between cost and external constraints.&amp;nbsp; For example, I have decided not to automatically adjust for daylight savings time which occurs twice a year, because it can change.&amp;nbsp; Currently it is on the second Sunday in March and on the first Sunday in November.&amp;nbsp; Since this is a maximum time of about 8 months between setting the time.&amp;nbsp; I only need to be acceptably accurate for up to 8 months.&amp;nbsp; I think I can live with anything up to 1 minute off.&amp;nbsp; The only real way to know if the clock is displaying something other than correct time would be to compare it to NTP on a cell phone or computer.&amp;nbsp; This is an arbitrarily chosen value but it should give me a start.&amp;nbsp;&amp;nbsp; One minute in 8 months is approximately 2.9 ppm.&amp;nbsp; So, my goal will be to calibrate my clock to better than ~3 ppm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When I first started this project I thought I would slap a 32768 Hz watch crystal on a uC and call it a day.&amp;nbsp; Well I did that, and wrote the code to keep track of hours, minutes and seconds in a day and set it running.&amp;nbsp; It was off by -4 seconds in the first 24 hours.&amp;nbsp; I checked the code, double checked the load capacitor values and found nothing wrong.&amp;nbsp; I believe the stray capacitance on the board and the uC pins was pulling the frequency of the watch crystal ~-46 ppm.&amp;nbsp; Well beyond the +/-20 ppm tolerance of the part.&amp;nbsp; Clearly this was unacceptable.&amp;nbsp; I needed to buy a variable capacitor to tune the load capacitance so that the frequency was within my tolerance of ~3 ppm.&lt;br /&gt;
&lt;br /&gt;
But, instead I started thinking of software solutions.&amp;nbsp; Code is free for me to type and I don't have to wait for it to arrive from DigiKey.&amp;nbsp; I first thought of adding 4 seconds to the display at say 2 AM when I should be fast a sleep.&amp;nbsp; This idea bothered me on many levels, but using the 32768 Hz crystal I had setup my asynchronous timer for an interrupt fired at 1 Hz.&amp;nbsp; What was I to do but get more resolution...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is another photo of the LED edge lit plexiglass.&amp;nbsp; Shown only to break up all of those words in this blog post.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-lE6Z1HEwBuc/TdMdM41BQqI/AAAAAAAAAzo/A18UTcqLJHI/s1600/IMAG0803.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/-lE6Z1HEwBuc/TdMdM41BQqI/AAAAAAAAAzo/A18UTcqLJHI/s320/IMAG0803.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Selecting a new crystal oscillator I picked a higher frequency 16384000 Hz crystal with a +/- 10 ppm over -20C to 70C range thermal stability.&amp;nbsp; Digikey part number 887-1245-ND.&amp;nbsp; They are currently $0.48 each in quantity of 10.&amp;nbsp; I am much more interested in a crystal's frequency as a function of temperature than out of the out of the box accuracy since I will be calibrating the clock in software which you can read about below.&amp;nbsp; This type of crystal has a different cut on the quartz compared to a watch crystal too.&amp;nbsp; A watch crystal will always lose time when its temperature is above or below 25C, where as my crystal has a frequency vs temperature curve that is a sine function with its origin at 25C.&amp;nbsp; That is, above 25C it has a higher frequency and below 25C it's frequency is lower.&lt;br /&gt;
&lt;table border="0" cellpadding="0" cellspacing="0" style="width: 85px;"&gt;&lt;colgroup&gt;&lt;col width="85"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr height="20"&gt;   &lt;td height="20" style="height: 15.0pt; width: 64pt;" width="85"&gt;&lt;br /&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Side bar.&amp;nbsp; I also needed a way of measuring frequency more accurately than an oscilloscope so I bought a cheap Chinese frequency counter, a VC3165.&amp;nbsp; Other than the incredibly dim 7-segment display the frequency counter functions quite well.&amp;nbsp; I was leery of purchasing it, but it uses a TCXO so I hoped it would be pretty accurate.&amp;nbsp; Unfortunately, it cannot be calibrated.&amp;nbsp; I opened it up and there is no adjustments to be made.&amp;nbsp; I was able to experimentally derive it to be accurate to ~-2 ppm though.&amp;nbsp; So it should be fine for most work.&amp;nbsp; Certainly -2 ppm falls within my 3 ppm self imposed tolerance. &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-BhNJWZNSSGw/TdMXCG8l9hI/AAAAAAAAAzc/a_MNEGqJz9s/s1600/IMAG0531.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-BhNJWZNSSGw/TdMXCG8l9hI/AAAAAAAAAzc/a_MNEGqJz9s/s320/IMAG0531.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
So, I've ended up with an 16384000 Hz crystal and setup my interrupt service routine (ISR) to fire every millisecond.&amp;nbsp; Now, I can adjust in software on the mS level and it will be totally transparent to the clock user as current plans call for seconds display as optional.&amp;nbsp; Even if I were to display milliseconds you couldn't read them fast enough to notice the adjustment.&lt;br /&gt;
&lt;br /&gt;
To make the adjustment you just add a millisecond every x-number of (1mS) ISR cycles.&amp;nbsp; For x = F_CPU / ( F_CPU * error_in_ppm ).&amp;nbsp; In my case I had my ATMega328 running on a 16384000 Hz crystal.&amp;nbsp; I set the CKOUT fuse to output the system clock frequency on pin 14 to measure the undivided system clock on my frequency counter and got 16383480.&amp;nbsp; A difference of -31.7 ppm.&amp;nbsp; since x = 16384000 / 16384000 * -31.7x10^-6 = 31508 (rounded up) , every 31508 mS aka every 31508 ISR cycles I add (because it was running slow) one millisecond.&lt;br /&gt;
&lt;br /&gt;
Here is a snippet of my ISR.&amp;nbsp; Don't do this.&amp;nbsp; I just threw this code together for testing my clock ideas.&amp;nbsp; In practice you want to handle everything other than updating the millisecond counter outside of the ISR.&amp;nbsp; I will make that change when I write my final clock program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;//This interrupt is called at 1kHz

ISR(TIMER1_COMPA_vect)
{
 static uint16_t milliseconds = 0;  // mS value for timekeeping 1000mS/1S
 static uint16_t clock_cal_counter = 0; // counting up the milliseconds to MS_ADJ
 const uint16_t MS_ADJ = 35088;   // F_CPU / (F_CPU * PPM_ERROR) 
 const uint16_t MS_IN_SEC = 1000;  // 1000mS/1S
 
 milliseconds++;
 clock_cal_counter++;
 
 
 if( milliseconds &amp;gt;= MS_IN_SEC )
 {
  milliseconds = 0;      
  ss++;    // increment seconds
  toggle_led();   // toggle led
 
  if( ss &amp;gt; 59 )
  {
   mm++;   // increment minutes
   ss = 0;   // reset seconds
  }
 
  if( mm &amp;gt; 59 )
  {
   hh++;   // increment hours
   mm = 0;   // reset minutes
  }
 
  if( hh &amp;gt; 23 )
  {
   // increment day
   hh = 0;   // reset hours
  }
 }
 
 
 // milliseconds must be less than 999 to avoid missing an adjustment.
 // eg if milliseconds were to be 999 and we increment it here to 1000
 // the next ISR call will make it 1001 and reset to zero just as if it 
 // would for 1000 and the adjustment would be effectively canceled out.
 
 if( ( clock_cal_counter &amp;gt;= MS_ADJ ) &amp;amp;&amp;amp; ( milliseconds &amp;lt; MS_IN_SEC - 1 ) ) 
 {
  milliseconds++;
  
  // it may be that clock_cal_counter is &amp;gt; than MS_ADJ in which case
  // I want to count the tick towards the next adjustment
  // should always be 1 or 0
  
  clock_cal_counter = clock_cal_counter - MS_ADJ; 
 }
 
} 
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Next I ran my clock again.&amp;nbsp; I synched it's time to NTP and checked it again daily.&amp;nbsp; After 6 days however, I found that my clock was about 1 second fast compared to NTP.&amp;nbsp; Recall above that I said my frequency counter was ~-2 ppm off well, this is how I found this out.&amp;nbsp; Had my frequency counter been calibrated to be spot on, my NTP test would have revealed I am only off in time by rounding errors in my ppm error calculations above. Or approximately -0.3 ppm. &lt;br /&gt;
&lt;br /&gt;
My results thus far are acceptable and fit into my arbitrarily defined tolerance.&amp;nbsp; In my research however, I came across a program written by an AVR freaks member that you can use to check the frequency of a clock if you don't have a frequency counter.&amp;nbsp; I figured this would be good information to relay for those without frequency counters and who want to try and replicate what I have done here.&amp;nbsp; You can find the program &lt;a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;t=82842&amp;amp;highlight=ntp"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-tIQdAHOpLZQ/TdMXZvUcbjI/AAAAAAAAAzg/IXhYvM1SZmw/s1600/Untitled_3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="201" src="http://3.bp.blogspot.com/-tIQdAHOpLZQ/TdMXZvUcbjI/AAAAAAAAAzg/IXhYvM1SZmw/s320/Untitled_3.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Using the same 16384000 Hz crystal on my avr I setup an ISR at 1 kHz that toggles an output pin.&amp;nbsp; I connected that pin to the RxD line on an FTDI cable and ran the program.&amp;nbsp; Some samples were wildly wrong as the author suggests could happen so, I discarded those and averaged the remaining 17 Hrs of data to come up with an error of -28.5 ppm.&amp;nbsp; Subtracting my new error from my frequency counter calculated error above yields (-31.7) - (-28.5) = -3.2 ppm.&amp;nbsp; I expected this to be approximately -2 ppm, however, there were a lot of indirect methods used here and a bit of rounding.&amp;nbsp; Not the least of which is the ~1second/6days estimation when comparing my clock to NTP with visual inspection.&amp;nbsp; Having said all that,&amp;nbsp; I am more apt to believe the -28.5 ppm error from the Network Frequency Transfer program at the moment and say my frequency counter -3.2 ppm off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-HktprId8RBc/TdQ_VHY94yI/AAAAAAAAAzs/vOWcs_tUsks/s1600/IMAG0787.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/-HktprId8RBc/TdQ_VHY94yI/AAAAAAAAAzs/vOWcs_tUsks/s320/IMAG0787.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;FTDI cable RxD line on uC pin 14&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Going back to the calibration value calculations above you will see my new MS_ADJ value will be x = 16384000 / 16384000 * -28.5x10^-6 = 35088 (rounded up) or every 35088  mS aka every 35088 ISR cycles I add (because it was running slow) one  millisecond.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
That is a lot of theory, calculations and measurement.&amp;nbsp; The proof really, is in the pudding.&amp;nbsp; Real world application of the code and derived calibration value is what is needed now.&amp;nbsp; Currently I have the clock running is a room that gets arbitrarily cold at night and warms up during the day.&amp;nbsp; Just like it will see in operation.&amp;nbsp; I synched it to NTP when I started it and I will check the deviation daily.&lt;br /&gt;
&lt;br /&gt;
So, it has been 3 days and 4 hours since I started my clock synched to NTP and there is no visual deviation from NTP.&amp;nbsp; The way I check this is I have an app on my phone that gets NTP and displays it with 1 second resolution.&amp;nbsp; First, I check that my app and the clock are displaying the same value down to 1 second and then with my peripheral vision watch an LED on my clock toggle at 1Hz while I am watching the app on my phone.&amp;nbsp; I have found during these experiments that using this method I am able to detect a deviation of as little as 50mS quite easily.&amp;nbsp; This is possible only at the change of the seconds value i.e. the NTP app ticks over and I can see the LED turn on slightly before or after.&amp;nbsp; I could not estimate say a half second or a quarter second with the same 50mS resolution.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Back to the numbers.&amp;nbsp; As I said it has been 3 days and 4 hours since I started my clock run and I cannot see any deviation in clock time v.s. synched NTP time.&amp;nbsp; If I say I cannot see deviations less than 50mS I will assume the worst case scenario and say it is 50mS off.&amp;nbsp; ( 1 / (run_time / error) ) * 1x10^6 = error_in_ppm so, ( 1 / ( 273600 seconds / 0.05 seconds ) ) * 1x10^6 = 0.18 ppm.&amp;nbsp; That is pretty darn good and cheap too boot!&lt;br /&gt;
&lt;br /&gt;
This is far from a clock yet.&amp;nbsp; Yes, it tells time in human readable units, but I still need to implement a calendar, power outage protection, alarm functions and make it do something cool.&amp;nbsp; Maybe display moon phases?&amp;nbsp; Time will tell...&lt;br /&gt;
&lt;br /&gt;
I really learned a lot through this project up to now.&amp;nbsp; I certainly did not end up with anything close to how I imagined I would implement a clock and I am rather pleased with the outcome and deeper understanding of timekeeping.&amp;nbsp; My hope is that I was able to present some of the information I learned in a way that it can be useful to others too.&amp;nbsp; I think "Part 2" will have a more refined clock-like appearance to it both in software and physical implementation.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/LviMqdmPRJU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/4180024396521027599/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=4180024396521027599" title="12 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4180024396521027599?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/4180024396521027599?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/LviMqdmPRJU/real-time-clock-part-1.html" title="Real Time Clock - Part 1" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-z5ciEt-1xD0/TdMS8jEgYXI/AAAAAAAAAzU/OWxnKhKf7L4/s72-c/IMAG0694.jpg" height="72" width="72" /><thr:total>12</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/05/real-time-clock-part-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4DSXw4eCp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-7170848249122184440</id><published>2011-03-20T21:28:00.003-04:00</published><updated>2011-08-19T19:52:58.230-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:52:58.230-04:00</app:edited><title>Magic 8 Thing</title><content type="html">For about a week now I have been staring at a cellphone charger my friend Caitlin gave me to repair after she had loaned it to some chimpanzees for apparent durability testing.&amp;nbsp; I was debating on whether I had put the repair off long enough, when, with no humans in earshot to ask, I figured I would build a Magic 8 Thing and ask &lt;i&gt;it &lt;/i&gt;if I could procrastinate any longer.&amp;nbsp; Was this a lack of motivation to repair a cellphone charger or was it motivation to make a Magic 8 Thing.&amp;nbsp; Irrelevant really as I got both things done in about 10 hours this weekend.&lt;br /&gt;
&lt;br /&gt;
For those who don't know what a Magic 8 Thing is, it is a Magic 8 Ball, made with an ATMega328, an LCD, a surplus mercury tilt switch from a retired thermostat and some code.&amp;nbsp; I call it a "Thing" instead of a "Ball" because my version is both non-spherical and bears no functional resemblance to an actual &lt;a href="http://en.wikipedia.org/wiki/Magic_8-Ball"&gt;"Magic 8 Ball"&lt;/a&gt;.&amp;nbsp; It does, however, have equal effectiveness in helping you make important life decisions.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-vuhxgYxjxEc/TYabbu_JrnI/AAAAAAAAAjs/oBKQGUcEv-A/s1600/014.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh6.googleusercontent.com/-vuhxgYxjxEc/TYabbu_JrnI/AAAAAAAAAjs/oBKQGUcEv-A/s320/014.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;&lt;/div&gt;I wanted to be able to physically shake the thing to illicit a response to my questions.&amp;nbsp; And, since I wanted this project to be done quickly i.e. no ordering parts&amp;nbsp; I was thinking about making a "shake" switch out of a couple of quarters and a &lt;a href="http://en.wikipedia.org/wiki/Pachinko"&gt;pachinko ball&lt;/a&gt;.&amp;nbsp; But, instead, while rooting through one of my many "stuff" bins I found an old thermostat with a mercury tilt switch.&amp;nbsp; This has an unanticipated side effect of being able to hear the mercury sloshing around when you shake it.&amp;nbsp; It is cool, it almost sounds like the original Magic 8 Ball that has the answer icosahedron floating in it.&amp;nbsp; If I had my druthers, however, I would have used an accelerometer like a normal human to detect the shakes, but I have none at the moment.&lt;br /&gt;
&lt;br /&gt;
You can see the mercury switch in the picture below.&amp;nbsp; It is hot glued to the lower left of the circuit board.&amp;nbsp; The header at the top connects the LCD which is mounted in the lid of this enclosure.&amp;nbsp; Space and time were limiting factors on this&amp;nbsp; build so, component layout was adjusted accordingly.&amp;nbsp; E.g. jamb the bits in where they fit.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-h_vLXO8MsO4/TYagofdBZQI/AAAAAAAAAjw/BQ0buSZOUYk/s1600/008.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh5.googleusercontent.com/-h_vLXO8MsO4/TYagofdBZQI/AAAAAAAAAjw/BQ0buSZOUYk/s320/008.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;Here is a schematic.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-Qg5B5wRAuWM/TYag-djgCxI/AAAAAAAAAj0/iyYP7ot-WSA/s1600/Magic+8+Thing+Schematic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="https://lh4.googleusercontent.com/-Qg5B5wRAuWM/TYag-djgCxI/AAAAAAAAAj0/iyYP7ot-WSA/s320/Magic+8+Thing+Schematic.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;And the code.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/*
Program Tile: Magic 8 Thing
Filename: ATMega_328_Magic_8_Thing_v1.0_main.c

Date: 2011.03.20

Author: Pete Mills
http://petemills.blogspot.com/

ATMega328
Ext. Crystal Osc. 8.0-    MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms
*/

/*
Program description

This program uses an ATMega328 to interface an LCD and a Hg "shake" switch.
This is actually a mercury tilt switch from a retired thermostat.
rand() is called to generate a random value for a switch statement.  There are 
20 possible answers based on the original "Magic 8 Ball" toy.  The responses were 
found on wikipedia and modified very little.

The LCD library is written by Peter Fleury and can be found at http://www.jump.to/fleury
You will need to modify lcd.h to fit your port connections.

The user is to ask the device a question then shake the unit.  The device then
responds with one of 20 answers ranging from affirmative to negative and somewhere
in between.  Don't shake it too hard or it will tell you to "Stop It! before giving
you an answer.
*/

// Includes

#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;avr/io.h&amp;gt;     // defines things like "PORTB" and "TCCR0" etc
#include &amp;lt;util/delay.h&amp;gt;    // delay functions
#include "lcd.h"     // LCD Library
#include &amp;lt;avr/interrupt.h&amp;gt;


// Definitions

#define LED_PORT PORTD
#define LED PD1      // LED pin PORTD Pin 2


// function prototypes

void setup(void);
int is_shakin(void);

// Global 

volatile uint8_t shake_count = 0; // counts up the mercury switch contacts, overflows for entropy
volatile uint16_t seconds = 0;  // seconds counter

int main(void)
{

setup();  
sei();        // enable global interrupts
lcd_init(LCD_DISP_ON);    // initialize display and turn off cursor



 while(1)
 { 
 
 uint8_t rand_num = 0;   // random number from prng seeded w/ shake_count
 
 lcd_clrscr();     // clear display and put cursor @ home
 lcd_puts("Magic 8 Thing\n"); // line 1
 lcd_puts("Ask and Shake");  // line 2
 
 while (is_shakin() == 0);  // while nothing is happening
         // now it detected a shake
 
 _delay_ms(500);     // wait a second er, half
 
 lcd_clrscr();     // clear display and put cursor @ home
 
 while (is_shakin() == 1)  // wait for the shaking to stop
 { 
  lcd_puts("Stop It!");  // line 1
  _delay_ms(2000);
  lcd_clrscr();    // clear display and put cursor @ home
 }
 
 srand(shake_count);    // seed the prng with shake_count
 rand_num = (uint8_t) rand(); // get a pseudo random number from 0 to 255
 
 lcd_puts("Magic 8 Thing\n"); // line 1
 lcd_puts("Says...");   // line 2
 
 _delay_ms(3000);
 
 
 // the responses...
 
 lcd_clrscr();     // clear display and put cursor @ home
 
 switch (rand_num % 20)   // pick an answer
 {
  case 0:
   lcd_puts("As I see it, yes\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 1:
   lcd_puts("It is certain!\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 2:
   lcd_puts("It is decidedly\n"); // line 1
   lcd_puts("so.");    // line 2
  break;
  
  case 3:
   lcd_puts("Most likely.\n");  // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 4:
   lcd_puts("Outlook good!\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 5:
   lcd_puts("Signs point to\n"); // line 1
   lcd_puts("yes!");    // line 2
  break;
  
  case 6:
   lcd_puts("Without a doubt!\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 7:
   lcd_puts("Yes.\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 8:
   lcd_puts("Yes, definitely\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 9:
   lcd_puts("You may rely\n");  // line 1
   lcd_puts("on it!");    // line 2
  break;
  
  case 10:
   lcd_puts("Reply hazy,\n");  // line 1
   lcd_puts("try again.");   // line 2
  break;
  
  case 11:
   lcd_puts("Ask again later.\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 12:
   lcd_puts("Better not tell\n"); // line 1
   lcd_puts("you now!");   // line 2
  break;
  
  case 13:
   lcd_puts("Cannot predict\n"); // line 1
   lcd_puts("now...");    // line 2
  break;
  
  case 14:
   lcd_puts("Concentrate and\n"); // line 1
   lcd_puts("ask again.");   // line 2
  break;
  
  case 15:
   lcd_puts("Don't count on\n"); // line 1
   lcd_puts("it!");    // line 2
  break;
  
  case 16:
   lcd_puts("My reply is no.\n"); // line 1
   //lcd_puts("blank");   // line 2
  break;
  
  case 17:
   lcd_puts("My sources say\n"); // line 1
   lcd_puts("no!");    // line 2
  break;
  
  case 18:
   lcd_puts("Outlook not so\n"); // line 1
   lcd_puts("good.");    // line 2
  break;
  
  case 19:
   lcd_puts("Very doubtful!\n"); // line 1
   lcd_puts("LOL");    // line 2
  break;
  
  default: // you should never be here
   lcd_puts("IDK\n");    // line 1
  
 }
 
  _delay_ms(5000); // display the answer for this long
    
 }
}


// functions

void setup(void)
{

// port config

DDRC |= ((1&amp;lt;&amp;lt;1) | (1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;3) | (1&amp;lt;&amp;lt;4) | (1&amp;lt;&amp;lt;5) | (1&amp;lt;&amp;lt;6)); // set PC0::6 to 1 for LCD OUTPUT

DDRD &amp;amp;= ~(1&amp;lt;&amp;lt;2);    // set PD0 to "0" for mercury switch input
PORTD |= (1&amp;lt;&amp;lt;2);    // enable internal pullup
DDRD |= ((1&amp;lt;&amp;lt;0) | (1&amp;lt;&amp;lt;1)); // set PD1 to "1" for output - LED PD0 for LCD
PORTD &amp;amp;= ~(1&amp;lt;&amp;lt;1);    // set the output low

// interrupt config
// external interrupts

EICRA |= ((1&amp;lt;&amp;lt;ISC00) | (1&amp;lt;&amp;lt;ISC01)); // external rising edge interrupt on INT0
EIMSK |= (1&amp;lt;&amp;lt;INT0);     // enable external interrupt

}

ISR(INT0_vect)
{
shake_count++;
}

int is_shakin(void)
{
// this function determines if the unit is being shaken based on the number
// of pin state changes in 100mS

 uint8_t shake_count_first = shake_count; // initial shake count
 
 _delay_ms(100);
 
 if (shake_count - shake_count_first &amp;gt; 3) // can adjust the shake "sensitivity" here
 {
  LED_PORT |= (1&amp;lt;&amp;lt;LED);
  return 1;
 }
 
 LED_PORT &amp;amp;= ~(1&amp;lt;&amp;lt;LED);

return 0;
}
&lt;/pre&gt;&lt;br /&gt;
Here is a video of the Magic 8 Thing in action.&amp;nbsp; As you can see, you ask it a question (which I failed to do in the video), shake it and it replies with one of its 20 answers.&amp;nbsp; If you shake it to hard though, it tells you to "Stop It!" then gives you an answer anyway. The sound at the end of the video is my cellphone getting a text message.&amp;nbsp; It has nothing to do with the Magic 8 Thing.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/edm9MSHHszk/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/edm9MSHHszk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/edm9MSHHszk?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;So, as I stated in the beginning, this Magic 8 Thing was made to help me decide if I have goofed off enough and should start on the cell phone charger repair.&amp;nbsp; When I posed the the question "Magic 8 thing, have I procrastinated long enough?" it replied with the text in the picture below. Apropos.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-S9cW8s60ZtA/TYamO8II_uI/AAAAAAAAAj4/A-Ha-XeCaeM/s1600/019.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh6.googleusercontent.com/-S9cW8s60ZtA/TYamO8II_uI/AAAAAAAAAj4/A-Ha-XeCaeM/s320/019.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-S9cW8s60ZtA/TYamO8II_uI/AAAAAAAAAj4/A-Ha-XeCaeM/s1600/019.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/S_6XuC2WXU4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/7170848249122184440/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=7170848249122184440" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7170848249122184440?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7170848249122184440?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/S_6XuC2WXU4/magic-8-thing.html" title="Magic 8 Thing" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh6.googleusercontent.com/-vuhxgYxjxEc/TYabbu_JrnI/AAAAAAAAAjs/oBKQGUcEv-A/s72-c/014.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/03/magic-8-thing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcBQnY7fCp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-1014904427559288253</id><published>2011-03-11T18:25:00.007-05:00</published><updated>2011-08-19T19:54:13.804-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:54:13.804-04:00</app:edited><title>Cigar Box Laser Light Show</title><content type="html">&lt;div class="separator" style="clear: both; text-align: left;"&gt;It was spring break last week so I had some spare time to kill.&amp;nbsp; I wanted to do a project that would be done fairly quickly and still have some time to study for classes resuming.&amp;nbsp; I do have several other projects going that I could have worked on, but I figured a laser light show would be appropriate for the occasion, being spring break and all.&amp;nbsp; Actually, I have no idea if spring break party goers are the least bit interested in seeing laser light shows, but I am interested in getting some motors spinning programmatically.&amp;nbsp; And to seal the deal there is a new cat in the mix over here so I have buckets full of laser pointers.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;A cigar box made a really nice case for this project due to the nature of mounting the motors.&amp;nbsp;&amp;nbsp; Initially I was going to use a Fossil watch tin but it proved too small for everything to fit nicely.&amp;nbsp; Cigar shops sell empty boxes for a few dollars each. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-ADDDMXgk6Jw/TXqT6wabGcI/AAAAAAAAAfQ/kPJsuG-UdPU/s1600/013.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh5.googleusercontent.com/-ADDDMXgk6Jw/TXqT6wabGcI/AAAAAAAAAfQ/kPJsuG-UdPU/s320/013.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-fX1rUGbMHVQ/TXqVxAam8uI/AAAAAAAAAfU/BrGjd-iC6FE/s1600/012.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh5.googleusercontent.com/-fX1rUGbMHVQ/TXqVxAam8uI/AAAAAAAAAfU/BrGjd-iC6FE/s320/012.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Here is an overview of the theory of operation.&amp;nbsp; When a mirror is mounted on a motor shaft so that the mirrors' face is less than perpendicular and less than parallel to the motors axis of rotation and a laser is reflected off of this rotating mirror, the reflected laser light will trace a circle on a projection surface and dependent on the speed of the motor being high enough, the laser path traced will appear to be a solid circle on the projection surface (a wall in my case) due to the persistence of vision.&amp;nbsp; You can think about it like a laser cone being reflected off of the mirror.&amp;nbsp; If you stopped there, with one motor and mirror, you would have a laser light show that can draw circles.&amp;nbsp; If instead, you aim this reflected "laser cone" onto another one or more motor/mirror pairs, very interesting shapes begin to appear and change too, depending on the relative speed of all the motors.&amp;nbsp; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I decided on 3 motors/mirrors for my laser light show.&amp;nbsp; I got the motors with nice metal gears on their shafts from Ratshack.&amp;nbsp; The gear was helpful in mounting the mirrors which are just hobby mirrors from some craft store.&amp;nbsp; They are not first surface mirrors as you would have expected in an optics related project, but I did not witness any ghosting as I was anticipating.&amp;nbsp; I think this is due to the relative brightness of the laser beam in a dark room.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I first mounted (epoxied) the mirrors onto the motor shaft at too large of an angle.&amp;nbsp; I had carefully setup a jig that would hold a mirror at an angle and centered on the motor shaft to be glued.&amp;nbsp; With the deviation of motor rotation axis and mirror surface too far from perpendicular the reflected laser cone just shot off the edges of the final mirror.&amp;nbsp; In the end, I used a sharpie to mark the center of the mirror, squirted some hot glue on the back of the mirror and stuck the motor with gear on the center mark, holding it as near to perpendicular as my eyes could tell until the glue dried.&amp;nbsp; This worked great and was much simpler than I had tried to make it.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;After the project was complete, I projected circles onto a wall, one at a time with each mirror.&amp;nbsp; I measured the diameter of the circle and the distance to the wall to empirically derive the angle of the mirror face to the motor's axis of rotation to be 87.55 degrees, 87.74 degrees and 86.12 degrees, for the first, second and third mirrors respectively.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Here you can see a laser being reflected through the three mirrors.&amp;nbsp; And in the next photo how I set up the 3 motors/mirrors to be 45 degrees from each other.&amp;nbsp; The laser beam "enters" the lower left mirror, reflected to the top left mirror then, on to the final mirror on the right and out, straight down, 90&amp;nbsp; degrees from where it started.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-_U5CRzyIZBs/TXqdFTrFZYI/AAAAAAAAAfY/XpJHto6Ipws/s1600/008.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh5.googleusercontent.com/-_U5CRzyIZBs/TXqdFTrFZYI/AAAAAAAAAfY/XpJHto6Ipws/s320/008.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-sJovUmIfKa0/TXqeSCI_63I/AAAAAAAAAfc/5uxiwaM_vvo/s1600/026.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh6.googleusercontent.com/-sJovUmIfKa0/TXqeSCI_63I/AAAAAAAAAfc/5uxiwaM_vvo/s320/026.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;And here it is all set up ready to use.&amp;nbsp; You can select manual mode where one of three potentiometers is assigned to one of the three motors to control its speed via PWM.&amp;nbsp; The scale potentiometer scales the PWM output so that you can run the whole system at say 50% or 82% etc of full speed.&amp;nbsp; In automatic mode a PRN generates the motors PWM values, it too is scaled by the scale pot.&amp;nbsp; Also, in automatic mode the third motor potentiometer now controls the fade delay, setting how long it takes the motor to get to its new PWM value. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-6UP7AQA-7nw/TXqgLLoeIqI/AAAAAAAAAfg/lRF-vfWz_EM/s1600/006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="https://lh5.googleusercontent.com/-6UP7AQA-7nw/TXqgLLoeIqI/AAAAAAAAAfg/lRF-vfWz_EM/s320/006.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Here are a couple of videos.&amp;nbsp; The first one shows the output while running in automatic mode.&amp;nbsp; The second video is a slide show of photos of the output.&amp;nbsp; There are more videos on my &lt;a href="http://www.youtube.com/user/pm6041141?feature=mhum"&gt;YouTube channel&lt;/a&gt; of the laser light show if you would like to have a look; these are just two.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/C7U4SZhPL3I/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/C7U4SZhPL3I?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/C7U4SZhPL3I?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/eTItwBvmH-Y/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/eTItwBvmH-Y?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/eTItwBvmH-Y?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span id="goog_2107870831"&gt;&lt;/span&gt;&lt;span id="goog_2107870832"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: left;"&gt;A couple things I noticed about my setup are that one of the three motors whines at lower speeds.&amp;nbsp; I fully expected the whole thing to be a little noisy, and to be fair in person it is not loud at all.&amp;nbsp; I suspect the one motor has looser windings than the rest allowing them to vibrate more than the others.&amp;nbsp; The PWM frequency I had to drive the motors at is well within the human audible range.&amp;nbsp; I had initally tried a higher PWM frequency but could not get the motors to spin.&amp;nbsp; I think this is an issue with motor inductance.&lt;br /&gt;
&lt;br /&gt;
As you can imagine video and pictures of the laser light show have framerate issues that produce interesting effects but aren't that great to look at on youtube.&amp;nbsp; In person, the laser is much brighter and it does produce some pretty interesting images.&amp;nbsp; Some almost appear three dimensional.&amp;nbsp; It was a fun project, but I doubt I will get that much use out of it.&amp;nbsp; I certainly wont be sitting there staring at it for hours on end, but on the upside to that, if I look in a mirror I probably won't see my face melting off and flowing into a river that a unicorn is drinking from.&amp;nbsp; Tune in, turn on, and drop out.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;Code and circuit.&amp;nbsp; On the circuit side of things there really isnt much to talk about.&amp;nbsp; I included a description of the hardware in the comments in the program that has a bit more detail, but basically the ATMega328 reads a pot and outputs a PWM signal that triggers the gate of an IRF510 mosfet for each motor.&amp;nbsp; The motors needed 3vDC so I whipped up a quick power supply with an LM317 and a heatsink.&amp;nbsp; thats about it really.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;And here is the code.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c" name="code"&gt;/*
Program Tile: Laser Light Show v1.0
Filename: ATMega_328_LLS_v1.0_main.c

Date: 2011.03.10

Author: Pete Mills
http://petemills.blogspot.com/

ATMega328
Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms

*/

/*
Program Description

This program has two modes of operation.  In the manual mode, four potentiometers voltages
are measured. One for "scale" and 3 are assigned to 3 motors PWM channels. That is to say
an 8-bit pot value is read, it is scaled by the scale pot value and it is put into an 8-bit PWM 
register such that a potentiometer is controlling the speed of the motor via open loop PWM. 

The scale potentiometer sets the upper range for the PWM output. eg. if the scale pot is
at 50% the PWM output is scaled full range (0::255) to 0::127.

So, in manual mode, a pot is read, the value scaled based on the scale pot, the value
is output to a motor channel. This is done 3 times, once for each motor.

In automatic mode, the scale pot works in just the same way but, the 3 "motor pots" no
longer control the speed of the motors.  Instead rand() is called to generate an 8-bit
PRN that is then scaled by the scale pot and put into the PWM register for a motor.

In automatic mode the third motor pot (motor_pot_2 ADC CH2) is now used to set the fade delay 
between random speed generations.  Larger ADC values = slower fade times.

There is an LED connected to PD0 to indicate which mode you are in, though it is fairly
obvious when the laser light show is running itself using automatic mode.
*/

/*
Circuit description

Microcontroller: ATMega328

Regulated 5v power is supplied via an LM7805 and requisite caps
No external crystal as the internal R/C oscillator is used (dont for get to set the fuses...)
See above for internal R/C oscillator settings.


There are 4 potientiometers with their wipers connected to PC0::3 and legs to 5v and gnd
An led is connected to PD2 with a current limiting resistor
PD0 has a toggle switch to ground for selecting the mode
PD3, PD5 and PD6 connect to the gate of 3 separate IRF510 mosfets
The 3 IRF510 mosfets each have a 1k0 pulldown resistor attached to their gates.
The source of said mosfets are each connected to gnd and their drains to one leg of a motor,
the other leg of the motor connects to +3v motor power.
Across each of the motor leads is attached a reverse biased 1N4001 diode to protect against back EMF

The 3v motor power comes from an LM317 adjustable regulator with heatsink attached. 
*/

// Includes

#include &amp;lt;avr/io.h&amp;gt;     // defines things like "PORTB" and "TCCR0" etc
#include &amp;lt;util/delay.h&amp;gt;    // delay functions
#include &amp;lt;avr/interrupt.h&amp;gt;   // interrupt service
//#include &amp;lt;avr/sleep.h&amp;gt;


// Definitions

#define LED_PORT PORTD
#define LED PD2      // LED pin PORTD Pin 2
#define MODE PIND0     // mode switch

#define FIRST_ADC_INPUT 0   // lowest ADC channel to sample
#define ADC_CHANNELS 4    // number of ADC channels to sample
#define ADC_VREF_TYPE 0    // AREF, Internal Vref turned off

#define MOTOR_POT_0 0    // ADC channels
#define MOTOR_POT_1 1    
#define MOTOR_POT_2 2
#define SCALE_POT 3


// Global Constants

uint8_t FADE_DELAY_MIN = UINT8_C (10);  // mS
uint8_t IN_LOW_SCALE = UINT8_C (0);   // output scaling
uint8_t IN_HI_SCALE = UINT8_C (255);  // max val for motor pot ADC
uint8_t OUT_LOW_SCALE = UINT8_C (0);  // min val for motor pot ADC

volatile uint8_t adc_raw[ADC_CHANNELS];


// function prototypes

void setup(void);
int get_adc(int a);
int scale_outp(int input, int inp_low, int inp_hi, int outp_low, int outp_hi);
ISR(ADC_vect);


int main(void)
{



setup(); // do port configs etc
sei();  // global interrupt enable

 while(1)
 { 
 
  // Variables
  
  uint8_t cur_motor_speed_0 = 0;  // current speed of motor 0::255
  uint8_t cur_motor_speed_1 = 0;
  uint8_t cur_motor_speed_2 = 0;
  
  uint8_t new_motor_speed_0 = 0;  // random value to fade to 0::255
  uint8_t new_motor_speed_1 = 0;
  uint8_t new_motor_speed_2 = 0;
  
  uint8_t adc_val_motor_0 = 0;  // pot on adc0
  uint8_t adc_val_motor_1 = 0;  // pot on adc1
  uint8_t adc_val_motor_2 = 0;  // pot on adc2
  uint8_t adc_val_scale = 0;   // pot on adc3
  
  
  PORTD &amp;amp;= ~(1&amp;lt;&amp;lt;LED);  // turn off led to show where you are - manual mode
  
  // get the output scale value
  
  adc_val_scale = adc_raw[SCALE_POT];  
  
  
  // get the motor pot value, scale it and output to PWM channel - thrice
  
  adc_val_motor_0 = adc_raw[MOTOR_POT_0];  
  cur_motor_speed_0 = scale_outp(adc_val_motor_0, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
  OCR2B = cur_motor_speed_0;
  
  adc_val_motor_1 = adc_raw[MOTOR_POT_1];
  cur_motor_speed_1 = scale_outp(adc_val_motor_1, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
  OCR0B = cur_motor_speed_1;
  
  adc_val_motor_2 = adc_raw[MOTOR_POT_2];
  cur_motor_speed_2 = scale_outp(adc_val_motor_2, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
  OCR0A = cur_motor_speed_2;
  
  _delay_ms(20); 
  
  // effective end of manual mode code
  
  
  while (PIND &amp;amp; (1&amp;lt;&amp;lt;MODE))     // if mode switch is on automatic mode (val 1/true)
  {
  
   PORTD |= (1&amp;lt;&amp;lt;LED);      // turn on led to show mode is automatic mode
  
   new_motor_speed_0 = (uint8_t) rand(); // get a pseudo random number from 0 to 255 for each of the motors
   new_motor_speed_1 = (uint8_t) rand();
   new_motor_speed_2 = (uint8_t) rand();
  
  
   // while the current motor speed != motor speed set point
   
   while((cur_motor_speed_0 + cur_motor_speed_1 + cur_motor_speed_2) != (new_motor_speed_0 + new_motor_speed_1 + new_motor_speed_2))
   {
    
    if(cur_motor_speed_0 &amp;gt; new_motor_speed_0){   // take a step towards the new speed for motor 0
    --cur_motor_speed_0;
    }
   
    else if(cur_motor_speed_0 &amp;lt; new_motor_speed_0){
    ++cur_motor_speed_0;
    }
   
   
    if(cur_motor_speed_1 &amp;gt; new_motor_speed_1){  // and for motor 1
    --cur_motor_speed_1;
    }
    
    else if(cur_motor_speed_1 &amp;lt; new_motor_speed_1){
    ++cur_motor_speed_1;
    }
   
   
    if(cur_motor_speed_2 &amp;gt; new_motor_speed_2){  // and motor 2
    --cur_motor_speed_2;
    }
   
    else if(cur_motor_speed_2 &amp;lt; new_motor_speed_2){
    ++cur_motor_speed_2;
    }
    
    
    adc_val_scale = adc_raw[SCALE_POT];  // get the scale pot value
    
    // scale values first then output to PWM registers
    
    OCR2B = scale_outp(cur_motor_speed_0, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
    OCR0B = scale_outp(cur_motor_speed_1, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
    OCR0A = scale_outp(cur_motor_speed_2, IN_LOW_SCALE, IN_HI_SCALE, OUT_LOW_SCALE, adc_val_scale);
   
   
    // MOTOR_POT_2 now controls the fade delay within automatic mode
    
    adc_val_motor_2 = adc_raw[MOTOR_POT_2];  
    _delay_ms(FADE_DELAY_MIN + adc_val_motor_2); 
    
   } // end fade while
  
  } // end if(MODE)
  
 } // end while(1)
  
} // end int main()


// functions

void setup(void)
{

// port config

DDRC &amp;amp;= ~((1&amp;lt;&amp;lt;0) | (1&amp;lt;&amp;lt;1) | (1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;3));  // set PC0::3 to "0" for adc input

DDRD &amp;amp;= ~(1&amp;lt;&amp;lt;0);          // set PD0 to "0" for switch input
PORTD |= (1&amp;lt;&amp;lt;0);          // enable internal pullup
DDRD |= ((1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;3) | (1&amp;lt;&amp;lt;5) | (1&amp;lt;&amp;lt;6));   // set PD2::3 and PD5::6 to "1" for output - PWM &amp;amp; LED
PORTD &amp;amp;= ~((1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;3) | (1&amp;lt;&amp;lt;5) | (1&amp;lt;&amp;lt;6));  // set the outputs low

// ADC Config

// adc enable, cdiv 8Mhz/64 = 125kHz, interrupt enable, auto trigger enable

ADCSRA |= ((1&amp;lt;&amp;lt;ADEN) | (1&amp;lt;&amp;lt;ADPS2) | (1&amp;lt;&amp;lt;ADPS1) | (1&amp;lt;&amp;lt;ADIE) | (1&amp;lt;&amp;lt;ADATE));  
ADCSRB |= (1&amp;lt;&amp;lt;ADTS2); // set to be anything other than free running mode 
DIDR0 |=((1&amp;lt;&amp;lt;ADC0D) | (1&amp;lt;&amp;lt;ADC1D) | (1&amp;lt;&amp;lt;ADC2D) | (1&amp;lt;&amp;lt;ADC3D)); // disable digital input buffers to save power


// PWM config

// Timer/Counter0: channel:A/B clear on compare match, Fast PWM, TOP = OC0A,0C0B

TCCR0A |= ((1&amp;lt;&amp;lt;COM0A1) | (1&amp;lt;&amp;lt;COM0B1) | (1&amp;lt;&amp;lt;WGM01) | (1&amp;lt;&amp;lt;WGM00));
TCCR0B |= ((1&amp;lt;&amp;lt;CS00) | (1&amp;lt;&amp;lt;CS02));         // internal clock as source, div 1024 prescale

  
// Timer/Counter1: Channel:A clear on compare match, Fast PWM, TOP = OC2B

TCCR2A |= ((1&amp;lt;&amp;lt;COM2B1) | (1&amp;lt;&amp;lt;WGM21) | (1&amp;lt;&amp;lt;WGM20));
TCCR2B |= ((1&amp;lt;&amp;lt;CS20) | (1&amp;lt;&amp;lt;CS22));         // internal clock as source, div 1024 prescale

}

int scale_outp(int input, int inp_low, int inp_hi, int outp_low, int outp_hi)
{
return ((input - inp_low) * (outp_hi - outp_low) / (inp_hi - inp_low) + outp_low);
}

// ADC interrupt service routine
ISR(ADC_vect) 
{
static unsigned char input_index=0;

// Read the AD conversion result
   adc_raw[input_index]=ADCH;
// Select next ADC input
   if (++input_index &amp;gt;= ADC_CHANNELS)
      {
      input_index=0;
      }

   ADMUX=(FIRST_ADC_INPUT | ADC_VREF_TYPE | (1&amp;lt;&amp;lt;ADLAR))+input_index; //and left adjust

// Start the AD conversion
   ADCSRA |= (1&amp;lt;&amp;lt;ADSC);

}
&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: left;"&gt;UPDATE:&lt;br /&gt;
&lt;br /&gt;
A reader asked if I would make a schematic available.&amp;nbsp; I didn't have one so I just drew this one up from the text description in the program, of the circuit, that I wrote when I did the project..&amp;nbsp; This schematic was drawn after I built the circuit.&amp;nbsp; I did not use this schematic while I was building this project, but I believe it to be correct.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-4J241tzERmc/TYfNhyUhGpI/AAAAAAAAAj8/XAezwZGMQw0/s1600/Laser+Light+Show+Schematic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="https://lh4.googleusercontent.com/-4J241tzERmc/TYfNhyUhGpI/AAAAAAAAAj8/XAezwZGMQw0/s320/Laser+Light+Show+Schematic.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/gk-r1ysCu3c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/1014904427559288253/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=1014904427559288253" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/1014904427559288253?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/1014904427559288253?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/gk-r1ysCu3c/cigar-box-laser-light-show.html" title="Cigar Box Laser Light Show" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh5.googleusercontent.com/-ADDDMXgk6Jw/TXqT6wabGcI/AAAAAAAAAfQ/kPJsuG-UdPU/s72-c/013.jpg" height="72" width="72" /><thr:total>10</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/03/cigar-box-laser-light-show.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcNSHc9eSp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-7857530641842727674</id><published>2011-02-02T14:58:00.001-05:00</published><updated>2011-08-19T19:54:59.961-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:54:59.961-04:00</app:edited><title>New Workspace</title><content type="html">I am in the process of setting up a new workspace for my electronics/homework and thought I would share some photos of the progress.&amp;nbsp; It is by no means complete but a good start has been made.&amp;nbsp; This desk is really nice and big.&amp;nbsp; It is 8 feet long and about 3 feet deep.&lt;br /&gt;
&lt;br /&gt;
I like looking at pictures of workspaces because you can kind of see how they evolved over time to suit the individual.&amp;nbsp; We make them work for us and what doesn't work doesn't usually last that long.&amp;nbsp; It will be interesting to see what this work area looks like in a years time.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmcYGuBqyI/AAAAAAAAAeo/1kONYUPPhJ4/s1600/002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmcYGuBqyI/AAAAAAAAAeo/1kONYUPPhJ4/s320/002.jpg" width="320" /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;One of the things I would like to add in addition to more outlets is an outlet timer.&amp;nbsp; Something that will automatically shut off my soldering station or hot glue gun when I accidentally leave them on.&amp;nbsp; I guess I will have to remember to turn things off until I have more time to automate my life.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp;In this picture you can see a contact printer I am currently modifying to be used as a light box for PCB photofabrication, but I will post more about that another day.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TUmcjuoIYpI/AAAAAAAAAes/QpPE_DD5VsE/s1600/004.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TUmcjuoIYpI/AAAAAAAAAes/QpPE_DD5VsE/s320/004.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I found a great Eck-Adams chair at Treasure Mart for $20.&amp;nbsp; I think it matches the clock radio I found at Treasure Mart also, quite well.&amp;nbsp; Here is a picture of the chair on the ride home.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmT523oEyI/AAAAAAAAAeI/5HNJORokeLo/s1600/006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmT523oEyI/AAAAAAAAAeI/5HNJORokeLo/s320/006.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmUTDXO0oI/AAAAAAAAAeU/8Y6-zM0fUUM/s1600/014.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmUTDXO0oI/AAAAAAAAAeU/8Y6-zM0fUUM/s320/014.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;
Here are a couple of action shots.&amp;nbsp; You can see that the chair functions quite well as something to sit on.&amp;nbsp; Studies have shown that people who stand less often tend to sit more.&amp;nbsp; I think this is a good addition to my workspace.&amp;nbsp; It is really comfortable; it has that 1970's cushioning and it's seat to back angle is quite inviting.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmUZQLZxCI/AAAAAAAAAec/_ZMrsUHYgLY/s1600/022.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmUZQLZxCI/AAAAAAAAAec/_ZMrsUHYgLY/s320/022.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Action Shot - Form following function&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_AS-W62ca4e0/TUmUWnCj8oI/AAAAAAAAAeY/aIawM1L9xYQ/s1600/018.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_AS-W62ca4e0/TUmUWnCj8oI/AAAAAAAAAeY/aIawM1L9xYQ/s320/018.jpg" width="191" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Action Shot - P.O.V.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
It is no secret that this chair came from the Eck-Adams company.&amp;nbsp; Googling the company turns up no real information though.&amp;nbsp; I guess they have gone out of business. But, what a fine chair they made before they did.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmUEDAfCzI/AAAAAAAAAeM/U16JsOXUqQE/s1600/009.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmUEDAfCzI/AAAAAAAAAeM/U16JsOXUqQE/s320/009.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TUmUeIRQfOI/AAAAAAAAAeg/8ilOieg2MaY/s1600/033.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TUmUeIRQfOI/AAAAAAAAAeg/8ilOieg2MaY/s320/033.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmUIwZCP7I/AAAAAAAAAeQ/QbYVID952Ss/s1600/010.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="191" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TUmUIwZCP7I/AAAAAAAAAeQ/QbYVID952Ss/s320/010.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Accidental photo's are interesting&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
If you have any photos of a workspace you would like to share, feel free to post a link in the comments.&amp;nbsp; Or just share what the favorite part about your workspace is.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/8aavz1hwDMM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/7857530641842727674/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=7857530641842727674" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7857530641842727674?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/7857530641842727674?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/8aavz1hwDMM/new-workspace.html" title="New Workspace" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_AS-W62ca4e0/TUmcYGuBqyI/AAAAAAAAAeo/1kONYUPPhJ4/s72-c/002.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/02/new-workspace.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4DQX84fSp7ImA9Wx9QGEQ.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-8582279674430025768</id><published>2011-01-01T02:43:00.005-05:00</published><updated>2011-01-01T09:42:50.135-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-01T09:42:50.135-05:00</app:edited><title>3$ LED Map Light Replacement</title><content type="html">I needed to replace the map light lamp in my car this afternoon and I thought I would go for LED replacement bulbs.&amp;nbsp; The original incandescent bulb's orange glow looks dingy anyway and the last few times I needed to see by way of the map light it seemed rather dim.&amp;nbsp; I figured the local auto parts store would be teeming with LED's as it seems all of the futuristic cars nowadays are jamb packed with the things.&amp;nbsp; This, however, turned out not to be the case.&amp;nbsp; According to the worker at the parts shop, LED's are "high performance" parts and as such, must be custom ordered.&amp;nbsp; I was also told that "the internet has them".&amp;nbsp; Neat. Too bad "the internet" thinks LED replacement bulbs are more valuable than McDonald's orange juice.&lt;br /&gt;
&lt;br /&gt;
Not to be out done, I walked to the dollar store next door to the auto parts shop, where I found these beauties for 1$ each.&amp;nbsp; A Trisonic 3 LED Push Light; batteries not included.&amp;nbsp; I bought three, driver/passenger map light and cargo area hence, the $3.&amp;nbsp; In case you were wondering, the text on the bottom front says "To uplift our character, begin with cultivating peace in mind, body, family, and activity.".&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_AS-W62ca4e0/TR7UTZwex-I/AAAAAAAAAco/VMWHZU_6ybk/s1600/023_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_AS-W62ca4e0/TR7UTZwex-I/AAAAAAAAAco/VMWHZU_6ybk/s320/023_crop.jpg" width="247" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
And on the back, the text "Cultivate a big heart-but a small ego", let me know these were the right bit of kit for the job because, that is exactly what I was trying to do.&amp;nbsp; No, this project wasn't "X to the Z" pimping any rides.&amp;nbsp; And, my car is neither empirically "faster" nor, objectively, more "furious" because of this upgrade.&amp;nbsp; Just humble LED's helping electrons change orbitals to emit photons for me to read maps by.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UVcWWLkI/AAAAAAAAAcs/AjEQINW-Hxk/s1600/024_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UVcWWLkI/AAAAAAAAAcs/AjEQINW-Hxk/s320/024_crop.jpg" width="247" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UnM0YnxI/AAAAAAAAAdM/fgRCGa_DG5U/s1600/038_crop.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;I wanted to verify the light worked as intended and would be bright enough first, before ripping it to pieces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TR7UX-APEqI/AAAAAAAAAcw/dKkAGP7c-MU/s1600/025_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TR7UX-APEqI/AAAAAAAAAcw/dKkAGP7c-MU/s320/025_crop.jpg" width="247" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TR7UaeE7dWI/AAAAAAAAAc0/2UM3mTo-WBI/s1600/026_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TR7UaeE7dWI/AAAAAAAAAc0/2UM3mTo-WBI/s320/026_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This is what I found inside.&amp;nbsp; 3 LED's, a switch and a single resistor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UcxU31pI/AAAAAAAAAc4/m_PF_oMgCSs/s1600/029.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UcxU31pI/AAAAAAAAAc4/m_PF_oMgCSs/s320/029.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
And just what do we have here?&amp;nbsp; The good people of Trisonic have designed their circuit to have the LED's in parallel.&amp;nbsp; This works for the design specifications of the product they made but it is not helpful to me so I first desoldered all of the components.&amp;nbsp; Then, I cut through two of the PCB traces to allow me to solder the LED's back in place in series instead of parallel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TR7Ue9qdSFI/AAAAAAAAAc8/-AoPMuCxGfg/s1600/031_crop.jpg" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="179" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TR7Ue9qdSFI/AAAAAAAAAc8/-AoPMuCxGfg/s320/031_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Before&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
While the LED's were desoldered from the board I wired one of them up to a 9v battery through a 1k0 resistor.&amp;nbsp; Measuring the voltage across the LED I got a forward voltage Vf=2.8v.&amp;nbsp; Previously, I had measured the current of all three LED's together to be 130mA before taking this thing apart so, I know each LED can handle at least ~43mA.&amp;nbsp; To select my current limiting resistor for the series LED's I have ((14vBatt-(2.8*3))/40mA = 140R or standard value 150R for 37mA.&amp;nbsp; Power dissipation 0.207W so, a 1/4 Watt resistor is fine.&lt;br /&gt;
&lt;br /&gt;
Here, Vbatt = 14v because the car's 12v system operates around 13v with the car running at idle and peaks up to ~14v when the RPM of the alternator increases.&amp;nbsp; 14v is kind of a design for "worst case" scenario with lower battery voltages resulting in LED operation towards safer limits.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Here you can see the LED's soldered in the new series configuration and current limiting resistor in place.&amp;nbsp; In series, the LED's are hooked up anode to cathode of each other with a current limiting resistor on one end, the negative side of 12v in my case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UgBoAlJI/AAAAAAAAAdA/CviT8Js6jXQ/s1600/033_crop.jpg" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="180" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UgBoAlJI/AAAAAAAAAdA/CviT8Js6jXQ/s320/033_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;After&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here you can see the LED PCB hot glued into place in the light reflector housing.&amp;nbsp; You can also see the PCB traces I cut to allow the parallel/series modification.&amp;nbsp; The +/- 12v (nominal) power leads on the LED board are soldered to the wires that used to deliver battery voltage to the incandescent bulb.&amp;nbsp; The connector for the original lamp was left in place electrically and solder joints were insulated against short circuits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UiiYbe3I/AAAAAAAAAdE/xzoLKexrgMY/s1600/034_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="179" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UiiYbe3I/AAAAAAAAAdE/xzoLKexrgMY/s320/034_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TR7Uk9n6bfI/AAAAAAAAAdI/Zz-4E2Cp6C0/s1600/036_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TR7Uk9n6bfI/AAAAAAAAAdI/Zz-4E2Cp6C0/s320/036_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TR7Ue9qdSFI/AAAAAAAAAc8/-AoPMuCxGfg/s1600/031_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt; &lt;br /&gt;
A side by side comparison shows the difference in color of the LED's on the left and the incandescent bulb on the right.&amp;nbsp; The LED's are equally as bright and diffuse quite well so there is no "hot spot" of light.&amp;nbsp; I will perform the same LED retrofit to the right side of the light housing next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UnM0YnxI/AAAAAAAAAdM/fgRCGa_DG5U/s1600/038_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UnM0YnxI/AAAAAAAAAdM/fgRCGa_DG5U/s320/038_crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This was a fun afternoon project and I am pleased with the results.&amp;nbsp; Average prices for ready made LED replacement bulbs for this style holder seem to be $15 x 3 lights = $45.&amp;nbsp; The method outlined above came in at ~$3 total.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TR7UnM0YnxI/AAAAAAAAAdM/fgRCGa_DG5U/s1600/038_crop.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/Doe6hXigUoM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/8582279674430025768/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=8582279674430025768" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8582279674430025768?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/8582279674430025768?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/Doe6hXigUoM/3-led-map-light-replacement.html" title="3$ LED Map Light Replacement" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_AS-W62ca4e0/TR7UTZwex-I/AAAAAAAAAco/VMWHZU_6ybk/s72-c/023_crop.jpg" height="72" width="72" /><thr:total>11</thr:total><feedburner:origLink>http://petemills.blogspot.com/2011/01/3-led-map-light-replacement.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYBQnk5cSp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-5154628902131998123</id><published>2010-10-25T17:13:00.001-04:00</published><updated>2011-08-19T19:55:53.729-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:55:53.729-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="christmas story mannequin leg lamp" /><title>Mannequin Leg Lamp</title><content type="html">&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TMR57t79nGI/AAAAAAAAAZQ/4KHJhXdMkYA/s1600/080.jpg"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The 1983 movie &lt;a href="http://www.imdb.com/title/tt0085334/"&gt;A Christmas Story&lt;/a&gt; supplied the idea for this project when I happened upon a ladies mannequin leg at a &lt;a href="http://thetreasuremart.wordpress.com/"&gt;local store&lt;/a&gt;.  To clarify, the leg &lt;span style="font-style: italic;"&gt;was &lt;/span&gt;for sale and I did pay for it.&lt;br /&gt;
&lt;br /&gt;
So, in the movie A Christmas Story the father is awarded a leg lamp for winning a contest.  Technically, the winning answer is supplied by his wife and when the prize shows up she is less than enthusiastic about it.  But, the father is quite smitten with the leg lamp and the movie takes place in the 1940's so it's all good.&lt;br /&gt;
&lt;br /&gt;
Here, I have just found and purchased the leg.  As you can see, I am quite happy with the find.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TMRxWVxnYHI/AAAAAAAAAYw/gOiC7fR85Mw/s1600/051_crop.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531670870934118514" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TMRxWVxnYHI/AAAAAAAAAYw/gOiC7fR85Mw/s320/051_crop.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 234px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I took the leg shoe shopping.  Although I didn't find any shoes there to fit I did get some good information.  The ladies at the store, who got a good laugh out of shoe shopping for a mannequin leg, said I would need a size 6, 4" heel.  I suspect it is closer to a 6" heel that would be necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TMR57CXbY-I/AAAAAAAAAZA/3G0WK1HfH0g/s1600/055.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531680297472189410" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TMR57CXbY-I/AAAAAAAAAZA/3G0WK1HfH0g/s320/055.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 192px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;A local thrift store had these shoes available.  Not a perfect match for the lamp in the movie or even a good match for the leg as it needs a higher heel but the size was right and so was the $3.60 price tag. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TMSbhPRSNWI/AAAAAAAAAZY/KALS0q2-XK0/s1600/073.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531717237654828386" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TMSbhPRSNWI/AAAAAAAAAZY/KALS0q2-XK0/s320/073.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 192px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Halloween seems to be a good time to make one of these lamps as body parts and costume clothes are necessary ingredients.  The stockings came from a seasonal Halloween shop.  Sexay...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TMSbhgpN1gI/AAAAAAAAAZw/kVj89f93VaU/s1600/057.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531717242318607874" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TMSbhgpN1gI/AAAAAAAAAZw/kVj89f93VaU/s320/057.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 192px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see the leg manufacture info it says RPM Industries, INC  Shoe Form Division Auburn, NY.  The designation #W-47 is probably the model number.  You can also see that I have added a piece of poplar wood with a clearance hole for the lamp parts about to be installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TMSbhL3q3xI/AAAAAAAAAZg/0hoduFHHaqw/s1600/095_crop.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531717236742086418" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TMSbhL3q3xI/AAAAAAAAAZg/0hoduFHHaqw/s320/095_crop.jpg" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 307px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the parts from a donor lamp installed I could run the power cord.&amp;nbsp; I drilled a clearance hole in the leg approximately in between the inferior extensor retinaculum would be if this were a human leg.&amp;nbsp; Once threaded through the interior of the leg I tied a knot in the cord for strain relief.&amp;nbsp; Then I wired the bulb socket so that the center conductor was the AC "hot" wire and the threaded part was the AC "neutral".&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_AS-W62ca4e0/TMXqq9HMS9I/AAAAAAAAAaU/zf3qsL9EnVo/s1600/096.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_AS-W62ca4e0/TMXqq9HMS9I/AAAAAAAAAaU/zf3qsL9EnVo/s320/096.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
One of the things I was struggling with design wise was how to mount the leg in the shoe on a base so that it will stand up and not wobble around.&amp;nbsp; I thought that a shoe like the one I found would be enough to strap it down and in the end it was ok, but I was a bit disappointed to find that the strap has a piece of elastic on it.&amp;nbsp; So, as it &lt;i&gt;stands &lt;/i&gt;now, I have screwed the sole of the shoe to the base and have a little riser temporarily to make up for the slightly short heel.&amp;nbsp; The base of the lamp is a piece of locally reclaimed black walnut.&amp;nbsp; For now it is unfinished but I will pretty it up one day.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/TMR57t79nGI/AAAAAAAAAZQ/4KHJhXdMkYA/s1600/080.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5531680309168151650" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TMR57t79nGI/AAAAAAAAAZQ/4KHJhXdMkYA/s320/080.jpg" style="display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 192px;" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The stockings are infuriatingly difficult to stuff in the end of the shoe against the slippery plastic mannequin leg.&amp;nbsp; You can also see the local black walnut base here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_AS-W62ca4e0/TMXugwuG7nI/AAAAAAAAAaY/VVrnOrksPYo/s1600/109.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/_AS-W62ca4e0/TMXugwuG7nI/AAAAAAAAAaY/VVrnOrksPYo/s320/109.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the nearly finished product.&amp;nbsp; As you can see it is not an &lt;i&gt;exact &lt;/i&gt;replica of the one in the movie.&amp;nbsp; For instance, my shade with the added tassels is a bit different and the leg in the movie was, um, meatier?&amp;nbsp; But, differences aside, anyone who as seen it thus, far immediately recalls the movie A Christmas Story.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/TMXveyQz9ZI/AAAAAAAAAac/dWk6_hyNxys/s1600/106.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_AS-W62ca4e0/TMXveyQz9ZI/AAAAAAAAAac/dWk6_hyNxys/s320/106.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Hur, Hur...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/TMXwkT7cYmI/AAAAAAAAAag/1fee-lHkjNE/s1600/107.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TMXwkT7cYmI/AAAAAAAAAag/1fee-lHkjNE/s320/107.jpg" width="191" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This is by no means a project of great technical achievement, but it was a heck of a lot of fun to build.&amp;nbsp; There is something to be said for spontaneous projects.&amp;nbsp; I did not set out to build or own one of these lamps - or any lamp at the time, but I found the leg and had a few hours to kill.&lt;br /&gt;
&lt;br /&gt;
In the movie the father uses the words "glorious" and "magnificent" to describe his lamp and if I am honest with myself, truer words could not describe this lamp.&amp;nbsp; I find myself looking at it with satisfaction and sometimes turning it on just to have it on.&amp;nbsp; The pictures, unfortunately, do not do it justice.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/FWAALlDfZhE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/5154628902131998123/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=5154628902131998123" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5154628902131998123?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/5154628902131998123?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/FWAALlDfZhE/mannequin-leg-lamp.html" title="Mannequin Leg Lamp" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_AS-W62ca4e0/TMRxWVxnYHI/AAAAAAAAAYw/gOiC7fR85Mw/s72-c/051_crop.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://petemills.blogspot.com/2010/10/mannequin-leg-lamp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYDQnYyeyp7ImA9Wx5UE0k.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-1964126805902870475</id><published>2010-10-17T15:56:00.013-04:00</published><updated>2010-10-17T16:42:53.893-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-17T16:42:53.893-04:00</app:edited><title>School Bell</title><content type="html">Having several irons in the fire has never stopped me from opening the door when opportunity comes knocking.  Ok, so this school bell didn't exactly "find" me so much as I was out at one of my usual haunts &lt;a href="http://thetreasuremart.wordpress.com/"&gt;Treasure Mart&lt;/a&gt; looking for neat treasures when I came across IT. &lt;br /&gt;&lt;br /&gt;It was labeled "School Bell - $8.00" and that was it.  It rattled when I shook it, which turned out to be a mounting screw, surplus to requirement, left inside.  Despite the mysterious rattle and the rusted condition of the bell it was too good of a find to pass up.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtYGr9SoAI/AAAAAAAAAYM/Gg0F5g5Z-xY/s1600/021.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 192px; height: 320px;" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtYGr9SoAI/AAAAAAAAAYM/Gg0F5g5Z-xY/s320/021.jpg" alt="" id="BLOGGER_PHOTO_ID_5529109839429672962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;As you can see here it is labeled "The Autocall Co.".  It also says [0].22 Amps, 24 Watts and 115-60.  The last designation I take to mean 115 volts at 60 Hertz aka standard US AC voltage/frequency.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtXeON4mBI/AAAAAAAAAYE/PHVxnErhM88/s1600/027.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 192px; height: 320px;" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtXeON4mBI/AAAAAAAAAYE/PHVxnErhM88/s320/027.jpg" alt="" id="BLOGGER_PHOTO_ID_5529109144251439122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Immediately after getting home I opened it up to discover the bell's simple design.  A spring dampened plunger in an AC solenoid.  Each half of that 60Hz sine wave causing the plunger to move to and fro; ringing out that familiar and much awaited signal that class was over.  This time, however, there would be no "Pete, please see me after class.".  Shenanigans will abound.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtYHzH5e9I/AAAAAAAAAYc/XR6wvVWan9Y/s1600/023.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 192px;" src="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtYHzH5e9I/AAAAAAAAAYc/XR6wvVWan9Y/s320/023.jpg" alt="" id="BLOGGER_PHOTO_ID_5529109858533080018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_AS-W62ca4e0/TLtYHAs7vAI/AAAAAAAAAYU/az6Eehds9C8/s1600/022.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 192px; height: 320px;" src="http://1.bp.blogspot.com/_AS-W62ca4e0/TLtYHAs7vAI/AAAAAAAAAYU/az6Eehds9C8/s320/022.jpg" alt="" id="BLOGGER_PHOTO_ID_5529109844998208514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The bell came with two 14 Ga. wires, one stranded the other solid, attached to the solenoid. Testing the bell by jamming these wires into an outlet controlled by a wall switch proved that the bell works.  Not a surprising revelation after the visual inspection.  However, needless to say, jamming bare wires into an outlet is not a long term solution to powering this bell and they were removed in favor of a two prong plug which you can see in the above pictures.&lt;br /&gt;&lt;br /&gt;This thing really is quite loud.  The microphone on my camera cannot pick up the audio too well until the amplitude falls within range.&lt;br /&gt;&lt;br /&gt;&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/G-y8rTp0yIs?fs=1&amp;amp;hl=en_US"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/G-y8rTp0yIs?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="385" width="480"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Now, I have several ideas on what I will do with this bell in the future but I imagine nothing just yet.  I think the application will present itself when the time is right.  Perhaps an alarm to alert you the refrigerator door has been left open for too long.  An alarm clock?  Maybe use a PIR sensor to trigger the bell for a couple seconds anytime it "sees" a person enter a room.  Or it could ring each time an email comes into my inbox.  Certainly this serves as another reminder that an inductive vehicle detector loop is desirable in everyone's driveway.  And of course with Halloween just around the corner it could be used to just plain scare the living daylights out of some poor unsuspecting soul.  Let me know in the comment section what you would do with a school bell of your own.&lt;br /&gt;&lt;br /&gt;A brief word on safety.  Although this is called a school bell I believe they are also used in fire alarm systems.  If nothing else I believe some people might interpret the sound to mean "DANGER".  With this in mind I only activate the bell where those that can hear it are aware that the sound is not intended to signal any type of emergency condition.  I encourage you to consider this possibility if you happen to come across such an item to play with too.&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/ZwQx-NvD2XE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/1964126805902870475/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=1964126805902870475" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/1964126805902870475?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/1964126805902870475?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/ZwQx-NvD2XE/school-bell.html" title="School Bell" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_AS-W62ca4e0/TLtYGr9SoAI/AAAAAAAAAYM/Gg0F5g5Z-xY/s72-c/021.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://petemills.blogspot.com/2010/10/school-bell.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUGSXozfCp7ImA9WhdQF0Q.&quot;"><id>tag:blogger.com,1999:blog-1634572204034071649.post-2706141467443327480</id><published>2010-05-14T14:40:00.022-04:00</published><updated>2011-08-19T19:57:08.484-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T19:57:08.484-04:00</app:edited><title>Train Whistle Doorbell</title><content type="html">For the people who know me, the title of this project will be read as “well that sounds about right”.  For the rest of society it may need some modicum of rationalization.  To that end, have you ever missed the doorbell ringing?  Perhaps you were in the shower or vacuuming the floor.  Well, fear no more; you won't miss hearing this one.&lt;br /&gt;
&lt;div style="margin-bottom: 0in;"&gt;I was given this Lunkenheimer steam train whistle as a birthday gift quite a few years ago.  I came up with the idea to make it into a doorbell shortly thereafter for pretty obvious reasons, but I was unsure how I wanted to execute the wireless part of it.  As you can see here I ended up using an el-cheapo wireless doorbell.  This solved a lot of problems for me, not the least of which is that I can let the bell ring for a bit first before activating the steam whistle so my heart remains firmly in my chest rather than being startled to death every time UPS stops by.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;a href="http://4.bp.blogspot.com/_AS-W62ca4e0/S-2aATbXnoI/AAAAAAAAAWY/0D7l_tNbdpE/s1600/DSCN1201.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5471198452330765954" src="http://4.bp.blogspot.com/_AS-W62ca4e0/S-2aATbXnoI/AAAAAAAAAWY/0D7l_tNbdpE/s320/DSCN1201.JPG" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 240px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;Circuit wise, this doorbell came with an led on the front that blinks when the bell is activated.  So, when I was designing the circuit in my head, thinking I would have to tap into the circuit board to get a logic signal; turns out I could just make a simple circuit to 'watch' the led; a photo transistor with a 10k pulldown works a treat.  The sprinkler solenoid is rated at 24VAC.  I don't know why they are AC and they work fine on DC, but it was easy enough to make a power supply that had the 24VAC and 12VDC so I did.  The 5v RadioShack relay annoyed me when I found out it was going to draw 83mA and I would need a transistor amplifier.  Yeah, not that big of a deal, but I thought I was being clever instead of using one of the 12v automotive relays from the junk box.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;a href="http://2.bp.blogspot.com/_AS-W62ca4e0/S-2fbuFABGI/AAAAAAAAAWg/BKsQwKxArzs/s1600/DSCN1200.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5471204420899308642" src="http://2.bp.blogspot.com/_AS-W62ca4e0/S-2fbuFABGI/AAAAAAAAAWg/BKsQwKxArzs/s320/DSCN1200.JPG" style="cursor: pointer; display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 240px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;I took the spring and valve out of the steam whistle so that it could be operated solely by the sprinkler solenoid.  This allows a massive amount of air to be passed through the whistle so “tuning” it was necessary by screwing the bell part in closer to the air escapement.  I was hovering over the whistle when I tried out the circuit for the first time and it literally blasted the eye glasses off of my face.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_AS-W62ca4e0/S-2iZVgkkvI/AAAAAAAAAWo/nsXTUfyD0DU/s1600/DSCN1203.JPG" style="margin-left: auto; margin-right: auto;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5471207678479209202" src="http://1.bp.blogspot.com/_AS-W62ca4e0/S-2iZVgkkvI/AAAAAAAAAWo/nsXTUfyD0DU/s320/DSCN1203.JPG" style="display: block; height: 320px; margin: 0px auto 10px; text-align: center; width: 240px;" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Ear defenders are necessary.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;The doorbell has, I think, 7 different rings to it.  I settled on the “fog horn”; it cracks me up.  It reminds me of Eeyore for whatever reason.  Then the train whistle kicks in so it is like the whole thing goes from depressive to bat shit hyper in 3 seconds.   For now it does a toot tooooot as you would imagine.  It uses up pretty much all the air in the compressor in that short amount of time.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/_AS-W62ca4e0/S-2nb9GsSqI/AAAAAAAAAWw/V5CM40uPR8U/s1600/DSCN1202.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5471213221025958562" src="http://3.bp.blogspot.com/_AS-W62ca4e0/S-2nb9GsSqI/AAAAAAAAAWw/V5CM40uPR8U/s320/DSCN1202.JPG" style="cursor: pointer; display: block; height: 240px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;br /&gt;
The video can be seen here; sadly the camera cannot pick up how loud it really is.  The fact that the entire assembly wiggles when activated should give you a bit of an idea how much air is being passed through it though.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/FafCv99frcE/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/FafCv99frcE?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/FafCv99frcE?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;Here is another vid of the doorbell in action.&amp;nbsp; The whistle is set inside of the house while I activate it from outside.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/6h6l7ou54i8/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/6h6l7ou54i8?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/6h6l7ou54i8?f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;I am still trying to find a good way to upload code, but for today here it is:&lt;/div&gt;&lt;br /&gt;
http://www.scribd.com/doc/31385978&lt;br /&gt;
&lt;div style="margin-bottom: 0in;"&gt;The schematic:&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;a href="http://www.scribd.com/doc/31385712/twdb-schematic" style="display: block; font: 14px Helvetica,Arial,Sans-serif; margin: 12px auto 6px; text-decoration: underline;" title="View twdb_schematic on Scribd"&gt;twdb_schematic&lt;/a&gt; &lt;object data="http://d1.scribdassets.com/ScribdViewer.swf" height="600" id="doc_884416241525237" name="doc_884416241525237" style="outline: medium none;" type="application/x-shockwave-flash" width="100%"&gt;        &lt;param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"&gt;&lt;param name="wmode" value="opaque"&gt;&lt;param name="bgcolor" value="#ffffff"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;param name="FlashVars" value="document_id=31385712&amp;amp;access_key=key-msemus7ar8pdoyjwxb7&amp;amp;page=1&amp;amp;viewMode=slideshow"&gt;&lt;embed id="doc_884416241525237" name="doc_884416241525237" src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=31385712&amp;amp;access_key=key-msemus7ar8pdoyjwxb7&amp;amp;page=1&amp;amp;viewMode=slideshow" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" bgcolor="#ffffff" height="600" width="100%"&gt;&lt;/embed&gt;     &lt;/object&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/fSUJk/~4/gktXI4wJ_Ac" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://petemills.blogspot.com/feeds/2706141467443327480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=1634572204034071649&amp;postID=2706141467443327480" title="35 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2706141467443327480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1634572204034071649/posts/default/2706141467443327480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/fSUJk/~3/gktXI4wJ_Ac/train-whistle-doorbell.html" title="Train Whistle Doorbell" /><author><name>Pete</name><uri>http://www.blogger.com/profile/10432659350949374712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://3.bp.blogspot.com/-2tAC9EmQRrI/TgfmwirLE1I/AAAAAAAAA6E/7iPyeWNS6zg/s220/089.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_AS-W62ca4e0/S-2aATbXnoI/AAAAAAAAAWY/0D7l_tNbdpE/s72-c/DSCN1201.JPG" height="72" width="72" /><thr:total>35</thr:total><feedburner:origLink>http://petemills.blogspot.com/2010/05/train-whistle-doorbell.html</feedburner:origLink></entry></feed>
