1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Generating 1/2 second timeout without buying dedicated RTC chip

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by mik3ca, Nov 2, 2017.

  1. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    184
    Likes:
    1
    I'm trying to make a fairly accurate external timer to use with my microcontroller that expires 1/2 second later using low-priced parts. I have come up with the following schematic:

    circuit.png

    would this schematic cause the crystal oscillator section to stop working when output Q14 is high? or do I need to instead connect the NPN collector to /PO or the xtal?
     
  2. AnalogKid

    AnalogKid Well-Known Member

    Joined:
    Sep 22, 2011
    Messages:
    1,125
    Likes:
    161
    Location:
    Ohio - GMT-5
    ONLINE
    You are close. Replace Q1 with a signal diode like a 1N914 or 1N4148 from pin 14 to pin 11. The signal output still com3es from Q14.

    ak
     
  3. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    184
    Likes:
    1
    so wait... if I connect anode of diode to Q14, wouldn't that always mess the oscillator? or do I reverse-bias it?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. AnalogKid

    AnalogKid Well-Known Member

    Joined:
    Sep 22, 2011
    Messages:
    1,125
    Likes:
    161
    Location:
    Ohio - GMT-5
    ONLINE

    Anode to Q14, cathode to P1. For 1/4 second Q14 is low so the diode is reverse biased. You might have to eliminate the 10 pF capacitor at P1 because the diode junction capacitance might be enough. After 1/4 second, Q14 goes high and the diode conducts, holding P1 high and stopping the oscillator.

    A potential problem is that the frequency at Q14 is 2 Hz, so each half cycle is 1/4 sec. Without knowing what the output is used for, we can't say if this is good enough.

    ak
     
  6. ci139

    ci139 Active Member

    Joined:
    Apr 12, 2012
    Messages:
    469
    Likes:
    37
  7. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    184
    Likes:
    1
    I just need a simple timer where the output stays high after a certain amount of time has elapsed. I want an 8051 microcontroller to detect it. I'm effectively trying to stop the CPU from freezing my program for several hundred thousand cycles at a time
     
  8. AnalogKid

    AnalogKid Well-Known Member

    Joined:
    Sep 22, 2011
    Messages:
    1,125
    Likes:
    161
    Location:
    Ohio - GMT-5
    ONLINE
    Many 8051 variants have a watchdog timer built in.

    ak
     
  9. Colin

    Colin Member

    Joined:
    Sep 25, 2003
    Messages:
    397
    Likes:
    22
    Location:
    Australia
    The output is only going to go to half a volt. Is that enough?
    The 10p's need to be about 33p
     
  10. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,083
    Likes:
    326
    Location:
    Brisbane Australia
    Your micro doesn't have to " freeze for several hundred thousand cycles" in order to do this. Can't you setup a 1mS interrupt to increment a counter? Then, periodically check the counter and do what is required at the desired time(s).

    Mike.
     
  11. Colin

    Colin Member

    Joined:
    Sep 25, 2003
    Messages:
    397
    Likes:
    22
    Location:
    Australia
    Just count in the background.

    That's what I do. I sit in the corner and count sheep until its time to go home.
     
    • Dislike Dislike x 1
  12. AnalogKid

    AnalogKid Well-Known Member

    Joined:
    Sep 22, 2011
    Messages:
    1,125
    Likes:
    161
    Location:
    Ohio - GMT-5
    ONLINE
    Obviously not, since the output drives a uC. It would have been nice to explain why, and suggest a solution.

    mic - As shown, your initial schematic will work if you add one resistor in series with the base, between the base and the point where the TimeOver signal is picked off. In this way the output signal will be at full CMOS amplitude while the resistor limits the base current and separates the output signal from the base-emitter diode voltage. Without the resistor, the base-emitter diode clamps the output voltage to around +0.6 V. Because the collector current is so low, anything between 10K and 100K should work.

    And again, the delay from releasing the Reset input to a positive-going edge on the output is 0.25 s. The output will sit high until the circuit is reset, so you cannot count it twice to get a 0.5 s delay.

    ak
     
  13. mik3ca

    mik3ca Member

    Joined:
    Jun 24, 2017
    Messages:
    184
    Likes:
    1
    Ok I followed the diode setup and will use 33pF capacitors to connect the leg of the crystal (not attached to the diode to ground) and for resistors, could I use lower value resistors if I kept the ratio the same (for example, 100K across the crystal leads and 10K for the other resistor to /P0?) and if output voltage isn't high enough, couldn't I just add a resistor between output and VCC to pull the voltage up a bit?
     

Share This Page