# Creating a 1Hz square pulse

1. Jun 15, 2017

### minhduc515

i'm new on creating my own circuit. And i'm trying to create a digital clock, using 74ls90+74ls47
I have problem on creating 1hz square pulse part.

This is my teacher's Simulation

I have searched on google that i can create 1hz pulse by using NAND gate, crystal, or Ne555, but i can't find any document have image same to my teacher's simualtion

Anyone can explain me how that circuit work ? And how i can choose value of resistor, capacitor ? (eg :R43 = 4k7, R44 = 1k, C3 = 100uF ..)

(Link to the simulation, using Altium Designer : https://www.mediafire.com/?a4yljeglibk9rei)
Sorry for my bad English :D

2. Jun 15, 2017

### .Scott

When the circuit starts, the output of U13A will either by high or low. Which ever it is will cause a voltage swing on its input as current moves through R43 to either charge or discharge C3. This will continue until the U13A input voltage crosses the threshold so that the input is interpreted as switching from eithe 1 to 0 or 0 to 1.

Let's say that U13A output goes high. It will immediately force U13B low and two things will happen: Our circuit output will go low, and this sudden transition to low will be pass through C3 and reinforce the already low state of the U13A input. From here, R43 will slowly recharge C3 eventually causing the U13A input to cross the voltage threshold and become a logic 1. Making U13A go low, U13B go high, and everything happens in reverse until we reach the start of a new square wave.

In this case, "slowly" means half a second. So, in order to determine values for C3 and R43, you will need to know the output voltage swings of U13A and U13B and their 0-1 and 1-0 input transition voltages.

3. Jun 15, 2017

### Staff: Mentor

Welcome to the PF.

You're not going to get a very accurate clock with an RC circuit. Even if you use a potentiometer to tune the frequency close to 1Hz, it willl drit with temperature and over time.

A much better way (and simpler) is to use a 32kHz watch crystal and a 74HC4060 oscillator + divider IC. I've used these before for a number of circuits, and the 4060 is a sweet IC. The figure below shows that you get 2Hz out of Q14, so to get 1Hz, just add one more external Flip-Flop.

https://www.eevblog.com/forum/micro...-oscillator-with-74hc4060-doesn't-oscillate!/

4. Jun 15, 2017

### jim hardy

5. Jun 15, 2017

### davenn

yeah nice one Jim

exactly what I used on my old analog seismograph system for generating minute markers

Dave

6. Jun 16, 2017

### minhduc515

thanks :D but i have already talked to my teacher that i'll use NAND gate create a 1hz square pulse :D
I have found this site about NAND gate waveform generator, that similar to my simulation : http://www.electronics-tutorials.ws/waveforms/generators.html
It said that the frequency of the square wave is given by f = 1 / 2.2 R1C1. But how it is derived?

7. Jun 16, 2017

### Staff: Mentor

So it sounds like this is for a schoolwork / homework assignment, so I will move it to the schoolwork forums for you.

Also, since this is your assignment, you should try to do the calculation yourself and show us your work. We can check it for you.

8. Jun 16, 2017

### Staff: Mentor

BTW, you show a 100uF polar capacitor in your original circuit. Why is it a design error to use a polar capacitor in that position?

9. Jun 16, 2017

### CWatters

It's pretty complicated to derive that equation and I'm not going to try here. Basically the capacitor charges in alternate directions with an exponential waveform of the form

Vc = Vcc(1-e-t/T).......................................(1)

See "Stable RC oscillator" in here...

https://www.fairchildsemi.com/application-notes/AN/AN-118.pdf

I would start with the waveform on the capacitor at the top of page 3. Note how the voltage on the capacitor goes below 0V and above Vcc. The capacitor actually charges from -0.5Vcc towards Vcc. When it reaches 0.5Vcc the logic gates toggle and the capacitor voltage shoots up to 3/2 Vcc and starts discharging towards 0V. So in my equation (1) you need to replace Vcc with 3/2*Vcc.

Knowing the starting and ending voltages it's possible to plug all the numbers into the capacitor exponential equation to work out "t" the time each phase takes and hence the frequency.

The equation you quoted (f = 1 / 2.2 R1C1) is actually a simplified version of the full equation they give on page 2. It assumes R2 >> R1. The capacitor C is mainly charged by current flowing through resistor R1 but there is a complication because the capacitor voltage exceeds Vcc and goes below 0V. This voltage is "clamped" to Vcc and 0V by the input diodes on gate A so there is a voltage across and current through R2. This effects the charge/discharge time and explains why their equation is more complicated. If you assume R2 >> R1 then R2//R1 is approximately equal to R1 and their equation is the same as the one you quoted.

It's slightly easier to understand how the single Schmitt Input oscillator works. If you are committed to using a NAND gate then a single Schmitt input NAND gate oscillator (74xx132 with one unused input connected to Vcc) might be a possibility.

10. Jun 16, 2017

### Baluncore

minhduc515;
You are asking for a square wave but I do not think you actually need a square wave, you only need a regular digital pulse signal with one pulse per second. A counter or divider only advances on one edge of the clock signal so the duty cycle does not need to be exactly 50%. If you take a train of short rectangular pulses and use a D-type flip-flop to divide that frequency by two, you will get a square wave with 50% duty cycle. It is difficult to build a true square wave oscillator using TTL logic which has an asymmetric internal circuit structure.

The 74LS00 circuit may work as a model, but I would not actually build an oscillator that way. Apart from the polar capacitor pointed out by berkeman in post #8, there is also an electrical problem with the LED and R44.
TTL gates are a “current sinking logic” and have little ability to supply current from Vcc through a loaded output to ground. If instead you connect the LED and series resistor between +5Vcc and the TTL output it will be much happier, as a TTL gate is very good at sinking current when low. The LED will then be on when the gate output is low.

The output characteristics of TTL are described here; https://en.wikipedia.org/wiki/Transistor–transistor_logic#TTL_with_a_.22totem-pole.22_output_stage

A TTL input signal is defined as "low" when between ground and 0.8V with respect to the ground, and "high" when between 2V and +5Vcc. https://en.wikipedia.org/wiki/Transistor–transistor_logic#Interfacing_considerations