Square wave generator

WBahn

Joined Mar 31, 2012
32,870
atm = at the moment

This is why i asked here for advice, how would you do to make it work?

Even with dubble 9 volt battery's the output looks the same, and a 9 volt battery got like 500mah, so it should be more then enough for this application.

So how to make it right? an op amp as a voltage follower or?
What does the capacity rating of the battery have to do with anything? 500 mAh tells you nothing about how much current the battery can deliver, only how long it can be expected to last at a particular current output. It is a measure of total available charge, not current.

Assuming this is a typical alkaline 9 V battery, that 500 mAh rating is likely for a current draw of about 10 mA. At 250 mA, they typically fail after about half an hour (it depends on how low you can let the voltage drop for your application, but a cutoff voltage of about 7 V is pretty common for 9 V batteries).

https://www.duracell.com/wp-content/uploads/2016/03/MN1604_US_CT1.pdf
 

Thread Starter

om3n

Joined Sep 8, 2023
12
What does the capacity rating of the battery have to do with anything? 500 mAh tells you nothing about how much current the battery can deliver, only how long it can be expected to last at a particular current output. It is a measure of total available charge, not current.

Assuming this is a typical alkaline 9 V battery, that 500 mAh rating is likely for a current draw of about 10 mA. At 250 mA, they typically fail after about half an hour (it depends on how low you can let the voltage drop for your application, but a cutoff voltage of about 7 V is pretty common for 9 V batteries).

https://www.duracell.com/wp-content/uploads/2016/03/MN1604_US_CT1.pdf
Yea my fault.

But it was just to see if it was a power issue, but when the square wave looks exactly the same on 3 different power supplys, then the issue is properly not the power supply.

The problem is how I control the output, how do I make it controllable from 10 to 0v?
 

KeithWalker

Joined Jul 10, 2017
3,607
This is the circuit I designed for the square wave output of my function generator. It gives 0 - rail-to-rail output. It should work with your circuit:
Pulse Amp Schematic2.jpg
 
Last edited:

AnalogKid

Joined Aug 1, 2013
12,141
Then wire the power opamp as a voltage follower with input from the pot.
The LM675 is not inherently stable at any gain less than 10. It can run at lower gains if external frequency compensation is added to the circuit. Page 9 of the datasheet shows such networks for both inverting and non-inverting unity gain applications.

The datasheet also makes it implicitly clear that a Zobel network is required at the output for any application.

Separate from that, there are many different ways to do what you want. As has been mentioned before, one way is to separate generating the square wave from driving the load. A typical signal flow would be:

Squarewave generator circuit >> output level potentiometer >> output power amplifier.

In this case, the LM675 always is operating as a linear amplifier, not in saturation. This is good, because as an output stage transitions from non-saturated to saturated to non-saturated, all kinds of small imperfections will appear in the output waveform.

Speaking of that, consider using a small digital circuit, rather than an opamp, to produce the square wave. In general, you get better system performance if you let digital parts do digital jobs. A 555 is a hybrid part, and can do the task very well, but its output is unipolar so it was to be level-shifted in order to produce a +/- output voltage. Because you are using only a 50% duty cycle squarewave, this can be a simple as a single coupling capacitor. If you go with a 555, use a CMOS version (LMC555). It has a much more symmetrical output and a higher slew rate for maximum "squareness" of the output. The datasheet has the schematic for a 50/50 astable oscillator circuit.

With a LMC555 running on +12 V, the output will be 12 Vpp. To turn this into +/-10 V, the power amp need to have a gain of 2. To do this, increase R2 in the unity-gain schematics.

LMC555 Squarewave circuit >> coupling capacitor >> output level potentiometer >> output power amplifier.

ak
 
Last edited:

KeithWalker

Joined Jul 10, 2017
3,607
Have you built this circuit?

ak
Yes, I made a 20HZ to 20KHz function generator using an ICL8138 and a 10-turn potentiometer. It has sine, saw-tooth and square wave outputs. That is the circuit I used for the square-wave output. The rise time is about 0.1uS, which is OK for my needs. I It's in the top left of the picture below:

Oscillators.jpg
 
Last edited:

AnalogKid

Joined Aug 1, 2013
12,141
Yes, I made a 20HZ to 20KHz function generator using an ICL8138 and a 10-turn potentiometer. It has sine, saw-tooth and square wave outputs. That is the circuit I used for the square-wave output. The rise time is about 0.1uS, which is OK for my needs. I It's in the top left of the picture below:
Good looking gear. Schematics? And, I'm curious about the sine oscillator.

ak
 

KeithWalker

Joined Jul 10, 2017
3,607
Good looking gear. Schematics? And, I'm curious about the sine oscillator.

ak
It's basically the diagram in Fig.8 in the datasheet with a dual LM4458 buffer op-amp on the sine and triangle outputs plus the circuit I posted on the square output. I used a ATMega328P-PU and a 0.91" OLED display for the frequency display. The sine wave output is not perfect, but good enough for general use (that's why you can see my homebuilt, low distortion Wien bridge oscillator in the same picture).

https://www.renesas.com/br/en/document/dst/icl8038-datasheet
 

AnalogKid

Joined Aug 1, 2013
12,141
!. Yes, that is a typo. 2N3904, 2N2222, 2N4401 are very popular types, and all will work in that circuit. For the PNP transistors, 2N3906, 2N2219, 2N4403. The types do not have to be matched. For example, you can use a 2N4401 and a 2N3906.

2. That is a generic symbol for a shielded connector with one signal contact, such as a BNC, which is very common in test equipment.

ak
 
Last edited:

Thread Starter

om3n

Joined Sep 8, 2023
12
!. Yes, that is a typo. 2N3904, 2N2222, 2N4401 are very popular types, and all will work in that circuit. For the PNP transistors, 2N3906, 2N2219, 2N4403. The types do not have to be matched. For example, you can use a 2N4401 and a 2N3906.

2. That is a generic symbol for a shielded connector with one signal contact, such as a BNC, which is very common in test equipment.

ak

In the simulation, it doesn't work as expected, but I should get the parts I missed to build it today.
but how did you calculate the values of the resistors?
 

Thread Starter

om3n

Joined Sep 8, 2023
12
!. Yes, that is a typo. 2N3904, 2N2222, 2N4401 are very popular types, and all will work in that circuit. For the PNP transistors, 2N3906, 2N2219, 2N4403. The types do not have to be matched. For example, you can use a 2N4401 and a 2N3906.

2. That is a generic symbol for a shielded connector with one signal contact, such as a BNC, which is very common in test equipment.

ak
Oh sorry quoted the wrong post! My apologies
 
Top