Getting Interupt every time switch press

Hi
I build the attached scheme, in order to send an interupt to the arduino every time one of the switches is pressed.
The circuit is not working - output Int0 is not going to 1' when I pressed on the one of the switches
What is the reason?
Thank you for your help
Moses
1111.pdf (119.9 KB)

Read the forum guidelines.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Your schematic does not show which pins of the Arduino to connector goes to, nor which version of Arduino you are using.
Paul

Connected to Int0

I'm using Arduino Uno R3

The LM358 has a poor common-mode range (0 to VCC - 1.5volt at best).
Your circuit could work better with a rail2rail input opamp.
Or re-design your ladder to be further away from VCC.

Interrupts are a poor choice for human-operated and bouncing switches.
Leo.

Good day

I need to keep the R ladder as is
Is LM393 better (with pullup resistor to VCC)?
Can you send me other good choise?

Thank you

Hello
why do you ignore the guide lines for this forum constantly?

Hi
Sorry, but what is wrong and not match the guide lines?
I will respect any instruction related to this
Thank you

Google/study opamp common mode and differential mode.
If VCC is 5volt, then keep all the input voltages for this opamp between 0 and 3volt.

I assume you want to generate an interrupt pulse with this (slow) opamp when a button is pressed.
Why not just poll ladder voltage with each loop, like everybody else does.
Human button presses are a lot slower than the loop time should be.
Reading takes about 100us on an Uno.
Leo..

Hi
When a switch is pressed, I'm want to do two things.
generating an intterupt- unside the ISR I'm reading the voltage of the corresponding switch, in order to determine the correct pressed switch
Do you have another solution?

Hi @b_moshe
I suggest something like this, but I've never tested it.

RV mineirin

Sem título

Hi
Thank you @ruilviana
When key is pressed the voltage in A0 input might be 0-3.6V max. according to the pressed switch no.
3.6V (Or maybe 3.6-0.7V) might recognized as 1' to the Arduino hardware ?

But why do you want to use interrupts for human-operated switches.
Leo..

An opamp could be too slow to drive a logic input reliably, you may get multiple transistions as logic inputs are expected to switch in a few dozen nanoseconds to be reliably counted.
A slow edge risks unwanted transistions. And as explained many opamps can't pull their outputs high enough for CMOS logic - you need one that's properly rail-to-rail (output as well as inputs).

The correct component would be a fast comparator, which are designed to drive
logic circuits (using a pull-up resistor).

Failure to comprehend the purpose of interrupts. :roll_eyes:

Yeah. Just poll that adc pin from the main loop and call it a day. Saves on hardware, less prone to spurious behavior, overall much more simple.

Hi to all
I use a rail to rail comperator LM393LV with pullup resistor and it's working fine
I use the interrupt in order to prevent polling of the switches in the root software about the debounce of the switches, I will treat this issue in the software
Thank you all

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.