Synched to Clock interval Timer

Discussion in 'The Projects Forum' started by haloway13, Feb 17, 2014.

  1. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    This kit came very close to what I wanted to do: http://www.apogeekits.com/pulse_pause_timer_electronic_kit_mk188.htm

    Unfortunately the accuracy of the 10 Min interval was more like 10min 15 secs + the 4s pulse. After 6 cycles overall time was closes to 62 min. Anybody have any idea as to how to alter that circuit so that the timing would be more accurate?

    I started thinking that if I could hack an alarm clock to drive appropriate and gates when all the segments off a 0 where on.... but then I get stuck with the problem that I only want a 4-5s pulse.

    From a square wave with 60s H, 540s L, 60s H, 540s L, etc. I would like to be able to drive a transistor for about 4 seconds on the leading edge that would activate a relay.

    With the need of it having high fidelity to when a clock minute ones digit is 0.

    Essentially triggering the relay @ 7:50, 8:00, 8:10, 8:20, 8:30, 8:40, 8:50, 9:00

    any input is greatly appreciated.

    Thank you,
    Tim
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    Its going to be hard to get real accurate with the RC controls they are using. It looks like they use the ADC to relate the pot settings to a target time. They have used the internal oscillator in the PIC16F676. The deviation you indicate not out of the realm of possibility (Fig 13-15 of the Datasheet). Add in ADC granularity and some (suspected) dummy delays and it can easily get off ideal time.

    The problem with hacking an alarm clock (other than the fact that it would be a kludge) is that the display is likely multiplexed, increasing the logic complexity a bit. You would have to decode the 7-seg '0' coincident with the digit select to get a pulsing signal when the '0' was lit. It would have to be an LED clock. Plus.. its a kludge.

    If you do any hacking on the PIC, you are talking new firmware, not an impossibility. I'd start with a crystal oscillator, relocating the jumpers or try another way of specifying operation. Alternately, the OSC pins can be used with a 32KHz watch crystal in LP mode to make an internal hh:mm:ss clock but I'd just use a good crystal or canned oscillator.

    Those are about your only options for that board as I see it.

    I don't know what your level of PIC expertise is but I'd be tempted to roll my own clock with display if necessary and the exact outputs needed but there may be other hobby boards out there that are closer to what you want.

    Good luck.
     
    Last edited: Feb 17, 2014
  3. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Thank you for your input. You have given me many choices.

    I like the idea of just using an external crystal oscillator. Would this require a code change?

    I tried reading through the spec sheet and I am quite overwhelmed. My gut tells me that I am way over my head. Do I need to try to figure out what the internal clock rate has been set to first before I go picking an external crystal oscillator?

    Is there such a beast as a tun-able external oscillator for the purposes of getting the timing to better by trial and error?
     
  4. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    If I read this correctly, what you really want is 4s H, 596s L, 4s H, 596s L, etc. Correct, or do you want two outputs, one high for one minute every ten, and one high for 4 seconds every ten minutes?

    Also, do you have to use a kit, or are you up for some random logic assembly?

    ak
     
  5. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    You are correct in you assessment: 4s H, 596s L, 4s H, 596s L, etc.

    Random logic assembly would be fine.
     
  6. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    Going to an external oscillator would require a code change as the PIC is programmed to use its internal oscillator PLUS, it would use at least pin 2 of the PIC as an input from an external oscillator requiring SK9 (on the schematic) to be relocated. That would require access to the source code which you don't have.

    Using the ext osc would not address the problem of reading the two pots with the ADC to set the times.

    In short, I think you are getting about all out of the board that it can deliver. You might think about these options:

    Replace the PIC with one that you've programmed to suit your task, including upgrading the timing accuracy. If dealing with PICs for the first time, consider programming in C using MikroC (extensive PIC library support) or Microchip's XC8 (lighter on the library support but supports Microchip's cheaper development debugger/programmers). Both have free versions of the compiler. Consider one of the development boards that either sells to ease wiring tasks.

    Take a look at Arduino. There is a huge user base with jillions of published projects. Its simple to program as well.

    Check out industrial timing modules from industrial suppliers like Grainger, Allied etc.

    For a chip-based solution, TimerBlox from Linear Technology may be just the ticket.

    Lots of options. What suits your fancy?
     
  7. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Certainly seems like 2 of these:http://www.linear.com/product/LTC6995-1 would do the trick.

    One set to do the 4s H one to do the 596s L. For me it gets tricky on how to set up guaranteeing that the 4s H comes first and how it will trigger the pause to start counting and then have it trigger a repeat.
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,050
    3,244
    How about using one of these to generate the 10min ±1.5% period oscillation and use that to trigger a 4s one-shot, such as with a CD4047 or 555 timer.
     
  9. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,804
    1,105
    Perhaps use a cheapo analogue battery clock as the (pretty accurate) source of 1 sec pulses, then count the pulses?
     
  10. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    So I have taken the sample LTC6991 LTSpice example and altered for the intervals I want. Running into the issue that I have no idea how to get the relay configured properly. (Is there a need for current limiting resistor needed for the relay?)

    Can somebody help me with it?

    Ultimately, I would like to attach a 12V 1.5A Car horn using a separate power source that will get activated with the relay. I guess I can simulate that with an LED with a current limiting resistor.

    Thank you!
     
  11. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    I would use a transistor to drive the relay coil, sized to be able to handle the current and voltage. Add a diode across the coil to protect the transistor. A bipolar NPN would require a base resistor but a logic level FET (e.g. 2N7000) could be driven directly.

    Sure. For the sim, just turn on an LED through a resistor or monitor the logic level output.

    BTW: Be sure to check the timing tolerances to ensure you are good in that area.. I didn't :(
     
  12. crutschow

    Expert

    Mar 14, 2008
    13,050
    3,244
    If the relay coil is rated for 5V (or whatever you power supply voltage is) you don't need a resistor.

    Yes, you can use a LED with a resistor in place of the relay.

    Note that the way it is configured the relay will be ON for 1 hour and then OFF for 1 hour. Is that what you want?
     
  13. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Here is the new circuit without the transistor and relay/diode.

    Still have a lot to learn about LTSpice. I think this circuit gives me the delay/pulse I need.

    Any feedback on how I should be adding the transistor/diode/relay?

    Thank you!
     
    Last edited: Feb 17, 2014
  14. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    A PIC or Arduino with a cheap crystal will give you better accuracy if you can handle the programming. Or, sticking to hard hardware:

    A 32 KHz watch crystal counted down to 10 minutes takes a 25 bit counter plus some decoding logic. That's a CD4060 (crystal oscillator plus the first 14 bits) followed by a CD4020 (the next 11 bits). If your 4 second output pulse can be shortened to 3.4 seconds, you have to decode only 7 bits with two 4-in AND gates to pick off one pulse every 10 minutes.

    Whatever method you use to generate the pulse, a separate problem is driving the relay. Use a transistor with a max current rating that is at least twice the relay coil current spec (4 to 10 times would be better) and a voltage rating that is at least twice the relay coil voltage. Always include a resistor in the base to limit the current. This protects both the transistor and the counter output. You already show a snub diode across the coil.

    ak
     
  15. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    So I think I figured it out. See attached.
    [​IMG]

    The reason I have a separate 12V supply is that I am really powering a 1.5A 12V car horn.

    Is there anything that I should do different?
     
  16. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    After looking at getting together all of the parts together for this circuit, along with some kind of LDO converter, it looks like it is going to be much cheaper for me to go the the route of a counter of some sort.

    Should I start a new thread with that version?
     
  17. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Or just use a microcontroller?
     
  18. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,546
    1,252
    A car horn relay might draw too much current for a 2222, so you might have to go to a power darlington like a TIP110 or 120.

    If you decide to go with a counter-based design, remember that original CD4000 series parts are good for up to 18V supply voltage. A car's electrical environment is really dirty, but the operating current (without the relay coil) will be really low. A simple resistor, zener, and cap will clip out all of the junk.

    ak
     
  19. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    So I have a clock kit that I will try to trigger off of when the minute 7 segment LED turns to 0 to achieve the need of the timer going off on the hour and 10s of minutes. I have tried to simulate what this would look like in LTSpice.

    Please look it over and critique.

    I will try to breadboard it next. Just need to get the parts.
     
Loading...