Blue Blinky Bug #2

      No Comments on Blue Blinky Bug #2

[Originally published in a series of posts in 2005 on the original S9Y hosted version of this site the posts have been combined, edited, and retro dated. — jv]

The solar powered Altoids tin!  This is a Geocaching Travel bug TBHC3P launched in 2005 it was still showing life when last logged in 2009.  It survived the Waco flood of ’07 and traveled 5509 miles to texas and back.

This is the completed bug:

img_5093img_5089img_5087img_5081bbb2

 

This second bug in the series is currently under development and taking shape. The design is based around a PIC microcontroller chip which increases the intelligence of this bug. Like the first bug the primary mission is to blink a blue LED. Number 2 also includes solar power and somewhat intelligent power saving when dark. It is also programmed to chirp and blink additional LEDs when it is found in a geocache or when it is put away from the light.

Features and Behaviors:

  • Solar powered for extended mission life.
  • Rechargeable internal lithium ion battery. Without actually testing or doing all the math I estimate that the bug can run dark for at least a month, perhaps more.
  • Electrolytic capacitor for backup operation. If the main battery pack dies it can be unplugged to allow light operation and a few minutes of dark operation.
  • Light operation the bug blinks a blue LED about every 4 seconds and emit a double click.
  • In dark operation it will blink about every 13 seconds and emit a single click
  • Transitioning from light-to-dark it emits sad chirps.
  • Transition from dark to light triggers happy chirps.

User operation:

  • Open the lid and examine it.
  • Take it with you while in your care and try to keep it in the light (solar panel up) as much as possible to charge.
  • Try to place it in safe and dry caches that have a lot of traffic. The bug doesn’t like to hide for too long.
  • The bug doesn’t like extreme cold so it would prefer to migrate South for the Winter.

Here is the source code. It was cobbled up from some example I googled for when I was first playing with PICs. I don’t have the link any more.

Almost all of the parts for this were scavenged out of my junk boxes except for the solar cell ($5) and the PIC chips for about $3 from Jameco. The programmer was a $10 ebay special and the MPLAB assembler and IDE is a free download from Microchip. The signature Blue LED is scavenged from glucose meter and the lithium battery is from a no longer function digital camera.

I figured out the divider to sense the light ok. I found about 2K/10K worked fine. Of course when I added real components to the circuit I tried to use 10K/100K and it didn’t work. I haven’t debugged it yet but either I fat fingered the soldering or it doesn’t allow enough current to pull the pin high. I scaled the network up to reduce current but maybe I went to too far.

I made two feature changes to the hardware. The first was to remove the red LED which I wasn’t really using and use the hole to mount the travel bug ID tag. It is screwed in now but I will probably solder the screw to prevent it from loosening. The other change was to keep the BFC isolated from but parallel to the battery. I need to add 4 more diodes and rewire some stuff but I think the fugliness of the construction will be worth it. This way the battery can die and the circuit can still operate on solar/capacitor power.
I hope to achieve the lowest power consumption by spending most of the real time in SLEEP mode which only draws a few microamps. When it is running I have it clocked with a low power 32 khz tuning fork crystal. This is sufficient for what it needs to do where the most demanding task is beeping a piezo speaker.

LIST    P=16F84A;f=inhx8m
 
;_CP_OFF                equ     H'3FFF'                  ;code protect off
;_PWRTE_ON      equ   H'3FFF'       ;Power on timer on
;_WDT_OFF       equ    H'3FFB'               ;watch dog timer off
;_LP_OSC                equ     H'3FFD'                  ;crystal oscillator
;       __CONFIG       _CP_OFF & _PWRTE_ON & _WDT_OFF & _LP_OSC
;configure programmer directive
 
w      equ     0       ; register destination numbers.
f      equ     1
same    equ 1
 
z      equ     2       ; status flags
zero    equ 2
c       equ    0
carry   equ        0
 
count1 equ     0C      ; wait counter ls digit file register C
count2 equ     0D   ; wait counter ms digit file register D
portb  equ     06      ; port b I/O register f6
porta   equ        05      ; port a I/O register f5
status equ     03      ; status register f3
;
;
;
org     0       ; origin
;
init
movlw   0
tris    portb                   ; set portb as outputs
movwf   portb                   ; set portb levels all low
 
start
btfss   porta,1        ;  check for light
goto    islight
 
;; blue tick
bsf     portb,0            ; Blue on
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
call    beep
call    beep
bcf     portb,0            ; Blue off
call wait
 
;; blue tick
bsf     portb,0            ; Blue on
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
call    beep
call    beep
bcf     portb,0            ; Blue off
call wait
 
;; blue tick
bsf     portb,0            ; Blue on
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
call    beep
call    beep
bcf     portb,0            ; Blue off
call wait
 
isdark
call    boop
call    boop
call    boop
dark
sleep
sleep
sleep
sleep
sleep
sleep
 
;; blue tick
bsf     portb,0            ; Blue on
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
 
call wait
 
bcf     portb,0            ; Blue off
 
btfss   porta,1        ; check for light
goto    dark
 
islight
call    beep
call    beep
call    beep
light
sleep
sleep
 
;; blue tick
bsf     portb,0            ; Blue on
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
 
call wait
bcf     portb,2            ; tick
bsf     portb,2            ; tock
bcf     portb,2            ; tick
bsf     portb,2            ; tock
 
call wait
bcf  portb,0      ; Blue off
 
btfsc   porta,1        ; check for dark
goto    light
goto    isdark
 
beep
movlw   .20
movwf   count1
bd1     movfw        portb
xorlw   .4
movwf   portb
movfw   count1
movwf   count2
 
bd2     decfsz  count2,same  ; decrement and skip next line if zero
goto    bd2                ; if not zero
decfsz  count1    ; decrement count1 if count2 is zero
goto    bd1                ; do inside loop again if count2 nz
bsf          porta,1            ; A1 is beeper
retlw   00
 
boop
movlw   .40
movwf   count1
bp1     movfw        portb
xorlw   .4
movwf   portb
movfw   count1
sublw   .41
movwf   count2
 
bp2     decfsz  count2,same  ; decrement and skip next line if zero
goto    bp2                ; if not zero
decfsz  count1    ; decrement count1 if count2 is zero
goto    bp1                ; do inside loop again if count2 nz
bsf          porta,1            ; A1 is beeper
retlw   00
 
wait
movlw   .12             ; load count1 with delay multiplier
movwf   count1
d1      movlw   .12      ; load count2 with delay constant
movwf   count2
; shorten these for the simulator
 
d2      decfsz  count2,same   ; decrement and skip next line if zero
goto    d2  ; if not zero
decfsz  count1    ; decrement count1 if count2 is zero
goto    d1  ; do inside loop again if count2 nz
retlw   00
 
END

xxx

Dropped Off 03/08/2007 Lisatx&Waterman placed it in 23 Kazoo Texas – 57.52 miles Visit Log
Discovered It 02/13/2007 catweb79 discovered it Visit Log

Discovered it from Lisa,TX,cool blinking TB.

Discovered It 02/08/2007 Reese_Texas discovered it Visit Log

Discovered this TB while in the possession of Lisatx.

Retrieve It from a Cache 02/01/2007 Lisatx&Waterman retrieved it from I-45 Travel Bug Hotel Texas Visit Log

picked up tonight and will move it on its way.

Dropped Off 01/10/2007 Boxer Pups placed it in I-45 Travel Bug Hotel Texas – 166.64 miles Visit Log
Retrieve It from a Cache 01/01/2007 Boxer Pups retrieved it from Redwater City Park Cache Texas Visit Log

Great Travel Bug, we picked it up from the Redwater City Park and will take it with us to San Antonio, TX and warmer weather………..We will find a good cache for a drop off.

The battery is still holding a good charge. Still blinks and chirps like crazy…..

Dropped Off 11/02/2006 MrNezzer placed it in Redwater City Park Cache Texas – 272.86 miles Visit Log

Blinky is back on the road.

Retrieve It from a Cache 09/30/2006 MrNezzer retrieved it from Old Highway 67 TB Exchange Arkansas Visit Log

Blinky was clicking very sadly when found. After a few minutes in the sun he started blinking and clicking.

Dropped Off 09/04/2006 hummer dude placed it in Old Highway 67 TB Exchange Arkansas – 294.72 miles Visit Log
Retrieve It from a Cache 07/28/2006 hummer dude retrieved it from The Hole in the Tree Texas Visit Log

What a great TB We will take it on a trip and place it someplace neat. The blue light is doing just fine.

Leave a Reply