Button with logic for long/short press

Discussion in 'The Projects Forum' started by kdobrev, Aug 2, 2012.

  1. kdobrev

    Thread Starter New Member

    Aug 1, 2012
    4
    0
    Hi all,

    I have electric curtains on my windows which are regulated by a simple DOWN-OFF-UP button. Current function of this switch is that as long as it is pressed the curtains fall or raise and when they reach end position the motor is switched off automaticaly. What I have designed so far is simple 555 timer schematic which when activated by a short press will provide contact for a relay which will be on for about 30-40 seconds which will fully open/close my curtains.

    The problem is that sometimes I want the curtains half way or so open. I want when I single press and release the button shortly to have the timer activated, but if I hold for more than say -1-2 seconds this timer to be invalidated and manual release of the button to stop the opening/closing of the curtains.

    Can you help me how should I modify the schematic?
     
  2. kdobrev

    Thread Starter New Member

    Aug 1, 2012
    4
    0
    Better schematic with junction points
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,718
    4,788
    Are you sure that's what you want? Don't you ever want to just tweak the curtains, say by moving them an amount that would correspond to only a second or so of button press?

    How about a different protocol:

    When you press the button and release it the timer is activated but if you press the button again while the timer is running the motion is stopped. That way, if you just want to move the curtains a tiny bit, you just hit the button twice with a short delay between the two presses. You also don't have to stand there and hold the button when you want to move half way, just press the button and then press it again once it has moved as far as you want.

    Assuming you have two pushbuttons, one for UP and one for DOWN, a simple control logic would be to have the following states: UP - IDLE - DOWN. In the IDLE state, the timer is held in reset. The pressing the UP button moves you from IDLE to UP, while pressing the DOWN button moves you from IDLE to DOWN. In either case, moving out of IDLE releases the reset on the timer and lets it run, the state (DOWN or UP) variable determines which relay is activited (note that you only need one timer). If either button is pushed, or if the timer expired, you move back to the IDLE state.

    This kind of circuit screams out for something like an 8-pin PIC microcontroller.
     
  4. kdobrev

    Thread Starter New Member

    Aug 1, 2012
    4
    0
    Yes that would be even better. My problem is that I do not have the equipment and knowledge to do microcontrollers. I was going to be at the top of my circuit experiences with the 555 timer and that is well beyond :)

    Althought it seems as too much efford do you think getting http://www.ebay.com/itm/PIC-USB-Aut...295?pt=LH_DefaultDomain_0&hash=item1c29d2489f

    and some chips would be a good start for me to learn how I can do that?
     
  5. WBahn

    Moderator

    Mar 31, 2012
    17,718
    4,788
    At just $11, you can't go too far wrong. I have no idea what selection of parts that thing will program, but it almost certainly will do some of the cheap, low end parts. A little project like this would be a good way to start getting your feet wet on MCU's.

    The alternative is to use some discrete logic part. You'll end up with more parts and more complicated wiring and probably about the same cost as going the MCU route (perhaps a bit more, perhaps a bit less), but you're only talking a handful of dollars in total either way.

    The attached state diagram is one possibility. You can get by with fewer states, but you then have to debounce the switches in hardware (which isn't two difficult and it definitely an option). The idea in this diagram is that you don't have to debounce the switches. Instead, you have two timers, one set up for a short duration of perhaps 50ms and the other set up for your full duration of 30 to 40 seconds.
     
  6. Mr. Mho

    Member

    Jun 15, 2009
    15
    3
    I think being able to stop the motion is a great suggestion. If you are willing to add a third "stop" switch, then the 555 circuit will work just fine. Your Up/Down switch can trigger the 555, generating a 30 second pulse. The stop switch can be connected to the RESET* pin to stop the motion. I assume you have one 555 for each relay - you can tie their RESET pins together - one STOP switch will halt either motor. It does require one more switch, but the circuit is much easier.
     
Loading...