single push buttons as an on/off switch

Discussion in 'The Projects Forum' started by M11, May 8, 2011.

  1. M11

    Thread Starter New Member

    Dec 27, 2010
    18
    1
    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:
    [​IMG][​IMG]

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

    2nd circuit:


    figure 1for denouncing and figure 2for latching
    [​IMG][​IMG][​IMG]


    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
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    I came up with a 555 version that would work well with a CMOS 555.

    555 Bistable Multivibrator

    Just replace the LEDs with a MOSFET.
     
    M11 likes this.
  3. M11

    Thread Starter New Member

    Dec 27, 2010
    18
    1
    thanks a lot.

    what about the idea of the OR gate ? is there a better way to it ?
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    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.
     
  5. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    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
     
    M11 likes this.
  6. M11

    Thread Starter New Member

    Dec 27, 2010
    18
    1
    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) ?
     
  7. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    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
     
    M11 likes this.
  8. M11

    Thread Starter New Member

    Dec 27, 2010
    18
    1
    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,
     
  9. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    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
     
Loading...