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

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

I need a circuit to make trigger for this circuit.
I mean make a trigger with power outage and connecting power(i diagram I have drawn a push button instead of connecting & disconnecting power I mean when I push the button and hold it,I connect the power and when I don’t push it,I disconnect power).
Now if it is possible help me with a circuit in a empty rectangle in diagram I have drawn.

Hi @alexpikkert
That circuit helps me very much and that was my problem that you have solved it but it is just works when I connect the power(change state from GND to VCC).If it is possible please help me with change the state from VCC to GND circuit.I really need this one.

Hi @Shayan and @robinlawrie
If you need to trigger when powering on and off you could always use a transformer with diodes and capacitors… Due to induction you will get a pulse when you connect or disconnect the power. This transformer helps also in separating mains with low voltage.
I see you’re in electronics so it should be fairly easy for you to design this.
Hint : you need a transformer with center tap on the secondary :slight_smile:
As mentioned above, this is a littlebits forum. If you like to experiment get one of those kits and start inventing. You’ll have great fun . They are not only designed for children but also for adults.
Try to solve on of my puzzles and you see what I mean :sweat_smile:

1 Like

Hi @Shayan, @robinlawrie,@Frankje, @JackANDJude

No offence, but this is indeed a Littlebits forum. This post started with a Littlebits discussion, but grew over time into a NE555 discussion.
Maybe you can try your luck at the following forums also: