How do I get the Arduino to act like a switch?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dark alchemist
 
Posts: 4
Joined: Thu Oct 03, 2013 3:16 am

How do I get the Arduino to act like a switch?

Post by dark alchemist »

I have a box with that has a switch. Now if I remove the switch I have the two wire that are make or break. How do I get the Arduino to act like the mechanical switch so I can trigger the external box using the Arduino?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How do I get the Arduino to act like a switch?

Post by adafruit_support_bill »

What kind of switching are we talking about here? AC? DC? Haw many volts? How many amps?

You could use the Arduino to drive a relay to do the switching. But if it is low-current DC, you might get by with just a transistor.

User avatar
dark alchemist
 
Posts: 4
Joined: Thu Oct 03, 2013 3:16 am

Re: How do I get the Arduino to act like a switch?

Post by dark alchemist »

I was just about to come back on here and update my post saying I did not want to use a mechanical relay if I can stay away from it.

No voltage is being touched as I am just taking wire 1 and wire 2 from a momentary switch and wanting to remove the mechanical switch and let my Arduino become the switch. I think I can do it with a transistor but too many years since I did electronics like this.

Oh, if there is a voltage it would be DC and so low of a current since it is powered by 3 button cells.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How do I get the Arduino to act like a switch?

Post by adafruit_support_bill »

No voltage is being touched as I am just taking wire 1 and wire 2 from a momentary switch
There would have to be some voltage there, or the switch would not be controlling anything (and a transistor would not do anything either). You will want to figure out whether it is a 'high-side' or 'low-side' switch in order to select the proper transistor for the job. If the switch is between the load and the positive battery terminal, it is a high-side switch. If it is between the load and the negative terminal, it is a low-side switch.

This tutorial has some good practical circuits. About halfway down is a section on switching.
http://www.electronicsclub.info/transistorcircuits.htm

User avatar
dark alchemist
 
Posts: 4
Joined: Thu Oct 03, 2013 3:16 am

Re: How do I get the Arduino to act like a switch?

Post by dark alchemist »

Yeah, it is just completing a circuit to tell the ic in the box to play music and since I see no ground and I see no positive on either wire I am not sure what it is doing.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How do I get the Arduino to act like a switch?

Post by adafruit_support_bill »

If you have a multimeter, you should be able to test the resistance between the wires and the battery terminals. One of the wires will most likely have direct connectivity to one of the battery terminals.

User avatar
dark alchemist
 
Posts: 4
Joined: Thu Oct 03, 2013 3:16 am

Re: How do I get the Arduino to act like a switch?

Post by dark alchemist »

Ahhh, I was going to test for ground but might as well test for both since it will be one or the other.

Thanks for the help and depending on ground or positive that will dictate which transistor type to use (NPN vs PNP).

Thanks again.

New2arduino
 
Posts: 1
Joined: Fri Nov 29, 2013 12:08 pm

Re: How do I get the Arduino to act like a switch?

Post by New2arduino »

Hi all,

I am too trying to get the adruino to act as a switch ! It will similar to above ( one wire cut in 2 to add the switch) and the max volts will be 5vdc and about 50 milliamps.
Can anyone help ? in particular to the switch command in C ?

Regards

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How do I get the Arduino to act like a switch?

Post by adafruit_support_bill »

@New2arduino - same questions as above. You need to figure out what those wires are connected to in order to determine the correct transistor type - unless you prefer to use a relay.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”