Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Stretching audio output pulse

Not open for further replies.


New Member
Newbie question. As per my posting at I am playing with one of these small LM393 based Arduino sound input boards: **broken link removed** running at 5v. I assume that the circuit diagram is something like this one: (The only physical difference is that my board has the output pin in the middle) The output is active low and digital. It turns on when the sound level reaches a certain volume and turns off when it drops below that.

I am trying to drive a small 5V solenoid from the output. I tried connecting the output directly to the gate of a p-channel mosfet, with a flywheel diode across the solenoid for protection, with the solenoid on the low side of the mosfet, but the input pulses are too short to activate the solenoid. I put a scope on the module output and even when I make a continuous loud sound the output spikes on and off rapidly. Is that to be expected? Maybe the module is faulty?

I tried putting a 1M pot inline with the gate, in parallel with a diode with the cathode facing the module output (designed to allow fast turn-on but slow turn-off), but all that did was cause the mosfet to heat up.

It is only when I turn the trimpot on the module until the output comes hard on that the solenoid activates. The problem is not helped by the fact that the trimpot on the board is not sensitive enough. At one setting the output is on permanently. Turn it by the smallest amount possible and the output will only come on with very loud noises. There seems to be no middle ground.

I need the output to be on for about 200ms to reliably activate the solenoid.

Part of the problem was the mosfet I was using. It was a MTP2955 p-channel mosfet. I see from the datasheet that it needs 10v, even though the scope showed 5v spikes on the mosfet output. I have since ordered some NDP6020P p-channel mosfets that turn on at 2.7v but I am still doubtful that they will turn on long enough to pull in the solenoid.

I have found various pulse stretching circuits based on a 555, for example but I was wondering if there was a simpler method of stretching the output pulse just using the mosfet and an RC combination (without heating up the mosfet). Bear in mind that the NDP6020P will still be hard on at 2.7v so that gives some leeway to allow the input to the gate to be stretched.

The only issue is that I want the turn on to be as fast as possible. I was worried that having to charge a cap on the input would slow down the turn-on. The 555 would not have that problem.

Attached is a shot of the scope reading of the module output with a sustained loud scream. The longest pulse is about 80ms. (Note the scale is 0.1s per div horizontal and 1V per div vertical.) (I obviously connected the probes backwards. The output pin sits at 5v and drops to 0v when activated.)
scope output.jpg

I want to activate it using normal voice. WIth that the pulses are very short. See nextimage. The longest pulse is about 6ms. (Note the horizontal scale is 20ms per div for that one).

scope output1.jpg
Last edited:
What is a "continuous loud sound". Banging on the table a lot is not a continuous sound because you bang slowly and electronics are very fast. A continuous sound would be a like a tone. And how fast is "rapid"?

Go to a website that generates tones and play that into your module and see how it reacts.

As far as stretching goes:

You could use a diode to bypass the R in the RC combination at the MOSFET gate to let it turn on quickly but turn off slowly. Diode in series with the R, and this RD combination is in parallel with the C. The C is in parallel with the gate-source terminals. The D acts to allow the R to interfere with charging the gate capacitor but allows it to participate in discharging.

The problem is that the MOSFET won't get a delayed turn off as much as it will be a slowly turning off as soon as it is released. You would have to overdrive the gate by some amount since as soon as you release it, the voltage will begin to slowly deteriorate. When this excess overdrive voltage is depleted the MOSFET will begin to shut off much more rapidly but still much slower than actually driving it off.

The slow discharge of the gate could cause the MOSFET to turn off too gradually which makes it spend too much time in the linear region in between on and off which generates more heat than if it was fully on or fully off. The voltage threshold for turning off also won't be very clear cut. If you placed a comparator in between the RCD circuit and the MOSFET gate, that would change things.

You might get away with just an RCD since it is a solenoid and doesn't need to be very precise to begin with. But watch for erratic behaviour when testing it.
Last edited:
Your 555 idea is the best way to deal with this.
Try a tone anyways. If the board is the schematic you say it is, it's because it's running a unipolar comparison operation on a bipolar AC signal. It should be plainly visible if that's what is happening if you use a sinusoidal test tone. If that's the case, any sound, continuous or not will never have a a continuous output.
I read in several places that if the input pulse (or subsequent pulses) to a 555 is still low when the timing interval expires then the output will remain high (forever?) eg. Quote "During the timing interval, the state of the trigger input has no effect on the output. However, as indicated in figure 3, if the trigger input is still low at the end of the timing interval the output will remain high. Make sure that the trigger pulse is shorter than the desired timing interval."

That would clearly be a problem in the (regular) case where a subsequent input pulse arrives right at the end of the previous timing interval. Starts getting messy, potentially requring a pulse on pin4 to reset it. Any ideas for catering for that please?
Based on the ebay photos, the board is a dual open-collector comparator with one section as a mic preamp and the other as a level sensor. I don't see enough capacitors for the board to be an envelope detector, which is what you want. I'm not a big 555 fan, but it is a good way to go for a one-off project if you want to stay with a pre-packaged mic circuit as the front end.

The 555 retrigger issue is well known and easy to solve with one additional capacitor.

As for the 555 issue, does it really stay on forever or does it just stay on until the input pulse goes high again? The latter would be fine.
Until the trigger input goes high again. The standard 555 monostable circuit does not have any positive feedback (necessary for a true monostable). It also is not a standard retriggerable monostable circuit.

Unlike a true monostable, the output is not completely independent of the input (once triggered).
Unlike a retriggerable monostable, the output timing doesn't restart if retriggered during a timing interval.
Unlike a differentiator circuit, the output pulse doesn't terminate if the input trigger pulse is narrower than the output.
Unlike a pulse-stretcher, the circuit pulse width isn't added onto the input pulse width.

Last edited:
I found this supposedly retriggerable 555 that requires no transistor. That looks exactly like what I want. Adding D1 supposedly changes it from non-retriggerable to retriggerable.

I found this pre-assembled module: **broken link removed** It is a time delay module, as described here:
I am hoping that with a few modifications I can adapt it to a pulse stretcher. I have asked them for a circuit diagram to see how much modification would be needed. Feasible?

In fact when I compare the non-retriggerable circuit diagram here: with a power on delay circuit here: they look virtually identical, so I presume it should be simple.

PS. Why do some circuits suggest a resistor between reset pin 4 and Vcc (eg. the one above) when others omit it?
Last edited:
Why do some circuits suggest a resistor between reset pin 4 and Vcc (eg. the one above) when others omit it?
Don't know. The direct connection has been on the datasheet since day 1.

Last edited:
Ok I built a little 555 monostable circuit on a prototype board to connect to the output of the sound module. Setting the output pulse to 100ms or so triggers the solenoid nicely, but now I have another problem.

Without the 555 connected to the output the sound module works perfectly. It is easy to adjust the trimpot so that normal voice at about 300mm from the mic makes the output LED on the module flicker on and off nicely. A scope on the output pin shows nice (negative) spikes when the volume is highest.

When I connect the module output to the 555 monostable trigger pin 2 however, the sound module no longer works properly. The output LED immediately comes on and stays on and the 555 triggers. I therefore have to adjust the trimpot on the module to increase the threshold at which the output triggers. I adjust it so the LED only just goes out, but the module then becomes very unresponsive. Normal voice, even a few mm from the mic no longer triggers it. I have to shout or blow on the electret mic to make it trigger.

I tried putting a 47k pull-up resistor on the 555 input. I tried a 10uF cap in series between the trigger pin and the module output. I tried both an NE555 and a 7555. None of them changed the situation.

The module, 555 and solenoid are sharing a common power supply. When the solenoid triggers it pulls around 1A current which was mucking things up so I put a 1000uF cap across the power input and that fixed that problem but the other problem remains.

I suspect that the modules are not very high quality at $3.26 each. I bought several of them but all are the same. Is there a logical reason why connecting the module to the 555 would alter the functioning of the module and is there any obvious way of fixing it?

I thought of connecting the module output to the gate of a mosfet and having the mosfet drive the 555 input but that will then invert the logic. (The module produces negative pulses with sound, which is what 555 input wants.)
Last edited:
Is it feasible to use a photo diode to receive the signal from the LED on the sound board rather than connecting them electrically?
Now I am totally confused. I connected the audio module to a different 5v plugpack from the 555 circuit. Now the circuit works perfectly, even though I didn't run a ground connection between the two.

I can understand that the solenoid (which has a flywheel diode across it) could be upsetting the circuit at the moment it turns on due to fluctuating voltage, but even when it was off the mere fact that the two circuits were connected to the one power source (5v x 1.8A plugpack) mucked up the operation of the sound module.
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips