Electronic – Multiple switches to multiple inputs – what kind of diode

buttondiodesmicrocontroller

I have six buttons going into a microcontroller on six IO pins. I have a seventh pin that acts as an interrupt and wakes the microcontroller, which is always asleep until a button is pressed (this is for a remote control). Is this circuit a legitimate way of doing it so that pressing any of the buttons will wake the microcontroller, and what kind of diode (Schottky, Zener, switching, rectifier) should I use?

I thought about doing SPDT switches but those are much more expensive than SMT diodes.

circuit of simple microcontroller with six buttons and an interrupt

Best Answer

As the input signals are from manually operated push-buttons, switching rates required are not very high. presumably any debouncing will be taken care of in software.

The circuit:

  • Adding a weak pull-down resistor (10K perhaps) to pin 19 would help: A button being pushed will turn the diode on, line will be pulled high, but there is nothing to pull the line back down when the button is released. So it will take time going back low if the input is high impedance.
  • Depending on length of wire / trace to the buttons and diodes from the microcontroller, capacitors at the inputs may be useful to bypass any ESD the lines pick up, preventing false triggers.
  • Depending on the MCU used, internal programmable weak pull-ups / pull-downs may be available on inputs. If programmable pull-ups are available (e.g. AVR), the circuit and corresponding code logic can be reversed to save on the pull-down resistors in the schematic, as well as the additional one on pin 19.
  • Is this the best way to do this? I'm not sure, but many MCUs allow for a wake-up due to state change on any digital GPIO, hence all this may be redundant.

The diodes:

  • Pretty much any forward biased small-signal silicon, germanium or Schottky diode with a low forward voltage will do. As price is a factor, just go for inexpensive.
  • Silicon diodes will pull the line up to around 2.6 Volts, typically enough to be recognized as high on 3.3 Volt logic parts. Germanium or Schottky diodes would allow an even higher signal on pin 19 when active, not that it is necessary.
  • Zener diodes won't help (they are typically used reverse biased, reverse breakdown voltages are 2.x Volts and up) as the goal is to have as low a voltage drop as possible.
  • A switching rectifier isn't ideal, the name tells you they are optimized for rectification, not small-signal purposes like this one.
Related Topic