Circuit to control the pulse width of digital signals

In summary: I do not know if this will work for output widths x^2. The amplitude A will be A^2, but if I put a comparator on the output of the rise and fall of the integrators, it will not give me a width that is proportional to...
  • #36
Seth Cohen said:
What do you mean by "the equation is not linear"

This seems like geometry.
I think there is a big misunderstanding. You guys are making me feel like I am taking crazy pills. See attached.

The output pulse width is m times the input pulse width. m is a constant multiplicative factor. No?
 
Engineering news on Phys.org
  • #37
Seth Cohen said:
What do you mean by "the equation is not linear"

This seems like geometry.
I think there is a big misunderstanding. You guys are making me feel like I am taking crazy pills. See attached.
ok. so if there is a very small pulse at the input (say 5 ms), the peak integrator output barely touches the comparator threshold, the comparator will never output anything, so the gain is zero.
so we know it takes a 5 ms pulse to go over the threshold for this comparator setting
if there is a pulse, say 6 ms, and the integrator barely goes over the comparator output, the output of the comparator would be 2 ms. or a gain of 0.33
7 ms pulse, the output would be 4 ms, or a gain of 0.57
8 ms pulse the output would be 6 ms, or a gain of 0.75

eventually it would come close to being linear (until the integrator saturates).

So if you are ok with nonlinear data in a certain range, then go for it (note by the time you approach a linear range you will be close to saturation).

The output of the integrator where the pulse should be active will be close to zero. the purpose of the comparator is to increase this voltage, basicly any voltage aboze ground will become 3.3 V, 5V, or whatever the comparator supply is at.
does that make sense.

dont worry about the crazy pills thing, it happens to everyone!
 
  • #38
I do not know of any other analog pulse width multipliers.
 
  • #39
you could use digital methods as well
 
  • #40
donpacino said:
you could use digital methods as well

What kind of digital method?
 
  • #41
you can either use a microprocessor (software), or digital logic (asics or fpgas).
basically you run a counter starting on the rising edge of the input, multiply the value of the counter by 2, or whatever value you want, then have the output stay high until the counter runs out.
 
  • #42
donpacino said:
ok. so if there is a very small pulse at the input (say 5 ms), the peak integrator output barely touches the comparator threshold, the comparator will never output anything, so the gain is zero.
so we know it takes a 5 ms pulse to go over the threshold for this comparator setting
if there is a pulse, say 6 ms, and the integrator barely goes over the comparator output, the output of the comparator would be 2 ms. or a gain of 0.33
7 ms pulse, the output would be 4 ms, or a gain of 0.57
8 ms pulse the output would be 6 ms, or a gain of 0.75

eventually it would come close to being linear (until the integrator saturates).

So if you are ok with nonlinear data in a certain range, then go for it (note by the time you approach a linear range you will be close to saturation).

The output of the integrator where the pulse should be active will be close to zero. the purpose of the comparator is to increase this voltage, basicly any voltage aboze ground will become 3.3 V, 5V, or whatever the comparator supply is at.
does that make sense.

dont worry about the crazy pills thing, it happens to everyone!
donpacino said:
you can either use a microprocessor (software), or digital logic (asics or fpgas).
basically you run a counter starting on the rising edge of the input, multiply the value of the counter by 2, or whatever value you want, then have the output stay high until the counter runs out.
This is a device that will be discretized to the clock rate - not a continuous function f(x).
 
  • #43
donpacino said:
ok. so if there is a very small pulse at the input (say 5 ms), the peak integrator output barely touches the comparator threshold, the comparator will never output anything, so the gain is zero.
so we know it takes a 5 ms pulse to go over the threshold for this comparator setting
if there is a pulse, say 6 ms, and the integrator barely goes over the comparator output, the output of the comparator would be 2 ms. or a gain of 0.33
7 ms pulse, the output would be 4 ms, or a gain of 0.57
8 ms pulse the output would be 6 ms, or a gain of 0.75

eventually it would come close to being linear (until the integrator saturates).

So if you are ok with nonlinear data in a certain range, then go for it (note by the time you approach a linear range you will be close to saturation).

The output of the integrator where the pulse should be active will be close to zero. the purpose of the comparator is to increase this voltage, basicly any voltage aboze ground will become 3.3 V, 5V, or whatever the comparator supply is at.
does that make sense.

