# LM358 waveform generator issue

I would like to generate a 30 kHz & 60 kHz sawtooth waveform using an LM358P operational amplifier per the following schematic.

Theoretically, and in the simulation, the circuit should work perfectly, generating a ~30 kHz or ~60 kHz signal depending on the switch position. In reality, the signal is distorted and varies between 6 & 8 kHz respectively.

Resistors/capacitor values were calculated based on the equations from the LM741 lab exercise which I am linking below.

What can be causing the issue? ## Calculations

I haven't taken the slew rate of a device into the account initially, but here are my calculations for the 30 & 60 kHZ sawtooth generator.

### 1. Biasing

Generator is driven from a single 24V power supply, virtual ground is derived from the voltage divider - two 1k resistors in parallel with 220nF capacitors, and saturation voltage is chosen to be 1V & 23V respectively.

Note: Saturation voltage was chosen without consulting the datasheet, so that was the first mistake.    ### 2. Amplitude

Chosen amplitude of a signal was 22V, so the following resistors were chosen.   ### 3. Duty Cycle

As I wanted to generate a sawtooth wave, chosen duty cycle was 10%. ### 4. Frequency

To keep resistor values small, 10nF capacitor was chosen for the integrator, and for the 30kHz frequency resistor was calculated with the equation from the attached lab.   Note: The frequency had to be appropriately increased to take into the account selected duty cycle.

### 4. Slew Rate

The slew rate of the LM358 is only 0.3 V/μ - which I didn't take into the account. For the 30 kHZ triangle wave generator minimum required slew rate is 4.14 V/μ, and for the 30kHZ sawtooth wave generator 6.9 V/μ. • Are you running of 24V as in the simulation? You'd be running into slew rate limitations. Nov 11 '20 at 21:30
• What is the slew rate required at the pin 7 output? What is the output slew rate of an LM358? Nov 11 '20 at 21:37
• From the datasheet: The slewrate is the rate at which an operational amplifier can change its output when there is a change on the input.These devices have a 0.5-V/μs slewrate (B Version). You are right, running the circuit from the 12V power supply generates a 6-8 kHz signal, while from the 24V power supply the signal is 3-4 kHz. Nov 11 '20 at 21:48
• What the schematic doesn't show is the hidden connections. If you built this with long dangly wires on a plugboard, it's probably the implementation, not the circuit, that's at fault. "neatness counts" when building circuits. Another thing that's not shown on the schematic is the electrical load of "sweep". Figure out the input impedance of "sweep" and add that to your simulation. Does it still work??? Nov 11 '20 at 22:38
• And, almost certainly, you should have capacitors on the power supply pins of the opamp. Those are not shown here. If you don't have such things, the opamp could definitely behave oddly (in a manner the simulation doesn't simulate). Nov 11 '20 at 22:40 