>I'm not fully buying this. Generally PIC pins, being connected to large >FETs inside, drive very close to Vss with no load. But, the PIC's Vss >pin ("ground") is not necessarily the same voltage as the transistor's >emitter ("ground") if the ground system isn't proper. Also if a heavy >current is flowing into other "low" output pins, it can pull the internal >Vss up so that "low" pins don't output zero. Read the spec, esp output voltage at logic zero max voltage. Then have a close look at what it really takes to turn on a transistor. Very close to zero isn't zero, and transistors often have quite a bit more gain than their spec, especially at low currents. >The obvious test is to measure the pin voltage after a timing cycle has >ended and the transistor is supposed to be off. It may be a good idea to >freeze the PIC clock during the measurement in case the PIC is actually >turning it on and off rapidly. If it is close to but not quite zero, try >a resistor from the transistor's base to emitter. But likely you will >find it a full 5V, indicating the PIC is actively trying to turn the >transistor on. Are you sure that something doesn't cause the PIC to >immediately restart a timing cycle when the transistor turns off? In >other words, the transistor turns off, but then something related to the >317 and the battery restarts the PIC timer. This could be either a >glitch in the 5V power supply causing a reset, or a bug in the PIC >software. Adding the emitter resistor puts the transistor in class A operation. It was in class C Are you SURE this is a good idea? Don't overcomplicate it. Transistors are not logic level devices. If adding the needed resistor bothers you too much, switch to low threshold FETs, which will begin turning on at about 2V. >In circuits that handle high currents, it's a good idea to establish >seperate "logic" and "power" ground networks. Connect them together at >one point only. The ground pin of the 5V regulator is a good place. This I agree with 100%