Synched to Clock interval Timer

Thread Starter

haloway13

Joined Oct 24, 2011
37
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
 

JohnInTX

Joined Jun 26, 2012
4,787
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:

Thread Starter

haloway13

Joined Oct 24, 2011
37
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?
 

AnalogKid

Joined Aug 1, 2013
10,986
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.
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
 

JohnInTX

Joined Jun 26, 2012
4,787
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?
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?
 

crutschow

Joined Mar 14, 2008
34,280
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.
 

Alec_t

Joined Sep 17, 2013
14,280
Perhaps use a cheapo analogue battery clock as the (pretty accurate) source of 1 sec pulses, then count the pulses?
 

Thread Starter

haloway13

Joined Oct 24, 2011
37
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!
 

Attachments

JohnInTX

Joined Jun 26, 2012
4,787
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!
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 :(
 

crutschow

Joined Mar 14, 2008
34,280
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?
 

Thread Starter

haloway13

Joined Oct 24, 2011
37
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!
 

Attachments

Last edited:

AnalogKid

Joined Aug 1, 2013
10,986
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
 

Thread Starter

haloway13

Joined Oct 24, 2011
37
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?
 

AnalogKid

Joined Aug 1, 2013
10,986
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
 

Thread Starter

haloway13

Joined Oct 24, 2011
37
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.
 

Attachments

Top