Variable frequency pulse generator

Thread Starter

wayneh

Joined Sep 9, 2010
17,496
I'm trying to figure out a way to generate a messy pulse sequence. By messy I mean:
1.) average frequency of ~0.5Hz (adjustable from maybe 0.2 to 10Hz)
2.) duty cycle roughly 50%, but with polarity alternating, so +5, off, -5, off and so on
3.) frequency changing by ~2x in a "random" manner. A very non-random sequence is fine, as long as the pulse width varies roughly 2X around the mean, in the range of 0.25 to 1 Hz when set to 0.5Hz mean

I'm most stuck on getting item 3. I think a 555 timer, or any square wave generator, followed by a 4017 counter would give me the first two criteria nicely. The wave generator sets the frequency. Using the counter outputs for "0" and "1" gives me the reversing polarity.

Could I use the control pins of the timer to adjust the frequency as I've described, maybe by feeding in a slow triangle wave to change the voltage at pins 5 or 6? Maybe some other VCO arrangement would be better? I have a nice 1 MHz oscillator can I could use, but that doesn't seem the best way to go. Changing the frequency sounds easier than changing the divide-down factor, since I don't want to use a microprocessor.

The load is small, up to 1mA max into ~5K ohms. Power supply isn't set yet, but it will be AAs, one or two, possibly boosted to 3 or 6v with a big cap to smooth out the boosted voltage. Battery life is an issue but the load is tiny, so the main drain will probably be an LED power indicator.

Ideas?
 

someonesdad

Joined Jul 7, 2009
1,583
If you're willing to mess with a microcontroller, that would probably be one way to get what you want. I'm guessing (you EEs don't be shy and correct me if I'm wrong :p) that a way to do this would be to use two output pins of the microcontroller; one pin each goes to an op amp. One op amp generates the +5 V; the other op amp generates the -5 V. Then you can use the third op amp (from a quad package) to add these two opposite-polarity signals together.
 

SgtWookie

Joined Jul 17, 2007
22,230
It's easier than that; just use a CMOS 555 timer as an inverter. Tie pins 2 & 6 (trigger & threshold) together, and feed your signal to invert to it, get the output from pin 3. No need to amplify it; use one of the outputs as a "virtual ground", and the circuit being powered by it will see +5 and -5v.
 

Thread Starter

wayneh

Joined Sep 9, 2010
17,496
I'm not clear what you want. See the drawing. I know that you also want to vary the frequency.
More like the first example. The dead spots are probably less important than the true polarity reversal, not just on and off.

I'm wondering about another approach. Suppose I make a "song" with whatever waveform I want, modulated at 15kHz (well above the audible range for a baby-boomer). I could then play that waveform on an iPod or such. I believe a circuit to demodulate and recreate the waveform would be very simple, right? Just an op-amp with a low-pass filter on the input? I think this approach would give me a lot of flexibility without worrying how to generate complicated waveforms without a micro.
 

Thread Starter

wayneh

Joined Sep 9, 2010
17,496
No, I'm not savvy with that application, but I have many other tools. It'd be easy to generate anything I want.

BTW, here's a circuit very similar to what I was first thinking, except that it's locked into one pattern without making manual changes. I'd want some way it could vary it's own frequency over a 5-10 second period. But now I'm leaning towards the iPod solution. Comments welcome.

pic.gif
R1_____________1M5 1/4W Resistor
R2____________15K 1/4W Resistor
R3___________100K Linear Potentiometer
R4_____________2K2 1/4W Resistor
C1___________330nF 63V Polyester Capacitor
C2___________100µF 25V Electrolytic Capacitor
D1_____________3mm. Red LED
IC1___________7555 or TS555CN CMos Timer IC
IC2___________4017 Decade counter with 10 decoded outputs IC
SW1___________SPST Slider Switch
B1______________9V PP3 Battery Clip for PP3 Battery
 

SgtWookie

Joined Jul 17, 2007
22,230
You might find this interesting; it's a combination of ideas. I'd posted a 4017 multi-timer a few years ago; this is a variation on the same theme.

The way this circuit works is that it's a typical 50% duty cycle astable, but the timing cap gets changed every time the U1 555's output goes high; the 4017 connects a different cap to ground via the logic level MOSFETs on it's output, thus changing the time it will take for that cap to charge via R1/D1 or discharge via R2.

Instead of a CMOS 555 timer, you could use a 4093 quad Schmitt trigger NAND or similar; the Schmitt trigger and inverting functions are mandatory. You could even use an LM339 comparator if you can't find either.

I didn't show any kind of reset sequence for the 4017; if it happens to power up with outputs O7-O9 high, the 555 will clock like it has no timing cap (as fast as it can go).

Something similar could be done with a binary counter and a 8-to-1 or a couple of 4-to-1 muxes; that would get rid of the MOSFETs.
 

Attachments

Last edited:

Thread Starter

wayneh

Joined Sep 9, 2010
17,496
Interesting. I like how you can change the range of times by choosing the various capacitors. You could even add more to fill every slot, right? And varying R1 and R2 would give plenty of control while in use.

Very interested in using the mux to eliminate all the MOSFETs. Never used a mux before; can you recommend a part?
 

SgtWookie

Joined Jul 17, 2007
22,230
Interesting. I like how you can change the range of times by choosing the various capacitors.
It would be better if a variety of resistors could be selected instead, as resistors are easier to obtain in much more precision than caps, as well as being more compact. However, that couldn't be done with a simple low-side switch.
You could even add more to fill every slot, right?
Yes.
And varying R1 and R2 would give plenty of control while in use.
Well, if you wanted to keep the duty cycle about the same, you would really need to use a ganged pot and a pair of resistors in series with the pots to ensure some minimum resistance; otherwise you could accidentally fry the pot or the 555. Also, it would be better to replace the 1N4148 with a BAT54 Schottky diode or 1N5817, as the Vf is much lower with these diodes.

Very interested in using the mux to eliminate all the MOSFETs. Never used a mux before; can you recommend a part?
It would take an analog mux/demux to do that, like a CD4051 or 74HC4051. The '4051 has three address inputs, 8 I/O's that are individually addressed, and one I/O that is the "common" to all 8.
74HC4051 datasheet: http://ics.nxp.com/products/hc/datasheet/74hc4051.hct4051.pdf
CD4051 datasheet: http://www.ti.com/lit/ds/symlink/cd4052b.pdf

The mux/demux would need to have it's address inputs driven by a 3-bit binary counter; preferably a synchronous counter to avoid "glitches".

Two such mux/demuxes could be driven by a 4-bit counter; the 4th bit used to control the enable pins of the mux/demux (one being inverted).

A possible disadvantage of using a mux/demux is that you would either need more logic to stop/reset the count at a certain number (your cap limit) or you would need to have exactly 2, 4, 8 or 16 caps.
 

Ron H

Joined Apr 14, 2005
7,063
It would be better if a variety of resistors could be selected instead, as resistors are easier to obtain in much more precision than caps, as well as being more compact. However, that couldn't be done with a simple low-side switch.
That is a cool circuit.
You could use diodes as a high side switches, if you could tolerate the minor tempco hit. You could also use a bank of inverters followed by PMOS or PNP high side switches.
 
Top