<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/"/>

<title>Jeff Epler's blog</title>
<modified>2011-07-25T13:41:29Z</modified>
<tagline>Photos, electronics, cnc, and more</tagline>
<author><name>Jeff Epler</name><email>jepler@unpythonic.net</email></author>
<entry>
<title>wwvbpy: WWVB timecode generator in python</title>
<issued>2011-07-25T13:41:29Z</issued>
<modified>2011-07-25T13:41:29Z</modified>
<id>http://emergent.unpythonic.net/01311601289</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01311601289"/>
<content type="text/html" mode="escaped">

&lt;div style=&quot;float:right;clear:right&quot;&gt;&lt;!-- timecode.png--&gt;&lt;div class=albumouter style=width:306px id=&gt;&lt;div class=albumimage style=&quot;width:306px;margin-left:0px;&quot;&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01311601289/timecode.png&quot; class=&quot;thickbox&quot; rel=&quot;album&quot; title=&quot;Timecode for the 1998 leap second&quot;&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01311601289/timecode-small.jpg&quot; width=300 height=72&gt;&lt;/a&gt;&lt;div &gt;&lt;div style=&quot;float: right&quot; &gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01311601289/timecode.png&quot;&gt;&lt;img class=zoom src=&quot;http://media.unpythonic.net/emergent-files/default/zoom.png&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01311601289/timecode.png&quot;&gt;Timecode for the 1998 leap second&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
A few weeks ago, I posted about a &lt;a href=&quot;http://emergent.unpythonic.net/01308865139&quot;&gt;WWVB timecode
generator written in C&lt;/a&gt;.  Unfortunately, this timecode generator did not
have a clear license permitting modification or redistribution, so I
felt I was unable to incorporate it into a project of my own.

&lt;p&gt;Thus was born my own timecode generator, called wwvbpy.  Its primary
output mode is compatible with the &amp;quot;wwvb2.c&amp;quot; that inspired it.  It also
has a few features that wwvb2.c didn't: automatic handling of DST, DUT1,
and leap seconds.  DST is handled according to the operating system's
rules for Denver.  DUT1 and leap seconds are handled using data from
IERS (As a result, my program's DUT1 does not exactly match past
broadcast data on WWVB, as the data NIST broadcasts is &amp;quot;an average value
for an extended range of dates&amp;quot;).

&lt;p&gt;It also has a set of tests of interesting times, such as the first and
second days after a DST change, the last and last-but-one days of leap
and non-leap years, a historical leap second, etc.  (where possible,
these test vectors were originally generated by wwvb2; however, some of
the tests—such as the DST tests—had to be hand-generated, as wwvb2
couldn't generate them; besides this limitation, I also uncovered a bug
in wwvb2 where non-leap years were treated as having 364 days and
leap-years were treated as having 365!)

&lt;p&gt;An option to output the timecode data to a serial device is contemplated
but not finished; ultimately, this would work together with an
Arduino/AVR firmware to produce a logic-level and/or 60kHz modulated
version of the signal for testing hardware devices.

&lt;p&gt;wwvbpy is covered by the GNU GPL v2+.  It can be obtained from my public
git repository: &lt;a href=&quot;http://git.unpy.net/view?p=wwvbpy.git;a=summary&quot;&gt;http://git.unpy.net/view?p=wwvbpy.git;a=summary&lt;/a&gt;.
</content>
</entry>
<entry>
<title>Side track: wwvb links</title>
<issued>2011-06-23T21:38:59Z</issued>
<modified>2011-06-23T21:38:59Z</modified>
<id>http://emergent.unpythonic.net/01308865139</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01308865139"/>
<content type="text/html" mode="escaped">
&lt;a href=&quot;http://timeguy.com&quot;&gt;Chris&lt;/a&gt; asks what advantage GPS has over &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/WWVB&quot;&gt;WWVB&lt;/a&gt; for my clock
project.  I don't have a good answer for that (except that having enough
controls to select one of 4 mainland US timezones and whether to apply DST
is undesirable).  However, this did prompt me to do some googling about WWVB.
I found some interesting links about generating WWVB signals at home.</content>
</entry>
<entry>
<title>Towards my GPS LED Light Clock</title>
<issued>2011-06-22T20:19:10Z</issued>
<modified>2011-06-22T20:19:10Z</modified>
<id>http://emergent.unpythonic.net/01308773950</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01308773950"/>
<content type="text/html" mode="escaped">
A few years ago, I made a CCFL light clock using an Arduino with a custom
shield containing a transformer (to get a reliable 60Hz timebase) and a
triac (for solid-state switching of the lamp).  By having a simple 7-day alarm calendar (set at compile time), the clock seldom requires interaction except for the reading lamp function.

&lt;p&gt;However, the design has two main problems:</content>
</entry>
<entry>
<title>at90usb162 single-sided board</title>
<issued>2009-06-29T12:19:33Z</issued>
<modified>2009-06-29T12:19:33Z</modified>
<id>http://emergent.unpythonic.net/01246277973</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01246277973"/>
<content type="text/html" mode="escaped">I got an e-mail request for this board.  You may use this eagle (4.x) library,
schematic, and board under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;GNU GPL version 2 or later&lt;/a&gt;, or &lt;a href=&quot;http://creativecommons.org/licenses/by-sa/3.0/us/&quot;&gt;CC-BY-SA&lt;/a&gt;.</content>
</entry>
<entry>
<title>qq: quick & dirty terminal</title>
<issued>2009-05-05T01:43:58Z</issued>
<modified>2009-05-05T01:43:58Z</modified>
<id>http://emergent.unpythonic.net/01241487838</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01241487838"/>
<content type="text/html" mode="escaped">

qq is a quick and dirty terminal application for beagleboard.  It's written in
Python and requires python-serial.  I didn't like cu (no CLOCAL that I could
find) or minicom (terminal emulation, keyboard shortcuts and configuration got
in the way of real work)

&lt;p&gt;Except for tilde-specials (similar to rsh, ssh and cu), qq just copies data
between the local terminal and the given tty.   Two tilde specials are
defined:
&lt;pre&gt;
    &amp;lt;CR&amp;gt;~.: quit
    &amp;lt;CR&amp;gt;~b: send break (useful for &amp;quot;alt-sysrq&amp;quot; actions on beagleboard)
&lt;/pre&gt;

&lt;p&gt;&lt;p&gt;&lt;b&gt;Files currently attached to this page:&lt;/b&gt;
&lt;table cellpadding=5&gt;&lt;col&gt;&lt;col style=&quot;text-align: right&quot;&gt;&lt;tr bgcolor=#eeeeee&gt;&lt;td&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01241487838/qq&quot;&gt;qq&lt;/a&gt;&lt;/td&gt;&lt;td&gt;4.0kB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;

&lt;p&gt;Copyright © 2009 Jeff Epler &amp;lt;jepler@unpythonic.net&amp;gt;

&lt;p&gt;This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

&lt;p&gt;This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

&lt;p&gt;You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

&lt;p&gt;</content>
</entry>
<entry>
<title>Facepalm of the day</title>
<issued>2009-03-13T01:33:35Z</issued>
<modified>2009-03-13T01:33:35Z</modified>
<id>http://emergent.unpythonic.net/01236908015</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01236908015"/>
<content type="text/html" mode="escaped">
I wrote this code for my &lt;a href=&quot;http://emergent.unpythonic.net/01233419381&quot;&gt;red alert box&lt;/a&gt; and tested it
using a shorter timeout than 60 seconds--it worked fine with a 10-second
timeout.  Just today I realized that the 60s timeout wasn't working; even after
several minutes without communication, the globe was still showing green.  The
cause of the bug is left to the reader, but a hint is available if you click
&amp;quot;more inside&amp;quot;.

&lt;p&gt;&lt;pre style=&quot;padding-left: 4ex;&quot;&gt;
void loop()
{
    unsigned long now = millis(); // time since boot in milliseconds

    if(Serial.available()) {
        level = Serial.read() % 4;
        last_message = now;
    } else if(now - last_message &amp;gt; 60*1000 &amp;amp;&amp;amp; level &amp;lt; 3) {
        // if no message received after 60*1000 ms, increase alert level
        last_message = now; // well, sorta
        level ++;
    }

    if(level != oldlevel) {
        set_led_color(level);
        oldlevel = level;
    }
    delay(50);
}&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Red Alert Box</title>
<issued>2009-01-31T16:29:41Z</issued>
<modified>2009-01-31T16:29:41Z</modified>
<id>http://emergent.unpythonic.net/01233419381</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01233419381"/>
<content type="text/html" mode="escaped">&lt;div style=&quot;float:right;clear:right&quot;&gt;&lt;!-- ohno.jpg--&gt;&lt;div class=albumouter style=width:306px id=&gt;&lt;div class=albumimage style=&quot;width:306px;margin-left:0px;&quot;&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01233419381/ohno-medium.jpg&quot; class=&quot;thickbox&quot; rel=&quot;album&quot; title=&quot;Oh no, vmware crashed again&quot;&gt;&lt;img src=&quot;http://media.unpythonic.net/emergent-files/01233419381/ohno-small.jpg&quot; width=300 height=210&gt;&lt;/a&gt;&lt;div &gt;&lt;div style=&quot;float: right&quot; &gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01233419381/ohno-medium.jpg&quot;&gt;(M)&lt;/a&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01233419381/ohno.jpg&quot;&gt;(L)&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01233419381/ohno.jpg&quot;&gt;Oh no, vmware crashed again&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
Every morning I get up too late, and then I think to myself &amp;quot;I'll just check
real quick to see that everything on my home network is running&amp;quot;.  45 minutes
later I've browsed all the new &lt;a href=&quot;http://icanhascheezburger.com/&quot;&gt;lolcats&lt;/a&gt; and read a few personal trainwreck posts on &lt;a href=&quot;http://ask.metafilter.com&quot;&gt;askme&lt;/a&gt;, and now I'm running really late.

&lt;p&gt;This is the kind of problem we can solve with technology!</content>
</entry>
<entry>
<title>Autoreprogram for DFU devices</title>
<issued>2008-10-04T12:54:38Z</issued>
<modified>2008-10-04T12:54:38Z</modified>
<id>http://emergent.unpythonic.net/01223124878</id>
<link rel="alternate" type="text/html" href="http://emergent.unpythonic.net/01223124878"/>
<content type="text/html" mode="escaped">
It's a bit of an annoyance to first have to press a combination of two
buttons on my at90usb162 board, then run a sequence of 4 dfu-programmer
commands.

&lt;p&gt;Thanks to the magic of the freedesktop 'hal', though, I've written a program
that waits for the dfu device to appear.  It then erases and flashes the
device, finally restarting into the newly uploaded firmware.

&lt;p&gt;Modify the program to name your .hex file (and avr partnumber if it's
different), then leave it running in the background.
It's still necessary to tickle the RESET and HWB buttons in the proper way
after rebuilding your firmware, but it does shorten the process.

&lt;p&gt;&lt;p&gt;&lt;b&gt;Files currently attached to this page:&lt;/b&gt;
&lt;table cellpadding=5&gt;&lt;col&gt;&lt;col style=&quot;text-align: right&quot;&gt;&lt;tr bgcolor=#eeeeee&gt;&lt;td&gt;&lt;a href=&quot;http://media.unpythonic.net/emergent-files/01223124878/autoprogram.py&quot;&gt;autoprogram.py&lt;/a&gt;&lt;/td&gt;&lt;td&gt;1.5kB&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;
</content>
</entry>
</feed>

