<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-587710201803969234</id><updated>2012-02-16T18:35:58.557-08:00</updated><category term='openwrt'/><category term='LG CE110 silent alarm clock'/><category term='weather station'/><category term='AVR'/><category term='asus WL-520GU'/><title type='text'>Hal's Lab</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-6747179430526999485</id><published>2009-10-20T01:04:00.009-07:00</published><updated>2009-10-20T01:16:10.583-07:00</updated><title type='text'>Project Recap: Binary Clock</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/4028226587/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2430/4028226587_df18e461b5_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/4028226587/"&gt;Binary Clock Layout&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;This was one of the first microcontroller projects that I completed.  I was working on a nixie clock at the time, and while writing the binary to decimal converter, I decided to pull over and make a pure binary clock. &lt;br /&gt;&lt;br /&gt;The first version was drawn with a sharpie onto copper by hand.  It is ugly (and in my photostream if you want to see).  A few months later, I was assigned a project in school that involved getting a board fabbed.  I had plenty of room left before reaching the minimum size, so I made a few of these binary clocks. This was my second time doing a layout in Eagle (the first being the school project), and I didn't really know what I was doing.  I made a layout, without making a schematic first.  Luckily, the layout worked, but I still don't have a schematic drawn up for this project - I will if there is enough demand.  There are 2 things about the layout that I would change if i made more - the switch holes are a bit off, and I would add an ICSP header.  I finished up 4 of these clocks, and gave two as gifts.  The others are currently at my parents' house, though.  I will be home and have some pictures in a few months.&lt;br /&gt;&lt;br /&gt;Anyway, I think the value of this project is in the code.  I learned PIC assembly from John Morton's &lt;a href="http://www.amazon.com/gp/product/0750650389?ie=UTF8&amp;tag=hasla-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0750650389"&gt;PIC: Your Personal Introductory Course&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=hasla-20&amp;l=as2&amp;o=1&amp;a=0750650389" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /&gt;. I have since moved on to C, but I sometimes miss coding in assembly.  The code that follows is very likely not efficient and may have remnants of past versions, but it should be easy to follow, and got the job done.  &lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #FFFFFF; background-color: #135;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;;********************************************************&lt;br /&gt;;* Binary Clock                                               *&lt;br /&gt;;* Written By: Hal Emmer                                      *&lt;br /&gt;;* Date: July, 2006                                           *&lt;br /&gt;;* version: 2.0 modified to use interrupts                    *&lt;br /&gt;;* for PIc: 16f628a                                           *&lt;br /&gt;;* clock: internal oscillator                                 *&lt;br /&gt;;**************************************************************&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    LIST            P=16F628a&lt;br /&gt;    ERRORLEVEL      -302    ; suppress bank selection messages&lt;br /&gt;    __CONFIG        3F18H   ; int oscillator&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PCL     EQU     2               ; bits and registers are defined here to &lt;br /&gt;STATUS  EQU     3               ; make this program self contained.&lt;br /&gt;PORTA   EQU     5&lt;br /&gt;PORTB   EQU     6&lt;br /&gt;INTCON  EQU     0BH&lt;br /&gt;TRISA   EQU     85H&lt;br /&gt;TRISB   EQU     86H&lt;br /&gt;OPTREG  EQU     81H&lt;br /&gt;CMCON   EQU     1FH&lt;br /&gt;TMR0    EQU     01H&lt;br /&gt;&lt;br /&gt;W       EQU     0&lt;br /&gt;F       EQU     1&lt;br /&gt;C       EQU     0               ; bits in STATUS&lt;br /&gt;Z       EQU     2&lt;br /&gt;RP0     EQU     5&lt;br /&gt;&lt;br /&gt;T0IF    EQU     2               ; bit in INTCON&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    CBLOCK  20H             ; define variables required&lt;br /&gt;&lt;br /&gt;    TICKS&lt;br /&gt;    SEGS                    ; one bit per segment: &amp;quot;-gfedcba&amp;quot;&lt;br /&gt;    SEC&lt;br /&gt;    MIN&lt;br /&gt;    HOUR&lt;br /&gt;    FRAME                   ; used to decide when to display time&lt;br /&gt;    HHMM                    ; one bit per digit displayed&lt;br /&gt;    COUNT                   ; scratch register&lt;br /&gt;    DIGIT                   ; last digit displayed&lt;br /&gt;    DELVAR            ; delay counter&lt;br /&gt;    SPEED&lt;br /&gt;    SPEED2            ; used to set time&lt;br /&gt;    LIGHT            ; hardware compensation&lt;br /&gt;    COUNT1&lt;br /&gt;    W_SAVE&lt;br /&gt;    STATUS_SAVE&lt;br /&gt;    ENDC&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ;         Initialization          ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;    ORG     0&lt;br /&gt;    goto    INIT&lt;br /&gt;    ORG        4&lt;br /&gt;    goto    ISR    &lt;br /&gt;&lt;br /&gt;INIT    CLRF    SEC&lt;br /&gt;    CLRF     MIN&lt;br /&gt;    CLRF     HOUR&lt;br /&gt;    CLRF     FRAME&lt;br /&gt;    CLRF     PORTA&lt;br /&gt;    CLRF     PORTB&lt;br /&gt;    CLRF     CMCON&lt;br /&gt;    MOVLW    07H&lt;br /&gt;    MOVWF    CMCON&lt;br /&gt;    movlw    h'C4'&lt;br /&gt;    movwf    SPEED&lt;br /&gt;    movlw    d'59'&lt;br /&gt;    movwf    SPEED2&lt;br /&gt;    BSF      STATUS,RP0      ; select register bank 1&lt;br /&gt;    CLRF     TRISB&lt;br /&gt;    BSF      TRISB,6        ; RB6 is an input min button&lt;br /&gt;    BSF      TRISB,7        ; RB7 is an input hr button&lt;br /&gt;    CLRF     TRISA        &lt;br /&gt;    bsf      TRISA,4        ; RA4 is clockin           &lt;br /&gt;    MOVLW    b'00101000'    ; t0cs is RA4/T0CKI&lt;br /&gt;    MOVWF    OPTREG          ; prescalar assigned to WDT (no prescaler)&lt;br /&gt;    BCF      STATUS,RP0      ; reselect bank 0&lt;br /&gt;    BSF      INTCON, 5    ; t0 overflow interrupt enable&lt;br /&gt;    BSF      INTCON, 7       ; global interrupt enable&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ;          Main Program           ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;MAIN    &lt;br /&gt;    CALL    DISPLAY         ; continue to display&lt;br /&gt;    GOTO    MAIN            ; unless interrupted&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ;  Real-time clock algorithm      ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;CLOCK   &lt;br /&gt;    INCF    SEC,F           ; second for next second&lt;br /&gt;    MOVF    SEC,W&lt;br /&gt;    SUBWF   SPEED2,W&lt;br /&gt;    BTFSC   STATUS,C&lt;br /&gt;     RETURN&lt;br /&gt;&lt;br /&gt;    CLRF    SEC&lt;br /&gt;    INCF    MIN,F&lt;br /&gt;    MOVF    MIN,W&lt;br /&gt;    SUBLW   d'59'&lt;br /&gt;    BTFSC   STATUS,C&lt;br /&gt;     RETURN&lt;br /&gt;&lt;br /&gt;    CLRF    MIN&lt;br /&gt;    INCF    HOUR,F&lt;br /&gt;    MOVF    HOUR,W&lt;br /&gt;    SUBLW   d'23'&lt;br /&gt;    BTFSS   STATUS,C &lt;br /&gt;    CLRF    HOUR&lt;br /&gt;    RETURN&lt;br /&gt;    &lt;br /&gt;    ;*********************************;&lt;br /&gt;    ;       Displays digit in W       ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;DISPLAY    clrf    LIGHT&lt;br /&gt;    btfsc  SEC,0        ; these lines are used to translate&lt;br /&gt;    bsf    LIGHT,3        ; the stored values to the physical pins&lt;br /&gt;    btfsc  SEC,1        ; that the LEdS are connected to.  Ideally,&lt;br /&gt;    bsf    LIGHT,2        ; they would not be required, but I wired some&lt;br /&gt;    btfsc  SEC,2        ; stuff backwards, so I had to fix it in &lt;br /&gt;    bsf    LIGHT,1        ; firmware - no biggie.&lt;br /&gt;    btfsc  SEC,3&lt;br /&gt;    bsf    LIGHT,0    &lt;br /&gt;    btfsc  SEC,4&lt;br /&gt;    bsf    LIGHT,4&lt;br /&gt;    btfsc  SEC,5&lt;br /&gt;    bsf    LIGHT,5&lt;br /&gt;    movfw  LIGHT&lt;br /&gt;    MOVWF  PORTB           ; and display&lt;br /&gt;    BSF    PORTA,1&lt;br /&gt;    CALL   DELAY2        ; short delay&lt;br /&gt;    BCF    PORTA,1          &lt;br /&gt;    &lt;br /&gt;    clrf   LIGHT&lt;br /&gt;    btfsc  MIN,0&lt;br /&gt;    bsf    LIGHT,3&lt;br /&gt;    btfsc  MIN,1&lt;br /&gt;    bsf    LIGHT,2&lt;br /&gt;    btfsc  MIN,2&lt;br /&gt;    bsf    LIGHT,1&lt;br /&gt;    btfsc  MIN,3&lt;br /&gt;    bsf    LIGHT,0    &lt;br /&gt;    btfsc  MIN,4&lt;br /&gt;    bsf    LIGHT,4&lt;br /&gt;    btfsc  MIN,5&lt;br /&gt;    bsf    LIGHT,5&lt;br /&gt;    movfw  LIGHT        &lt;br /&gt;    MOVWF  PORTB           ; and display&lt;br /&gt;    BSF    PORTA,0&lt;br /&gt;    CALL   DELAY2        ; short delay&lt;br /&gt;    BCF    PORTA,0&lt;br /&gt;    &lt;br /&gt;    clrf   LIGHT&lt;br /&gt;    btfsc  HOUR,0&lt;br /&gt;    bsf    LIGHT,3&lt;br /&gt;    btfsc  HOUR,1&lt;br /&gt;    bsf    LIGHT,2&lt;br /&gt;    btfsc  HOUR,2&lt;br /&gt;    bsf    LIGHT,1&lt;br /&gt;    btfsc  HOUR,3&lt;br /&gt;    bsf    LIGHT,0    &lt;br /&gt;    btfsc  HOUR,4&lt;br /&gt;    bsf    LIGHT,4&lt;br /&gt;    btfsc  HOUR,5&lt;br /&gt;    bsf    LIGHT,5&lt;br /&gt;    movfw  LIGHT          &lt;br /&gt;    MOVWF  PORTB           ; and display&lt;br /&gt;    BSF    PORTA,2&lt;br /&gt;    CALL   DELAY2        ; short delay&lt;br /&gt;    BCF    PORTA,2&lt;br /&gt;    RETURN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ; Checks for a switch press and   ;&lt;br /&gt;    ; updates digit if displayed      ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;CHKSW   BTFSC   PORTB,6         ; switch closed?&lt;br /&gt;    goto    CLRCNT1         ; no - return 0&lt;br /&gt;    movlw   h'FF'&lt;br /&gt;    movwf   SPEED&lt;br /&gt;    movlw   d'19'&lt;br /&gt;    movwf   SPEED2&lt;br /&gt;    incf    COUNT1,f&lt;br /&gt;    movfw   COUNT1&lt;br /&gt;    SUBLW   5&lt;br /&gt;    BTFSC   STATUS,C&lt;br /&gt;    RETURN&lt;br /&gt;    movlw    h'FF'&lt;br /&gt;    movwf    SPEED&lt;br /&gt;    RETURN&lt;br /&gt;&lt;br /&gt;CHKSW2  BTFSC   PORTB,7        ; switch closed?&lt;br /&gt;    RETURN                 ; no&lt;br /&gt;    INCF    HOUR,F         &lt;br /&gt;    MOVF    HOUR,W&lt;br /&gt;    SUBLW   23&lt;br /&gt;    BTFSS   STATUS,C&lt;br /&gt;    CLRF    HOUR&lt;br /&gt;    RETURN&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ; Delay used by switch routine    ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;DELAY   MOVLW   D'12'           ; roughly 100ms delay&lt;br /&gt;        MOVWF   TICKS&lt;br /&gt;DEL1    CALL    DELAY2&lt;br /&gt;        DECFSZ  TICKS,F&lt;br /&gt;        GOTO    DEL1&lt;br /&gt;        RETURN&lt;br /&gt;&lt;br /&gt;DELAY2  MOVLW    d'255'        ; 255 cycles or so...will test timing.&lt;br /&gt;    MOVWF    DELVAR&lt;br /&gt;    NOP&lt;br /&gt;    NOP    &lt;br /&gt;    NOP&lt;br /&gt;    NOP&lt;br /&gt;    NOP&lt;br /&gt;    NOP    &lt;br /&gt;    NOP&lt;br /&gt;    NOP&lt;br /&gt;    DECFSZ  DELVAR,F&lt;br /&gt;    GOTO    DELAY2+2&lt;br /&gt;    RETURN&lt;br /&gt;&lt;br /&gt;    ;*********************************;&lt;br /&gt;    ; Reset speed timers              ;&lt;br /&gt;    ;*********************************;&lt;br /&gt;&lt;br /&gt;CLRCNT1 movlw    h'C4'&lt;br /&gt;    movwf    SPEED&lt;br /&gt;    movlw    d'59'&lt;br /&gt;    movwf    SPEED2&lt;br /&gt;    clrf     COUNT1&lt;br /&gt;    return&lt;br /&gt;    &lt;br /&gt;ISR    MOVWF  W_SAVE            ; save W&lt;br /&gt;    SWAPF     STATUS, W         ; save STATUS &lt;br /&gt;    MOVWF     STATUS_SAVE&lt;br /&gt;    BCF       STATUS, RP0       ; be sure we are in bank 0    &lt;br /&gt;    BCF       INTCON,2        &lt;br /&gt;    movfw     SPEED&lt;br /&gt;    movwf     TMR0&lt;br /&gt;    movfw     SPEED&lt;br /&gt;    movwf     TMR0&lt;br /&gt;    CALL      CLOCK        ; increment the timer &lt;br /&gt;    CALL      CHKSW        ; and check the buttons&lt;br /&gt;    CALL      CHKSW2&lt;br /&gt;    SWAPF     STATUS_SAVE, W&lt;br /&gt;    MOVWF     STATUS        ; restore W and STATUS&lt;br /&gt;    SWAPF     W_SAVE, F&lt;br /&gt;    SWAPF     W_SAVE, W    &lt;br /&gt;    RETFIE                ; return from isr&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Also, a big thanks to Greg Houston for http://formatmysourcecode.blogspot.com/.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-6747179430526999485?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/6747179430526999485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/10/binary-clock-layout.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/6747179430526999485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/6747179430526999485'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/10/binary-clock-layout.html' title='Project Recap: Binary Clock'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2430/4028226587_df18e461b5_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-5955647956865729258</id><published>2009-06-03T07:03:00.000-07:00</published><updated>2009-06-03T07:24:48.391-07:00</updated><title type='text'>Really good iced tea</title><content type='html'>I surprised myself with this one.  It was really easy, and actually came out really good! Without further blabbing,&lt;br /&gt;&lt;p&gt;&lt;u&gt;Ingredients&lt;/u&gt;&lt;br /&gt;4 bags &lt;a href="http://www.wtea.com/product-item.aspx?item=8"&gt;Wissotzky Raspberry Black Tea&lt;/a&gt;. &lt;br /&gt;10 leaves fresh mint (I might use more next time, but I didn't want to cut too much)&lt;br /&gt;1 lemon&lt;br /&gt;1/2 cup sugar&lt;br /&gt;around 3/4 of a pitcher full of water&lt;br /&gt;&lt;br /&gt;In a pot, heat the water.  Throw in the tea bags (without paper) when the water looks pretty hot.  Let it boil, then turn off the heat.  When it cools a bit, add the mint.  Juice half the lemon, and cut the other half into quartered slices, and place inside.  Add sugar.  Let it cool some more.  Pour into pitcher, and fill the rest of the way with water, and let cool in fridge.  Drink and enjoy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-5955647956865729258?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/5955647956865729258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/06/really-good-iced-tea.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/5955647956865729258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/5955647956865729258'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/06/really-good-iced-tea.html' title='Really good iced tea'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-1393872359747996551</id><published>2009-05-26T20:25:00.001-07:00</published><updated>2009-07-10T07:43:25.494-07:00</updated><title type='text'>A better 'Arduino' Stamp (very beta)</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3569503482/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3330/3569503482_a9ec474ceb_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3569503482/"&gt;avr stamp board layout&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Edit (7/10/09): I finally got the boards back.  I am working out some small problems, and will update soon.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I'm not exactly sure if this is ready to publish, but I don't think I'm going to get any farther until I get a prototype put together, which may be a while down the road.  Anyway, my school has a lot of &lt;a href="http://en.wikipedia.org/wiki/Boe-Bot"&gt;Boe-Bots&lt;/a&gt;.  The Boe-bot is a really great beginner robotics/microcontroller platform, but that is exactly what it is.  They are used for high school students and freshmen in an "Intro to all types of engineering" class.  It would be nice to get some more use out of them in higher level classes, and the ability to program them in C would do just that.  So I was given the task of designing a board that I could swap with the BASIC Stamp to allow this.  The &lt;a href="http://arduino.cc/en/Main/ArduinoBoardMini"&gt;Arduino Mini&lt;/a&gt; is almost that, but not quite.  There are a number of problems that make it unsuitable to simply stick in a Board of Education (BoE).  I aimed to fix all of these:&lt;br /&gt;&lt;br /&gt;1. The BS2 has inverters on TX/RX on the board.  This way, it can talk RS-232 without a MAX232.  The BoE has an FTDI USB to Serial converter, and inverters built in on the board, so it can talk to the BS2 (it ends up inverting the signal twice).  The only way to make a board that is hot swappable would be to put inverters on the AVR Stamp as well (or to use a different USB/serial device, but I chose the first option).&lt;br /&gt;2.  The BoE has a silk layer saying the pinouts - and these are broken from the socket to headers around a small breadboard. They were shifted by 2 on the Arduino mini.  They're still wrong, but closer.  Now it's right from 0-8.&lt;br /&gt;3.  The BS2 lacks hardware PWM, so pins 12, 13, 14, and 15 are arbitrarily broken out to headers that can connect to the motors.  I needed to connect at least 2 of these to Arduino PWM pins, so I chose Arduino pins 9 and 10 (OC1A and OC1B).  &lt;br /&gt;4.  The Arduino Mini didn't fit in the socket well.  I hope I can find headers/pins that will fit better.&lt;br /&gt;5.  The Arduino Mini had to be reset before programming.  The Mini Pro (and my AVR Stamp) has a switch to make this easier.  I hope the DTR will work now, though. I'll see, and perhaps be able to use this board space for an ISP header or breakout for more analog pins in a later revision.&lt;br /&gt;&lt;br /&gt;This board layout is totally unconfirmed.  Don't make it if you want it to work.  Don't complain to me if you make it and it doesn't work.  &lt;br /&gt;&lt;br /&gt;Eagle files follow.  The library contains 2 parts, and the board also uses the Sparkfun library.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://halslab.googlegroups.com/web/BOM.txt"&gt;Bill of Materials&lt;/a&gt; with Digi-Key part numbers&lt;br /&gt;&lt;a href="http://groups.google.com/group/halslab/web/avr_stamp_v1.brd"&gt;Eagle Board File&lt;/a&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/halslab/web/avr_stamp_v1.sch"&gt;Eagle Schematic File&lt;/a&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/halslab/web/stampparts.lbr"&gt;Eagle Library&lt;/a&gt; with the two transistors.&lt;br /&gt;&lt;br /&gt;Note: I know that I used the words Arduino and AVR interchangeably here.  But that's because they mostly are.  This project is not official Arduino hardware, and should not be called an Arduino.  However, it is very closely based on the Arduino Mini Pro, which basically makes it an Arduino?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-1393872359747996551?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/1393872359747996551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/05/better-arduino-stamp-very-beta.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/1393872359747996551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/1393872359747996551'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/05/better-arduino-stamp-very-beta.html' title='A better &apos;Arduino&apos; Stamp (very beta)'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3330/3569503482_a9ec474ceb_t.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-9141081732519053249</id><published>2009-05-11T07:57:00.000-07:00</published><updated>2009-05-11T08:16:20.643-07:00</updated><title type='text'>Classes are done!</title><content type='html'>Summer time = hacking time, which should lead to posting time?  And it will.  But for now I just bought a Game Boy Advance and &lt;a href="http://www.dealextreme.com/details.dx/sku.4707~r.89823315"&gt;Flash Cart&lt;/a&gt;. I have &lt;a href="http://www.pixelproc.net/gpsnomap.html"&gt;this GPS data viewer&lt;/a&gt; wired up with my Trimble Ace II.  I'm reading through &lt;a href="http://www.coranac.com/tonc/text/toc.htm"&gt;TONC,&lt;/a&gt; an awesome tutorial.  I want to do tons of stuff with it, starting with rewriting that GPS program without the HAM and HEL libraries (mostly as an exercise), and add a waypoint finder so that it could be used for &lt;a href=http://en.wikipedia.org/wiki/Geocaching&gt;Geocaching&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It's so weird having a 32 bit native datatype.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-9141081732519053249?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/9141081732519053249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/05/classes-are-done.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/9141081732519053249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/9141081732519053249'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/05/classes-are-done.html' title='Classes are done!'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-4426346165702341699</id><published>2009-02-28T14:26:00.001-08:00</published><updated>2009-02-28T14:30:20.156-08:00</updated><title type='text'>Single cell white LED flashlight</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3316708995/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3450/3316708995_65ce9ce4d3_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3316708995/"&gt;flashlight_schem&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;I have been quite busy with classes and trying to figure out what to do next year, so I still haven't had a chance to finish up the weather station.  Anyway, Here's a little project that I am working on (well, waiting for switches to arrive from &lt;a href="http://dealextreme.com/"&gt;DX&lt;/a&gt;) for a class under &lt;a href="http://www.youtube.com/watch?v=h4O5YCGhsls"&gt;Professor Mark Yim&lt;/a&gt; .  As I have mentioned before, I am very inexperienced (and frankly, just bad) at mechanical design, but for this project we used a 3D Printer to make the case.  The assignment was to make an LED flashlight, just as an intro to the course - expect cooler stuff in the future.  I chose to make a small light that will run for a long time (~15 hours off AAA, 35 with a AA).  &lt;br /&gt;&lt;br /&gt;The circuit is basically straight out of an app note, but I don't think the IC is well embraced by the hobbyist community - I didn't see any designs out there at all, so I figured I would share.  Anyway, it's very small, and I was able to keep the entire circuit small with some careful soldering.  I also had tons of fun using the 3D printer.  The knurling and threads came out so much better than I expected!  Although i barely have time to hack, it's really nice to be at a university with all of these resources.&lt;br /&gt;&lt;br /&gt;Click on the image to see the rest of the pictures from this project on flickr.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-4426346165702341699?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/4426346165702341699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/02/single-cell-white-led-flashlight.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/4426346165702341699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/4426346165702341699'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/02/single-cell-white-led-flashlight.html' title='Single cell white LED flashlight'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3450/3316708995_65ce9ce4d3_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-5371191829309568174</id><published>2009-01-24T13:33:00.001-08:00</published><updated>2009-01-24T13:33:11.505-08:00</updated><title type='text'>Weather Station Update</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3222799533/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3506/3222799533_3f6888d312_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3222799533/"&gt;Weather Projector Wheel&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;Sorry it's been so long since I last updated.  I finished the software, and the mechanics are (as always) holding me up.  This time, with the help of Cameron, I laser cut a projection wheel for the project.  Light will shine through this wheel, projecting the shape onto a screen, with the color dictated by the forecast temperature, as described in the last post.  The shape projected corresponds to the first icon in the forecast section, from &lt;a href="wunderground.com"&gt;Weather Underground&lt;/a&gt;, retrieved through the API.  The question mark is used for any "chance of" forecast.  More on this, and code, soon.&lt;br /&gt;&lt;br /&gt;We also took the opportunity to cut &lt;a href="http://caaaaaam.tumblr.com/post/72757507/i-made-120-snowflakes-today-each-one-was-exactly"&gt; 120 snowflakes&lt;/a&gt; out of the other side of the box.  It's awesome to have all the resources of a university to abuse.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-5371191829309568174?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/5371191829309568174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2009/01/weather-station-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/5371191829309568174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/5371191829309568174'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2009/01/weather-station-update.html' title='Weather Station Update'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3506/3222799533_3f6888d312_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-1602913212151400805</id><published>2008-12-25T17:18:00.001-08:00</published><updated>2008-12-27T07:38:29.019-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='weather station'/><category scheme='http://www.blogger.com/atom/ns#' term='openwrt'/><category scheme='http://www.blogger.com/atom/ns#' term='asus WL-520GU'/><category scheme='http://www.blogger.com/atom/ns#' term='AVR'/><title type='text'>Standalone Weather Station, Part 1</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3136684274/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3197/3136684274_175ec87345_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3136684274/"&gt;Nearly The Same&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;br /&gt;Click image for more photos of this project&lt;/span&gt;&lt;/div&gt;First, I have to put out a big thank you and acknowledgment to Jeff from &lt;a href="http://mightyohm.com/"&gt;mightyOhm&lt;/a&gt;.  I saw a link to &lt;a href="http://mightyohm.com/blog/2008/10/building-a-wifi-radio-part-1-introduction/"&gt;his wireless radio project&lt;/a&gt; posted somewhere, and thought it was interesting.  I had not even heard of &lt;a href="http://openwrt.org/"&gt;OpenWrt&lt;/a&gt; before reading the project on his blog.  I began my work by reproducing his, then moving on.  Similarly, if you are interested in building this, I recommend you begin by reading his tutorial, at least up to part 5.&lt;br /&gt;&lt;br /&gt;Aside from radio functionality, one of the things that I would like to be able to do without a computer is check the weather in the morning.  I use &lt;a href="http://www.wunderground.com/"&gt;Weather Underground&lt;/a&gt; to check my weather - a neat, community based weather website with many features (including an API - more on that later).  One of my favorite parts of this site is the simple statement under the 5-day forecast, along the lines of "Tomorrow is forecast to be Much Warmer than today."  It would be useful to be able to view this statement without turning on my computer. Since it is such a small amount of information (only 5 different possibilities), it would be silly to dedicate complicated hardware to this.  Instead, I will be displaying the result on an RGB LED (for now 2 LEDs) that fades between blue and red, based on the forecasted temperature relative to the past day.&lt;br /&gt;&lt;br /&gt;I am developing this system using an ATMEGA168P, programmed in C.  Excuse the appearance of my development hardware - it is not nearly as complicated as it looks.  I'm simply using what I had available, which was originally constructed for a different purpose.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;b&gt;Software on the Router&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, I wrote a script for the router to check the forecast, and output the result as a number from 1 to 5.  This would then be easy for the AVR to interpret.  Since the router is considerably more powerful, it is logical to do as much processing on the router as possible.  All of these scripts were written using vi, with a telnet connection to the router.  To use this script, put this file in a location that the $PATH variable points to, such as /usr/bin/, and use chmod 577 to make it executable.  Unfortunately, the statement that I want is not contained in the API output, so the script uses wget to extract the contents of the Weather Underground search result website.  The rest of the script is beyond the scope of this post, but there is a lot of information about shell scripting available on the internet.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: courier new;"&gt;#! /bin/ash&lt;br /&gt;&lt;br /&gt;#reltemp.sh&lt;br /&gt;&lt;br /&gt;FORECAST=`wget -q -O - "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=$ZIPCODE" | grep 'is forecast to' | sed 's/&lt;[^&gt;]*&gt;//g;s/^ [ ]*//g' `&lt;br /&gt;&lt;br /&gt;#echo $FORECAST&lt;br /&gt;&lt;br /&gt;case $FORECAST in&lt;br /&gt;"Tomorrow is forecast to be Much Warmer than today."|"Today is forecast to be Much Warmer than yesterday.")&lt;br /&gt;echo 5&lt;br /&gt;;;&lt;br /&gt;"Tomorrow is forecast to be Warmer than today."|"Today is forecast to be Warmer than yesterday.")&lt;br /&gt;echo 4&lt;br /&gt;;;&lt;br /&gt;"Tomorrow is forecast to be nearly the same temperature as today."|"Today is forecast to be nearly the same temperature as yesterday.")&lt;br /&gt;echo 3&lt;br /&gt;;;&lt;br /&gt;"Tomorrow is forecast to be Cooler than today."|"Today is forecast to be Cooler than yesterday.")&lt;br /&gt;echo 2&lt;br /&gt;;;&lt;br /&gt;"Tomorrow is forecast to be Much Cooler than today."|"Today is forecast to be Much Cooler than yesterday.")&lt;br /&gt;echo 1&lt;br /&gt;;;&lt;br /&gt;*)&lt;br /&gt;echo 0&lt;br /&gt;;;&lt;br /&gt;esac &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now, we have to set up our location in the environment variable ZIPCODE.  Simply add the following line to the /etc/profile file, obviously with your own zip code.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: courier new;"&gt;export ZIPCODE=19104&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;With this complete, simply type reltemp.sh, and in a couple of seconds, a number between 1 and 5 should appear on the terminal, indicating the forecasted temperature of tomorrow relative to today, or today relative to yesterday, based on the time of day.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;External Interface&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, the AVR must talk to the router in order to display the information.  Although not pictured, the hardware is relatively simple.  The AVR must be connected to power (provided by the router), a 20 MHz crystal oscillator, and the serial Rx and Tx on the router.  Additionally, connect the LEDs as shown in the schematic below.  This is connected to the PWM output of the AVR, so that a high signal will turn the red LED on, and a low signal will turn the blue LED on.  Therefore, changing the duty cycle of a wave applied between the LEDs allows them to fade between blue and red.  Change resistor values as needed to balance the shades, based on the brightness of the LEDs.&lt;br /&gt;&lt;br /&gt;&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3136278531/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3108/3136278531_8ab3b0ebe2_m.jpg" alt="" style="border: 2px solid rgb(0, 0, 0);" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="margin-top: 0px;font-size:0;" &gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3136278531/"&gt;LEDs&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Please note, although we developed similar solutions in parallel, what I did is slightly different from what Jeff does in his parts 6 and 7.  I used the default router baud rate of 115.2k, but communication was only stable if I ran the AVR with a baud rate of 110k.  You might have to tweak this value for your router, or clock it down as shown at &lt;a href="http://www.blogger.com/mightyohm.com"&gt;mightyOhm&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: courier new;"&gt;&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;Copyright: Hal Emmer 2008&lt;br /&gt;License: Creative Commons Attribution-Noncommercial-Share Alike 3.0&lt;br /&gt;&lt;br /&gt;For atmega168, at 20 MHz.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;avr/io.h&amp;gt;&lt;br /&gt;#include &amp;lt;avr/eeprom.h&amp;gt;&lt;br /&gt;#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;#include &amp;lt;avr/interrupt.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#define FOSC 20000000&lt;br /&gt;#define BAUD 110000     //router is nominally 115.2k bps, communication is most stable at 110k bps.&lt;br /&gt;#define MYUBRR FOSC/8/BAUD-1  //double speed&lt;br /&gt;//#define MYUBRR&lt;br /&gt;&lt;br /&gt;#define sbi(var, mask)   ((var) |= (uint8_t)(1 &amp;lt;&amp;lt; mask))&lt;br /&gt;#define cbi(var, mask)   ((var) &amp;amp;= (uint8_t)~(1 &amp;lt;&amp;lt; mask))&lt;br /&gt;&lt;br /&gt;#define STATUS_LED 0&lt;br /&gt;&lt;br /&gt;#define BUFFERSIZE 80&lt;br /&gt;&lt;br /&gt;volatile unsigned int global_time1;&lt;br /&gt;&lt;br /&gt;//======================&lt;br /&gt;//Define functions&lt;br /&gt;//======================&lt;br /&gt;&lt;br /&gt;static int uart_putchar(char c2, FILE *stream);&lt;br /&gt;uint8_t uart_getchar(void);&lt;br /&gt;static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);&lt;br /&gt;void init(void);&lt;br /&gt;void get_output(char *str);&lt;br /&gt;void get_rel_temp(void);&lt;br /&gt;//======================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main (void)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;init();    //Setup IO pins and defaults&lt;br /&gt;printf("\nreltemp.sh\n");&lt;br /&gt;while(1){&lt;br /&gt;&lt;br /&gt;if (global_time1 &amp;gt;= 4578){  //4578 = 1 minute&lt;br /&gt;global_time1 = 0;&lt;br /&gt;get_rel_temp();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void init (void)&lt;br /&gt;{&lt;br /&gt;//1 = output, 0 = input&lt;br /&gt;DDRB = 0b11101111; //PB4 = MISO&lt;br /&gt;DDRC = 0b11111110; //&lt;br /&gt;DDRD = 0b11111110; //PORTD (RX on PD0)&lt;br /&gt;&lt;br /&gt;//USART Baud rate: 115200&lt;br /&gt;UBRR0H = ((MYUBRR &amp;gt;&amp;gt; 8));&lt;br /&gt;UBRR0L = MYUBRR;&lt;br /&gt;UCSR0B |= (1&amp;lt;&amp;lt;RXEN0)|(1&amp;lt;&amp;lt;TXEN0);&lt;br /&gt;UCSR0A |= (1&amp;lt;&amp;lt;U2X0);  //double rate&lt;br /&gt;&lt;br /&gt;stdout = &amp;mystdout; //Required for printf init&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set up PWM (for fading LED)*/&lt;br /&gt;DDRB |= (1 &amp;lt;&amp;lt; 3);   // OC1A (PB3),outputs&lt;br /&gt;ICR1 = 20000;    // TOP, set for 125Hz&lt;br /&gt;OCR1A = 10000;    // neutral/purple&lt;br /&gt;TCCR1A = (1&amp;lt;&amp;lt;COM1A1)|(1&amp;lt;&amp;lt;WGM11);       // Clear on compare, set at TOP&lt;br /&gt;TCCR1B = (1&amp;lt;&amp;lt;WGM13)|(1&amp;lt;&amp;lt;WGM12)|(1&amp;lt;&amp;lt;CS11);   // Timer 1 fast PWM mode 14 , /8 prescaler&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set up TOI on timer2 for task timing */&lt;br /&gt;TCCR2B |= (1&amp;lt;&amp;lt;CS22)|(1&amp;lt;&amp;lt;CS21)|(1&amp;lt;&amp;lt;CS20);   //Start Timer2 with 1/1024 prescaler.&lt;br /&gt;TIMSK2 |= (1&amp;lt;&amp;lt;TOIE2);        //enable timer2 overflow interrupt&lt;br /&gt;TIFR2 |= (1&amp;lt;&amp;lt;TOV2);         //clear the mask&lt;br /&gt;sei();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;static int uart_putchar(char c2, FILE *stream)&lt;br /&gt;{&lt;br /&gt;//if (c2 == '\n') uart_putchar('\r', stream);&lt;br /&gt;&lt;br /&gt;loop_until_bit_is_set(UCSR0A, UDRE0);&lt;br /&gt;UDR0 = c2;&lt;br /&gt;&lt;br /&gt;return c2;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;uint8_t uart_getchar(void)&lt;br /&gt;{&lt;br /&gt;while( !(UCSR0A &amp;amp; (1&amp;lt;&amp;lt;RXC0)) );&lt;br /&gt;return(UDR0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* not used right now */&lt;br /&gt;void get_output(char *str) {&lt;br /&gt;unsigned char count;&lt;br /&gt;for (count = 0; count &amp;lt; BUFFERSIZE; count++) {&lt;br /&gt;str[count] = uart_getchar();&lt;br /&gt;if (str[count] == '@' &amp;amp;&amp;amp; str[count - 1] == 't')&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;str[count - 5] = '\0';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void get_rel_temp(void){&lt;br /&gt;char c = 0;&lt;br /&gt;&lt;br /&gt;printf("\nreltemp.sh\n"); //as the router for the relative temperature&lt;br /&gt;while(!isdigit(c))   //get a character until you get a digit&lt;br /&gt;c = uart_getchar();&lt;br /&gt;switch(c){&lt;br /&gt;case '0':&lt;br /&gt;OCR1A = 10000;    // error / purple&lt;br /&gt;break;&lt;br /&gt;case '1':&lt;br /&gt;OCR1A = 0;     // much cooler / blue&lt;br /&gt;break;&lt;br /&gt;case '2':&lt;br /&gt;OCR1A = 2500;    // cooler / blue-purple&lt;br /&gt;break;&lt;br /&gt;case '3':&lt;br /&gt;OCR1A = 10000;    // same temp as / purple&lt;br /&gt;break;&lt;br /&gt;case '4':&lt;br /&gt;OCR1A = 17500;    // warmer / red-purple&lt;br /&gt;break;&lt;br /&gt;case '5':&lt;br /&gt;OCR1A = 20000;    // much warmer / red&lt;br /&gt;break;&lt;br /&gt;default:&lt;br /&gt;OCR1A = 10000;    // error / purple&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ISR(TIMER2_OVF_vect)&lt;br /&gt;{&lt;br /&gt;global_time1++;&lt;br /&gt;//uart_putchar('0'+global_time1, stdout);&lt;br /&gt;TIFR2 |= (1&amp;lt;&amp;lt;TOV2);&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;That should do it.  Next time I will explore how to display the next important piece of information - if it will be sunny, cloudy, rainy, etc.  After that I will wrap up the project in a more presentable package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-1602913212151400805?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/1602913212151400805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2008/12/standalone-weather-station-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/1602913212151400805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/1602913212151400805'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2008/12/standalone-weather-station-part-1.html' title='Standalone Weather Station, Part 1'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3197/3136684274_175ec87345_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-8929447127375411932</id><published>2008-12-15T21:05:00.001-08:00</published><updated>2008-12-15T21:58:37.186-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LG CE110 silent alarm clock'/><title type='text'>How to use the LG CE110 as a practical alarm clock</title><content type='html'>I'm not sure about all of you, but when I go to sleep, I don't like to wake up to a cell phone call - be it a 3am "ARE YOU AWAKE!?  COME HANG OUT!" or a 8am wrong number. But I like to use my cell phone as an alarm clock - it keeps good time, is battery powered, easy to place by my bed, and face it - I have one anyway, why buy an alarm clock?&lt;br /&gt;&lt;br /&gt;Anyway, when my beloved Sony Ericsson Z520a died, and I was forced to use an LG CE110.  I don’t demand much from a cell phone, but I was disappointed when I realized that the ringer volume was tied to the alarm clock volume.   If I put the phone on vibrate, the alarm would be a vibration.  That made the phone useless as an alarm clock.&lt;br /&gt;&lt;br /&gt;So my fairly simple solution:&lt;br /&gt;1. Make a silent mp3 file.  I used &lt;a href=http://audacity.sourceforge.net/&gt;Audacity&lt;/a&gt;.&lt;br /&gt;2. Use Bluetooth to transfer it to the phone. &lt;br /&gt;3. Set this as your ringtone.  Turn up your volume.&lt;br /&gt;4. Enjoy a good night’s sleep, with the knowledge that you will wake up on time, and not earlier.&lt;br /&gt;&lt;br /&gt;It’s a bit annoying to change it back and forth if you use a ringer, but I leave my phone on vibrate or silent most of the time anyway.  And I think my solution is the only workaround for this large oversight in the firmware.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-8929447127375411932?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/8929447127375411932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2008/12/how-to-use-lg-ce110-as-practical-alarm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/8929447127375411932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/8929447127375411932'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2008/12/how-to-use-lg-ce110-as-practical-alarm.html' title='How to use the LG CE110 as a practical alarm clock'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-7103280321222187616</id><published>2008-12-14T20:11:00.001-08:00</published><updated>2008-12-14T20:13:30.579-08:00</updated><title type='text'>My cell phone died this morning.</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3108891631/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3276/3108891631_fafae06f17_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=" margin-top: 0px;font-size:0.9em;"&gt;&lt;a href="http://www.flickr.com/photos/33440806@N08/3108891631/"&gt;Headless Sony&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/33440806@N08/"&gt;hithisishal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;It was pretty tragic.  I opened it up when the alarm went off, and the display was white.  I closed it, and the outside display worked.  Opened and closed it again, and they were both dead.  Apparently  it's a &lt;a href="http://www.howardforums.com/archive/topic/981743-1.html"&gt;pretty common problem&lt;/a&gt;, and most likely the flex connector.  Could be worse - the phone is almost 3 years old, and we have another one floating around my house, so I can replace it.&lt;br /&gt;&lt;br /&gt;Anyway, I opened it up to see if playing with the connector could fix it, but it did not.  Then, just for fun I put it back together without the display.  I obviously can't hear anything, because the speaker is on the top part, but it can still make calls, and the mic works just fine.  Might be possible to use in some embedded system at some point.  Did someone say &lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=287"&gt;Port-O-Rotary&lt;/a&gt;?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-7103280321222187616?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/7103280321222187616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2008/12/my-cell-phone-died-this-morning.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/7103280321222187616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/7103280321222187616'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2008/12/my-cell-phone-died-this-morning.html' title='My cell phone died this morning.'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3276/3108891631_fafae06f17_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-587710201803969234.post-2236042465671767949</id><published>2008-12-13T22:38:00.000-08:00</published><updated>2008-12-13T23:03:00.629-08:00</updated><title type='text'>Hi, This is Hal</title><content type='html'>So this blog is about me, the stuff that I am doing and have done, and ideas that I want to share.  I wanted to blog for some time, mostly as a way of giving back to an awesome hobbyist/hacker/maker community which has taught me so much.  So right now the idea is to start off with updates about my current project, which should be posted soon, and then when I have time, I will fill in some stuff about other projects that I have completed over the years. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/587710201803969234-2236042465671767949?l=hithisishal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hithisishal.blogspot.com/feeds/2236042465671767949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://hithisishal.blogspot.com/2008/12/hi-this-is-hal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/2236042465671767949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/587710201803969234/posts/default/2236042465671767949'/><link rel='alternate' type='text/html' href='http://hithisishal.blogspot.com/2008/12/hi-this-is-hal.html' title='Hi, This is Hal'/><author><name>Hal</name><uri>http://www.blogger.com/profile/18105976576400911422</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_r01fir3gi8I/SVZMFmvk15I/AAAAAAAAAAM/nHev5hd-6ok/S220/2.jpg'/></author><thr:total>0</thr:total></entry></feed>
