Go Down

Topic: Virtual switch (Read 2629 times) previous topic - next topic

I have a camera flash that is triggered by putting two wires together. Is there any way to trigger that by plugging the wires into my arduino duemilanove and typing something into the serial monitor? It will need to be triggered my a left mouse click.
C program run. C program crash. C programmer quit.

CrossRoads

Yes.
See the Learning or Playground section for accepting Serial input.
Use a relay like this to close the contacts
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PB1110-ND
http://media.digikey.com/pdf/Catalog%20Drawings/Relays/FX2%20RELAY%20NON%20LATCHING%20FTPRNT.jpg
Connect one side of the Coil to +5V (Pin 1), the other (Pin10) to one side of a 15 ohm resister, the other side of the resister to an arduino output pin that you will drive low to energize the relay (and you may not need the resister, but start with it). Put a diode across pins  1 (cathode) and 10 (anode) to voltage spikes away from the arduino pin
(such as http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=1N4004FSTR-ND).
Connect pins 4 & 5 to your contacts.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Is there anyway I can do this all without external hardware?
C program run. C program crash. C programmer quit.

All I need to do really is touch two wires together momentarly. The problem is it is needs to be triggered by a left click as the program I am using converts sound into a left click
C program run. C program crash. C programmer quit.

CrossRoads

The arduino does not have isolated pins that allow you to connect external signals together.
Without knowing what the two wires have on them for voltage and how much current flows when connected, the best you can do is an external part to keep from blowing out the arduino.
Do you have a multimeter? Can you make some measurements on the pins? Is there a ground that the arduino ground can connect to?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Graynomad

Quote
All I need to do really is touch two wires together momentarly.

The problem is you don't know exactly what's on those two wires. It is possible that just applying a logic level to one of them and GND or 5V to the other will work, but you don't know that without proper documentation.

Therefore the only safe way is with a relay of some kind.

Get some proper data and there may be other options.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

I have now the following:

http://parts.digikey.com/1/parts/753815-relay-mini-dpdt-2a-5vdc-pc-mnt-ds2e-m-dc5v.html

A diode that appears to say "16".

How would I hook these up to create a virtual switch?
C program run. C program crash. C programmer quit.

CrossRoads

See the relay connections on the right side.
That relay seems to take a bit too much current to drive from an arduino pin directly.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Graynomad

Yes that relay pulls 80mA, way over what an Arduino can supply. Use the circuit shown in Crossroad's schematic.

NOTE: If you are careful and use direct port manipulation you could drive the relay from 4 Arduino pins and not need the transistor. But this approach is quite prone to blowing up your Arduino if you get it wrong :)

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com


Yes.
See the Learning or Playground section for accepting Serial input.
Use a relay like this to close the contacts
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PB1110-ND
http://media.digikey.com/pdf/Catalog%20Drawings/Relays/FX2%20RELAY%20NON%20LATCHING%20FTPRNT.jpg
Connect one side of the Coil to +5V (Pin 1), the other (Pin10) to one side of a 15 ohm resister, the other side of the resister to an arduino output pin that you will drive low to energize the relay (and you may not need the resister, but start with it). Put a diode across pins  1 (cathode) and 10 (anode) to voltage spikes away from the arduino pin
(such as http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=1N4004FSTR-ND).
Connect pins 4 & 5 to your contacts.


Will this work using my relay that I bought? If not can you please explain the schematic
C program run. C program crash. C programmer quit.

CrossRoads

You didn't purchase the relay in #9, you purchased one that has lower coil resistance, which requires more current flow.
Thus you need an NPN transister which can control that larger current flow without overheating and burning up.
When a smaller amount of current is supplied to the base of the transister, a much larger amount of current is allowed to flow from the collecter to the emitter.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

So instead of http://www.allelectronics.com/make-a-store/item/RLY-648/5-VDC-DIP-RELAY/1.html what relay do I get from all electronics?
C program run. C program crash. C programmer quit.

CrossRoads

The one that I linked to back in Reply #2 because it only  needs 31ma to turn it on, which the Arduino can handle.

I don't think any of these will work without a transistor as they all need too much current.
http://www.allelectronics.com/make-a-store/category/500200/Relays/DIP/1.html
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

http://www.allelectronics.com/make-a-store/item/RLY-620/ULTRA-SMALL-5-VDC-DPDT-RELAY/1.html

Maybe this one.  How many volts across the 2 wires?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

mrmeval

Even with the lower current relay you still need the diode or the reverse EMF can fry the arduino
If it was designed by man it can be repaired by man.

Go Up