# OR gate with momentary output

I have 8 different boards that can be triggered via capacitive touch and I need to feed into one input of a microcontroller. Whenever one board goes HIGH, the microcontroller's input should also change state(I don't care if it is HIGH or LOW, as long as it detects the change).

After searching the web I think that CD4078 is what will cover it, but here's the catch:

Inputs can stay HIGH for anything between 1 second and 1 minute.

Every time an input goes HIGH the microcontroller needs to know it, regardless if another input had been HIGH already.

Ideally, the gate's output should change state momentarily regardless of the input's duration, and be able to change state again once another input goes HIGH.

I know that I can accomplish this with an Arduino, but I'm trying to keeps costs down as this circuit will have to be replicated 11 times(11 x 8 inputs).

Does such an OR gate exist, or can I accomplish it with only a few more components?

• While any "parity gate" (including CD40101 (9 inputs) & CD4531 (13 inputs)) will change output for each and every input going HIGH on its own, it will change again when any input goes low. A NOR gate ('4078) will stay low unless all inputs are inactive. Feb 12 at 11:08
• how soon after an edge does the system need to respond? and what is the shortest input pulse that you need to reliably detect (1 second it seems)? can you do it by using a separate input to the controller for each input, and simply polling? (If shortest pulse is 1s, it seems that you certainly can. Feb 12 at 11:19
• I need 11 [groups of 8 touch sensor signals to 11 binary signals to the MCU] If the group a touch is sensed in makes a significant difference, please add that to the question body. Feb 13 at 10:25

## 3 Answers

Each of the XOR gates below, with the RC delay at one of its inputs, will emit a 1ms pulse on each input edge:

simulate this circuit – Schematic created using CircuitLab

These are some example inputs, A B and C:

This is the output of a single gate G1, at node X:

The OR gate G4 will simply go high whenever any of the edge detector outputs go high. This is overall output F:

That means that even if one of the inputs is stuck either low or high for an extended period, a change "notification" can still appear at F, if any other input event occurs in the meantime.

If you're worried about finding a 3 million input OR gate, you can diode-OR the XOR outputs instead:

simulate this circuit

• If I understand it correctly, I'd be getting 2 pulses(on rise and fall) instead of 1(which is what I need) on every state change, right? Feb 13 at 9:43
• Afraid it appears you haven't read the question properly, this is any edge detection not the OP's rising edge detection. (Also, you could reduce the huge image sizes, all needs a ton of scrolling to communicate relatively little content.) Feb 13 at 9:56
• Rising edge detection could be implemented using "implication gates". Late entry: 74*2G97 - even Schmitt-trigger inputs… Feb 13 at 10:39
• @PetrosNousias, yes you understand correctly. Feb 13 at 10:58

If what you're trying to achieve is a way to interrupt your uController with a event on your keys, consider a PCF8574; page 11, Chapter 8 on the datasheet PCF8574 - Datasheet - TI show a functional block, detailing the sensing operations and how you program it to generate an interrupt on pin change.

Following is an example on the datasheet.

• Adding the diagram to the answer might be a good idea. Feb 12 at 12:07

Looking at all the options, I think the least complicated way is to use a microcontroller in-between.

Given I need 11x8 outputs -> 11x1 input, I can use 6 Arduino Nano clones(each handling 2 sets of 8 inputs and 2 outputs) that go for about 2,5 euros and have around 20 usable GPIO.I could also go for 1 nano with 5 MCP23017 but the cost and wiring would be the same, with more complicated coding.

• cost and wiring you found why Simon Fitch's technically close answer is not economical. And part of the advantages of microcontrollers over speciality hardware (one more big part is adaptability). Feb 13 at 10:15