Optoisolator for Arduino Input Pins...

Hi,

I had 8 PIR sensors (like this: http://www.ebay.com/itm/PIR-Motion-sensor-module-AVR-ARM-PIC-Arduino-compatible-/170842963267) and I need to optoisolate digital pins to avoid damages in case of external manumissions.
Can I use ULN2003 or 2803 in reverse connection? If yes how?
Thanks.

No they are not opto isolators. All you need is the opto isolator and a resistor, nothing else.

But why do you need isolation? What faults do you expect? And do you plan on giving each PIR it's own power supply then?

The power requirement for those is 4.5 to 20V DC. If trying to protect the digital inputs of any Arduino for up to ±30VDC, just use a series 33K resistor for each input pin.

"manumissions". Sounds like something from Google translate.

Do you mean connecting or disconnecting.

If you supply those PIR sensors from Arduino's 5volt pin, nothing bad should happen to the input pins.
The pin will always be within 5volt and ground, even if you connect supply first.
Only static electricity could possibly damage things.
Always wise to connect ground first, and disconnect ground last.
Leo..

Wawa:
Always wise to connect ground first, and disconnect ground last.

Except for a car battery :smiley:

But those PIR sensors just output 3V... Even when connected to 20V. They have a onboard 3V regulator.

Except for a car battery

Depends how the car is wired up. I haven't seen a positive ground car in the UK for at least 30 years.

Indeed, and when the chassis is negative connecting positive first is by far the safest. If you connect GND first it’s very easy to generate fireworks when you touch chassis (which is like everywhere) with the spanner while fastening the positive. Not possible if you connect the positive first. :smiley:

very easy to generate fireworks when you touch chassis (which is like everywhere) with the spanner while fastening the positive.

Sorry I wasn't considering the idiot factor, I was concerned about the safety of the on board electronics.

I have used 4N26 opto's on several Arduino inputs for isolation. They are an older part, but they work perfectly. I typically use a 330 ohm resistor for 5 V inputs, a 1 K for for 12 v inputs, and a 2.2 K for 24 V inputs. If you use the internal pullups in the Arduino, you are done !! You can get 4N26 chips from DigiKey, Mouser, etc. They are not very expensive - think I paid about $0.75 each last time I bought them from D-K !! Hope that helps. Tom

Grumpy_Mike:
Sorry I wasn't considering the idiot factor, I was concerned about the safety of the on board electronics.

Always consider the idiot factor :smiley: And when the battery isn't connected it's not referenced in any way with the electronics. So there is no change for the electronics between connecting bat+ first or bat- first. But first connecting bat+ is a hell lot more human safe.