Author Topic: Clever circuit required? Push button + LED + Wake up  (Read 1285 times)

0 Members and 1 Guest are viewing this topic.

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Clever circuit required? Push button + LED + Wake up
« on: April 06, 2022, 12:00:53 pm »
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?
 

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: Clever circuit required? Push button + LED + Wake up
« Reply #1 on: April 06, 2022, 01:04:36 pm »


Thats what i have so far, trying to use the least components possible   :-+
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8164
  • Country: de
  • A qualified hobbyist ;)
Re: Clever circuit required? Push button + LED + Wake up
« Reply #2 on: April 06, 2022, 01:21:22 pm »
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.
 

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: Clever circuit required? Push button + LED + Wake up
« Reply #3 on: April 06, 2022, 04:34:26 pm »
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 button

The 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
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8164
  • Country: de
  • A qualified hobbyist ;)
Re: Clever circuit required? Push button + LED + Wake up
« Reply #4 on: April 07, 2022, 09:23:10 am »
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.
 

Offline Romualds

  • Contributor
  • Posts: 14
  • Country: lv
Re: Clever circuit required? Push button + LED + Wake up
« Reply #5 on: April 13, 2022, 01:07:15 am »
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.
« Last Edit: April 13, 2022, 06:17:11 am by Romualds »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf