How setup 4013 toggle to start up in OFF state?

Discussion in 'The Projects Forum' started by superduper, May 10, 2011.

  1. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    Hi guys. I built this project. It seems to work fine. The switch appears to debounce correctly because the toggle operation is positive without errors. I varied R3 to obtain the LED brightness I desired. I also used what I had for NPN transistor (2N3904 instead of BC547 as prescribed).

    Now, here is my problem. This circuit ALWAYS starts up in an ON state. I would like this to start up in an OFF state. Can anyone tell me how to set it up to do this, or offer a circuit modification suggestion to accomplish this? Thanks.

    [​IMG]
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Connect 10K from VCC to pin 4, and 100nF cap from pin 4 to GND. That should generate reset signal on power up.
     
  3. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    Hi Kubeek. Thanks for your suggestion. I did try it and it does not work. The circuit behaves no different at all with the added circuitry. Note that in the project depicted, the S and R pins are tied to ground. If I remove the ground connection on the S pin, then the circuit no longer works. Same with the R pin.

    Does anyone else have a suggestion to offer? Or should I scrap this and start over with an alternate circuit? I just want a latching toggle switch to toggle the dial lamp on a portable device. Normally, the lamps have a momentary switch to illuminate the dial. I would like to be able to allow the light to illuminate on/off using the original momentary switch to keep external modifications to a minimum.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The easiest way to start with the output off would be to change the R4 connection from pin 1 to pin 2 on the 4013. The Q and Q\ outputs are complementary, so when Q is high, Q\ is low and vice versa.

    As far as Kubeeks' mod, he had the right idea, but the cap and resistor connections swapped.

    Remove the ground from pin 4 (RESET input).
    The cap needs to go from pin 4 to +12v instead of ground.
    The 10k resistor needs to go from pin 4 to ground instead of +12v.

    That way, the cap will pull the RESET input high by following the 12v supply when first powered on, and then the resistor will charge the capacitor, pulling the RESET input back to ground.

    If it's still not starting off with the output low, then increase the resistor to 47k or 100k.

    But, the 1st mod is easier.
     
    superduper likes this.
  5. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    WooHoo! Yes! Sgt. Wookie to the rescue.

    I didn't bother trying the additional circuitry because like he said, merely
    tying the R4 connection to pin 2 instead of pin 1 was the solution. Initially, I thought he meant to switch the R4 and R5 connections with pins 1 and 2 respectively but when that didn't work, I tried it exactly like he said and voila, it really was that simple. :D

    Just a note, I also increased R1 to 270 ohms instead of the 47 ohms as recommended in the schematic. That seemed to improve the debouncing response with less false triggering than I saw with the 47 ohms.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Gee, I didn't even look at R1.
    The 1N4148 might fail on you, as they have a pretty low current rating. When the transistor Q1 cuts off the current, D1 will get a pretty healthy blast. You could replace it with any 1N400x diode (1N4001 to 1N4007) for better reliability.
     
  7. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    44mA is no big deal to a 1N4148. Have a look at the datasheet.
     
  8. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    D1 is a non-issue because I did not implement the relay into the circuit. The 2N3904 will power the dial lamp LED's directly. I am assuming about 30mA -- maybe 80mA max if I go crazy with the lighting. I think datasheet for the 2N3904 says it will handle 200mA and 625mW so that should be fine I think? :confused:

    Anyhow, I built one and it worked fine. With film caps. Then confirming that it worked fine, I built 3-more and this time, I used the cheaper electrolytic caps. But the last 3 would then power up in ON state again. So I had to redo the PCB and move the transistor base connection (R4) back to pin 1 instead of pin 2 of the other completed project. All I can say is..... :confused::confused::confused:

    Why would it power up in ON state using pin 1 of the 4013 on one project, then power up in ON state using pin 2 of the 4013 in another project? Does the type of cap make a difference, even if same value? I'm befuddled. Seems I can correct it by merely swapping either pin 1 or 2 to get the startup state that I want but really makes me wonder what conditions determines the startup state.
     
  9. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    As kubeek said, you need a Power On Reset, only he got it backwards.
    Also, clock rise and fall times need to be less than 30usec (see datasheet). Maybe your circuit does this. I didn't analyze it.
    You can use the other half of your CD4013 to debounce the switch without violating this condition. See the attached schematic.

    EDIT: I just realized that you get one clock pulse from the debouncer when you press the switch, and another when you release it. I have to think about this.:(

    EDIT: OK, I fixed it. I had forgotten the cap from the switch to GND (with 100Ω in series to keep contact current from being too high).
     
    Last edited: May 15, 2011
  10. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    I simulated your circuit, and it looks good, except for the fact that you need a Power On Reset circuit. It is simpler than mine.
     
  11. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    Thanks Ron. OK, I initially just went with SgtWookie's recommendation to swap either Q1 or Q2 to get the proper startup state because it was a simpler solution than the startup reset route but seeing that if conditions and component selection (cap type) changes, I could end up with different results -- then looks like I will indeed need to insert the startup reset circuitry so it will work reliably and predictably which is essential in case I decide to have some PCB's made.

    As for the debouncing -- R1, R2 and C1 seems to perform a satisfactory job of debouncing. I've tested it for a long time on the breadboard before transferring it to a small PCB and concluded that it works best with R1 @270R instead of 47R. One momentary throw of the switch = one pulse and the output does change state. So I'm thinking probably not necessary to make the project any more complicated by using the other 1/2 of the 4013.
     
  12. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    I agree that the debounce circuit you posted is simpler than mine.
    You need power on reset because the FF internal circuitry is symmetrical, so you can't predict which state it will come up in.
     
  13. superduper

    Thread Starter Active Member

    Dec 5, 2010
    53
    0
    That's all I needed to know. Thanks again to everyone. :)
     
Loading...