Power ONLY on button press... HELP!

macsoft

Member
Hi there,
I've done some basic picaxe circuits before and i just love these little chips. I normally use the 08m2 for it's size and low price, i've got a ton of these to play with :)
I now need a simple circuit like a wired with 2 or 3 buttons.
each button connected to an input on the 08M2.
That part is simple.. what i cannot figure out is, i what the push of any button to function as a power button too. that is: the circuit is OFF, and when you push a button, the circuit gets power AND the input connected to that switch changes state to ON.

If it was just one button, i could just make it a power button and had the input already closed.
if i use DPDT switches i could also close the input and close the POWER circuits with the same push.
But i want to use small SPST switches..
How do i do this?

Thank you! :)
 

nick12ab

Senior Member
If the circuit is only on when the button is pressed, why do you also need to to make an input high?

Or is the PICAXE not part of the circuit?
 

macsoft

Member
the circuit has 2 or 3 buttons. At the push of each button i want to power the circuit and make one of the inputs high. each button connected to an input.
Like in a normal tv remote: the circuit is off, but when you press a button, the circuit is ON and reacts differently to each button press
 

hippy

Ex-Staff (retired)
You can use diode mixing for the power if the voltage drop across the diodes is tolerable ...

Added: There should really be diodes or current limiting resistors inline with the input signals as well to keep voltages / currents within spec.
 

Attachments

Captain Haddock

Senior Member
It would be quite easy with a flip-flop ic (4013 will do it) with the output powering the picaxe, at the end of the program have the flip-flop input pulsed high again and the power will go off till next press.
 

PaulRB

Senior Member
Does the picaxe need to be "off"? A TV remote is not really off when you are not pressing buttons. It's just in a low power state. Picaxe can do the same. This approach would be considerably simpler, no extra components needed.

Paul
 

macsoft

Member
A TV remote is not really off when you are not pressing buttons? I didn't know that.. well i can try that with picaxe, but the first problem is I'm using a 08M2 that does not have the SLEEP function :S no extra components would be the best choice yes.
the IC 4013 is too big, i have space problems in my circuit.
The diode mixing seams a good idea.. i think I would try that.

Any more thoughts?
Thanks! :)
 

eclectic

Moderator
The 08M2 does have
SLEEP.

Otherwise, see

Nap.

Setfreq k31.

Disablebod

Have a look at Manual 2 for more info.

e
 

macsoft

Member
I will try it with sleep. seams a god idea not having to add nomore components. Nice link! 5 year continuos working and going?! cool! well my project works on one CR2025, not AA batteries, but then again, i do not want it to work for 5 years straight :)
thank you
 

macsoft

Member
its a remote for controlling my automated blinds on my window. I have a picaxe circuit connected to 2 relays and 2 positions sensors that operate the up and down movement of my blinds.
I now wan't to control it remotely. I wan't to use the case and battery holder of a small generic remote i have, so I need the circuit to be small (08m2) and to run on a CR2025 so i can use the case i already have.
So sleep mode waking up on interrupt?
 

Hemi345

Senior Member
If you have a TV in the same room that uses universal remote (capable of Sony codes), use that to control the blinds. That's what I did on my automated blinds project. WAF is VERY high :)
 

macsoft

Member
that is an alternative, but i really would like this opportunity to have another picaxe project. in each project i learn so much more :)
 

PaulRB

Senior Member
Not sure interrupts will wake from SLEEP or NAP.

Just need a tight loop that NAPs for a fraction of a second at a time, until one or other button is pressed.

Paul
 

westaust55

Moderator
Not sure interrupts will wake from SLEEP or NAP.

Paul
Correct and as macsoft is using an M2 part there is no interrupt alternative.

With the X2 parts, a hardware interrup (see HINTSETUP) can bring the PICAXE out of SLEEP immediately (X2 parts do not have the NAP command).
 

macsoft

Member
Hum..wont a tight loop that NAPs for a fraction of a second makes the low power consumption not so low? I'm using a CR2025
 

westaust55

Moderator
If you have a "tight loop" for the shortest time of 18ms (at 4MHz)
the loop might take around 1 ms and
instigating the NAP command would be around 0.25 ms
a check/scan of a single input pin could be another 0.25 ms

so for around90 percent of the time the PICAXE is in the low power mode so still some reasonably substantial power savings could be achieved.

If you do a forum search, there have been several past threads on achieving very low power consumption including one about flashing an LED which has been running for quite a long time (years?) on a couple of batteries.
 

macsoft

Member
Yap, ecletic posted that link up there. but they wore using 2 AA batteries and a much longer sleep cycle.
Well... nothing like trying it :) I will try it and see what happens.
thanks :)
 

AllyCat

Senior Member
Hi,

As mentioned earlier, there is also the possibilityof using a 32kHz clock, which will get the consumption down to a few tens of uA or less. Note that the PIC hardware actually has two "32kHz" oscillators (one is used for the Sleep/watchdog timer, the other is divided down from the "normal" clock), I'm not sure which PICaxe basic selects for setfreq k31, but both should be accessible via SFR commands, if necessary.

So you should be able to get adequate life from a CR2025, but I'd be more concered whether it can deliver sufficient current to drive an IR transmitter LED with sufficient current for the required range.

Cheers, Alan.
 

macsoft

Member
i use a BC550 transistor to boost it up a little, and i can work it from 8 meters away. Lts just see how long the battery will hold on standby
 
Top