Author Topic: Saw generator with offset on a double comparator  (Read 346 times)

Mahagam, AlexRG, D2236 and 11 Guests are viewing this topic.

Online AlexRGTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: ru
Saw generator with offset on a double comparator
« on: Yesterday at 05:27:15 pm »
Hello friends! I need to get a sawtooth signal with a frequency of 90 kHz (tolerance of 88..92 kHz), an amplitude of 1 V, and a +2.5 V offset at the output. See the figure.

Is it possible to use a chip with two comparators for this task? For example, the MX3502S. Datasheet: https://www.lcsc.com/product-detail/C19269867.html (this is an Asian clone of the TLV3502).

If possible, could you draw a diagram of such a generator? At the same time, can you explain which element in the diagram is responsible for what?

p.s. I need a saw generator, not a triangle generator!
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 487
  • Country: pl
Re: Saw generator with offset on a double comparator
« Reply #1 on: Today at 06:42:37 am »
If you want to use two comparators, you need to replicate the internal structure of the NE555 - connect an RS flip-flop to the comparators. Control the discharge from the output.

The simplest circuit would look like this.
2847708-0
This is a single comparator with hysteresis that controls the charging and discharging of the capacitor.

Here, the sawtooth slope is not linear; to achieve that, a current source would need to be added.


On two comparators, it would be like this.
2847718-1
« Last Edit: Today at 07:08:23 am by MariuszD »
 

Online AlexRGTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: ru
Re: Saw generator with offset on a double comparator
« Reply #2 on: Today at 10:42:34 am »

On two comparators, it would be like this.
(Attachment Link)

The linearity of the saw is very important to me. Will the saw be linear on this circuit? Can I do without logic? Just with two comparators?
 

Online mtwieg

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
Re: Saw generator with offset on a double comparator
« Reply #3 on: Today at 12:41:05 pm »
The linearity of the saw is very important to me. Will the saw be linear on this circuit? Can I do without logic? Just with two comparators?
No, as MariuszD said, you need a current source for that.

Also your example waveform seems to have the output change instantaneously (infinite slew rate). Obviously that's not realistic, you'll need some finite slew rate there. The faster it is, the more difficult it will be to produce cleanly (will require faster logic and components).
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 487
  • Country: pl
Re: Saw generator with offset on a double comparator
« Reply #4 on: Today at 01:52:11 pm »
The linearity of the saw is very important to me. Will the saw be linear on this circuit?
Linearity will depend on the output resistance of the current source. The second schematic contains a current source. If I cared about linearity, I would probably add a transistor in cascode.

How good should linearity be?

The falling edge in my circuits is deliberately slowed down by a resistor. The faster it is, the harder it is to precisely stop the discharge when the voltage drops to 2V. It needs to be tested on a real circuit.

Do you want to make a PWM modulator?

Quote
Can I do without logic? Just with two comparators?
No.
« Last Edit: Today at 01:55:14 pm by MariuszD »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 2187
Re: Saw generator with offset on a double comparator
« Reply #5 on: Today at 02:11:47 pm »
Hi,

A couple notes here...

First, a regular op amp can be used as a low current current-source.  The output to inverting input produces a current that is the same as the input current because here is no actual current into the op amp input itself.  So if the input is 1ma then the cap current is 1ma up to the point of saturation.  This gives you a nearly perfect ramp.
To reset, you can apply a negative pulse of higher amplitude, and a reset mechanism to reset the cap.

Second, if you need a very fast reset, you might consider using two op amps and two caps (and resistors) and gate the outputs so that while one is resetting the other is providing the output ramp.  You want to try to match the ramps so you might want to add an adjustment.  Long term stability would have to be checked also.

The first above should be fairly easy to implement, while the second is a little tricky.
 

Online AlexRGTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: ru
Re: Saw generator with offset on a double comparator
« Reply #6 on: Today at 02:59:36 pm »
Do you want to make a PWM modulator?


Yes, I want to try making a homemade PWM controller. To do this, the saw must be as linear as possible. I've sketched your second circuit in Multisim, and it seems to be very linear. What are the potential pitfalls in implementing it in reality?

 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 487
  • Country: pl
Re: Saw generator with offset on a double comparator
« Reply #7 on: Today at 03:38:39 pm »
Yes, I want to try making a homemade PWM controller.

For what application? For power supplies or other controllers operating in a closed feedback loop, linearity is not important, nor is it whether we use a sawtooth or a triangle.
If it were a modulator for transmitting sound, linearity would be important.

Quote
To do this, the saw must be as linear as possible. I've sketched your second circuit in Multisim, and it seems to be very linear.
Output resistance of the source determines linearity; according to my simulation, it should be better than 0.1%.
Quote
What are the potential pitfalls in implementing it in reality?


