what's the electronics equivalent of OR gate?

Hello,
If my microcontroller only has 1 wake pin, and I have 2 reed switches, how do I use both reed switches to wake the microcontroller, but still have the reed switches go to individual I/O so I can tell which of them were set off?

In other words, I want to OR the two reed switch outputs to go into the wake-up pin. The reed switches can be NO or NC, but I do need a rising edge on the wake-up pin (so when a switch goes off, I need the output of the OR to generate a 0 to 3.3V transition).

Thanks!

CD4071 CMOS OR GATE

CD4071

You need to post a schematic of how the reed switches are connected.
In order to use them as OR gate inputs, you need to connect one end of a switch to GND and the other end of switch to a 10 k ohm pullup resistor which is connected to 3.3V.
This will convert the reed switches to digital signals. The end of the resistor that connects to the switch is then used an an input for the 4071 OR gate chip gate.

Or a couple of schottky diodes. Each switch connects to an anode, the cathodes are connected together and go to the input pin, which has a 10K pulldown resistor to prevent the pin from floating high.

In your case I would use wire oring, you would put your switches in parallel with a diode between each switch and your input pin. Assuming the diode have a 0.7V drop, you would want your switches connected to 4V. ALso be sure to use pull up or pull down resistors, depending on how the swtiches are connected.

I used wire oring in for my university foundation year project, it's quick and easy for simple stuff like that. Have a google for the term and also try 'diode or gate'.

Altho after drawing it, could be the diodes are not even needed as there's really nothing needed isolation.

CrossRoads:
could be the diodes are not even needed as there's really nothing needed isolation.

Yes there is...

arusr:
but still have the reed switches go to individual I/O so I can tell which of them were set off?

So regular diodes will do. And the easiest is to connect the reeds to GND and use the internal pull ups. Then you don't need an external resistor, only two diodes. Something simple as a 1N4148 will do just fine.

DIODE OR GATE

You need to connect the pulled up read switch to an I/O and also to the diode or gate.. The input of the diode or gate is the individual I/O and the output is the OR. You may need to use a diode for the individual I/O. Haven't used those myself. I usually use something like a CD4050.

Thanks all. Of I go with the diode idea, is there any particular diode that I have to use or will any signal diode work? Is there a difference between using a schottky diode vs. a common "signal diode"?

This is how I understand the circuit:

arusr:
This is how I understand the circuit:

you understand it wrong.
using your schematic, both inputs are HIGH if either sw1 or sw2 is ON
look at the link Raschemmel gave you, and look for "diode OR gate" schematic (and read again Crossroads' and Septillion's answers, everything you need is there :wink: ) :idea:

With just one diode and one extra input...

If input is low upon wake, then the second switch is pressed, otherwise the first switch is pressed.

yep :slight_smile:
don't forget to use pullups resistors on the input (internal or external)

You mean "their idea" ?

I meant it would be a good idea to look at the link and to read again the previous answers :wink: