I'm looking at doing something where I'll have a remote photoelectric switch with an NPN open collector output situated ~300m from my power source (18Vdc) and microcontroller. I'm not sure the best way to go about this and was wondering if the following approach would be ok?
I'm contemplating running a light, cheap 3 or 4 core wire to the sensor for the 3 signals required.
The microprocessor will be required to read the active low signal from the sensor as an interrupt. I'll have to do a bit of level shifting and buffering here but that's no problem.
Is there any other easier way of doing this that I may not have thought of? I don't need the response time to be super fast, anything under 10mS would be fine. The output circuit of the sensor is attached.
I agree with IanP. Although electrically it looks fine, consider that your wiring looks like a big antenna, it is almost certainly going to pick up and possibly radiate interference. Isolating it will provide an RF barrier and also protect your processor from the effects of noise and static pick up. This is particularly important if you are in an area prone to thunder storms.
That's one option - but an expensive one.
The cheap solution is to use a standard opto-isolator at the receiving end. You can't isolate the power lines easily but they can probably absorb quite a lot of interference without causing any problems. What you really have to worry about is the input to the microcontroller which could easily be damaged if it's voltage went too high or too low. What you do is use your existing circuit to drive the input (LED) side of the isolator and connect the output side to the micro. It will still transfer the signal but it will also provide a barrier which can withstand a few KV across it. Look at data sheets for 4N37 for ideas.
U will need shielded wire and a voltage pwr supply with sense input, or use current source mode supply for the opto.
u will also need filters and or Schmidt trigger