Pages: [1]   Go Down
Author Topic: Using one circuit to switch another - (basic!)  (Read 961 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi. Here's a noob question for you


I have one circuit with a power source (batteries) powering an led, controlled by a switch.

I want this same switch (single pole) to also set an arduino pin HIGH when it is pressed.


Can I use a transistor? From what I've been reading here - http://www.ermicro.com/blog/?p=423 I should be able to use something like a 2n3904 transistor to switch the arduino pin high when there is a current in the other circuit, but I cant work it out.

Am I going about this the right way?  And do both circuits need to be powered from the same power source for this to work?


Thanks
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6143
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

An Arduino pin set as an INPUT is a high impedance input.  So you do not need to "switch" it on.  What is the high voltage of the switch that turns on the LED?  If it is 5V you can just connect the Arduino INPUT pin to the same point as the high-side of your switch.

Quote
And do both circuits need to be powered from the same power source for this to work?
Voltages are based on references, so all components which are connected to each other much share the same reference.  In this case, it means the GROUND of each "circuit" should be connected together.

GROUND is another way of saying "reference plane."
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8475
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You have to share GNDs between the two systems. If the current circuit has a voltage approx 4.5-5v (say 3 AA cells) you could feed the signal that powers the LED directly into an Arduino pin.

If it's a higher voltage (or a lot lower) a transistor would work, using a diagram from that link



you would run a wire from where it says "non-inductive load" to the Arduino input, and "Microcontroller IO port" is your LED circuit. The signal will be inverted so if you read a LOW the button is pressed.

Quote
And do both circuits need to be powered from the same power source for this to work?
No, just share GND.
______
Rob
« Last Edit: May 17, 2011, 09:17:31 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I'll have a play and get back to you
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The voltage is 5.9v  Will this be too much for the arduino pin?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8475
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The voltage is 5.9v
Then another (simpler) option is to step it down with a voltage divider.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that worked.

Thanks!
Logged

Pages: [1]   Go Up
Jump to: