How can I send a single pulse when the input is a constant ON?

Hi @titanium,

After a few tryouts and failures I found a nice solution…
As you also noticed the NE555 trigger input is very very noise sensitive…

I recreated the Littlebits timeout bit without the opamps and added the differentiator as discussed earlier. The differentiator is connected to the trigger input from the NE555 via a capacitor (100nF) and a variable resistor (P1, 50kOhm).
You must set this resistor appr. halfway (30/50) to get a stable trigger.
To adjust the output pulse duration you can vary the values of the capacitor C1 and the resistor R1.

The output LED flashes 3 seconds when the switch changes from OFF to ON (and stays ON). When the switch is released (changing from ON to OFF and staying OFF) the LED flashes again 3 seconds.

I think this answers your question (I hope)… :grinning:

1 Like

Enthusiastically three times a day I was checking & waiting for your precious reply.
You left me speechless… :no_mouth:
I really don’t know how to thank you…

I’m short in a few of elements in the circuit. I’ll obtain them and will inform you of the result, hopefully tomorrow…
Regards :rose:

PS: I’m short in 100nf but I couldn’t wait until tomorrow, so I tried to assemble them using what I had and managed to make & try the circuit with 190nf (instead of 100nf)
But unfortunately I do not get the LED ON upon press and I just get it ON for 3 secs upon release!!
Probably that capacitor is the culprits. I’ll try the circuit tomorrow this time with the exact elements and post the results ASAP.

1 Like

The variable resistor P1 is crucial. After setting it I measured the setting and replaced this part by two normal resistors, 33kOhm from the middle connection to VCC and 22kOhm from the middle connection to GND. Then it also worked as it should.

1 Like


1 Like

Please share your final project when ready…



And Final Project:



Hi Alex.

Love this project you’ve done. I am planning on using this to trigger a switch that only has a push button so this will work ideally for me as the switch will be either on or off and the push button is temporary. So each time the switch status is changed from either on to off or off to on the circuit will send a single pulse through. Will you please advise me what is needed so this circuit will work off 3.3V input and give a positive 3.3V output (trigger).

Thanks in advance

1 Like

Hi @Michael266911,
The general specification of the 555 IC mentiones a minimum operating voltage of 4.5 Volt. I checked the trigger at 3.3 V and it worked without changing any component, although the output voltage on pin 3 of the 555 is 2.75 Volt without the Led and 2.05 Volt with the Led connected.
I do not think this output voltage can be increased, I suppose it is caused by the internal setup of the 555 IC.
Hope this is what you need,

1 Like

Hi Alex,

Can you please guide me How I can get the inverted output from this 555 IC circuit.

Hi @Mukesh_1896,
An inverted output can be done with an additional transistor BC547, see attached diagram.
I did not test this but I think it should work.

Hi, i found this handy circuit and the very helpful Alex Pikkert when searching for a solution to my problem. im trying to trigger a wifi connected switch when the house current is interrupted. i have a ups to run the circuit from (12v output) and the input of the wifi switch is a momentary switch (a longer press puts it into setup mode)

so, your circuit which takes an input state change, and outputs a pulse is ideal.

i have modified a mains sensing circuit i used before, which has an optoisolator and a big resistor for sensing mains current. its been working fine in the current circuit for almost a year, and i have spares.

the output needs to drive a small relay to keep things nice and seperate from the wifi switch.

i have built what i think should be a version of your circuit, with my optoisolator on the input, and a transistor output to drive the relay in LTspice, but it basically just doesnt work.

i get nothing on the output for the first 2.5 seconds, then the output latches, and stays latched. input doesnt affect anything.

i need to figure out how to upload a screengrab of my ltspice simulation, but i hope i can get some advice from the horses mouth so to speak.

going on holiday in a week and it seems the power drops out every time we go on holiday and we come back to a smelly fridge!


edit:hm. new user, cant upload an image :frowning:

Hi @robinlawrie,
The transistor output should work when connected to my circuit.
Try to use a relay contact as input signal.
adjusting the variable resistor P1 might help.


Hi @robinlawrie.
I have a few questions here.
What does your wifi switch do ?
If power breaks, how long is the power out ?
Is there enough power for the rest of the circuit when power fails ?
How is your optocoupler connected to the power dedection and 555 circuit ?
A schematic would be apreciated. Can’t you post on Flickr or similar ?

Hi All, thanks for the replies. in the end i was shown another circuit that works (in ltspice at least) so im in the process of building that.

@frankie, i am using the wifi switch in an unconventional way. it is designed to be activated either by a small button on the switch, or via an app on your phone over the internet. it then trips its relay and turns something on or off.

however the feature im using is the fact that when you trigger it via the button on the device, it sends a message to the phone too.

so i will be using it without an output (i.e. not switching anything) and i will replace the pushbutton switch with a relay driven by the momentary circuit we are discussing.

the same button on the wifi switch is used to put it into setup mode if it is held down for a longer period, hence the need for a momentary circuit.

i have a mini 12v UPS which keeps my router running in case of outage. i will be running the wif switch and this circuit from the same thing. it provides about 4-5 hrs of power in case of a blackout.

so, behaviour is as follows:

mains across AC optoisolator ( with 220k resistor to bring mains down to circa 1v for the opto - i use 4x 55k resistors to spread out the tiny load and avoid heat buildup) - this part of the circuit should be potted in epoxy or protected well of course… mains isnt funny.

the opto part of the circuit i used in another project where heat was an issue, i started with a tiny transformer to step down mains for detection, but it got up to about 80 degrees when run continuously, and drew about 1 w for no reason.

opto runs cold and consumes virtually nothing.

output of optoisolator is used to trigger momentary circuit.

if mains goes down, opto changes state, momentary circuit trips relay for 1 second or so, and wifi switch sends message to my phone.

this is useful here as lumpy mains often trips circuit breakers while we are away. i can call the neighbours if i get an alert.

1 Like

Excuse me but can you help me with triging a 555 IC when state changes from VCC to GND and also when it changes from GND to VCC?
I can use two 555ICs one of them for GND to VCC and other for VCC to GND.
Please help me. I have a few time to complete my project.
In conclusion I need to trig a 555IC with a power Off and power On.

Hi @Shayan :smile:
To trigger a 555 in monostable mode, you need a negative trigger pulse at pin 2. If your assignment is also to demonstrate triggering the same 555 circuit but with a positive signal, then here are two options. I hope this is helpful to you.

  1. Use an NPN transistor with the collector connected to VCC in series with a 10K resistor. Also attach pin 2 to the collector. Emitter to GND. Connect your incoming signal to the base with a 1K resistor in series.

  2. Use an op amp to make an inverting comparator, as seen in the littleBits timeout Bit (see image below): Find out more about comparators in “Timer, Op Amp & Optoelectronic Circuits & Projects” by Forrest M. Mims III.

Hi @jackANDJude
I mean I want a circuit like an UPS system circuit.
For example I will connect a adapter to the circuit then with poweroutage(plug out the adapter) the circuit make a trig on 555IC and when I connect adapter, agin it make trig on 555IC.
Something like UPS.
Can you help me with trigger circuit?

How many 555’s do you plan on using? Could you please draw a block diagram to help us better understand the problem?

Please keep in mind that on this forum you will likely get responses from myself and others with littleBits to prototype solutions. Bits are perfect for testing the logic of block diagrams. :bitstar:

Hi @Shayan,
please take a look at the beginning of this post.
There is exactly what you are looking for, however built with Littlebits.
This is a littlebits forum, so you can expect Littlebits solutions.

1 Like