single push buttons as an on/off switch

Thread Starter

M11

Joined Dec 27, 2010
18
Hello,

I am doing a project using pic16f877 (battery powered). The system is currently switched on and off using a normal switch. I want to add a feature to the system that shuts off the power automatically if it was not used for a certain period of time (I get this information from a sensor).

I succeeded in getting the signal that indicates that the device is not being used from the pic. the problem is how can I use this signal to cut off the power ?

I am thinking of covering the on/off switch which is currently used to a push button, then using an OR gate with one input connected to the push button and the other input connected to the pin of the PIC that generates the signal. I am not sure if this is the best way to do it, so any suggestions are most welcome.

so, the first step is to build the circuit required for the push button. I have come across many circuits, and I am not sure which is the most appropriate circuit for a battery powered system.

1st circuit:


http://www.pcsilencioso.com/cpemma/flipflop.html

2nd circuit:


figure 1for denouncing and figure 2for latching



there are also those circuit which use the 555 timer.


Any suggestions on the best way to do this is much appreciated.

Thanks in advance
 

Wendy

Joined Mar 24, 2008
23,421
The ultimate in easy is a push on/push off switch. You can buy them off the shelf.

I don't see how a OR gate can latch and hold. You can do something like the second picture for a monostable type action, I've seen a lot of DVMs do something like this.
 

KMoffett

Joined Dec 19, 2007
2,918
The system is currently switched on and off using a normal switch. I want to add a feature to the system that shuts off the power automatically if it was not used for a certain period of time (I get this information from a sensor).
This is a circuit I used with a PICAXE 08M microcontroller to provide both a Push-ON/Push-OFF and Push-ON/Program-OFF. It uses one input and one output.

Ken
 

Attachments

Thread Starter

M11

Joined Dec 27, 2010
18
thanks for your help guys. I have finished that part.

now I have another problem
I am using 9v 280mAh battery and a voltage regulator to supply 5v to the circuit. I am thinking of using a 4.8v supply (4x 1.2v AA 2500mAh) to avoid wasting power on the voltage regulator. Will the pic16f877 work well with 4.8volts ? I looked in the data sheet but I didn't find the minimum vdd value.

the minimum supply voltage that the components I am using is 4.5v (other than the pic).

which is expected to last longer, the 4.8v(2500mAh) or the 9v(240mAh) ?
 

KMoffett

Joined Dec 19, 2007
2,918
Go with the 4.8V battery pack. The circuit will draw what current it needs. AT 4.8V it will consume just the needed amount of power. With the 9V battery, (9v-5v)*(microprocessor current) is wasted as heat.

Ken
 

Thread Starter

M11

Joined Dec 27, 2010
18
thanks ken. I have done that nad everything works fine, but there is still a problem. the low battery indicator does not work anymore.
before, I had a voltage divider that divides the voltage comming from the battery ( before the voltage regulator) and read it by the ADC of the pic.
now that I have removed the voltage regulator, how can generate a low battery indicator signal ?

thanks,
 

KMoffett

Joined Dec 19, 2007
2,918
Yeah, that's a problem with the ADC in microcontrollers that use the battery voltage as a reference. Do you have a spare ADC input? I've seen were a second ADC measures a fixed, low voltage, external reference...a forward biased diode (~0.6V) or LED (~1.7V)...or a precision reference IC (2.5v)...and compares it to the apparent unchanging voltage in the ADC monitoring the battery.

Ken
 
Top