Could someone take a look?

Hello,

This is my first time connecting an IR light-gate sensor to provide an external interrupt. I would be grateful if someone could review my diagram and let me know if there are any problems. The yellow, green, and red lines are coming from a PSU and represent 3.3v, ground, and 5.5v respectively.

TIA :slight_smile:

Picture-4.jpg

"K" isn't connected anywhere? I guess, this is cathode of the input diode.

"K" isn't connected anywhere

Oops! Yes, I forgot to put its ground connection in!

Why do you need two resistors for the LED? IE what's the 330R for?

Also, why the digitalWrite(2,LOW)?


Rob

Why do you need two resistors for the LED? IE what's the 330R for?

It's a voltage divider circuit. Will that not work? Do I not need that? :blush:

Also, why the digitalWrite(2,LOW)?

I thought it would be a good precaution to make sure that the pin is low to start with. I am still very much a beginner!

It’s a voltage divider circuit. Will that not work? Do I not need that?

No need, it won’t do any harm I don’t think but all you need is a single current-limiting resistor. 680 would be too high for 3v3 I think but I don’t know what the IRLED spec is.

I thought it would be a good precaution to make sure that the pin is low to start with.

It’s an input being pulled low so the write is both unnecessary and will do nothing anyway.

If however you write a HIGH to the pin you can turn on the internal pull up resistor, by doing that, reversing your wiring, and doing

attachInterrupt (0, home, FALLING);

you can get rid of the 10k resistor.


Rob

Thank you, Rob. I always like to keep things as simple as possible.

If I understand you correctly I can wire this sensor like this:

Picture 4.png

Close. E would goto GND.

Also, just curious, why are you using 3v3?


Rob

Close. E would goto GND.

Of course! :astonished: I have updated the diagram.

...why are you using 3v3?

Just because it is there—the power supply I have outputs 3v3, 5v and 12v.

Thank you once again!