3
\$\begingroup\$

I've got an assignment to make some kind of alarm. When user presses the push button, 1kHz sound should be generated and outputted on some kind of speaker (I'll use buzzer).

That part I know how to make. I can use NE 555 to make astable to generate 1kHz output. But other part of the assignment is the problem. Is says that duty cycle should change from 50% to 0% while user is holding the push button ... I don't even have an idea what to try ...

EDIT: Duty cycle should decay from 50% to 0%.

\$\endgroup\$
2
\$\begingroup\$

Is the duty cycle supposed to switch from 50% to 0%, or decay from 50% to 0%? Is there any particular precision required on the 50%? Is there any requirement regarding quiescent current?

I would suggest that you start by using a 555 or similar chip to generate a symmetrical sawtooth-ish (doesn't have to have straight sides) wave, and then feed that into one side of a comparator. The other side of the comparator should be connected to a circuit which will generate a voltage that will start at half-rail when the button is first pushed, but will either rise toward VDD or fall toward ground after that. If you can use a SPDT pushbutton, a simple realization of such a circuit would be to connect the center pole of the button to a cap whose other leg is ground. Connect the normally-closed contact to VDD, and the normally-open contact to the comparator input. Connect a resistor from that comparator input to ground.

Conceptually, it would be nice if a single active device could be used to provide the output, without needing the separate comparator. It's possible for the 555 to provide an output whose duty cycle will be affected by an input voltage. Unfortunately, the frequency will also be affected by the input voltage; I'm not sure of any easy way to make a compensated circuit such that the decrease in high time will be balanced by an increase in the low time so as to yield a reasonably-constant frequency (as opposed to having a device generate a 1Khz reference signal which is then shaped by a second active device). A two-chip circuit doesn't seem unreasonable, though.

Here's a simple circuit which will illustrate the concept. For simulation purposes, it uses an op amp, but a comparator would work just as well. One slight note: many comparators ground the output when the + input is higher than the - input, so the polarity would be opposite that of an op amp.

\$\endgroup\$
  • \$\begingroup\$ It is supposed to decay from 50% to 0%. No other requirements. And no particular precision. It should be around 50%. I'm not familiar with comparators ... Is it operational amplifier used as comparator ? Would what you described give me 1Khz with decaying duty cycle ? Thank you answering :) \$\endgroup\$ – xx77aBs Dec 17 '11 at 17:54
  • \$\begingroup\$ There are two styles of "ideal" comparator; one behaves as an ideal op amp whose outputs are pegged to the rails. The other acts like a switch which connects the output to ground whenever the first type would output a positive voltage. It's possible to use an op amp as a comparator, but it's important to note that op amps have limited (albeit large) gain and are designed to have their gain roll off at high frequencies, since this tends to improve stability in typical applications. By contrast... \$\endgroup\$ – supercat Dec 17 '11 at 18:04
  • \$\begingroup\$ ...comparators are designed so that when they notice that one input is higher than the other, they will switch as hard and as quickly as possible. This is often accomplished by including a small amount of internal positive feedback. \$\endgroup\$ – supercat Dec 17 '11 at 18:06
5
\$\begingroup\$

Personally I'd use a small microcontroller.

Something like an ATTiny, or a PIC10F for example. Both incredibly cheap, and pretty much no external components needed other than some resistors, a button and a piezo transducer.

\$\endgroup\$
  • \$\begingroup\$ I don't have programmer, so I can't use microcontroller :( \$\endgroup\$ – xx77aBs Dec 17 '11 at 17:39
4
\$\begingroup\$

This is actually pretty easy if you think about it the right way. You say making a 1 kHz oscillator driving a speaker is no problem. You already know how to enable and disable that. When free running, the duty cycle should be about 50% (a square wave) already. Now note that 0% duty cycle is the same as off. So intead of having the switch gate your 1 kHz oscillator, make another slower oscillator and have that gate the 1 kHz oscillator.

So to summarize, you have the switch, which gates a slow oscillator (let's say 10 Hz), which gates the 1 kHz oscillator, which drives the speaker. You have to arrange the polarity of the first oscillator output and the second oscillator input such that the second oscillator is off when the first is gated off by the switch.

Basically, this is just using two instead of one of the same circuit you already know how to make.

\$\endgroup\$
  • \$\begingroup\$ agreed, a simple disable can be made in moments. \$\endgroup\$ – Kortuk Dec 14 '11 at 14:46
  • \$\begingroup\$ From the description, I don't think it's clear whether it's supposed to be a 'gated' disable, or a decaying duty cycle. \$\endgroup\$ – supercat Dec 14 '11 at 16:10
  • \$\begingroup\$ I am sorry for posting misleading question, it should be decaying duty cycle ... \$\endgroup\$ – xx77aBs Dec 17 '11 at 17:40
3
\$\begingroup\$

Have you considered multiple 555 timers? The first setting the variable duty cycle as an input to the 1khz generator?

\$\endgroup\$
  • \$\begingroup\$ Isn't duty cycle defined by used resistors ? How can I control it using another 555 timer ? \$\endgroup\$ – xx77aBs Dec 17 '11 at 17:42
  • 1
    \$\begingroup\$ You can manipulate the duty cycle using the control voltage. Example 12 in this appnote: doctronics.co.uk/pdf_files/555an.pdf \$\endgroup\$ – Tevo D Dec 19 '11 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.