Square wave generator

I have never benn able to get the above ckt to work with a 7400 or a 74LS00! I did get it to work nicely with a 74HC00!

I wonder if it would actually work with a 74LS00 OR would the ckt require 3 NAND gates? Or, are the component values wrong for a 74LS00?

by RayLeiter
January 21, 2023

Simulation shows, the square waves matches the propagation delay (T_PD) of the gates.Can you explain how the circuit works in the real world? What PWM frequency did you achieve?

by Dan.Ka
January 23, 2023

I'm not sure if I provided an answer to you question by the right approach. I used the "Answer" facility.

by RayLeiter
January 23, 2023

2 Answers

Answer by RayLeiter

First, thanks for your reply. I'm not sure what you mean by your question "Can you explain how the circuit works in the real world?". I have read a few explanations of how the circuit works and I understand them. Among those I've read is the one given by the contributor of the ckt. on the website "Gadgetronics". As for your second question: "What PWM frequency did you achieve?", here is what I observed on my Rigol DS1054 scope: f = 84.7 Hz., Duty Cycle = 52.54%. The theory, via f = 1 / (2.2R1C1), yields f = 90 Hz. This is good agreement (the IC was 74HC00). These days it's hard to find 7400 series ICs. I was really surprised when the 74LS00 didn't work. When I say "something didn't work", I mean the result is no where near what is expected. In the case of the 74LS00, the output wave was no where near being stable - I couldn't determine the freq.! The output appeared to be VERY HIGH frequency (near 100 MHz., I think). Since the circuit appears to yield an output freq. dependent to some extent on the prop. delay (T_PD), I can only conclude that the T_PD of the 74HC00, which is 8ns is somehow better than the T_PD of the 74LS00, which is 3-10ns. I'm not smart enough to actually provide an anlysis to show what happened. Do you think different values of the components (R & C) might work with the 74LS00? Thanks Ray

+1 vote
by RayLeiter
January 23, 2023

Answer by vanderghast

Run the simulation (time transient) and observe that the period is 20 ns.

I added explicit reference to the ground with 1Meg resistor to simulate a near floating condition.

But the datasheet of the 74LS00 mentions that the raise time time is ... around 10 ns, with a load of 15 pf, and 15ns with a load of 50pf. You use ... 1 uF, way too much. (Raising down, or sinking, is a little bit faster for LS tech., but clearly, what you are asking is just too fast.)

74LS00 old simplified datasheet

A more recent datasheet for Texas Instruments is available, with more details, if you are interested.

The simulator does NOT consider the raise time and display a rectangular waveform, but it just happens that it highly becomes technology dependent.

+1 vote
by vanderghast
January 25, 2023

I think this has gotten out of hand. My only reason for posting the question was to see if anyone could explain why the circuit doesn't produce a square wave output with a freq. of approx. 90 Hz, which is what you obtain by doing the calculation given for the output freq. This ckt. is not anything I came up with. I just copied it from the website "Gadgetronics". I don't have a 7400, so I thought is would work with a 74LS00. It didn't -- but it did work with a 74HC00!! I guess the thing I should take away from this is that the technology used for the IC is important to make the ckt work. As I have indicated, it produced an output of approx. 84 Hz when I used a 74HC00, which in theory (when calculated) is 90Hz. I was wondering if I could obtaing the same 84 Hz. output with a 74LS00 by changing the values of the external components, like R1 or C1 -- apparently NOT!

by RayLeiter
January 25, 2023

Try using a 74LS132 or, instead of the circuit you show, a single (removing one NAND and one resistor) 74LS14. These Schmitt trigger NAND for the 74LS132, NOT for the 74LS14, should help firing at a much lower rate, as you seek, given the hysteresis supplied by the Schmitt trigger. Those components are not available here to the simulator, as far as I know.

Any clock circuit based on a capacitor is unlikely of a reliable precision toward temperature changes, though, and is generally not energy friendly.

by vanderghast
January 26, 2023

Take a look at figure 6 (or the whole doc. if you are really interested to know about the "why" you need a Schmitt trigger IC.)


by vanderghast
January 26, 2023

I don't have a 74LS14, but I do have a 74HC14 and it works. With it, I got f=147 Hz. where the calculation yields 83 Hz -- close enough! I also have a 40106 and it works. With it, I got f=166 Hz. Again, close enough! I am fully aware of what would be needed if I were to want to build a "real" square wave generator. My involvement in this effort is only out of the pure joy of fiddling around with digital electronics. Thanks for the reference (AN-118). If you will, take a look at this: "https://www.gadgetronicx.com/square-wave-generator-logic-gates/". It is where I began this journey. Notice the first ckt. is shown with a 7400. I wonder if it really works or is it some attempt at explaining theory behind using gates to build square wave generators? I could probably get a 7400 from a friend and try it but I'm not sure it would be worth the effort. Don't you think it's interesting that the ckt. I've shown works with a 74HC00 (which isn't schmitt)? Clearly the schmitt trigger capability is not an absolute requirement -- I suspect the "H" in 74HC00 has something to do with it working. Functionally the 74LS00 and the 74HC00 are equivalent. However, they are not equal when used in the manner of the 2 gate square wave generator shown in the ckt I provided. The different technologies involved (TTL vs CMOS) are clearly relevant -- I don't know how, though.

by RayLeiter
January 26, 2023

The Schmitt trigger is a must if the number of gates is even, but not required if that number of gates (NOT, or NAND uses to make a NOT) is odd, as explained in AN-118. And when I say "a must", it is just to be "sure" that it will work for whatever technology, or even within a given technology (given the possible variations from chip to chip). That is why the double gate (as you used) is not so often uses, in practice, even if it is often mentioned as supplying a square wave: it is just not reliable without Schmitt trigger chip.

by vanderghast
January 27, 2023

Thanks again for the insight. From what you're saying, I shouldn't expect the 2-gate version of the circuit to always work even though I use the 74HC00! I was thinking the use of the 74HC00 was a certainty for the circuit to always work. But, as I'm learning from you and the AN-118, I was just fortunate. Thanks for the time you spent on this -- I appreciate the help I can get from folks like yourself who use tools like CircuitLab to respond to those who request help.

by RayLeiter
January 27, 2023

Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers

Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.

About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.