Hello! Newbie here. I have a project where I want to use 8 micro switches/limit switches to play eight different sounds effects from a mini DF player when pressed. I have not done coding yet but have a general idea. I understand that I need to solder wires to the C (common) and NO (normally opened) but I am unsure where to connect the wires. Should C or NO go to my input pins (i.e. 2-9)? Where does the other wire go? They all connect to ground? I have been using a breadboard so far and inserting pins but I don't want them falling out. Can you solder them in a breadboard or is that frowned upon?
You don't solder to a breadboard. The breadboard provides connections between holes in rows that jumpers plug in.
You replace the jumpers with wire that has no special ends and you solder wires that connect on the breadboard to each other to make connection without the breadboard. You do it carefully to replicate the circuit that works on the breadboard, do not guess about anything.
Thanks. What about the limit switches? Should my common or normally open go to my input?
The normally open in this case I think, that should mean not connected when the button is up (normal condition).
If you have a multimeter you can test components like the switches and get to know them in a practical way, spend 10 minutes playing around and see if you don't feel better, more "real" about these things. It is a good feeling.
No meter? You don't need a real good one to deal with digital electric but having a meter (and ability to use it) can answer a lot of questions about hardware and circuits.
The most basic switch is a break in a conductor (like wire). If the ends don't touch it is open, if they do it is closed.
The switch you have is like 3 wires where the one in the middle is moved to touch one of the others using a button.
If the button is down it touches one and if up it touches the other.
The middle wire that may touch either of the others is the common wire.
The one that the common touches when the button is down is normally open since normally the button is up.
The other one is normally closed since when the button is up the common wire is connected to it.
So you take the switch and make sure that common only connects to NO (normal open) when the button is down and you understand it a bit deeper than words.
And here is full circle: Since the switch simply connects 2 wires together, it doesn't matter which end connects to the input pin and which to power or ground. The connected wires are electrically 1 wire that the switch connects or breaks.
I would suggest that you wire your IO pins to switch and then switch normally open to ground. The IO pin can be set to INPUT_PULLUP mode where the pin itself is supplied 5V through a 20+K resistor (only small, safe amount of current can flow from that pin). When the button is up the pin will read HIGH and when the button is down the pin connects to ground and the pin will read LOW. The logic is reverse to the button, the code will be that LOW means pressed.
If you wire the pin to 5V through the switch (so button down supplies the pin with 5V, makes it HIGH) then you also need a wire to the pin that has a resistor (usual is 10K Ohms) and connects to ground otherwise what happens:
- The button is pressed and 5V pushes current into the wire going to the pin, the wire becomes charged.
- The button is let up, cutting the 5V pin off but, the wire between the switch and the pin is still charged and the pin is HIGH.
- That is why when supplying 5V to input there needs to be a slow drain to ground (called pulldown) to get rid of the charge when the connection to 5V is broken.
You save parts and work when using INPUT_PULLUP and wiring your switches to pin and ground.