# Passive circuit to generate a pulse when a door opens/closes?

I've searched a bit here, for example https://electronics.stackexchange.com/search?q=pulse+switch, but I haven't quite found what I'm looking for.

Here's the actual problem: I want to send a signal to a server, wirelessly, every time a door is closed (it would be fine to send on open and close, but all I need is on close). I'm open to other solutions, but my current approach (using materials I already have) is to use the Amazon dash button hack (https://medium.com/@edwardbenson/how-i-hacked-amazon-s-5-wifi-button-to-track-baby-data-794214b0bdd8 for example), along with a reed switch. This means I need the dash button to be momentarily pressed when the door state changes - that is, if the door open/closed state is represented as a 0/1 signal, I want a circuit that generates a short pulse when that signal goes high.

I know this can be done with an XOR gate and RC, I think I can do it with three NAND gates, and I'm sure there are a few other simple powered circuits that can do this. The problem is the dash button runs on a single 1.5V battery, so I'd like to do it either passively, or with a power draw that does not significantly effect the battery life. It seems to me that using CMOS logic to do this would work, but 1) I'm not sure how well it would work at 1.5V, and 2) I'm wondering if I'm missing a simpler or better solution. So...

The question I'm trying to ask: What is the simplest/cheapest/lowest-power way to generate a short pulse, in response to a door changing state from open to closed? Ideally, passively, with a reed switch.

The question that might be better answered: What is the simplest/cheapest/lowest-power way to send a boolean signal, wirelessly, to a web server in response to an edge in the door state?

Mount the reed switch on the outside of the door jamb, and the magnet not opposite the switch on the door but on the other side horizontally.

That way the switch is not closed while at rest, but briefly closes every time the door goes past.

• That will give a pulse when the door is opened and closed - the OP preferred a pulse only on close. Also what happens if door is not closed properly?
– Icy
Oct 7, 2015 at 13:33
• I couldn't figure out a good way to produce this behavior - it seems like the best solution, if it will work. I don't quite follow the configuration you're describing, could you please elaborate a little? Oct 7, 2015 at 15:19
• @pjc50 I think I understand now - your specific suggestion won't work for me, but I may be able to use a similar idea. Are you the person behind www.pjrc.com? Oct 7, 2015 at 15:29
• Glad you figured it out, I was too lazy to draw a diagram :) No, that's someone else. Oct 7, 2015 at 16:24

A variant of this circuit will give you a short pulse.

simulate this circuit – Schematic created using CircuitLab

• Thanks - I will try it out. Do you expect something like this to work at 1.5V? Oct 7, 2015 at 15:25
• Yes, this circuit would work at 1.5V but what input are you using on your computer? That may not work with at such a low voltage. If your input can be configured for an 'open collector' input, that would work, just connect the computer input across the transistor and don't bother with R3. If you havent yet got a digital input for your computer JRE's solution is really what you need.
– Icy
Oct 7, 2015 at 19:23
• Ideally, the computer won't need a wired input - the dash button attempts to connect to the wifi network, and a packet sniffer detects that. It's a roundabout solution, but if that's what it takes to get a \$5 wireless button, I'll do it. The button runs on a single lithium AAA. Oct 8, 2015 at 21:34

Your simplest, cheapest way to get the signal into the webserver is probably going to be by using a small USB device like this: USB contact

It has a single input that can closed by your reed switch.

Since you will have to write software for your web server to interface with the contact, just have the software watch for the transistion from open to closed. You won't need to generate a pulse in hardware, then. Software is enough, and you can include debouncing in the software if needed.

Those devices usually include a library that you use to read the input. Bind that into a small program or library that your web page can use, then just evaluate the input signal and set the needed value for your webserver.

That Cleware device is just an example. There are many other manufacturers that can probably beat it on price, availability, reliability, whatever. I just gave it as an example because I've actually used one before.

• Sorry, I forgot an important point: I want the device to be wireless, which is why the dash button seemed like a good approach. I do like the idea of that USB device, but I don't think it will work here for me. Oct 7, 2015 at 15:20