Monday, February 18, 2008

Blinkenlight

Overview: Basically this is a PIC based light flasher that uses temperature as input. It has several states it can drive the two lights(Power/HDD): Brightness/Random, Blink synchronously, Pulse synchronously, Blink Alternating, Pulse Alternating, Brightness Both, Pulse/Random, Trigger(1 light on if it's hot, 2 on if it's really hot). A state is picked psuedo-randomly at startup based on the last 3 LSBs computed from the analog input of the thermistor. The states can be cycled through by pressing the reset button on the computer, and every other one is off(So it's easy to stop the blinking).

Software:
The program is pretty simple. It has 2 threads, a main one to deal with the lights and convert analog values, the other is for monitoring switch presses(I didn't use button interrupts like I should have). There is some bit fiddling to guestimate a speed, and this would change significantly with a different thermistor. Also my alternating states suck, and I didn't feel like desoldering to fix them. The problem is the computer's LEDs are bigger than the ones I was testing with, so the alternating algorithm always makes one weaker looking. The random flashing patterns are made using some modulus magic and adding variations using the analog input. The MCC18 code can be downloaded here, and the hex can be obtained here.

Electronics:
Parts:
* PIC18F2550
* 4.7 Kohms Resistor
* 1 Kohm resistor
* 220 Ohm resistor -- should match close to the thermistor, give or take for adjustment
* 7.200 Oscillator(Could be about any, although speeds would need adjusted)
* 3 sets of pins to hook up connectors (Salvaged from an old computer)
* 300 Ohm Thermistor

Schematic:
I ended up using 2 boards, one that just held the thermisistor and could plug into a spare slot under the CPU, picture below:


Everything hooked up:



Running at a slightly warm temperature:

No comments: