I've been working with a project where I need to trigger an external device to start listening for output from my Arduino. The external device uses a simple contact closure to trigger listening mode. I have tried setting a digital pin to High/LOW but the closure gets sensed immediately (before I send it). I have also tried this with an Analogwrite as well with similar results. I can make it work by collecting the closure from a push button, but I'd like my program to be able to send that signal without my pressing the button each time. I also have a small 5v DC relay from Radio Shack, but have not been able to figure out those connections either.
Any suggestions? I feel like this should be a simple thing, but I have a limited electronics background at best and I'm missing something.
You have to be careful about making direct electrical connections from an Arduino to an another device which has not been specifically designed to operate with the Arduino.
If your 'external device' has contacts which are normally open and closing these causes the device to function, the safest way is to use the relay. There you connect the relay contacts in parallel with the contacts of the 'external device' (use the n/o normally open contacts).
How you wire the relay coil is dependent on the type of relay. In the simplest case, you connect this between an Arduino pin and ground. However, if the current required to drive the relay is more than around 20 mA, you need a transistor to switch it. Some relay modules have an inbuilt transistor switch.
I assume the part I'm missing is the transistor. Here is the relay information and a layout for the pins. I appreciate the help and guess I need to go read up on transistors.
You need a transistor because 90 mA exceeds the absolute maximum Arduino pin current capacity of 40 mA.
You should do something like this:
with the exception that you are using 5 volts and not 12 volts as in the illustration.
Example transistor 2n3904. Only the relay coil is shown, not the contacts it switches.