Picaxe turns on with Pin 3 input

GGnz

New Member
Ok heres the deal. I have a permanent 5V feed going into the postive side of the PicAxe, and a switch on the negative (im using NPN transistors to power LED's). However I also have a switch for input to pin 3 which is also a negative feed. When I flick this switch to pin 3 the Picaxe turns on although there is no ground going to the ground pin. Is this normal PicAxe behaviour and is there something I can enter in the code to stop the Picaxe powering of Pin 3? Cheers.
 

BeanieBots

Moderator
This is "expected" behaviour but not a good thing to do.
Most PICAXE inputs have an internal diode between the input and Vcc and the input and 0v. These diodes are to prevent the inputs from ever going above or below the power rails.
By putting a signal on a PICAXE input when it is not powered will therefore raise the power rail via the diode and ultimately power the device via its input.
The same is true for the 0v line.
 

GGnz

New Member
Whats the best way to counteract this? Im thinking I may not use the inputs but don't really want to resort to this since it alters the timing of the flashing. When using "if pin3 = 1 then ..." would it matter if I had a resistor in place? That way it wouldn't have a massive current going through it. Say for example, would 0.5V still be "1" in the If statement?
 

jodicalhon

New Member
Each input has protection diodes from the internal power busses to the input. Pin3 has a diode from the internal negative power bus to the input. All the other inputs have two diodes, one from the neg power bus to the input, the other from the input to the positive power bus.

When you apply a neg signal to pin3, there is a path from the internal negative power bus, via the internal diode, to the input and thence through your switch to gnd.

EDIT: BB got in first. Please ignore my ramblings.
 
Last edited:

BeanieBots

Moderator
The "correct" solution is not to do it.
You should not feed signals into an unpowered device. That is true of any chip, not just PICAXE.
Fitting a resistor is good practice anyway and MIGHT help.
The PICAXE requires very little current to operate and even a high value resistor may well supply enough current to make it run. A lot depends on what else is on your power rail.

Try using 47k in series with the input and put 1k across the power pins.
It'll waste about 5mA of current when powered but is a quick fix for your problem.

An example I have is an 18X which monitors a 12v line with its ADC input.
The potential divider is 10k/4k7. which equates to about 3k2 from a 5v line.
It is not enough to startup the PICAXE but if it is already powered, it is enough to stop it from shutting down when power is removed.
 

Wrenow

Senior Member
Isn't the easy solution to move the power switch to the +5v side, leaving the 0v (ground, neg) side permanently connected? I.e., move the poser switch to the other side of the power supply?

Or am I missing something?

Wreno
 
Top