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

I have a rain sensor that sends an input signal to my Cloudbit, which then sends me a notification (using an IFTTT recipe) when it starts raining. The problem is that the rain/moisture sensor remains constantly ON when it gets wet, so I continue to get notifications from IFTTT every minute after it gets wet.

I would like to just get a single notification when it starts and stops raining (i.e. when it changes state). Another example would be if you used the bend sensor to be notified when a door opens or closes. You may not want to be continuously notified when the door remains open, only when it first opens and/or closes.

I’ve tried using the timeout bit to shut off the high signal after a certain duration, but that doesn’t work. The constantly high input signal overrides the timeout bit. I tested this using a simple pushbutton circuit. If the pushbutton remains depressed, the signal remains ON beyond the timeout bit until the pushbutton is released.

For a different project, I created a one-shot pulse module, but that sends a pulse when the circuit is initially powered on ( http://littlebits.cc/projects/delayed-one-shot-pulse-timer-module ). In this new situation, I’d like a singe pulse when the input trigger goes high (and stays high) so I only get one notification from IFTTT.

Any ideas?

-Tom

Hi @tomparsons2,
welcome to the forum!
I suggest you could use an Arduino bit, the logic needed to make a “single shot” based on a changing input can be programmed… :slight_smile:

Hey @tomparsons2

I agree with @alexpikkert! If you have an Arduino bit you can program that to send the trigger on state change. I would think you would want to read the analog value and create conditionals to react accordingly with a delay of a few minutes or so.

Something like this should get you started (havent tested this yet):

 int moistureValue = analogRead(rainSensor)
    
 if(moistureValue <= somevalue)  //change condition according to your sensor (add additional conditions, etc)
{
       digitalWrite(cloudBit, HIGH)  //cloudbit on
      delay(100);
       digitalWrite(cloudBit, LOW) //cloudbit off
 } 

delay(300000); // read sensor every 5 minutes, change to whatever value you need in milliseconds
1 Like

Hi Jude @JackAndJude,

I remember you started a topic a few months ago about using the IC 555…
Maybe this could be a useful application, a “single shot” bit which generates one fixed defined pulse on the output when the input changes from GND to VCC or ftom VCC to GND…
Then an Arduino is no longer needed for this.

Bitlab ?

:bitstar: .

You could use a little circuit with a 555 IC on a protoboard bit…
It generates a 3 seconds pulse when the input is switched to GND, even when it stays on this level.
So it sends a pulse only once when the input changes state from VCC to GND.
Maybe the circuit can be extended to also send a pulse when the input changes state from GND to VCC.
:sweat_smile: …


2 Likes

Hi Tom,

I think a XOR Bit and a Latch Bit might be able to do the trick.
Have a look at the diagram below:

  • When your weather sensor starts to send the ON signal, the XOR Bit will output ON, which will activate the the Latch Bit to become ON, which will make the output of the XOR Bit OFF again and stop sending a signal to the Cloud Bit. The Latch Bit will stay ON.
  • Now when the weather sensor switches to OFF, the XOR Bit will send ON again (because the Latch Bit is still ON), sending another signal to the Cloud Bit, and switching the Latch Bit to OFF, which will also make the output of the XOR Bit OFF again, and so stop sending a signal to the Cloud Bit.

Does this make sense?

You could also use the Arduino Bit, but I kind of like a “basic Bits” solution :smile:

–Dion

1 Like

Problem SOLVED. Thanks for everyone’s responses.

I took the advice of @DionoiD and created a circuit using an XOR bit to turn off the signal to the Cloudbit after a pulse of a few seconds (actually, I had to add a timeout bit to the circuit that Dion suggested, but now it appears to work perfectly).

See the video demonstration: http://www.youtube.com/watch?v=Un66KHkauh8

I can think of alot of applications for this “single pulse” circuit. For example, suppose you want to use a light sensor to get a single notification when the sun comes up in the morning.

Thanks again,
Tom

4 Likes

Great to know that you got this working, Tom!
I agree that such a “single pulse generator” would be useful for a lot of projects.

The Timeout that you added, provides the delay you need to get this circuit working.
Thanks for the fix!! :slight_smile:

1 Like

WOW - great solution and suggestions all around! :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Hi Alexpikkert,

I have a slimier problem needing to make a latching 12volt to a pulse to fire a relay and i came across your diagram its exactly what i need, is there a way to make it a 1 second pulse?

Thank you so much

Hi @jonomobile,
I will check my diagram and try to change the timing to one second. I will send you the update when it works.
:grinning:

Hi @jonomobile,

To make a one second pulse you only need to change one resistor in the diagram. ®

A value of 33 kOhm will make a pulse of approximately one second.
(the NE555 is an analogue IC so it is not accurate…)
You can experiment with other values of R to make different pulses.
The power supply can be 12Volt DC as you mentioned, but then it will not fit into the Littlebits world anymore… Littlebits use a maximum of 5 Volt DC.
:grinning:

Thank you so much Alexpikkert, your a life saver, going shopping today will build it and let you know, thanks again :smile:

1 Like

Hi @jonomobile,
In my diagram the 555 output switches only a led, if you want to switch a relay keep in mind that the 555 can switch max. 200 milliamps.
My advise is to keep it far below this value…

Hi @alexpikkert and @jonomobile
You could also use 5V for the 555 timer IC and connect a npn transistor at the output to control a 5V relay. Don’t forget to use a Si diode across the relay coil to suppress spikes.
This way you can use the power supply from the littleBits, so there no need to use 12V.
Greetings


1 Like

Hello Alexpikkert, does the 100k, 1uF parallel circuit convert the continuous input into pulse input for the trigger. please confirm. if so what would be the pulse size? thanks.

Hi @tamil,
Indeed it does so.
The pulse size on pin 2 does not matter, when this voltage changes from VCC to GND the 555 will be triggered, see this diagram where it is based on :

Hope this answers your question,
greetings
Alex

thanks @alexpikkert.
I shall use the second circuit and change the values of R and C based on the timing.

1 Like

How can I make this output a pulse only when the trigger is released?

Hi Rob @goscicki ,

It can be made with a NOR logic bit and a time delay bit.
See this video: https://youtu.be/FSKzUJ_94To
Input B is 0. When the trigger is released (the button on input A) this input A changes from 1 to 0 (a negative edge) the output goes HIGH, after the time delay the input B changes to 1 so the output changes to LOW, thus creating a single pulse.
Hope this is what you need… :grinning:
You can find detailed info here:
https://www.allaboutcircuits.com/textbook/digital/chpt-10/edge-triggered-latches-flip-flops/

1 Like