Button press timer circut

Thread Starter

Jimbo6871

Joined Jun 3, 2018
3
Hi all, first things first I'm a total noob to this fourm so if I inadvertently infringe on any rules etc. it's not intended. Also I'm a bit of a novice to electronics, so if my questions seem a bit basic I apologise in advance.

I am in need of some advice on building a circut that will trigger a timed output to close a relay for around two seconds when a momentry push button is pressed. The two main requirements of the circut are:
1. If the push button is not pressed for the full two seconds - eg. it is only pressed for one second, the circut will still close the relay for the required two seconds.
2. If the push button is pressed and held - eg. for three seconds or indeed much longer, the circut will still only close the relay for two seconds then return to its open state and remain open until the push button is released and the circut will not close the relay until the button is pressed again.

I had been thinking along the lines of something based around a 555 but to be honest I lack / doubt my ability to come up with a reliable circut (yes I know it sucks that I doubt myself on even the most basic of circuts), but in the counsel of many there is wisdom and so I'm turning to the combined wisdom of the membership of this fourm for assiatance and advice.

Many thanks in advance.
Jimbo
 

jpanhalt

Joined Jan 18, 2008
11,087
Welcome to AAC.

What you are looking for is called a "one shot." That is, once you trigger it, it will send a pulse for 2 seconds. The trigger is an edge, such as a rising or falling edge of the signal the switch makes. There are retriggerable and non-retriggerable one-shots. In the retriggerable version, a second pulse before the end of the 2 seconds will prolong the pulse. Here's more discussion of that:https://electronics.stackexchange.c...a-nonretriggerable-and-retriggerable-one-shot

It is not clear from your description which type you want (note: a second pulse is not the same as press and hold, which produces only one edge). 555's are versatile and a web search will give circuits for one-shots of both versions. There are also purpose-designed chips for doing that. As I recall, it is harder to make a non-retriggerable one with the 555 but my source link has been down for awhile.
 

Thread Starter

Jimbo6871

Joined Jun 3, 2018
3
Thank you jpanhalt.

I'll try to explain as best I can the purpose of the circut.

I need to interface an audio board with a button push in the following way:

The audio board will play a preprogramed wav file when the trigger switch contacts on the audio board are momentarily connected (pin to ground).

https://learn.adafruit.com/adafruit-audio-fx-sound-board/overview

However if the trigger switch contacts remain connected for longer than the wav file length the audio board will replay the wav file repeatedly until the trigger contacts are disconnected.

https://learn.adafruit.com/adafruit-audio-fx-sound-board/faq

The issue that I'm looking to avoid is the situation where the user presses and holds the momentary push button longer than the wav file length and therefore cause it to repeat.

I need the users button to only activate (ground) pin one on the fx board for long enough to trigger the track but then disconnect pin one from ground again almost immediately, even if the user holds in their button for a longer period of time, so that the wave file only plays once during each user button press no matter how long that button press is.

Hopefully that's a little clearer
Thank you again for all your help,
Jimbo
 

danadak

Joined Mar 10, 2018
4,057
A simple state machine would work here.

Key question, how do you know, electrically, a signal, that wave file has finished ?
Or is a simple fixed timeout adequate to take care of the wave file completion ?

Regards, Dana.
 

eetech00

Joined Jun 8, 2013
3,859
Hi all, first things first I'm a total noob to this fourm so if I inadvertently infringe on any rules etc. it's not intended. Also I'm a bit of a novice to electronics, so if my questions seem a bit basic I apologise in advance.

I am in need of some advice on building a circut that will trigger a timed output to close a relay for around two seconds when a momentry push button is pressed. The two main requirements of the circut are:
1. If the push button is not pressed for the full two seconds - eg. it is only pressed for one second, the circut will still close the relay for the required two seconds.
2. If the push button is pressed and held - eg. for three seconds or indeed much longer, the circut will still only close the relay for two seconds then return to its open state and remain open until the push button is released and the circut will not close the relay until the button is pressed again.

I had been thinking along the lines of something based around a 555 but to be honest I lack / doubt my ability to come up with a reliable circut (yes I know it sucks that I doubt myself on even the most basic of circuts), but in the counsel of many there is wisdom and so I'm turning to the combined wisdom of the membership of this fourm for assiatance and advice.

Many thanks in advance.
Jimbo
Hi

What is the available power supply voltage?
What is the minimum time ground has to be applied to trigger the wav playback?
Will the wire connecting the button to the audio unit be very long?

Edit:
I see minimum time is 125 ms. and each input has internal 100k pullup resistor.
I also see power is 3v - 5.5v
eT
 
Last edited:

eetech00

Joined Jun 8, 2013
3,859
Hi

This should work.

The graphic shows that when the button is help pressed, the input (pin0) will be at ground for about 250ms.
The same will occur if the button is pressed and released. If the wires are long, may have to add additional circuitry.


You might want to add led connected to "Act" pin to show that the audio is playing. This pin goes low when audio in playing. I didn't see how much current is available thu this pin but might be able to be an LED connected from "Act" pin thru a resistor to "Vin" (anode thru resistor to Vin, cathode to Act pin).

eT

MomPB.png
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
If the trigger input to audio board is CMOS very slow rise/fall signals can cause
multiple logic triggers as input stays too long in input totem pole active region
and system noise causes false triggers..

Its reason why logic interface like this need either Schmidt trigger gate or comparator
with hysteresis.

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwirq-PK8bfbAhWr34MKHc_PC0wQFggpMAA&url=http://www.ti.com/lit/an/scba004d/scba004d.pdf&usg=AOvVaw1yyAQyDUY6j2SFKEr8Qgtu

