Can I used arduino outputs like a relay? Plz help

Basically if I connect 4 open wires to Arduino pin 3 4 5 and 6, can I write a program to connect say wire 3 to wire 4, wire 4 to wire 6, etc? It seems like something easy to do but not sure what the script would be. If it can't be down with arduino I guess the easiest way is to buy a few relays and put them in between each of the wires and use arduino to trigger them but I'd prefer if it could be all software based. Any advise?

Short answer, no.

It depends on what you have the wires connected to at the other end. Whether you want to pass voltage or current, analog or digital signals.

The Arduino pins are internally connected to ground or +5V as oputput pins or high impedance as input, so you can only use the Arduino to connect your open wires to ground or 5V. So electrically you cannot connect the wires as with a relay.

But you can write a program to give wire 3 the same output voltage (0 / 5V) as wire 4 sends as input voltage.

Its for a game keypad, trying to write a program to automate a perfect game. The keypad has a 3 x 3 layout and the keys are triggered by one of them push switches, not sure if triggering with voltage or ground would do the trick. I already found the connections and can manually press the keys by connecting 2 wires. I just need to program the timing etc. Can you recommend a good relay? Smaller the better and maybe like a 10 in 1. I bought one of these but have no idea how it works. http://www.ficrelay.com.hk/details/FRT5.pdf

Check optocouplers, you can use them to control the switches on the gamepad.

hmm you mean one of these? http://en.wikipedia.org/wiki/Opto-isolator nothing mentioned about relays or keypads, here either http://www.jaycar.com.au/images_uploaded/optocoup.pdf. It kind of has a computer keyboard type layout, i already have the wires connected anyways, just need to connect them together by a program so it can be at and for certain times.

If i understrood right, you basically want Arduino to control some switches in the gamepad right ?

Check this:

http://fritzing.org/projects/optocoupler/

EDIT: or check a 4066 IC whic is basically 4 switches controllable by Arduino pins.

Optocouplers have the advantage that your gamepad and Arduino will not be electrically connected.

hmm seems a bit confusing, wouldn’t relays be easier? i kind of understand, so does is act kind of like a relay? what if i wanted pin 4 and 6 to go together, do i need to connect another pin to the arduino or? http://fritzing.org/media/projects/o/p/t/optocoupler/images/optocoupler_Optocoupler_2.jpg

You could just use a Transistor, with a resistor from the Arduino. That way all you need to do is put the two connections you want to connect on the outside, and then just use digitalWrite to turn it on.

You'll also need to find the ground of that circuit and connect that to your Arduino.

Well I have a few 2N3906 PNP and 2N3904 NPN Transistors but thought transistors were power related, still confused. Which pin would I connect to the arduino, 1 2 or 3 :) ? http://www.sparkfun.com/datasheets/Components/2N3904.pdf

Digitalwrite I can do :)

Using a relay would be much more complicated than using an optocoupler.

Most relays will draw too much current to be driven directly from an Arduino pin, and would require as a minimum a transistor, a diode and a resistor to drive them, and most likely also am external powersupply.

An optocoupler can be hooked up with 2 arduino pins and possibly a single resistor.

The optocouplers other side would act like a switch.

Using a relay is more complicated than an optocoupler?

I haven't worked with an Optocoupler before... but I don't think relays can get any easier.

But you would be able to get away with transistor, diode, resistor.. the external supply isn't required if you have 5v relays. (of course, this depends on how much power is being used all together)

But with relays.. you just clip 1 wire of a connection, and connect one side to either the NC or NO (normally closed or normally open), and the other goes to the middle pin. (I don't know the name:X, but it's not the coil, lol)

When the relay has power, the two wires that you cut and connected, will be complete. When it's grounded, or no power, it's disconnected.

But I guess it really depends on what you have around, or what you're willing to wait for! lol