# Building a square wave generator

#### Sparky83

Jan 28, 2012
1
Hope someone can help me.

I want to build a square generator. I want it to have control for frequency variable 1hz to 200hz, a switchable voltage output of +5v and +12v. To run on 12v- to 14v. To have an LED to reflect output signal. All contain in a hand held box.

Where do i begin.

N

#### (*steve*)

##### ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
A 555 operating from 12V should be able to do that.

A series resistor to protect the 555 is a good idea, and simply switch a 5.1V zener across the output to limit the square wave to 5V (or thereabouts)

#### davenn

Moderator
Sep 5, 2009
14,011
..... snip..... To have an LED to reflect output signal. All contain in a hand held box.

N

Just keel in mind a LED is going to be useless indicator over ~ 25 Hz as any freq higher than that you eye isnt going to detect the flickering of the LED anyway.
ie. the LED as an indication of freq of the square wave will be ok from 1Hz to ~25Hz
and no good for the other 180 Hz that you want to cover

cheers
Dave

#### daGenie

Jan 23, 2012
43
try this circuit...................you may need to put a buffer at the output, depending on the application

#### Attachments

• sq_osc.jpg
25.8 KB · Views: 496

#### (*steve*)

##### ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
daGenie, that is a solution, but not a great one (however it is your first genuinely helpful post). [EDIT: No, that's a bit harsh]

There are a couple of problems:

1) the duty cycle varies with frequency
2) the problem is less that you may need to buffer the output than the output if shorted could destroy the 555.
3) using a voltage regulator to limit the voltage is probably not a great idea, but at low frequencies probably not that bad either. It may not be cost effective though

To get a 50% duty cycle you either need to use steering diodes or stop using pin 7 as the discharge pin.

This is the steering diode solution:

This requires 2 resistors to set the frequency (since charge and discharge go through separate resistors. It is possible to add a single pot to control frequency, using the 2 fixed resistors to set the maximum frequency.

Pins 6 and 2 connect to the top of the capacitor and a pot is connected between the junction of R2 and the cathode of the diode and the top of C1. R1 and R2 need to be chosen both to limit the max frequency and also to limit the current through the discharge transistor (see the normal limitations on R1).

And this is the pin 3 solution:

In the latter case, if you don't want variable duty cycle, you can remove R1 and the 2 diodes (replacing them with a link).

The 555 is drawn as a schmitt trigger inverter, because in this circuit that is the function it is performing.

As mentioned earlier, the output of this curcuit should be connected to pin 3 via a resistor to limit fault current and (in the second case) to ensure correct timing under load. This can be connected to a 12V zener with a 5V zener switched in parallel to give the 12V or 5V signal.

The rise and fall times won't be perfect, but they'll be pretty good considering the low frequency.

The power supply should be around 14 or 15 volts (16V absolute max) to ensure a good 12V output.

Last edited:

#### daGenie

Jan 23, 2012
43
thanks for the constructive criticism...............i just calculated the duty cycle and it ranges from 50% to 65%.................i should have considered that..............

anyway, i just started designing circuits recently and most of my designs work..............im just trying to strengthen myself in that area so i can be perfect by next year............

once again steve, thanks, i really appreciate it...............im looking forward to learning all i can learn from you in particular, if that's ok with you...........i want to be a wizard in my field before i graduate................peace