I have a single button system for which I want to detect the short press and long press of the button. The task is really easy with a microcontroller, but I want to do it without in a simpler way, in order to reduce the BOM as well as some cost on the BOM, however miniscule it might be. So, is there any way to detect the long press and short press without using the microcontroller?
-
\$\begingroup\$ There are ICs for this, I think. Some may use an MCU. But you can ignore that fact and just imagine they have an analog circuit for it. If you are sincere about an analog method then look up the use of one-shots. This could be readily designed using a few of these. \$\endgroup\$– jonkCommented Jul 23, 2020 at 16:59
-
\$\begingroup\$ @jonk : I feel the use of a microcontroller for this purpose is an overkill, which is why I'm asking this question. \$\endgroup\$– spockshrCommented Jul 23, 2020 at 17:04
-
6\$\begingroup\$ If you can temporarily ignore the software development side (which is ornery, I admit), then the MCU is the only case that isn't overkill. Everything else is much more pain. You can take a PIC10F20x or PIC10LF32x, which come in SOT23-6 packaging, and be done with it. Just supply power and they work right. The one-shot approach is very good, but it involves lots more parts and more space and more cost and probably a lot more power, as well. \$\endgroup\$– jonkCommented Jul 23, 2020 at 17:08
-
3\$\begingroup\$ "I don't want to do it without using a microcontroller" -- That means you DO want to use a microcontroller! And a 6- or 8-pin MCU is going to give you the lowest BOM cost anyway, especially once you factor in the extra PCB area, etc. as well. \$\endgroup\$– Dave TweedCommented Jul 23, 2020 at 17:20
-
1\$\begingroup\$ Are you sure this will shorten the BOM? \$\endgroup\$– Criticizing Israel not allowedCommented Jul 23, 2020 at 17:55
2 Answers
The user is looking for 2 outputs from the design. (Long press and short press). In my design, X1 is the button. When you close it, point A will have 3.3V instantaneously making this short press. If the switch is closed for more than 6 seconds, then point B will also have 3.3V, making this long press.
This delay can be adjusted by changing R3. In this config, Its acts as supply and model. You can use separate voltage sources if you want. I assumed voltage higher than 2.5V is HIGH. If its different, Use different voltage source.
-
-
\$\begingroup\$ The OP doesn't explicitly say it, but they might want the short and long press signals to be mutually exclusive; i.e. the short press signal doesn't go high in the event of a long press. For the above given circuit, if the press is long, then the output signal A goes high followed by B going high after some time while A still remains high. I such cases the long or short decision can be made only after user releases the press. \$\endgroup\$– AJNCommented Jul 27, 2020 at 17:37
-
\$\begingroup\$ If that's the case, then I would say, send A and B through a comparator. With just one input and no micro, the user can get two different inputs. \$\endgroup\$– varunCommented Jul 27, 2020 at 18:17
Try this:
R3 is your delay time configurator. Higher the R3, more the delay. Adjust it accordingly.
Connect the input of HCS360 between R4 and Q1. There is voltage only when the gate Voltages exceeds 0.7V, and that doesn't happen until 6 seconds roughly (This delay is adjustable).
-
\$\begingroup\$ Can you include more info on how this circuit distinguishes long presses from short ones ? Also details for "Connect the input of HCS360 between R4 and Q1" ? Is V2 supply or a model for the push button switch ? \$\endgroup\$– AJNCommented Jul 24, 2020 at 2:18
-
\$\begingroup\$ The OP doesn't explicitly say it, but they might want the short and long press signals to be mutually exclusive; i.e. the short press signal doesn't go high in the event of a long press. For the above given circuit, if the press is long, then the output signal A goes high followed by B going high after some time while A still remains high. I such cases the long or short decision can be made only after user releases the press. \$\endgroup\$– AJNCommented Jul 27, 2020 at 17:37