I want to turn on a LED with a single push button. When the button is pressed, the LED has to be turned on for an X amount of time. But what I also want, is to turn of the LED with the same push button in this X time period. I've searched the internet for quite a time now but I never found the solution for this problem. Is there anyone who can help me with this ?
Thanks in advance
-
\$\begingroup\$ Could you better define the on and off conditions for the LED? Is the LED blinking or does it turn off only once after turning on? \$\endgroup\$kanoo– kanoo2020年10月20日 14:58:25 +00:00Commented Oct 20, 2020 at 14:58
-
\$\begingroup\$ I'm sorry. The LED is not blinking or anything. It is just a simple case of turning on. The led has to be turned by hand with an push button and than automatically turned off after 30 mins. I want to be able to turn the led off during those 30 mins by the same push button. Hope this is a clear explanation. \$\endgroup\$leon bouman– leon bouman2020年10月20日 15:14:45 +00:00Commented Oct 20, 2020 at 15:14
-
6\$\begingroup\$ 30 minutes? This is not a job for a 555. To get a 30 minute period with a 555, you're going to need a ridiculously huge capacitor. I'd use a tiny microcontroller, which will also make it easy to implement the logic of "turn off after time elapses or when the button is pushed." Just the cap you'd need with the 555 will cost more than a microcontroller. \$\endgroup\$Jerry Coffin– Jerry Coffin2020年10月20日 15:31:46 +00:00Commented Oct 20, 2020 at 15:31
-
1\$\begingroup\$ Depends (heavily) on the surrounding circumstances. If this is a one-off hobbyist thing, then you typically care most about one-time costs (programmer, dev tools), in which case I'd consider something like a CH552, which has a built-in USB core, so you can just wire it up to a USB cord to program it, and it uses an 8051, for which there are lots of free tools. OTOH, if you're going to produce any quantity, spending 50ドル-100 on a programmer to say 1ドル/piece on the parts is a reasonable investment. Likewise, your ability to deal with surface mount parts helps determine the packaging you want. \$\endgroup\$Jerry Coffin– Jerry Coffin2020年10月20日 17:21:29 +00:00Commented Oct 20, 2020 at 17:21
-
1\$\begingroup\$ As far as things like the instruction set of the micrcontroller or included peripherals go: unless you're doing to do more with it than this, they barely matter. You need one input pin for the switch, and one output for the LED. Unless you decide to implement other stuff as well, the code should be no more than 20 lines of code. If you really needed to, you could probably get by with 32 bytes of ROM and 0 of RAM (which would have meant something in 1975, but today a chip with ~1-2K of Flash and at least a little RAM is so cheap that trying for less doesn't mean much). \$\endgroup\$Jerry Coffin– Jerry Coffin2020年10月20日 17:26:21 +00:00Commented Oct 20, 2020 at 17:26
1 Answer 1
I once designed a circuit to do that as shown above.
Each time the push button is pressed the 7555 generates a short pulse which toggles the D-Type flipflop resulting in the 4060 timer being enabled to run or held in reset.
C5/R7/D2 are a power on reset circuit.