Using 14m to keep itself on

fojinpic

New Member
hello again[previous problem changing between inputs and outputs on 14m appear to be resolved-- don't know what I was doing to cause a problem nor what I did to fix]. forgive me this is daft but here goes -- I want my 14m to come on and remain on from a momentary switch . The pic starts up quickly enough from a momentary switch, and an output goes high okay. I'm then connecting this high output through 330 resistor to the base of npn transistor trying to turn it on to take over power of the pic. I'm connecting collector of transistor to battery positive, and emitter to positive of the pic, reasoning that current will flow through the pic to its normal ground. Reasoning is obviously wrong because it doesn't work! Politely!!, any comments on how I can power from a momentary switch and keep it on with a transistor or other method.

If I can get this working, my preferred method is to charge a capacitor with the momentary switch, and use that to power the base of a small transistor, either to turn the pic on directly or else to use that output to power the base of another transistor to turn the pic on. I need maybe 10 seconds of operation of the pic. But I don't seem to be getting even to first base with a transistor
 

BeanieBots

Moderator
It would help if you posted a diagram of what you have.
Sounds like you are using the PNP as a "high side" switch.
That is correct, except a "high" to the base will actually turn it OFF.
For a high side PNP, you need to pull the base LOW to turn it on.

The problem then is that an unpowered PICAXE will pull the base low, and turn it on.
This has been covered several times before including working examples. Can't think of an exact post off-hand but have a look around using search.
 

MPep

Senior Member
@BB: Re-read the posting. It mentions using a NPN transistor, not PNP.

The reason it doesn't work is that the high output from the PICAXE cannot go higher than the Emitter of the NPN. As the Base needs to be 0.6V higher than the Emitter, this isn't going to work.

If a PNP was used, then a logic low would be required. However, i suspect that the Base would always be too low, and so be switched on (even with a High output).

This question has come up a few times already. Do a search.

I haven't tried it, but an idea I have had would to use a PWM output feeding a voltage multiplier to get a higher than (PICAXE) Vcc, in order to switch on the NPN. This voltage would then feed the Base.

The idea of charging a capacitor is interesting. You would need to make sure that it can charge very quickly and the PICAXE does its job before the C discharges too much to be of any use. Using a low leakage part is obviously required here.

Good luck.
 

kevrus

New Member
Maybe the idea of using an NPN transistor is to switch the -ve to the picaxe, as that is probably the most common configuration, try a forum search as i'm sure I recall this topic before
 

hippy

Ex-Staff (retired)
If power consumption isn't much of a problem when turned on, the PICAXE could drive a suitable low-current relay to +V directly from an output pin which can short across the input switch to keep powered.

No messing with transistors at all, no charge pumps nor what-nots, zero current drain when off and, best of all, connected to a PICAXE output pin which goes active low when reset it should auto-energise the relay.

With an extra diode and a pull-down R ( not in-circuit when powered off ) it would be possible to use the switch for power on and for power-off under software control.

If one wanted to 'live dangerously' it might even be possible to feed the power via the switch straight to an input and rely on the parasitic power feature of the PICAXE/PICmicro to activate it. That saves a diode. The relay would connect power to normal +V.

Code:
              . . . . . . . . . . . . . . . .
             :                               :
              /                              :
       .---O/  O-------------.---------.     :
       |                     |         |     :
       |                .----^----      )    :
       |     _          |   +V    |     ) . .
       |   _|_|_        |         |     )
       }---O   O---.----| Ix      |    |  RELAY
     + |          .|.   |      Ox |----'
    ___|___       | |   |   0V    |
     --.--        |_|   `----.----'
     - |           |         |
       `-----------^---------'
It probably needs a back-EMF diode across the relay.
 
Last edited:

kevrus

New Member
Following on from Hippy's post regarding the use of a relay, what about a latching relay, a short pulse to latch on, another to latch off
 

Jeremy Leach

Senior Member
I know this is crude, but isn't this all you need for a cap solution?

Code:
   o--o-----------------o-------o
      |                 |
      o             .---o---.
    \               |       |
     \.             |Picaxe |
      o             |       |
     .|.            |       |
     | |            '---o---'
  R1 | |                |
     '-'                '
      |               |/
      o------o--------|    NPN or FET
      |      |        |>
     .-.    ---         |
     | |    ---         |
  R2 | |     |  C1      |
     '-'     |          |
      |      |          |
      |      |          |
    o-o------o----------o------o
R1 is low value allowing quick charge of cap. R2 is high value which discharges the cap. I think a FET would be better than an NPN, esp one with low RDSon, but NPN would probably work. I think the code would have to hit an End statement before the voltage dropped too much otherwise possible erratic picaxe behaviour. I know the transistor wouldn't turn off sharply - but if the solution works for 10 seconds then who cares ;)
 
Last edited:

leftyretro

New Member
Following on from Hippy's post regarding the use of a relay, what about a latching relay, a short pulse to latch on, another to latch off
Here is a drawing I built to do just that. Worked great and the use of the cap on the relay means that no continous power is used by the relay once it has latched on. I found the relays on E-bay for around 50 cents each. Code needed is just to make output 1 high at startup and then make output 1 low when wishing to shutdown.

Lefty
 

Attachments

BeanieBots

Moderator
Mpep, well spotted. Funny how you see what you expect to see and not what is written.
Until we see THE circuit diagram, not much point speculating any further.
Personally, I always use the latching relay method. ZERO quiescent current.
 

MPep

Senior Member
I have never used them. Have heard of them, but the latching relay, as BB and others mentioned, uses the least current.
 

Jeremy Leach

Senior Member
Get your drift sghioto, but got some issues with that diagram ;)

The base of the NPN is floating when the switch is open and the picaxe is off.
There seems to be a resistor missing off the collector of the NPN.
The horizontal line off the emitter of NPN is GND ??
 

sghioto

Senior Member
Sorry about that. Here is the correct schematic for the two transistor switch. The base of the NPN is not floating, it will be connected to one of the output pins the user decides on and YES the emitter is tied to ground. The mistake was a connection between the collector of the NPN and 5 volts.

Cheers,
Steve G.
 

Attachments

Jeremy Leach

Senior Member
Hmm, well I think when the picaxe is powered down the output will be very high impedance (because the FETs of the output pin will be 'off') and so the connection from the output to the NPN base resistor will be effectively floating. So I think you need another resistor from the base of the NPN to ground. Also I think you need another resistor from the collector of the NPN to 5V.
 
Last edited:

sghioto

Senior Member
Jeremy Leach,

You can add the two additional resistors if you want but the circuit functions fine without them. This isn't theory, this is a working circuit on one of my projects.

Steve G.
 

Jeremy Leach

Senior Member
Ok Steve, I stand corrected ;) I just by habit try to not let inputs float. The collector resistor - well it just seems odd without the resistor going to 5V but I can grasp how it works. Anyway, nice one !
 
Top