dont worry about the crazy pills thing, it happens to everyone!
I still disagree - if the integrator is created the tent-like shape, and you choose a threshold like in the figure I attached, then the output will be linearly related to this input. Granted, like you said, there will be a range of short pulse widths < dw where the output will be nothing. BUT, beyond dw, the output width y = m*(x-dw) for x > dw and y = 0 for x < dw. This model also assumes that m < 2 and that x is shorter than the saturation time of the integrator.
 
  • #44
Seth Cohen said:
This is a device that will be discretized to the clock rate - not a continuous function f(x).
yup, like all digital devices its clock needs to be fast enough.
 
  • #45
Seth Cohen said:
I still disagree - if the integrator is created the tent-like shape, and you choose a threshold like in the figure I attached, then the output will be linearly related to this input. Granted, like you said, there will be a range of short pulse widths < dw where the output will be nothing. BUT, beyond dw, the output width y = m*(x-dw) for x > dw and y = 0 for x < dw. This model also assumes that m < 2 and that x is shorter than the saturation time of the integrator.

You can believe what you want. The higher your threshold, the more non-linear it becomes, it's a fact, not an opinion.
 
Last edited:
  • #46
donpacino said:
You can believe what you want. The higher your threshold, the more non-linear it becomes, it's a fact, not an opinion.

Can you at least tell me why the attached is wrong?
 

Attachments

  • flowRoot3872.png
    flowRoot3872.png
    14.4 KB · Views: 416
  • #47
its not wrong. that's what I am trying to tell you.
You will get a gain out of it. you will be able to control it with the threshold.
It will be non linear
 
  • #48
Maybe our definition of "linear" is the confusion. To me, linear is that the output y only depends on the input x, not something like x^2 or log(x). It is y LINEARLY related to x.
 
  • #49
ok let's try this. the value of "m" (which is the gain) will change as X changes.
 
  • #50
why? isn't it just dependent on the RC?
 
  • #51
donpacino said:
ok. so if there is a very small pulse at the input (say 5 ms), the peak integrator output barely touches the comparator threshold, the comparator will never output anything, so the gain is zero.
so we know it takes a 5 ms pulse to go over the threshold for this comparator setting
if there is a pulse, say 6 ms, and the integrator barely goes over the comparator output, the output of the comparator would be 2 ms. or a gain of 0.33
7 ms pulse, the output would be 4 ms, or a gain of 0.57
8 ms pulse the output would be 6 ms, or a gain of 0.75

eventually it would come close to being linear (until the integrator saturates).

So if you are ok with nonlinear data in a certain range, then go for it (note by the time you approach a linear range you will be close to saturation).

The output of the integrator where the pulse should be active will be close to zero. the purpose of the comparator is to increase this voltage, basicly any voltage aboze ground will become 3.3 V, 5V, or whatever the comparator supply is at.
does that make sense.

dont worry about the crazy pills thing, it happens to everyone!

see above. the gain is the value of m. it will change as x changes
 
  • #52
ahaaa! I understand what you are saying, and I still think I am correct - we are just calculating m differently.

Based on your argument 5 ms = dw (see my picture). dw is fixed and does not change because the slope is fixed and the threshold is fixed.

2*(6 ms - dw) = 2;
2*(7 ms - dw) = 4;
2*(8 ms - dw) = 6;

m=2;
 
  • #53
dw remains constant, so your equations don't make sense. in this case dw is allways 5.

that means your m for each data point will be different, it can't be 2 every time.
 
  • #54
we are just labeling m differently.

in my equation, m is what multiplies the input width.
output width = m*((input width) - dw)

m*(6 ms - dw) = 2;
m*(7 ms - dw) = 4;
m*(8 ms - dw) = 6;

You are correct that the ratio of output/input, which some may call the gain, is not fixed. But the multiplicative factor of the input value, which is what I call m=2 or gain is fixed. The linear gain to me is the first derivative of the above formula.

Also, now that I look at this, it can ONLY have a linear multiplicative of 2, no matter what the threshold. Thoughts?
 
  • #55
how are you setting your m?
 
  • #56
donpacino said:
how are you setting your m?
I am not, the m is fixed at 2. This technique seems it will always double the time that the integrator is about the threshold while the input is in a high state.
 
  • #57
you were arguing the case for a variable m by using a comparator...
also your value of m, which is set by the integrator circuit, is dependant on dw being 0 or very close to it.
 
  • #58
