Monday, April 1, 2013

College Place Walmart, to Close on Friday Night, Saturday


     Following pressure from other businesses in the City of College Place, the venerable Walmart has decided to follow suit and close its doors Friday afternoon, to reopen on Saturday evening. College Place, built around the Seventh-day Adventist Institution, Walla Walla University, has been long known for businesses closing their doors on the Adventist Sabbath. While other unique aspects of the town, such as the difficulty in finding a caffeinated soda or beef jerky have faded, Saturday now seems to have gained some traction.

"It gives our facilities a chance to rest," says Store Manager, Warren Wimple. "We also didn't feel that it was fair to other businesses in the area. Besides when you look at the recent economic climate, keeping our store open 24 hours and 7 days a week has become a luxury." We interviewed a local businessman, who preferred to be called Andy. He had this to say, "This is a strongly positive and unexpected step for a large company like Walmart. We praise their actions to keep College Place as free of distractions as possible while people should be in church."

Many of those we interviewed were incredulous, "What a crock!" said Mr. McDonald panhandling in front of the store. "What am I supposed to do? Hold my sign in the church parking lot? Are you kidding?" 

Despite several angry responses Mr. Wimple responds, "customers will have to prepare for the weekend on Friday or wait until after sundown." 

Saturday, January 19, 2013

Apple Cinnamon Muffins (Mariel Higgins)


2 cups all purpose flour 
1 cup whole wheat flour
4 tsp baking powder
1 tsp salt
1/2 cup brown sugar
1 tbsp cinnamon
1 tsp nutmeg

1/2 cup vegetable oil
2 tbsp coconut oil, melted
1 cup applesauce
1 cup soy milk
2 apples, diced

combine dry ingredients
mix oils, applesauce and milk and add to dry ingredients
stir in chopped apples
fill muffin tins (makes 24 muffins) and bake at 400 degrees for 20-25 minutes

Tuesday, November 6, 2012

Wireless Power Transmission

After I got a hold of an Braun Electric toothbrush, the concept of inductive power coupling has intrigued me. The charger connection is completely insulated. The toothbrush has a hole on the bottom that mates with a small cylinder sticking out of the charger. (PICTURE)

To check out the effect I took a coil of wire wrapped around a plastic spool and set it on top of the charger. I obtained approximately 1.5V open circuit and 500mA short circuit. I couldn't get too near the cylinder so the coupling wasn't the best. (PICTURE)

Next, I cut a 120V to 12V E shaped core "filament transformer" about the size of my fist in half, to produce two separated E shaped iron cores. Cutting through all the copper windings, paper and iron core made a real mess, took a lot of time to cut and dulled my hack saw. I used a vice to keep the core slices from separating.

I next wound the core with about 200 wraps of transformer wire I got at Radio Shack (I used the entire spool however many wraps that was). Clear plastic tape was used to keep the windings in place. I used a small piece of 220 grit sandpaper to take the enamel off the ends of the wire. I checked the inductance with my wavetek multimeter and it showed .3 mH. The resistance showed 3.3 ohm. The reason I am worried about this is that I don't have extra 20A fuses for my meter and I want to get an estimate of the quiescent current of my transformer without blowing up my circuit breaker, my meter and myself.

A little math (determine impedance from resistance and inductance): V = I Z => I = V / Z

Z =R + jwL =R + j * 2 * pi * f * L =R + j * 6.28 * 60 * .0003 =3.3 + .11304j

I = 120 / (3.3 + .11304j) = 40A

This doesn't look good for my meter fuse or my breaker!

After further thought about the way a transformer works and electric versus magnetic circuits I determined the following.

The small quiescent current of a power transformer is a function of the reverse magnetic field produced by the voltage impressed on the secondary windings and not on the inherent impedance of the coil. When the magnetic field is broken (with an air gap) in a transformer it behaves like a shorted secondary and draws potentially lots and lots of current.

For this to really work well, a higher frequency should be used. I'm curious what my toothbrush uses.

Breakthrough discovery! I just hooked up my handy dandy yet old as dirt Freq Counter to that inductive coil and viola! 21 kHz and change.

I need a higher frequency source than 60Hz. I have a function generator, but it tops out under a single Watt power output and has a 50 ohm output impedance. Higher impedance means more coil wraps... no good. I discovered that an old audio amp I have laying around will put out 50W up to 70kHz at 8 ohm output impedance. I think I will choose 20 kHz however. Higher frequencies may cause extra loss in the rectification process later. The coil inductance that I need to produce more than 8 ohms of impedance at 20 kHz. More Math: Z = j*2*pi*f*L Z = 8j ohms L = Z/(2*pi*f) f = frequency = 20,000 Hz pi = 3.14 L = 64uH This is definitely more reasonable. In fact I may try and wind this around a plastic core.

How ESN's Work

ESN's are an 8 digit hexidecimal number or an 11 digit decimal number. Either one represents a 32 bit binary value.

Keep in mind that one digit of HEX equals 4 binary bits.

Manufacturer IDSerial Number
HEX0-F0-F0-F0-F0-F0-F0-F0-F
BINXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
DEC0-25500000000-16777215


For example:
ESN HEX: E6 9F FF FF

The Manufacturer Code is E6 (hex) or 230 (dec).

The Serial Number is 9F FF FF (hex) or 10485759 (dec).

So the decimal ESN is: 23010485759

Conversely, for decimal ESN: 23010485759

The Manufacturer Code is 230 (dec) or E6(hex).

The Serial Number is 10485759 (dec) or 9F FF FF (hex).

So the hex ESN is: E6 9F FF FF

Sunday, November 4, 2012

Morse Code Bicycle Safety Blinker

$3 in parts
Runs 4 days on 2 AA's
Tired of the boring steady blink? Sport a blinker that will get the attention of any old school ham radio operator! Check the Youtube video of the action.

This is my first project using an AVR microcontroller and really the first embedded systems project I've done since college. I had two options for programming languages C and assembly. I chose assembly because I was familiar (at least with the 8051) and because it is well documented in the datasheets. Another advantage of assembly is the ability to know exactly what is going on especially when using a device simulator.

Tools Needed: Parts Needed:
Soldering Iron
USBtinyISP
Breadboard
Computer
Free Software
#22 Solid Hookup Wire
Wire Strippers
Needle Nose Pliers
Tactile Switch
ATTiny85v Microcontroller
Bright RED LED
9V Battery Clip
2xAA Battery Holder
#24 Stranded Wire (similar to that on the battery clip) 
  • Step One: Install the USBtinyISP Drivers. I've found the LadyADA writeup to be quite adequate.
  • Step Two: Install WinAVR. This Ladyada writeup is also worth a look.
  • Step Three: Install AVR Studio 4 (requires registration).
    • Don't bother to install the Jungo USB Driver.
  • Step Four: Write your program in AVRStudio.
    • Open Start -> Programs -> Atmel AVR Tools -> AVR Studio 4
    • Select New Project
    • Select ATMEL AVR Assembler
    • Give your project a descriptive name and choose a folder. Remember the folder name, you will need it later.
    • Choose a debug platform, if you aren't sure use AVR Simulator.
    • Choose the target device. ATtiny85.
    • Copy and paste the code below. If you're brave feel free to tweak it a little.
    • Press F7 to compile the code.
  • Step Five: Program Fuses (this needs to be done once per IC)
    • Check out the The Engbedded AVR Fuse Calculator.
    • Choose the ATTiny85 AVR Part. (There is no ATtiny85v option).
      • Feature Configuration
      • Select "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6CK/14CK + 64ms: [CKSEL=100 SUT=10]
      • A slow clock requires less battery power.
      • Uncheck "Divide clock by 8 internally; [CKDIV8=0]
      • Check "Serial program downloading (SPI) enabled; [SPIEN=0]"
      • All other's should be unchecked.
      • Brown-out detection should be disabled.
    • No changes will be made to the Manual Fuse Bits section
    • Under Current settings copy down the generated AVRDUDE arguments
      • These should look suspeciously like -U lfuse:w:0xE4:m -u hfuse:w:0xdf:m -U efuse:w:0xff:m
    • Stuff to watch out for:
      • Any Clock selection beginning with EXT (you will need a crystal to program your chip)
      • Forgetting to check serial program (SPI) enabled. (Chip is bricked).
      • Disabling reset to gain an extra pin. (Chip is bricked, reset needed for programming.)
    • Open a DOS Prompt and execute the following command: avrdude -p attiny85 -P USB -c USBTINY -U lfuse:w:0xe4:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
  • Step Six: Breadboard the programmer and microprocessor.
    • Set the processor on the breadboard across the channel.
    • Press the pins into the breadboard by gently pressing on the processor.
    • Use #22 solid wire to connect the pins on the processor to the ones on the programmer's 6 pin cable.
    • Keep in mind that your processor may have a dot above pin 1 rather than the notch shown.

  • Step Seven: Program the microprocessor
    • Open Dos and change to the folder your project resides in.
    • type: avrdude -p attiny85 -P USB -c USBTINY -U flash:w:my_project.hex -B 10000 (the -B 10000) slows down the programmer for the slow clock speed.
  • Step: Eight: Connect up the circuit
    • This is much easier to do on the breadboard to get started.


Advanced Concepts
Integrating USBTinyISP w/AVR Studio
The Simulator (See AVR Studio Help Screens)

In this case I mounted the whole deal to a Fi'zik - Saddle Attachment system.


The Code


;Bikey Talkie
;by Tim Kyle
.include "tn45def.inc" ;Includes the ATTiny45/65/85 definitions file
.org 0x0000 ;Places the following code from address 0x0000

;The Following instructions and "nop"s are for handling interrupts.
rjmp RESET ;Take a Relative Jump to the RESET Label
rjmp Interrupt0 ;Handle an interrupt input on INT0 or PortB Pin 2 (case pin 7)
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
reti ;return from any other interrupts that might be thrown. They are not important.

Interrupt0:
ldi r16, 0x10 ; this represents about 1/3 of a second for a dit
rcall dah ; this produces a time delay long enough to handle switch bounce.
ldi r18, 0x00 ; Zero reference (there are easier ways I know)
cpse r18, r22 ; Was the unit on or off? If equal (off) skip 1 instruction
rjmp RESET
pop r20 ;pop the old program counter from the stack. It isn't important. R20 is a convenient place to put it.
sei ;Turn interrupts back on
rjmp LOOP

RESET: ;Reset Label
;Turn off all unnecessary clocks, timers, etc
ldi r16, 0x0F
out PRR, r16

;The momentary button is connected to DIP pin 8 (INT0, Port B Pin 2). It should normally be pulled up.
;The LED is connected directly between pin 3 (Port B pin 4) and Vcc. PWM replaces the resistor.
ldi r22, 0x00 ; Tell the interrupt process that the light is currently off.
sei ; set Global Interrupt Enable
;A high in the DDRB means we will use the pin for output, zeros will configure the pin for input.
;Unused pins will be configured as outputs to avoid unnecessary interrupts being thrown.
;Pin7 Pin6 Pin5 Pin4 Pin3 Pin2 Pin1 Pin0
;  1 1  1   1    1 0  1   1  = FB
ldi r16, 0xFB 
out DDRB, r16 ;Store this value in The PORTB Data direction Register
;A high in the PortB register would enable the pull up resistor for an input pin.
;A high in the PortB register sets an output pin high. (in this case turning off the light)
;Pin7 Pin6 Pin5 Pin4 Pin3 Pin2 Pin1 Pin0
;  0 0  0   1    0 1  0   0  = 14
ldi r16, 0x14 
out PORTB, r16
 
