How slow or fast must the risetime be on a square waveform to say it is a square - Page 1
Forum section: electronics / beginners

author: TAS
author_rank: Newbie
timestamp: November 21, 2023, 11:15:58 am
content: Hi thereI was wondering about square/rectangular waveforms. Are there any rules to how fast or slow the rise time must be, or how much the rise time can take up of the on-time, to say it is a square waveform and not being a trapezoidal or triangle waveform?Let say a pulse train with a square waveform with an on-time of 10µs. I would guess that if 1µs (1/10 of ton) is used for trise, that would be just fine, but what if it were 4µs or even as bad as 8-9µs? You could hardly call it a square wave if you only had 1 or 2µs before it ramps down again or could you?

author: tggzzz
author_rank: Super Contributor
timestamp: November 21, 2023, 11:25:00 am
content: Quote from: TAS on November 21, 2023, 11:15:58 amYes: the transition time must be fit for purpose. In other words, theapplicationdefines how fast.No: there are no general rules.FFI, consider the implications demonstrated in:https://entertaininghacks.wordpress.com/2018/05/08/digital-signal-integrity-and-bandwidth-signals-risetime-is-important-period-is-irrelevant/

author: vk6zgo
author_rank: Super Contributor
timestamp: November 21, 2023, 12:05:35 pm
content: Traditionally, though, the definition is that a 50% duty cycle waveform can be regarded as a "square wave" if it contains odd harmonics of the fundamental frequency up to & including the 7th harmonic (or sometimes quoted as the 5th harmonic). (It must not contain even harmonics)That is a minimum number of odd harmonics to meet the definition---more is better!Note: A "rectangular" waveform may be of any duty cycle & will hence contain other frequency components.A square wave is thus, a special case of a rectangular waveform.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 21, 2023, 12:12:55 pm
content: There's no textbook or industry-standard definition (aside from the unambiguously "square" ideal wave, that cannot exist as a real signal), so we default to good old language and ontology.It might be useful to think of "square" as a loose, catch-all, or general term for waves that are, in various part, made by intent (say from digital sources), functionally (clipping to "square up" a softer wave?), or descriptively (a signal with a sharply bimodal histogram, both in terms of voltage, and temporally; i.e., it spends most of its time "up", then most of its time "down", and little inbetween, and only those two states per cycle). This includes waves that have a short risetime in relation to their period (say, <20%?), that may be "square" in terms of the literal angle between edges and flats, or "square" in terms of some specific range of duty cycle (near 50%, say), or even "square" in terms of some fixed ratio of voltage to time.As a result, when speaking of a more specific signal, do provide specifiers, to make clear what meaning or description you're after.For example: a PWM square wave (and what phase reference if any), a sigma-delta bitstream, SPI (clock being periodic or gated), I2C (pulse widths being erratic, determined by protocol; rise and fall asymmetric), etc.Tim

author: iMo
author_rank: Super Contributor
timestamp: November 21, 2023, 12:51:34 pm
content: .. when the "low" state approaches the "high" state with the speed of light (and vice versa)..

author: shapirus
author_rank: Super Contributor
timestamp: November 21, 2023, 01:08:12 pm
content: infinitely fast, of course. anything short of infinite is not a square (or rectangle), but only an approximation.for practical applications the maximum allowed rise and fall times of a pulse are determined for each specific use case separately. for example, many ICs have these specified in their datasheets. if the pulse edges meet the requirements, then we can say that the waveform is "square enough".

author: tggzzz
author_rank: Super Contributor
timestamp: November 21, 2023, 01:55:19 pm
content: Quote from: vk6zgo on November 21, 2023, 12:05:35 pmThat "definition"requirescontext. Without that it is no more than cargo cult engineering.

author: CaptDon
author_rank: Super Contributor
timestamp: November 21, 2023, 02:01:39 pm
content: I would tend to agree with the prior posts, "Containing at least to the 7th harmonic", of course the amplitude of the harmonics would be a factor. Also, a transition time of less than 10% of the on time or 5% of the repetition time would be good. Also, as stated a certain design may require a faster rise time. Really fast logic gates such as the 74ACT series are incredibly prone to oscillation on slow rise and fall times. If a square wave was in a high state for a year and in a low state for a year and its transition time took a full day it would still look incredibly square when plotted. When 'sampling' a square wave with a digital scope it has been said that 'good' integrity of a square wave is preserved when the sample rate is at least 10X the repetition rate of the square wave and then if the sample rate is an exact multiple of the square wave rate you may see aliasing!! I have seen lab students examine a 'mystery wave' (known by me to be exactly 1MHz from a frequency standard) and have them report to me that they have measured and believe the wave to be 10Hz, 1KHz, etc. because they used a slow sample rate and sweep speed and measured the alias. They failed to increase the sample rate to prove the waveform was not of a higher frequency.

author: xrunner
author_rank: Super Contributor
timestamp: November 21, 2023, 02:06:36 pm
content: Quote from: TAS on November 21, 2023, 11:15:58 amWell technically if it doesn't match the mathematical (perfect) description of a square wave, it isn't a square wave -https://mathworld.wolfram.com/SquareWave.htmlIn other words, it's really a distorted wave that looks like a square wave if it comes from any physical electronic generator. A sine wave isn't a perfect sine wave they are all distroted waves too ... but if they are causing your circuit to function according to your design parameters (not too distorted from their perfect counterparts) they are called by their common names ...

author: tggzzz
author_rank: Super Contributor
timestamp: November 21, 2023, 02:21:39 pm
content: Quote from: CaptDon on November 21, 2023, 02:01:39 pmThose two statements are incorrect, of course."Good" depends solely on the context; it is defined by the application.If it is a digital signal, then theonlyrelevant measure is the risetime. If you have signal integrity problems suficient to cause your circuit to fail, then they will be present whether the signal is 1MHz or 1Hz. Ditto EMI/EMC.

author: CaptDon
author_rank: Super Contributor
timestamp: November 21, 2023, 02:36:30 pm
content: Hence the use of the word 'good' used loosely by technical people in labs such as "That looks pretty good" meaning "It's close enough to square for our purpose" or "That has been oversampled enough times to look like the original". Doesn't a 200MHz square wave look a bit more unlike a square wave than a 100MHz square wave when displayed at a 1GHz sample rate on a so called 500MHz bandwidth scope? Good is relative, so is square so in the lab environment we seldom use the word 'perfect', it is usually "That square wave generator makes a pretty good square wave at 500MHz but it 'sucks' at a GHz. 'Sucks' is a technical lab term that gets a lot of use also. Is there a standard lab reference for a square wave that 'sucks'?

author: ejeffrey
author_rank: Super Contributor
timestamp: November 21, 2023, 02:56:58 pm
content: I would usually call something a square wave if it has a basically flat top and bottom hold mostly independent of the rise and fall time. Basically what you get by switching action. But as stated, that's not any kind of normative standard, and doesn't mean it is or isn't "square enough" for any application. And it's not intended to be quantifiable so don't ask how flat the top and bottom need to be to counf.

author: tggzzz
author_rank: Super Contributor
timestamp: November 21, 2023, 04:19:24 pm
content: Quote from: CaptDon on November 21, 2023, 02:36:30 pm"Good" is relative to requirements, nothing else. If someone technical doesn't apply that when making technical statements, then they really shouldn't be doing a technical job.Yes, I have applied that throughout my technical career - as have all the engineers around me. The most frequently question is "what do you mean by that?". The answer - or lack of an answer - is usually revealing.Fundamentally adjectives are a pain in the backside; they should be omitted and replaced with numbers. Even the (presumably young) OP realises that, as indicated in his question!

author: vk6zgo
author_rank: Super Contributor
timestamp: November 21, 2023, 11:26:19 pm
content: Quote from: tggzzz on November 21, 2023, 02:21:39 pmIf you have a magnificent rise time but 39% "tilt" at the fundamental frequency, you may have problems!

author: tggzzz
author_rank: Super Contributor
timestamp: November 22, 2023, 12:13:16 am
content: Quote from: vk6zgo on November 21, 2023, 11:26:19 pmWhat do you mean by "39% tilt"?

author: David Hess
author_rank: Super Contributor
timestamp: November 22, 2023, 06:12:14 am
content: Quote from: TAS on November 21, 2023, 11:15:58 am10% is the rule I also use, however as others pointed out, this is application dependent, and at high frequencies "square waves" may look anything but square.