You can get el cheapo single gate logic, Schmidt trigger conditioned inputs, here -

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwixsvvv8LfbAhWF8YMKHXb4CfoQFggpMAA&url=http://www.ti.com/lit/sg/scyt129f/scyt129f.pdf&usg=AOvVaw3Gv2n5LeW9ZXhTf0MiNDJi

Regards, Dana.
 

AnalogKid

Joined Aug 1, 2013
10,987
First, the standard 555 application circuits cannot do what you describe.

The basic circuit you want is called a monostable, short for monostable mutivibrator. Since there are several variations that use this name but perform differently, a better term is a true monostable. This uses positive feedback to ensure that the output is completely independent of the input once triggered. The input closure can be longer than, equal to, or shorter than the output pulse and the output will not care.

Note 1 - typically a monostable takes about as long as the timing period to recover between timing cycles. So without a small modification, if the input is triggered again only 1 second after the last output ended, the next output will be shorter than the full 2 seconds.

Note 2 - If the switch is held down longer than the output pulse width, the circuit output ends normally but the resetting for the next pulse is delayed as long as the switch is held. For example, if you hold the switch for 5 seconds, the output sill make a 2 second pulse. But internally, the capacitor will not begin to reset for another 3 seconds (the remaining time the switch is being held). Once the switch is released, the capacitor will take 2 seconds to reset.

The classic monostable uses two NAND gates or two NOR gates, depending on the polarity of the input and output signals. Here is the 2-NAND circuit:

seq9.gif

Because of the positive feedback, you don't automatically need Schmitt trigger input gates such as the CD4093 for such a long output pulse, although it wouldn't hurt. For Ct and Rt, the timing calculations for Schmitt and non-Schmitt gates are different.

To shorten the reset time, a small signal diode is added in parallel with Ct.

What is the power supply voltage for the monostable circuit?
What is the power supply voltage for the audio board?

ak
 
Last edited:

eetech00

Joined Jun 8, 2013
3,859
If the trigger input to audio board is CMOS very slow rise/fall signals can cause
multiple logic triggers as input stays too long in input totem pole active region
and system noise causes false triggers..

Its reason why logic interface like this need either Schmidt trigger gate or comparator
with hysteresis.

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwirq-PK8bfbAhWr34MKHc_PC0wQFggpMAA&url=http://www.ti.com/lit/an/scba004d/scba004d.pdf&usg=AOvVaw1yyAQyDUY6j2SFKEr8Qgtu

You can get el cheapo single gate logic, Schmidt trigger conditioned inputs, here -

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwixsvvv8LfbAhWF8YMKHXb4CfoQFggpMAA&url=http://www.ti.com/lit/sg/scyt129f/scyt129f.pdf&usg=AOvVaw3Gv2n5LeW9ZXhTf0MiNDJi

Regards, Dana.
Yes...trying to avoid using chips. I could have used a pair of 4093's, or transistors at the output, but was waiting for the TS to reply to my question regarding wire length from the PB circuit to the audio device.

eT
 

Thread Starter

Jimbo6871

Joined Jun 3, 2018
3
Yes...trying to avoid using chips. I could have used a pair of 4093's, or transistors at the output, but was waiting for the TS to reply to my question regarding wire length from the PB circuit to the audio device.

eT
Hi, thank you for your input, it's a tremendious help!

As for distance in the push button circut goes, the actual 'electronics' of the push button circut can be housed right beside the audio module.
The reason I'm saying the 'electronics' is that the physical push button could be located some distance away (in the order of several tens of meters). Now I realised early on that voltage drop along a long cable would be an issue, my suggested work around for this was to use (a tried and tested method I've used for other applications) where the push button in the 'electronics' is replaced with the switch contacts of a NO relay, the actual button circut would be electrically independant and seperate from the electronics with it's own power supply suitable for the length of cable used in the circut.
Hope this clears that part up a bit.
***Note to all, I really really appreciate everyone's input on this, you're probably the most helpful bunch I've ever encountered on any fourm!****
 

AnalogKid

Joined Aug 1, 2013
10,987
I realised early on that voltage drop along a long cable would be an issue
Actually, no.

The voltage drop across long wire runs is dependent on the wire resistance and the signal current. If the current is only 1 mA, then a cable run of 100 feet (200 feet round trip) would have a voltage drop of only 3 mV. Of far greater concern is that the wire fun acts as a 200 foot noise antenna.

Try this. For the #8 schematic, pick R1 such that the current through it when the switch is pressed is 5-10 mA. This relatively high value has no effect of the operation of the circuit, but makes it more difficult for induced noise to cause a false trigger. For example, if the circuit power supply is 5 V, then R1 should be something in the 470-1000 ohms range. The current through the switch will be between 5 mA and 10.64 mA. If the switch's current rating is near this value, increase R1 such that the switch current is never greater than 50% of its rating.

The resistance of #22 wire is 0.0529 ohms per meter, or 0.016136 ohms per foot. Using Ohm's law, the voltage drop over the 200 foot round trip is 0.016 V to 0.034 V, not enough to matter.

For improved noise rejection, use twisted pair wire rather than long parallel runs such as lamp cord.

ak
 

danadak

Joined Mar 10, 2018
4,057
The comments about use of a Schmidt apply to the passive network shown just
prior to the Schmidt post and its response. I see I should have stated that so no
confusion.

Totally concur 555 takes care of that particular issue.

Regards, Dana.
 
Top