Clever circuit required? Push button + LED + Wake up - Page 1
Forum section: electronics / projects

author: max_torque
author_rank: Super Contributor
timestamp: April 06, 2022, 12:00:53 pm
content: I have a controller with two available pins on the output connector. I want to read a push button, have a LED illuminate in that push button, and when the ecu is "alseep" wake the controller up as well.So far i have though about wiring the switch contacts in parallel with the led illuminator, wiring a diode in series with the switch contacts but anti-phase to the intrinisic diode in the led.Toc heck the switch state, the ecu connects connects a pull up resistor to the return wire of the switch/led combo, and looks for a voltage to be generated on the input wire, which has a pull down to ground. It could do this for a short period of time every say often (say every 20 ms or something). When the button isn't pushed, no voltage will be present because current cannot flow backwards through the led.To illuminate the led, the controller applies a driving current in the opposite direction, which can't flow through the series switch/diode combo even when the switch is pressed, and so drives current through the led, and lights the led. Ever 20ms, that current output can be reversed for a few hundred uS to check for a switch press.So far, so go (i think)However, i also want the button to be able to wake up the ecu from sleep? And really i don't want that bit of circuitry to consume a large quiescent current. I'm sure there is a good way of doing this, but i can't right now come up with a very elegant solution?Any ideas anyone?

author: max_torque
author_rank: Super Contributor
timestamp: April 06, 2022, 01:04:36 pm
content: Thats what i have so far, trying to use the least components possible

author: madires
author_rank: Super Contributor
timestamp: April 06, 2022, 01:21:22 pm
content: Are controller and ECU the same chip/device? Does "output connector" mean that the pins are output-only? Which methods (high, low, pin change interrupt, ...) does the ECU's wake-up pin support? My crystal ball is a little bit cloudy today.

author: max_torque
author_rank: Super Contributor
timestamp: April 06, 2022, 04:34:26 pm
content: the output connector is the physical connector through which the device is connected to the host. 2 pins are currently spare on this connector and hence the only ones available to interface with the external buttonThe micro & pcb / circutry inside can be changed to suit the interface scheme chosen, so the limit really is adding this button / led / wake up functionality without using more than those two physical pins

author: madires
author_rank: Super Contributor
timestamp: April 07, 2022, 09:23:10 am
content: You could use one pin for the push button (pull-up resistor). In normal operation mode poll the pin for a button press. And before entering sleep mode set up an interrupt (pin change) to have the push button wake up the MCU. The second pin could control the LED.

author: Romualds
author_rank: Contributor
timestamp: April 13, 2022, 01:07:15 am
content: One MCU pin is enough for both LED and button if the purpose of LED is to show if the button is pressed.Instead of 10k R2, internal pull-up resistor of MCU can be used.