Author Topic: The All-Discrete Heavy Duty Square Wave Generator  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
The All-Discrete Heavy Duty Square Wave Generator
« on: October 30, 2024, 08:17:21 pm »
I wonder if this would work for a solid low frequency.  I may use this for an all-discrete digital clock and other things.  Might just be cool on its own.
 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #1 on: October 31, 2024, 12:29:37 am »
Why so complicated? Isn't that basically just an astable multivibrator?
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #2 on: October 31, 2024, 02:56:54 am »
Isn’t the traditional astable kinda unstable and unpredictable?  This should always start right away and be more controlled with a clean output.
 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #3 on: October 31, 2024, 03:09:09 am »
Unstable and unpredictable? Not necessarily. You might want to read this article on the subject, using BJTs; he shows several variations of the astable multivibrator. Like this one:



28 MOSFETs seems a little like overkill to me*. Where did you find that circuit?

* Unless that's the schematic of an IC (but can't be, not with those caps).
« Last Edit: October 31, 2024, 03:19:42 am by Analog Kid »
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #4 on: October 31, 2024, 03:35:56 am »
Yeah I’ve seen a couple different schematics for it. It’s a bit boring though haha. I’m not worried about being efficient…make it big. This is my own schematic, just finished today.
 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #5 on: October 31, 2024, 03:37:58 am »
So how does that work?
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #6 on: October 31, 2024, 04:08:07 am »
So there’s 4 latches. Left to right, the first latch charges up and turns on, bringing the output high. That causes the second latch to charge up and turn on, which resets the first latch, which brings the output low. With the second latch on, the third begins to charge up and turn on, which brings the output high again. That causes the fourth latch to charge up and turn on, which resets the second and third latches, bringing the output low. Now the first latch can charge up and turn on again, bringing the output high and resetting the fourth latch. The output is an OR gate connected to the first and third latches.

I also just realized the second latch divides the frequency by 2.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #7 on: October 31, 2024, 04:15:59 am »
Isn’t the traditional astable kinda unstable and unpredictable?  This should always start right away and be more controlled with a clean output.

That depends very much on how you design it.
It does not need to be anything like that complex to have low element errors, in fact, the fewer parts the better.

It is tough to find capacitors with better than 1% tolerance, so a design would try to use the lowest number - ie ONE.
Resistors sub 1% are more common, (0.1% are practical & even 0.05% in low ppm/K ), but again you try to use the lowest number.

AVX says this :
C0G (NP0) ceramics offer one of the most stable capacitor dielectrics available. Capacitance change with temperature is 0 ±30ppm/°C which is less than ±0.3% C from -55°C to +125°C. Capacitance drift or hysteresis for C0G (NP0) ceramics is negligible at less than ±0.05% versus up to ±2% for films. Typical capacitance change with life is less than ±0.1% for C0G (NP0), one-fifth that shown by most other dielectrics.

NPO CAPs are limited to below ~ 100nF


I wonder if this would work for a solid low frequency.  I may use this for an all-discrete digital clock and other things. 
What frequency, precision and stability do you expect to need for this digital clock:-//


Even if you manually trim this, the AVX info says    Typical capacitance change with life is less than ±0.1% for C0G (NP0)
« Last Edit: October 31, 2024, 05:18:46 am by PCB.Wiz »
 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #8 on: October 31, 2024, 04:27:54 am »
If you want to use something like your design, seems like you should be able to get it down to just two latches in a cross-coupled arrangement (like the traditional astable) and get rid of those other pieces. Probably make it more stable and accurate that way.
 

Online schmitt trigger

  • Super Contributor
  • ***
  • Posts: 2418
  • Country: mx
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #9 on: October 31, 2024, 02:38:19 pm »
I understand and appreciate the fact that you would like to design and build an unconventional  and difficult clock generator. Like George Mallory said about his motivation for scaling the Everest: Because it is there.

But like others have already pointed out, the results will be disappointing for the simple reason that the timing components have wide tolerances and tempcos. The frequency accuracy and stability will be anything but “solid”.
There is a reason crystals are used as timing components. You want a challenge? Use a common 32.768Khz tuning fork oscillator as your timebase and design the discrete divider chain.
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #10 on: October 31, 2024, 03:01:50 pm »
Yep, I understand about the tolerances.  I was planning on having a cal pot or two, and maybe a display to show the frequency.  Big ambitions lol.  I was thinking 10 Hz to display tenths of a second.  Now I'm thinking I might just build it for fun on its own and see what the results are because I think it's cool.  And use a more standard circuit for the clock, if I ever get back around to it.

I tried building a circuit around a 32.768 Khz oscillator and could only get any kind of oscillation when I touch it or around it, haha.  And I don't think it was even the right frequency - pretty sure it was just the inverter oscillating at some random frequency.  Maybe I'll post the circuit I was using in another topic to get some feedback on it.     

 
« Last Edit: October 31, 2024, 03:31:50 pm by GreggTech »
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3987
  • Country: nl
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #11 on: October 31, 2024, 07:47:06 pm »
Looks a lot like a ring oscillator. You can make a ring oscillator by chaining together an odd number of logic inverters. A ring oscillator can be easily built on a breadboard. No other parts required, although a power rail decoupling capacitor is still recommended. If you also build one on perf board, or simply dead bug style, you can see the effect of the breadboard capacitance slowing the thing down. With some extra RC combinations you can slow it further down.

For the rest, I fail to see the goal of this exercise. RC based circuits are never going to be very stable (1% over a decent temperature is a sort of ball park figure)
Using a few NE555 (if you want to adjust frequency & pulse width separately) seems more practial approach, but practicality (or usability?) is apparently not the goal here.  :-//
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #12 on: October 31, 2024, 08:38:24 pm »
Yes I have played around with ring oscillators.  This is really just for hobbyist fun - not for a commercial product or anything like that.  Not for practicality.  Just something fun to look at with a modest amount of precision.  Perhaps I should have taken out the word "solid" haha. 
« Last Edit: October 31, 2024, 08:40:07 pm by GreggTech »
 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #13 on: October 31, 2024, 08:42:19 pm »
I appreciate your hobbyist approach here. Pretty much mine too.

1. For any kind of clock, it seems like you really want/need to use a crystal if you want any kind of accuracy.

2. If you're going to go down the road of your homebrew design (which is impressive, if a bit clunky and overdone), I'd still really like to see what you can do with just two of those latches toggling each other. Intuitively it would seem that that arrangement would be much more accurate than what you have, since each stage can add its own bobbles to the final signal. Who knows? you might be able to tune it reasonably well to use as a clock base.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #14 on: October 31, 2024, 09:04:06 pm »
Yep, I understand about the tolerances.  I was planning on having a cal pot or two, and maybe a display to show the frequency.  Big ambitions lol.
That's why you need to define what accuracy is acceptable to you, before you start.
eg 1 minute per day, is about 0.07% - is that good enough for you ?
1 Second per day is about 11.6ppm, outside the reach of RC circuits, and even pushing 32Khz tuning fork crystals.

  Now I'm thinking I might just build it for fun on its own and see what the results are because I think it's cool.
Always a good idea to test an idea. 

I tried building a circuit around a 32.768 Khz oscillator and could only get any kind of oscillation when I touch it or around it, haha.       
32kHz should be simple. There are many CMOS parts like 4060/4521/4541/AHC1G4215 etc that can oscillate and divide for you.

  I was thinking 10 Hz to display tenths of a second. 
From AC mains, 10Hz is simple, from 32.768kHz that's more of a problem. It can be done, but you need to divide by 3276.8.
In practical terms that means alternating /3277/3277/3277/3277/3276 to average an exact /3276.800
Easy on any small MCU, not so simple in discrete parts.

 

Offline Analog Kid

  • Frequent Contributor
  • **
  • Posts: 964
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #15 on: October 31, 2024, 09:27:29 pm »
I discovered, when trying to design a device to generate an accurate 60 Hz wave, that a 4.9152 MHz crystal (easily available) will divide neatly down to that (divide by 10, then by powers of 2).
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #16 on: November 02, 2024, 06:04:00 pm »
I appreciate your hobbyist approach here. Pretty much mine too.

1. For any kind of clock, it seems like you really want/need to use a crystal if you want any kind of accuracy.

Idk if I'm big-brained enough for it to be anything but that lol.  But yes I'd like to revisit the crystal circuit at some point.  Would be great to get it working.     

2. If you're going to go down the road of your homebrew design (which is impressive, if a bit clunky and overdone), I'd still really like to see what you can do with just two of those latches toggling each other. Intuitively it would seem that that arrangement would be much more accurate than what you have, since each stage can add its own bobbles to the final signal. Who knows? you might be able to tune it reasonably well to use as a clock base.

Yeah I'd have to go back to the drawing board to figure out how to get two of the latches designed this way to toggle reliably.  But I know what you mean.  I also have a discrete master-slave T-flip flop design with diodes and FETs that maybe I could modify to be free-running.

I discovered, when trying to design a device to generate an accurate 60 Hz wave, that a 4.9152 MHz crystal (easily available) will divide neatly down to that (divide by 10, then by powers of 2).

Oh yeah, divide by 10 then 2^13.  Nice.

That's why you need to define what accuracy is acceptable to you, before you start.
eg 1 minute per day, is about 0.07% - is that good enough for you ?
1 Second per day is about 11.6ppm, outside the reach of RC circuits, and even pushing 32Khz tuning fork crystals.

1 minute per day would be good enough.  I think it would just be fun to look at and set the time.

32kHz should be simple. There are many CMOS parts like 4060/4521/4541/AHC1G4215 etc that can oscillate and divide for you.

Ah yes, but that'd be cheating.  I'd like it to be all-discrete and unconventional.  In the crystal circuit, I was using a PMOS/NMOS totem pole for the inverter (BS250P/2N7000), then another one on the output as a buffer.   

