Maker Pro
Maker Pro

Question about crystal time base

kong

Sep 26, 2010
122
Joined
Sep 26, 2010
Messages
122
So I have built this circuit (attached) and have used it to drive a 7 segment counter circuit. For simplicity, lets assume the counter circuit is a single digit.

It works terrifically, however, I would like to be able to change to higher frequencies by the push of a switch. (make the counter count faster)

I attempted this with a relay configuration; NC (no power to relay) the counter would be connected to (0.5hz), and when the relay is energized the contacts would switch to a higher frequency, say, 4hz.

The issue i'm having is when I energize the relay, the count on the display will skip, and when I de-energize it, it will skip again. I'm assuming this is because of contact bounce, but I can't be sure.

Does anyone know how I might fix this? Could solid state switching be the key? Could the addition of a monostable(s) circuit offer a fix?

Thanks in advance for any advice. http://www.hackersbench.com/Projects/1Hz/
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
A relay is a very bad choice due to contact bounce (as you have noted).

doing this with logic gates would be the best way, and whatever switch you use should also be debounced. Depending on what the outputs are like when you switch between them, you may get an additional transition.

There are several ways to do this, but an analog multiplexer chip may be simplest. You may need some logic to do the debouncing, and if you use a 40106 for this, with some cleverness (and diodes and resistors) you could use the remaining gates to perform this function.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I think that may be overkill, but that is certainly a solution.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
If I have time later today I'll draw you one :)
 

kong

Sep 26, 2010
122
Joined
Sep 26, 2010
Messages
122
Thanks! Also I'm researching the 74HC4051....i've never worked with multiplexers before but this seems like a starting point. Thanks again!
 

kong

Sep 26, 2010
122
Joined
Sep 26, 2010
Messages
122
Ok so i've built the single digit 7 segment display with the appropriate logic, (4510, 4511), and the timebase specified at the start of the forum. I took the outputs from the 4027 (0.5hz, and 4hz) and connected them to y0 and y1 respectively on the 4051, and applied power. Depending on the state of the select pins, (high, low) I can successfully toggle between 0.5hz and 4hz on the 7 segment. So far it works terrifically. The next step will be adding a mechanical switch of some sort with a debouncing circuit attached, such as an easy RC with the 40106. Thus far I've just manually taken the wires and pushed them into the + or - bus bar on my breadboard. I think i've figured it out but I'll keep updating until I'm sure. Thanks for your help.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Here's my Dave-CAD drawing :)

attachment.php


Gee, that's huge. Oops.

This uses a single hex schmitt triger inverter and some diodes, resistors and a capacitor to debounce a switch and switch between 2 clocks.

The clocks are CK1 and CK2, CK2 will appear inverted at the output when selected. If that is unacceptable, the spare gate (IC1f) can be used to invert it before it is passed into this circuit.

S1, R1, C1, and IC1a create a debounced logic level from the switch input.

When S1 is open, and C1 is discharges (at power on) the input if IC1a is initially low -- giving a high output. The resistor R1 charges up the capacitor. When it reaches the input high threshold, the output goes low.

Pressing S1 shorts the capacitor, rapidly dropping the input voltage, and making the output go high. The RC delay needs to be long enough that the capacitor cannot charge up to the input high threshold between bounces. The capacitor needs to be small enough to rapidly discharge through the switch without damaging it.

When R1 is released (and the bouncing stops) R1 charges C1 to the input High threshold and the output of Ic1a goes low after a short delay.

So, when S1 is pressed, the output of IC1a is high, when it it open the output is low. The output is resistant to bounces (how resistant depends on the RC time constant)

When the output of Ic1a is high, D1 forces the input of IC1b high and the output of IC1b remains low (regardless of the CK1 signal). D3 is reverse biased. At the same time D2 is reverse biased and CK2 appears at the output of IC1d alternately forward and reverse biasing D4.

When it it the output of Ic1a is low, D2 forces the input of IC1c low (regardless of CK2). The output of IC1d remains low and D4 is reverse biased. At the same time D1 is reverse biased and CK1 appears (inverted) at the output of IC1b alternately forward and reverse biasing D3.

D3 and D4 are "wire-or"ing the outputs of IC1b and IC1d. R4 pulls the input of IC1e low if both IC1b and IC1d are low. If either is high, the input of IC1e goes high.

Thus, S1 controls which cock appears at the output.

IC1 40106
C1 0.1uF
D1-D4 1N914 (1N4148)
R1 1M
R2-4 10k
When
 

Attachments

  • Scan-121221-0002.jpg
    Scan-121221-0002.jpg
    83 KB · Views: 171

kong

Sep 26, 2010
122
Joined
Sep 26, 2010
Messages
122
Wow, thank you! That looks great. Thanks for going to the trouble. I might have to pick up some parts for this one, but in the meantime I'll test the multiplexer chip that you suggested as well, and maybe I'll have two ways to do it!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
If you use the multiplexer chip (which is fine) then you'll still need to debounce the switch (which is what the first part of this circuit does.
 

kong

Sep 26, 2010
122
Joined
Sep 26, 2010
Messages
122
mmm ok, at the moment i'm working on that, but if this doesn't pan out like I'm hoping it will, I'll be sure to refer to your schematic instead. It's always good to have options :)
 

Similar threads

Top