Seth Cohen said:
For the case of a linear integrator, I can put a comparator on the output and raise and lower the threshold of the comparator to get different output width functions f(x) = m*x, where m is a constant multiplicative factor.
 
  • #59
I think I was wrong about having a variable m. I thought that by adjusting the threshold, it would change the multiplicative factor. Instead, I now believe that the multiplicative factor of the formula m*((input width) - dw) is always 2. dw is what gets adjusted,
 
  • #60
this has been helpful. I think in the end, this is very limited method of controlling pulse-widths. It cannot give an arbitrary function of widths f(input) = output.
 
  • #61
ok cool!

just a note as dw changes the actual m value will change, this is due to the electronics. remember gain is defined as output over input, so as dw increases, your output will decrease and input stay the same, so your gain will go down. this is why the comparator ground is set at zero or close to it, so dw is zero or close to it.

also if you have to do anything complicated digital is the way to go!11
 
  • #62
I don't know how to do f(something arbitrary?) for a single pulse

but your discussion reminds me of old time-division analog computers from 1950's
where we generated a train of pulses with duty cycle proportional to some function of analog inputs.
We used them to multiply and divide analog DC voltages.

A pulse train has average value of area under the curve, (duty cycle) X height.
For example, a 0 to 10 volt square wave that's high half the time will have average value 5 volts.

So consider the following circuit, with following prerequisites:
Capacitor C is charged by E1 through R when S1 is up
and is discharged by -E2 through equal R when S1 is down
Frequency of switching is fast compared to time constant RC.
PWM is basically a zero comparator controlling ratio of switch S1's up and down times,
so as to maintain zero volts on capacitor C. Therefore Ecap remains very nearly zero.
(In the 1950's precise zero detectors were fairly easy but precision opamps were difficult.)Let fraction of time S1 is UP = DC for Duty Cycle
and fraction of time S1 is DOWN = (1-DC)
So current into C is E1/R X DC
and current out of C is -E2/R X(1-DC) which equals E2/R X (DC-1)
TmeDivision_zpsufyjcp2o.jpg


It is apparent that to maintain Ecap = zero, the charge and discharge currents must be equal
so E1/R X DC = -E2/R X (1-DC)
E1 X DC = E2 X (DC-1)
E1/E2 = 1 - 1/DC

Output switch S2 will have same duty cycle
so Eout will have average value E3 X E1/E2
and a simple low pass filter at Eout will deliver a clean analog voltage equal to E3 X E1/E2.

Now we can use that analog computing element to derive products, quotients, squares and square roots as follows

BIG TEN-OOPS HERE, good buddies...

delete the next image and use instead one following
my drafting mistake old jim

TDMcomputer_zps1gxqpbi5.jpg
USE THIS IMAGE instead (i'd delete previous one but it's already been quoted)
TDMcorrected_zpsidpt04ia.jpg


Of course it's slow, two quadrants at best because E1 and E2 must have opposite polarity, and unstable at division by very near zero just like any divider.

but it's very handy for computing things like steam flow with density compensation from dp across an orifice as E1 and density (ρ of pressure) as E2, Eout tied back into E3 for square root of (dp X ρ) .
And absolutely impervious to Stuxnet.Hope you don't mind this digression.
But that's one way you could make pulses with ratio of ontime / offtime in proportion to f(?) = √(a product) which i think was an earlier question..

All we ever used was the analog voltages. This circuit is called "Time Division Multiplier" and is capable of extreme precision, for analog stuff. A testament to the tenacity of those 1950's circuit designers.
Modern ones use 555 timers and opamps and are still running in nuke plants. One even used a TL494 PWM.

old jim

ps it's late and something feels uncomfortable about my duty cycle derivation

will correct in the morning if needed...
 
Last edited:
  • #63
Digital is the way to go, I agree. But not clocked digital, as I want a continuous input output function
jim hardy said:
I don't know how to do f(something arbitrary?) for a single pulse

but your discussion reminds me of old time-division analog computers from 1950's
where we generated a train of pulses with duty cycle proportional to some function of analog inputs.
We used them to multiply and divide analog DC voltages.

A pulse train has average value of area under the curve, (duty cycle) X height.
For example, a 0 to 10 volt square wave that's high half the time will have average value 5 volts.

So consider the following circuit, with following prerequisites:
Capacitor C is charged by E1 through R when S1 is up
and is discharged by -E2 through equal R when S1 is down
Frequency of switching is fast compared to time constant RC.
PWM is basically a zero comparator controlling ratio of switch S1's up and down times,
so as to maintain zero volts on capacitor C. Therefore Ecap remains very nearly zero.
(In the 1950's precise zero detectors were fairly easy but precision opamps were difficult.)


Let fraction of time S1 is UP = DC for Duty Cycle
and fraction of time S1 is DOWN = (1-DC)
So current into C is E1/R X DC
and current out of C is -E2/R X(1-DC) which equals E2/R X (DC-1)


TmeDivision_zpsufyjcp2o.jpg


It is apparent that to maintain Ecap = zero, the charge and discharge currents must be equal
so E1/R X DC = -E2/R X (1-DC)
E1 X DC = E2 X (DC-1)
E1/E2 = 1 - 1/DC

Output switch S2 will have same duty cycle
so Eout will have average value E3 X E1/E2
and a simple low pass filter at Eout will deliver a clean analog voltage equal to E3 X E1/E2.

Now we can use that analog computing element to derive products, quotients, squares and square roots as follows

TDMcomputer_zps1gxqpbi5.jpg


Of course it's slow, two quadrants at best because E1 and E2 must have opposite polarity, and unstable at division by very near zero just like any divider.

but it's very handy for computing things like steam flow with density compensation from dp across an orifice as E1 and density (ρ of pressure) as E2, Eout tied back into E3 for square root of (dp X ρ) .
And absolutely impervious to Stuxnet.


Hope you don't mind this digression.
But that's one way you could make pulses with ratio of ontime / offtime in proportion to f(?) = √(a product) which i think was an earlier question..

All we ever used was the analog voltages. This circuit is called "Time Division Multiplier" and is capable of extreme precision, for analog stuff. A testament to the tenacity of those 1950's circuit designers.
Modern ones use 555 timers and opamps and are still running in nuke plants. One even used a TL494 PWM.

old jim

ps it's late and something feels uncomfortable about my duty cycle derivation

will correct in the morning if needed...

Hi Jim,

Thanks for contributing to the conversation. I will look at your derivation some time today/this weekend. PWM is definitely something I have been looking into because it relates to my problem. The idea of having a single input pulse of width x and a single output pulse of y = f(x), for arbitrary x is a problem that I do not think anyone has solved in some general way. I imagine a lot of optics applications could use this. What do you think?

I can also imagine clocking the input pulse and doing some processing can give me an approximation, but this is not a continuous function and may have discretization issues for optical ranging, etc.

Lastly, if you have published any papers from the 1950's and onward, I would definitely like to take a look.
 
  • #64
wow jim that's awesome!

seth. what is the min pulse width you are expecting. in optical applications you can get pulses as short as ten picoseconds.
 
  • #65
donpacino said:
wow jim that's awesome!

seth. what is the min pulse width you are expecting. in optical applications you can get pulses as short as ten picoseconds.
Any range - ns,us, ms
 
  • #66
you should be able to capture anything down to hundreds or tens of ns easily. all you need is a frequency that matches the smallest pulse width you expect to receive. (ideally it would be much more)
 
  • #67
Drat today it's obvious why i was uncomfortable

stupid drafting error

second image should be replaced with this one:

TDMcorrected_zpsidpt04ia.jpg


i'll go back and add it to above post

apologies to you guys

the derivation is okay i think , but it's more obvious why it works if one used just up-time and down-time instead of duty cycle.

old jim
 
  • #68
Seth Cohen said:
Aren't one-shots and monostable multivibrators used for outputing pulses of fixed widths, so that the function above would be y = f(x) = c, where c is constant. What about something that doubles every input pulse width like y = f(x) = 2x?

Seth, I don't know if they can be called monostable or not, but circuits using the ubiquitous 555 chip in many of its disguises will output a pulse train of constant frequency but variable duty cycle (the fraction of the period of oscillation in which the pulse is "on"). Such circuits are called Pulse Width Modulators and are used to deliver controlled power at constant voltage and frequency to an external device. DC motor speeds and LED brightness can be controlled this way. If the frequency is high enough, the time constant of the external device smooths its input waveform. In the case of a motor, the inertia of the rotor carries it through the off periods of each cycle. In the case of LEDs, they are fast enough to flash on and off with each cycle, but our eyes have long time constants in their response to light, so they experience brighter or dimmer yet smooth light.
 
Back
Top