From AC mains, 10Hz is simple, from 32.768kHz that's more of a problem. It can be done, but you need to divide by 3276.8.
In practical terms that means alternating /3277/3277/3277/3277/3276 to average an exact /3276.800
Easy on any small MCU, not so simple in discrete parts.

10Hz would indeed be challenging from a crystal with discrete parts.  I may just do seconds.  Didn't really want to mess with the mains, but I agree it'd be easier.  Leo's Bag of Tricks on YouTube did a nice discrete digital clock using the mains.     
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #17 on: November 02, 2024, 07:40:05 pm »
  But yes I'd like to revisit the crystal circuit at some point.  Would be great to get it working.     
I posted a variant of a PNP/NPN pair 32kHz oscillator, that is very forgiving, and gives a good output swing.
see :
https://www.eevblog.com/forum/projects/looking-for-transistor-based-32khz-quartz-test-circuit/msg5652417/#msg5652417

That's why you need to define what accuracy is acceptable to you, before you start.
eg 1 minute per day, is about 0.07% - is that good enough for you ?
1 Second per day is about 11.6ppm, outside the reach of RC circuits, and even pushing 32Khz tuning fork crystals.

1 minute per day would be good enough.  I think it would just be fun to look at and set the time.
To get even 1 minute a day, you need low bias currents and low temperature drift.
It might be ballpark doable with IC's like low noise opamps or a precision ALD555 (not cheap, but good ppm/K), but using discrete parts you would be forever chasing your tail.
 
Setting the time is a whole different ball game !


Quote from: GreggTech
I'd like it to be all-discrete and unconventional.
Understood, but you can consider SOT23 sized packages pretty much discrete ? .... A clock built entirely of SOT23 sized packages is certainly unconventional !
« Last Edit: November 02, 2024, 10:32:16 pm by PCB.Wiz »
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 1375
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #18 on: November 02, 2024, 08:38:20 pm »

Setting the time is a whole different ball game !


I figure you could just manually press a push button to switch the clock signal from 32kHz to, say, 1MHz.  Then release the push button once the clock has arrived at the correct time setting.
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #19 on: November 03, 2024, 02:49:39 am »
You guys talking about 1% capacitor tolerances when the whole circuit trigger point is at the mercy of whatever VGS(TH) each FET happen to be? Did I miss something here?
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #20 on: November 03, 2024, 03:04:14 am »
You guys talking about 1% capacitor tolerances when the whole circuit trigger point is at the mercy of whatever VGS(TH) each FET happen to be? Did I miss something here?

Of course, the capacitor tolerance and drift discussion applies to a far better circuit design.
Differential circuits and OpAmps  / Comparators can remove Vbe or Vgs effects, leaving just some constant * R * C, as the primary equation.
Good timing parts can get as low as 10ppm/'C, in the active element.
 

Offline GreggTechTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #21 on: November 03, 2024, 04:31:23 am »
I posted a variant of a PNP/NPN pair 32kHz oscillator, that is very forgiving, and gives a good output swing.

Cool, thanks - looks similar to mine, just with BJTs and biasing components.  I'll have to give it a try. 

To get even 1 minute a day, you need low bias currents and low temperature drift.
It might be ballpark doable with IC's like low noise opamps or a precision ALD555 (not cheap, but good ppm/K), but using discrete parts you would be forever chasing your tail.
 
Setting the time is a whole different ball game !

Do you think I'd get a min/day using something like your 32.768 Khz crystal circuit?  It really doesn't matter to me that much - just getting something working that has the appearance of keeping time is good enough for me.  I may try to build the square wave generator monstrosity I came up with just for fun with some LEDs and pot controls to display on its own if it works reasonably well. 

For setting the time, I have a circuit design that would theoretically cut off the oscillator output with a FET (not stopping the oscillator), enable a line that manually toggles the counters, and use an SR latch to toggle another line that determines the counter direction based on if a rotary encoder is turned clockwise or counterclockwise.  Some LED indicators for all of that too. 

You guys have given me some great feedback and resources to look into - thanks!  Will share some updates if I manage to get something physically built and working.
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #22 on: November 03, 2024, 05:03:58 am »
Properly driven 32kHz xtal should easily give you ~1min/month, provided you aren't too crazy with ambient temperature swing.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: au
Re: The All-Discrete Heavy Duty Square Wave Generator
« Reply #23 on: November 03, 2024, 05:09:33 am »
Do you think I'd get a min/day using something like your 32.768 Khz crystal circuit? 
Easily.
A 32.768kHz crystal will get you into the single digit seconds per day ballpark.
Do you have a means to measure frequency accurately ?
If you can get your hands on a SN74LV8154 (DIP20 or TSSOP20) and borrow a GPS with 1pps, you can check your trim.
Every 1 second resolves to ~30ppm, from 32.768, and if you reset and then take a picture of the 8 LEDs after 61 seconds, the LSB is ~ 0.5ppm
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf