Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

microswitch help

Status
Not open for further replies.

ltmhall

New Member
I recently bought a microswitch that has three pins common, normally open,
and normally closed. How would I connect them to a microcontroller.
Would I connect common to ground and the normally open or closed at my own descretion depending how I want it to work.
 
Normally you use pull-up resistors on a micro-controller, so common to ground (as you said) and the other two via seperate pull-up's to 5V, and also connected to two micro-controller inputs - so you can check either way.

However, this is rather a waste of two input pins, connecting just one will tell you the position of the switch - using either the normally open, or normally closed, is really up to you.
 
Some type of microcontroller cannot be left floating at their input. I would connect the common to the input, normally closed to ground and normally open to Vcc via a resistor.

Normally you use pull-up resistors on a micro-controller, so common to ground (as you said) and the other two via seperate pull-up's to 5V, and also connected to two micro-controller inputs - so you can check either way.

However, this is rather a waste of two input pins, connecting just one will tell you the position of the switch - using either the normally open, or normally closed, is really up to you.
Do you mean this (see attachment) When the switch is closed, the input of microcontroller is high or low or floating?

Thanks
 

Attachments

  • micro.GIF
    micro.GIF
    1.5 KB · Views: 420
Status
Not open for further replies.

Latest threads

Back
Top