I am trying to make a square wave generator but don't have an op-amp nor the PNP transistor to do it. Is there any way that works? I have tried using this one:
but it is always on.
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
A number of problems have been pointed out in your circuit. However, even when these are corrected, I was unable to get your circuit to oscillate in CircuitLab. Getting oscillating circuits to oscillate in a simulator is a known problem. It is sometimes especially difficult to get a symmetric circuit to oscillate in simulation, since, to the simulator calculates the exact same voltages and currents on both sides. In such cases, one can add asymmetry to the circuit, or add some sort of stimulus to get the oscillations started.
CircuitLab has a particular flag that if set incorrectly may cause failure to simulate oscillations. This is the "Skip initial" flag. You want that to be set to "yes". If it does not "Skip initial", it searches for an equilibrium (or quasi-equilibrium) state of the circuit as it's initial state. Such a state might be quite unstable in reality, like balancing a pencil on its point. But CircuitLab doesn't care, and might leave the pencil balancing forever, or the circuit not oscillating.
Below I provide another circuit that does oscillate in CircuitLab. It is a Schmitt Trigger Oscillator. It is not necessarily better than the astable multivibrator circuit you used, but it does oscillate CircuitLab. Q3 is present to drive the output -- an LED that I added, which is also not essential. If whatever the oscillator is driving has sufficiently high impedance, Q3 can be omitted.
There is something a bit odd about the simulation that I haven't quite figured out. You will notice voltage spikes. That is very weird, because there is no inductance in the circuit. Perhaps CircuitLab has added inductance to the resistors? or the capacitor? In any event, voltage spikes are possible with fast edges if there is inductance present. In real life, long leads or long traces between components are the source of such inductance. However, I personally would be quite surprised to see voltage spikes of such amplitude in reality, and think they may just be artifacts of the computations done by CircuitLab.
There are a couple of things it could be.
First, simply swapping the emitter and collector connections will make things worse, not better. A possible problem is that the Q3 base-emitter junction plus the LED are forming a clamp on the Q2 collector voltage. Because the circuit supply is only 5 V, this actually might not be preventing oscillation. However, it is a very bad practice. The solution is to add a resistor in series with the Q3 base and the C2-Q2-R4 node. Something in the 1K to 10K range will work.
Another option is to leave the base connection alone, connect the emitter directly to GND, and move the LED to the collector (adding a current-limiting resistor. Now Q3 is acting as a saturated switch rather than as an emitter-follower.
The main problem with the circuit is that resistors R1 through R4 are too small. The R2-C1 time constant is only 100 us (microseconds). It is entirely possible that the circuit is oscillating, but too fast for the eye to perceive the off times. To test this, increase R2 and R3 to something in the 220K to 470K range. Or you can increase the resistors to something like 10K and increase C1 and C2 to 47 uF. To slow down the oscillator so you can see the LED blink, each R x C product (the R-C time constant) should be greater than 0.1.
You also can increase R1 and R4 to 1K to take some load off of the power source.