1
\$\begingroup\$

I am currently working on a 555 timer in astable mode whose output will be fed into a 0.5W, 8Ohm speaker. I want a fading effect for the sound that will be produced by the speaker. I already acquired an envelope circuit which basically produces a voltage signal decaying exponentially for about 3-5 s. How can I turn the output of the 555 timer into a square wave that is also decaying exponentially within 3-5 s? AND can we also do that by only varying the voltage supplied to the 555 timer (i.e., the voltage connected to pin 8)? Here is the envelope circuit I already acquired:Envelope Circuit

Thanks in advance!

\$\endgroup\$
2
  • \$\begingroup\$ You need to use a form of modulation or a variable gain amplifier or, you could brute force it with a diode, a few resistors and an op-amp. It all depends on how accurate you expect the exponential decay to be and how clean the decaying square wave looks. This is down to you to specify. \$\endgroup\$
    – Andy aka
    Commented Dec 1, 2016 at 10:37
  • 1
    \$\begingroup\$ I built a high powered 'ping' for starting swimming races like this. 3v battery with flyback to produce 15v, charges two big capacitors. One capacitor runs the oscillator and FET gate drivers and doesn't droop much. The other capacitor powers the FET H bridge that drives the speaker, and runs down during the 'ping'. 20 watts of ping from two AAs! \$\endgroup\$
    – Neil_UK
    Commented Dec 1, 2016 at 10:53

3 Answers 3

2
\$\begingroup\$

What you want to do is to amplitude modulate a square wave. Fortunately, this is easy to do with square waves because you can amplify them arbitrarily and then clip at a adjustable level. This doesn't work with other waveshapes because the result is clipped tops and bottoms, so you end up with a square wave. However, when you start with a square wave, that is fine.

Here is a simple circuit that exploits this effect:

The transistor will switch on and off according to the square wave. The amplitude of the signal applied to the speaker is a function of the volume adjustment voltage, fed in at top.

R2 and D1 perform two functions. First, they give the inductive flyback current a place to go when Q1 abruptly shuts off. Without that, Q1 could get fried. Second, R2 causes the current decay when Q1 is shut off to have about the same profile as the current rise when Q1 is turned on. This isn't necessary to get sound out of the speaker, but will make the sound a little louder than if R2 was not there (replaced by a short).

\$\endgroup\$
4
  • \$\begingroup\$ Nice! Hadn't thought about the clipping property of the square wave \$\endgroup\$ Commented Dec 1, 2016 at 13:25
  • \$\begingroup\$ Currently trying the two circuits. In this circuit, how can I place a capacitor to prevent DC to pass through the speaker? \$\endgroup\$
    – user131241
    Commented Dec 1, 2016 at 13:58
  • \$\begingroup\$ @Poy: You don't bother. At this low power, a little DC isn't going to make much difference. Since you're driving the speaker with a square wave, it's clear that a little additional distortion isn't going to matter. Allowing DC thru the speaker allows for a louder result with a simpler circuit. \$\endgroup\$ Commented Dec 1, 2016 at 14:06
  • \$\begingroup\$ @Poypoyan the AC-coupling caps in my circuit are only necessary because I couldn't make any assumptions on the bias of your signal, and I really didn't want to push 4.5V/8Ω ~= 0.5A through your speaker before you start generating any signal. In reality, you'd typically add another NPN stage after my circuit – with Olin's, that is not necessary. \$\endgroup\$ Commented Dec 1, 2016 at 14:47
1
\$\begingroup\$

You could use the output of your envelope generator to drive the base of a transistor which amplifies the square wave signal.

To be fair, instead of your envelope circuit that decreases the output, I'd simply charge a capacitor through a resistor; that leads to a \$1-e^{-t}\$ kind of voltage over the capacitor. That, in turn, I would connect to the base of an NPN transistor (possibly with a bigger base resistor not to distort the voltage curve too much) in common-emitter configuration. That would attenuate the input signal with rising voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

Notice that I used C2 to capacitively couple your square wave into the circuit, and C3 to couple it out – that forms a high pass filter (i.e. DC can't go through), and the frequencies at which that circuit cuts off depend on the values of C2 and R5, and also on C3 – you can safely make C3 a lot bigger than 100nF. Don't worry about this changing your signal – it does – because your speaker doesn't care (or like) DC, anyway.

So what happens here is that you first have R3/R4 forming a voltage divider – so if there was nothing else, the collector point of Q1 would be at exactly 4.5V.

Then you couple in your signal through C2 and R5 – this "pulls" that 4.5V up and down with the high-passed input signal.

The variable attenuation happens because parallel to R3, we have Q1's collector-emitter resistance. When the current flowing into Q1's base (from the "capacitor's voltage" node through R2) is high, that resistance becomes low – in fact, significantly lower than R3 or R4. So what our signal now sees, after "coming out" of C2 is a voltage divider formed by R5 and Q1's collector-emitter resistance. The lower that gets, the smaller the ratio of output- to input voltage of that divider!

Because, as said, we don't want DC to flow through the speaker, we then pass the result through C3.

Congratulations! The simplest possible voltage controlled amplifier :) Note that this isn't even remotely linear in amplification. But square waves don't really call for "correct" or "clean" amplification, do they?

\$\endgroup\$
2
  • \$\begingroup\$ Hmm... What is R_charge? \$\endgroup\$
    – user131241
    Commented Dec 1, 2016 at 11:04
  • \$\begingroup\$ @poypoyan it's the charging capacitor, which defines how fast the voltage over C1 rises! \$\endgroup\$ Commented Dec 1, 2016 at 13:23
0
\$\begingroup\$

I'm not a big fan of the NE555. I agree it's a nice little IC to build timers, oscillators of all kinds, but in this time and age, its price is rivaled by microcontrollers, which, once you've learned how to program them, make design considerably easier. When you actually need something like a sawtooth, it's nice. If you need an appropriately set square wave, or easy adjustability, it's almost certainly not the way to go, in my opinion. I find it easier to build digital circuitry instead analog one, and it makes it easier to be exact and power-saving – with fewer components.

So, I'd simply use a microcontroller with a feasibly fast PWM unit (practically all you'd buy in an actual enclosure have one), and use that with a programmatically reduced duty cycle as the envelope function – a simple low-pass filter (RC) will convert the PWM, being much faster than what the human ear could perceive, to a DC voltage. Basically, a PWM-based Digital-to-Analog converter.

And instead of externally modulating a square wave with that DC voltage, I'd simply tell the microcontroller to set the PWM's duty cycle to 0 for when my square wave is supposed to be low, and to it's current (decaying) duty cycle when it's high. With anything but the very very tiniest microcontrollers you get another timer module that can generate interrupts at fixed intervals, making programming this very easy.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.