Another thing worth noting is the thermal stability of the current source. Here, there will be a drift of -3%/10°C. It might not fit within the frequency range

Another difficulty is the issues with the fast falling edge. In your simulation, the voltage from the divider setting the lower threshold is 2.74V. This means that the discharge thru R8 is still too fast, and the minimum sawtooth voltage is determined not only by the comparator threshold but also by the propagation time.

You can design the discharge circuit differently so that it always discharges to the set level, but there will be a slight delay after the falling edge before the rising edge begins.



« Last Edit: Today at 04:00:28 pm by MariuszD »
 

Online AlexRGTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: ru
Re: Saw generator with offset on a double comparator
« Reply #8 on: Today at 04:30:45 pm »
Another thing worth noting is the thermal stability of the current source. Here, there will be a drift of -3%/10°C. It might not fit within the frequency range


Yes, the PWM controller is needed for sound, for AM modulation. That's why the linearity should be as smooth as possible, within reasonable limits. Delay is also not allowed, so the 555 timer is not suitable.
I plan to use the MX3502S comparator, which has a delay of about 3-4 ns, and the SN74AHC74DR trigger, which has a delay of about 6 ns. Therefore, there should be no problems with the signal processing speed at a frequency of 90 kHz.

Regarding the temperature stability of the frequency. What parameters does it depend on? I will use C0G capacitors with a temperature stability of 30ppm and resistors with a temperature stability of 10ppm. I will also use a highly stable 5V linear regulator, the NCV8664CST50T3G.

p.s. In general, frequency stability is not particularly important for minimal sound distortion. What is important is the absence of jitter in the meander. In other words, there should be no amplitude fluctuations in the saw.
 

Online mtwieg

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
Re: Saw generator with offset on a double comparator
« Reply #9 on: Today at 04:42:09 pm »
Yes, the PWM controller is needed for sound, for AM modulation. That's why the linearity should be as smooth as possible, within reasonable limits.
If linearity is critical, then you should use center-aligned PWM (a triangle waveform with the same slope on up and down). A triangle waveform will also be much easier to control precisely than a sawtooth.

Quote
Delay is also not allowed, so the 555 timer is not suitable.
Some amount of effective delay is inevitable with PWM modulation, even if all the components are infinitely fast. How much delay depends on how you define delay though (not as trivial as one might expect).
« Last Edit: Today at 04:45:13 pm by mtwieg »
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 487
  • Country: pl
Re: Saw generator with offset on a double comparator
« Reply #10 on: Today at 04:53:21 pm »
Yes, the PWM controller is needed for sound, for AM modulation. That's why the linearity should be as smooth as possible, within reasonable limits. Delay is also not allowed, so the 555 timer is not suitable.
I used the 555 timer only as an example to show the method of discharging to a set voltage.

Quote
I plan to use the MX3502S comparator, which has a delay of about 3-4 ns, and the SN74AHC74DR trigger, which has a delay of about 6 ns. Therefore, there should be no problems with the signal processing speed at a frequency of 90 kHz.
Ok
If the exact frequency is important, the capacitor could be reset with a pulse from an external quartz oscillator.

Quote
Regarding the temperature stability of the frequency. What parameters does it depend on? I will use C0G capacitors with a temperature stability of 30ppm and resistors with a temperature stability of 10ppm. I will also use a highly stable 5V linear regulator, the NCV8664CST50T3G.
This is the temperature coefficient of the transistor Vbe. A more accurate current source can be made with an operational amplifier.



 

Online AlexRGTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: ru
Re: Saw generator with offset on a double comparator
« Reply #11 on: Today at 05:40:47 pm »
Output resistance of the source determines linearity; according to my simulation, it should be better than 0.1%.

The saw load will be the input of the second MX3502 chip, which will act as a summator. The first input will receive a 1V saw wave with a +2.5V offset. The second input will receive a +2.5V offset, which will create a default 50% duty cycle on the output. Additionally, the second input will receive a 1V sine wave (sound), which will change the duty cycle of the output square wave. That is, the load of the saw generator will be the input of the same comparator, just on the second chip. There are units of pf.

p.s. A linearity of 0.1% is more than enough.
« Last Edit: Today at 05:43:41 pm by AlexRG »
 

Online MariuszD

  • Frequent Contributor
  • **
  • Posts: 487
  • Country: pl
Re: Saw generator with offset on a double comparator
« Reply #12 on: Today at 05:58:21 pm »
I would also consider generating a triangular waveform, as it eliminates the issues with the falling edge in the previous circiuit.
NE555 replaces two comparators and a flip-flop, I didn't feel like drawing them. Of course, what you have in your schematic works faster, but the 555 follows the same principle of operation.

In the previous diagram, I only provided the linearity of the rising edge; the falling edge is nonlinear but quick, I will estimate it later.
« Last Edit: Today at 06:02:10 pm by MariuszD »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf