I'm working on a personal project and I am at my absolute whits end here. I have a configurable N.O. or N.C. switch (nteinc Magnetic Alarm Reed Switch) so I'm not too concerned with which way I use it.

My goal is as follows: When the two parts of the switch are separated from each other an LED strip turns on for 30 seconds and then turns off until the switch pieces are brought together again and then pulled apart again at which point it would then turn on for another 30 seconds...repeat indefinitely.

What I've tried: I've calculated that I'll be using 1Mohm resistor and 22uF capacitor to generate a 24.2 second pulse (which is close enough to 30 for me right now). I've attempted to hook up the following circuits



and a few more this system won't let me link to but they do not perform as expected and either only turn on/off the led strip by the switch without the timer or they run indefinitely..

Power Supply: 12v worth of AA batteries LED Strip: 9-12v (preferably closer to 12v) LED Strip: 30mA

I'm not entirely sure what I'm missing here but I would greatly appreciate an education as well as reference circuit. I think this has to be very common because it's almost like an intrusion alarm where if the window is opened an alarm sounds for a period of time so I'm not sure why I'm unable to get this to behave the way I want to.

Thanks in advance! You'll be saving my sanity here, I've been at this all day.

  • 1
    \$\begingroup\$ Where / how are you connecting the switch, for instance in the second circuit you posted? Also a schematic even hand drawn of what you are currently trying will help others here give you better answers \$\endgroup\$ Dec 23, 2014 at 5:52

3 Answers 3


This will work for you:

Since you can configure your switch to be either Normally Open or Normally Closed, configure it (S1) so it's normally open, and when you push it closed the 555 will generate a 30 second long pulse which will light the LED for that time, no mtter how long or short the time you keep S1 made.

The 555 needs to see a low-going trigger pulse which stays low for less than the timeout period, and C1 differentiates the low generated when S1 pulls R1 down to ground into the short pulse the 555 wants to see on its trigger input.

R3 and C2 set the timeout period, which is 1.1 R3C2, and with a 20µF cap in there about halfway through the pot should get you the 20 second pulse you want.

C3 is the bypass capacitor for U1, and it's important that it be connected across U1 pins 1 and 8, and as close to the package as possible.

R4 and C4 comprise the POR (Power-On-Reset) circuit for U1 and, by holding the RESET pin momentarily low while the rest of the circuit is coming to life, it forces the 555 to power up in a known state and with the output low.

R5 is the ballast resistor for the LED strip, and drops the 555's output voltage enough to limit the current through the LEDs to about 30mA. That is, unless the LED strip has its own internal ballast, in which case R5 can be eliminated and the strip connected directly across the 555's output and GND/0V.

BTW, here's the LTspice circuit list so you can simulate and play with the circuit if you want to.

enter image description here

  • 1
    \$\begingroup\$ I also realized I think I do care which way the switch operates because while I can configure it (nteinc.com/switches/pdf/magnetic_alarm/alarm_01.pdf) I need the LED to be ON when the magnet is SEPARATED. Thoughts? \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 14:55
  • \$\begingroup\$ Also GND is 1 and V_cc is 8 on the 555CN \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 15:25
  • \$\begingroup\$ Setting up your circuit only produced a quick flicker of the light but nothing else. \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 16:49
  • \$\begingroup\$ 2. Sorry about the Vcc/GND issue. I added pin numbers to my schematic to make it easier to read and got careless. I'll fix it as soon as I get these comments off. 3. If you connected power to the chip with Vcc and GND reversed I think that let the magic smoke out... \$\endgroup\$
    – EM Fields
    Dec 23, 2014 at 17:30
  • \$\begingroup\$ 1. I don't know whether NTE names their switch contact arrangements with the magnet engaged or not, but the switch must be wired so that when there's no magnet around the contacts which are closed are the ones you use. That is, with no magnets around, check the continuity between C and NC, then C and NO, and use the ones where there's continuity between them. To make sure, leave your ohmmeter connected to the closed contacts and bring the actuating magnet close to the switch. If the contacts open, you've got the right pair. – EM Fields 8 mins ago \$\endgroup\$
    – EM Fields
    Dec 23, 2014 at 17:46

Any time you're using resistors with "megohm" in their value, you have to seriously think about leakage currents from all the components around them - can these leakage currents upset or prevent the operation you are looking for?

A microamp or so may prevent the capacitor ever charging up far enough to allow the circuit to switch off.

In the context of your circuit, that means two obvious things - and maybe some others we can't see because we don't have your exact circuit in front of us...

  1. Make sure the 555 is a CMOS 555 - for example, ICM7555 - they have much lower leakage current than the classic bipolar 555.

  2. A 22uf capacitor is probably electrolytic, and these can leak, either through temperature, or maltreatment (connected wrong way round, however briefly) or simply age.

Old ones can actually be "re-formed" by connecting them to their rated DC voltage, and observing their leakage current until it is acceptably low.

But it's better to bypass the problem by not using electrolytics for precision timers : large value ceramic capacitors have their own problems, but leakage isn't one of them. Or use a much larger C to allow use of a lower R, to swamp the leakage current : for example, 220uF and 100K.

  • \$\begingroup\$ Interesting. Now does the fact that the switch is a reed and not a momentary switch have an affect? In the sense that it's not providing a pulse it's just going high or going low. \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 14:19
  • \$\begingroup\$ Check the 555 datasheet and app notes. There is probably an example of a differentiator to make a short trigger pulse from a level. \$\endgroup\$
    – user16324
    Dec 23, 2014 at 14:29

I used a similar circuit to your first link in the past. The circuit I used was here - http://555-timer-circuits.uk/operation/one-shot.html

However, there is a mistake on the image in the left. /TR (pin 2) is connected to the switch, which in turn is connected to ground. This leaves the /TR in two possible states- floating or ground. This is incorrect - in order to successfully toggle states, you need /TR to go between VCC and GND

/TR should also be connected to VCC through a big resistor (1k or higher). That way when the button isn't pressed, /TR will be at VCC turning off the timer. When the button is pressed, the 555 receives the GND impulse and will run for 30 seconds.

  • \$\begingroup\$ I'll give it a shot! \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 14:20
  • \$\begingroup\$ So all that does is allow the switch to turn the circuit on/off depending on where the switch is but it doesn't time. Why would that be? \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 14:47
  • \$\begingroup\$ I'm confused that shouldn't be the case. Here is a circuit simulation of the above configuration - goo.gl/c9A8qC \$\endgroup\$
    – darudude
    Dec 23, 2014 at 15:41
  • \$\begingroup\$ Yeah, I saw your simulation and it looks like it makes sense but for whatever reason I can't get it to translate. Thanks though! \$\endgroup\$
    – xytheron
    Dec 23, 2014 at 18:24
  • \$\begingroup\$ Can you attach an exact diagram of your hookup? Part numbers for components would be handy as well \$\endgroup\$
    – darudude
    Dec 23, 2014 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.