Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Controlling a relay with a switch and feedback to micro controller.

Status
Not open for further replies.

2bengg

Junior Member level 3
Joined
Feb 27, 2011
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,498
Hello.

i am trying control a relay directly with a switch. IMG_16861.jpg
there is also a connection to the pin of a micro controller. This is to detect if the relay is operating or not.
when the common and N/C of the switch are connected, the micro controller can read the voltage as 5 volts and as a result detect that relay is OFF.
however when the switch is operated, ie common and N/O of the switch are connected, the input of the micro controller is left floating.
while it will probably work most of the time, there is a chance of detecting false positive or false negative.

what can i do to improve this ?

i cannot have the switch connected to a micro controller and have the micro controller turn the relay on, because the micro controller is other wise generally occupied and i need the relay to switch ON as soon as the switch is pressed.

suggestions ?
 

Connect it to one of the supplies through a pull-up or pull-down resistor. One that is too high in value to draw excessive current but low enough to ensure the logic level when the micro input is floating. I suggest 10K to 22K as suitable values.

Brian.
 

do you mean like this ?ckt.jpg
 

Correct!

An open circuit pin will normally float at any voltage coupled to it by inductive or capacitive coupling. Because they draw such little current there is nowhere for the coupled charge to go so they could be at any voltage conducted to them although in most cases there will be some static protection mechanism inside the micro to prevent it going below ground or above supply voltage. These will not guarantee a logic level though. Adding a pull-down resistor will provide a path to discharge the pin to ground potential so it goes to (or extremely close to) zero volts and is seen as low logic level. The resistor can be a high value that discharges the weak conduction to the pin but doesn't cause problems when you intentionally connect a voltage across it.

Brian.
 

ok, thanks.
will give it a try and report back
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top