;GIMSK is the global interrupt mask. 
ldi r16, 0x40 ;Enable INT0 Interrupt
out GIMSK, r16 ;Enable INT0 Interrupt

;MCUCR Register
;00100001=21
;
;7 BODS - R/O Brown Out Detector during Sleep (page 38)
;6 PUD - Pull up disable (page 55,57)
;5 SE - Sleep Enable (Page 39) Set right before power down and unset right after power up.
;4 SM1 -Sleep Mode (page 39)
;3 SM0 -Sleep Mode (page 39)
;2 BODSE - R/O Brown Out Detector Sleep Disable (page 38)
;1 ISC01 - Interrupt sense control
;0 ISC00
;
;ISC
;00-Low Level Causes Interrupt
;01-Toggle Causes Interrupt
;10-Falling Edge
;11-Raising Edge
;
;SM
;00-Idle
;01-ADC Noise Reduction
;10-Power-down
;11-Reserved

;BODS  PUD  SE   SM1  SM0 BODSE ISC01 ISC00
;  0 0  1   1    0 0   0     0  = 30


ldi r16, 0x30 ;This is where the edge trigger for the interrupt and the sleep stuff is hiding.
out MCUCR, r16
sleep



LOOP: ;Loop Label
ldi r22, 0xff ; Tell the interrupt process that the light is currently on.
ldi r16, 0x08 ; this represents about 1/3 of a second for a dit
rcall dit
rcall dit
rcall dah
rcall dah
rcall dit
rcall dit
rcall space
rcall dah
rcall dah
rcall dit
rcall dit
rcall dah
rcall dah
rcall space
rjmp LOOP

;Subroutine Space. Tim Kyle Rev 0.1
;Waits the amount of time necessary for an interword space
;Uses Registers R16, R17 courteously (restores their previous values before return)
;Uses Labels 
;Requires: Wait
Space:
push r16 ;Save previous contents of R16 to the stack.
push r17 ;Save previous contents of R17 to the stack.
rcall WaitOff
rcall WaitOff
rcall WaitOff
pop r17
pop r16
ret


;Subroutine Dah. Tim Kyle Rev 0.1
;Waits the amount of time necessary for one dah
;Uses Registers R16, R17 courteously (restores their previous values before return)
;Uses Labels 
;Requires: Wait
Dah:
push r16 ;Save previous contents of R16 to the stack.
push r17 ;Save previous contents of R17 to the stack.
ldi r17, 0x04 ;Load Light On (the 4 keeps the button pull up resistor held high)
out PORTB, r17 ;Turn Light On
rcall WaitOn
rcall WaitOn
rcall WaitOn
ldi r17, 0x14 ;Turn Light Off (the 4 keeps the button pull up resistor held high)
out PORTB, r17 ;Turn Light Off
rcall WaitOff
pop r17
pop r16
ret


;Subroutine Dit. Tim Kyle Rev 0.1
;Waits the amount of time necessary for one dit
;Uses Registers R16, R17 courteously (restores their previous values before return)
;Uses Labels 
;Requires: Wait
Dit:
push r16 ;Save previous contents of R16 to the stack.
push r17 ;Save previous contents of R17 to the stack.
ldi r17, 0x04 ;Load Light On (the 4 keeps the button pull up resistor held high)
out PORTB, r17 ;Turn Light On
rcall WaitOn
ldi r17, 0x14 ;Turn Light Off (the 4 keeps the button pull up resistor held high)
out PORTB, r17 ;Turn Light Off
rcall WaitOff
pop r17
pop r16
ret


;Subroutine WaitOff. Tim Kyle Rev 0.1
;Waits the number of cycles specified in R16 * 1027 + 26 with the light off
;Uses Registers R16, R17, R18 courteously (restores their previous values before return)
;Uses Labels Wait, Wait1, Wait2
;If R16 is set to 0, cycles=28
;Requires: None
WaitOff:
push r16 ;Save previous contents of R16 to the stack.
push r17 ;Save previous contents of R17 to the stack.
push r18 ;Save previous contents of R18 to the stack.
ldi r17, 0x00 ;r17 is set to 0 because it is decremented to 255 before the compare is done.
ldi r18, 0x00 ;r18 is used as the 0 register to compare with because I opted to use cpse.
cpse r16, r18 ;if a zero is passed in R16 exit (otherwise it would be equivalent to 0xFF+1)
rjmp Wait1
rjmp Wait2
Wait1:
nop
nop
nop
nop
nop
nop
nop
dec r17
cpse r17, r18 ;Compare R1 and R3 (always 0) if they are equal skip the next instruction.
rjmp WAIT1
dec r16
cpse r16, r18
rjmp WAIT1
pop R18 ;Return previous contents of R18
pop R17 ;Return previous contents of R17
pop R16 ;Return previous contents of R16
ret
Wait2:
pop R18 ;Return previous contents of R18
pop R17 ;Return previous contents of R17
pop R16 ;Return previous contents of R16
ret
;End of Wait Subroutine

;Subroutine WaitOn. Tim Kyle Rev 0.1
;Waits the number of cycles specified in R16 * 1027 + 26 with the light on
;Uses Registers R16, R17, R18 courteously (restores their previous values before return)
;Uses Labels Wait, Wait1, Wait2
;If R16 is set to 0, cycles=28
;Requires: None
WaitOn:
push r16 ;Save previous contents of R16 to the stack.
push r17 ;Save previous contents of R17 to the stack.
push r18 ;Save previous contents of R18 to the stack.
push r19
push r20
ldi r17, 0x00 ;r17 is set to 0 because it is decremented to 255 before the compare is done.
ldi r18, 0x00 ;r18 is used as the 0 register to compare with because I opted to use cpse.
ldi r19, 0x04 ;Zeros for turning light on (the 4 keeps the button pull up resistor held high)
ldi r20, 0x14 ;One for Turning Light off (the 4 keeps the button pull up resistor held high)
cpse r16, r18 ;if a zero is passed in R16 exit (otherwise it would be equivalent to 0xFF+1)
rjmp WaitOn1
rjmp WaitOn2
WaitOn1:
out PORTB, r20 ;Turn Light off
nop
;nop
;nop
;nop
;nop
;nop
;nop
out PORTB, r19 ;Turn Light On
dec r17
cpse r17, r18 ;Compare R1 and R3 (always 0) if they are equal skip the next instruction.
rjmp WaitOn1
dec r16
cpse r16, r18
rjmp WaitOn1
pop R20 ;Return previous contents of R20
pop R19 ;Return previous contents of R19
pop R18 ;Return previous contents of R18
pop R17 ;Return previous contents of R17
pop R16 ;Return previous contents of R16
ret
WaitOn2:
pop R20 ;Return previous contents of R20
pop R19 ;Return previous contents of R19
pop R18 ;Return previous contents of R18
pop R17 ;Return previous contents of R17
pop R16 ;Return previous contents of R16
ret
;End of WaitOn Subroutine

Make a Tin Foil Float on Air!


I learned today at work that some light objects such as aluminum foil or balsa can be made into boat that will float on top of a gas, namely SF-6. SF-6 (sulfur hexafloride) is a gas that we use at work in circuit breakers to prevent arcs when the breaker opens under load. I found a pretty good video of it on the internet.
The guys at work talk about accidentally breathing SF-6 and because it is much heavier than normal air, talking really low, the opposite of helium.

Crazy Garlic Ranch (Tim Kyle)


Put the following in a blender:
3/4 cup Unsweetened Soymilk
3/4 t of Salt
4 t Lemon Juice
1/8t Dry Mustard
3 cloves garlic
10 squirts of Tapaito Hot Sauce
1/2 T Dill
Blend well, while blender is running, slowly add canola oil until desired thickness is reached.
Mix in Parmesan cheese to taste if desired.