2
\$\begingroup\$

I've constructed a simple circuit with a 555 timer: 555 circuit

When the button is pushed, the led lights for about a second as expected. What I want is:

  • push the button: led lights for a second (I have this)
  • push the button and before the led turns off, push again: led continues to light for an additional one second after second push
  • push the button, hold it and release after x seconds: led continuously lights for x+1 seconds

Is this kind of thing possible?

Thanks.

\$\endgroup\$

marked as duplicate by Marcus Müller, Voltage Spike, tcrosley, uint128_t, brhans Jan 27 '17 at 2:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ I would 2nd other people's suggestions for a mcu here. \$\endgroup\$ – dannyf Jan 28 '17 at 21:14
2
\$\begingroup\$

Put in a diode Anode to C1 R1 junction Cathode to switch R2 junction and you should get pretty close.

This (mostly) discharges C1 when the button is pressed restarting the timing period.

Or alternately (the really simple solution) eliminate R2 disconnect the DC (discharge) pin. Wire tr to th and the + side of the switch. This is not a finite state machine it is a simple retriggerable monostable.

\$\endgroup\$
3
\$\begingroup\$

There's no good reason to implement something that is strictly a sequential logic with a 555. Simply go, buy the cheapest microcontroller you're willing to program and do it with that. Less effort, less parts, in the end, usually cheaper, and much more flexible.

Note that this doesn't apply to all possible applications, but yours is what is typically called a finite state machine; that is, it switches between different, well-defined states in its operation, based on some inputs (namely, time, and button presses). In each state, it reacts differently to these inputs. Historically, processors were built to deal with these kinds of problems, that's why I'm acting a little bit surprised here

There's cheap Arduino clones all over ebay. The logic you're trying to implement is tremendously complex if done in analog, and totally easy if designed in C, in an Arduino sketch, or even a graphical programming language.

TL;DR: Don't try to do this with a 555. What you describe is too complex to be sensibly built with that, but totally easy if you have a microcontroller

\$\endgroup\$
  • \$\begingroup\$ Thanks for the insight. I'm trying to drive a PT2262 encoder with a mechanical rotary encoder. I have some experience with Arduino but I tried to implement it with some logic to minimize the power consumption. It seems that my limited knowledge won't be sufficient for that kind of application. \$\endgroup\$ – Egemenk Jan 26 '17 at 20:58
  • \$\begingroup\$ I do see your reasoning but it's often not a good idea to design in a microcontroller if you can do it with comparable circuitrt. It depends on the company you're working for and their market. Programming has a production cost, as does having software and needing it maintained and tested. In defence firms I've worked in, the documentation and testing makes a microcontroller a big investment. In other companies, their volumes or factory set-up make it easy to use MCUs. So it's far from a no-brainer to use one, it depends on a lot more than just components. Which is engineering, of course :-) \$\endgroup\$ – TonyM Jan 26 '17 at 21:25
  • 1
    \$\begingroup\$ Thanks and we're clearly mind-melded here on this. As an aside, it's actually not much work and the OP may learn a lot from a circuit and a scope, assuming this is a learning thing rather than a professional application...I am just guessing. I don't agree with your no-brainer-ish statement on it but think you're completely right that an MCU or CPLD is the avenue to most seriously consider. Just want OP to see the whole picture to be assessed in engineering. Thanks for your comments. \$\endgroup\$ – TonyM Jan 26 '17 at 21:42
  • 1
    \$\begingroup\$ No, thank you for critically approaching my answer and giving feedback! As a freelancing engineer, I think I could put a price tag on that, and as it stands, I'd owe you a drink \$\endgroup\$ – Marcus Müller Jan 26 '17 at 21:50
  • 1
    \$\begingroup\$ @TonyM used your feedback to actually improve my answer (or at least, I hope so) \$\endgroup\$ – Marcus Müller Jan 26 '17 at 21:53

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