So I'm trying to use an EE-SX4070 photo interrupter as an encoder but I can't seem to be able to get the thing to work. I am a novice and tried following the attached wiring. The transistor end just gets really hot when I run the sketch and I can't tell what's wrong. So, is the wiring correct and if it isn't how should I wire it? What else can I be doing wrong? Thanks for any help you can offer,
You have it connected backwards. A well known, but little mentioned convention in electronic schematics is that inputs are on the left and outputs on the right. Ground is at the bottom and positive power is at the top.
I Don't see the purpose of R2, it keeps the input pin pulled HIGH no matter the state of the opto, try @dougp's circuit, input pin will be normally HIGH and go LOW when 5V is applied to "A" and the beam is not broken.
EDIT: And do try to clear your mind of the notion that HIGH means ON and LOW means OFF.
So, I tried this new circuit and I still seem to be getting the same problem. The transistor end just heats up and the interrupter isn't doing what I want it to. Any other solutions I can try?
The wiring diagram is correct, so you have either physically wired it incorrectly (wrong components, confused the pin numbering) or damaged the module, or both.
If it heats up it may be permanently damaged, so plan on a replacement.
The circuit was correct, I was simply wiring it wrong. I checked the pins with a multimeter and figured out the correct wiring. It works perfectly now. Thanks for all your help. Means a lot