0
\$\begingroup\$

I'm very much an amateur when it comes to electronics so apologies for the stupid question. I have a switch that is normally high (5V) and then when i hit the mechanical button it drops to 1V. I need to configure my CNC firmware for this. So are these normally open or normally closed switches?

To me this would be a normally closed as with a normally open switch you wouldn't have a voltage when the mechanical button is not pressed, but the spec page for my switch says it is normally open so I am confused.

Thanks in advance!

\$\endgroup\$
  • \$\begingroup\$ This sounds like a normally closed switch. But I'm surprised it reads 1 V when you depress it. Try holding it down, shorting the output to ground through a resistor briefly and then seeing what the voltage reads. I' worried the switch is leaking. \$\endgroup\$ – zeta-band Oct 25 '18 at 21:20
  • 1
    \$\begingroup\$ How many wires on the switch? 2 or 3? Any part numbers? Is the output connected to a load when you measured the voltages? \$\endgroup\$ – Transistor Oct 25 '18 at 21:24
  • \$\begingroup\$ The 1V is weird but as to switches and levels have a look here: stackoverflow.com/questions/50774540/… \$\endgroup\$ – Oldfart Oct 25 '18 at 21:25
  • \$\begingroup\$ 3 wires but i'm only using 2. The other is for the LED but I can't use it with my grbl shield. Output has no load as far as I understand. I got that from putting a multimeter on it while the shield is powered and i measure 5V before pressing and 1V when I press. \$\endgroup\$ – Stephen Oct 25 '18 at 21:28
  • \$\begingroup\$ Yes I thought the 1V was weird too. The switches are these in the link amazon.co.uk/MUZOCT-6packs-Mechanical-Printer-Machine/dp/…. Just the standard endstops on CNC's/3D printers. I thought they were normally open when I bought but now I am unsure. I think they can be either as it says NC and NO on the actual board but like I said before electronics really isn't a strong point for me. \$\endgroup\$ – Stephen Oct 25 '18 at 21:30
1
\$\begingroup\$

enter image description here

Figure 1. What appears to be the same switch from Biqu Equipment.

Their instructions say:

  • Red line connecting VCC (ramps of +)
  • Connect the black wire GND (ramps of -)
  • Green Line connection SIGNAL (ramps in s)

Green is actually the switch output and black probably provides the common for the LED cathode (negative).

I suspect that you're using red and black when you should be using red and green. I recommend that you connect up the black anyway. The visual indication of switch status will be useful.

enter image description here

Figure 2. The schematic from Thingiverse.

    1. Red, Vcc.
    1. Black, GND.
    1. Black, GND.
    1. Green, Output.

How it works:

  • With the switch as shown the output is high and the LED is shorted out (so it is dark).
  • When actuated the output is pulled low and current flows through R1 and the DETECT LED to ground. The LED is lit.
  • R2 makes sure that the line is pulled high during switching from NO to NC rather than leave it floating and susceptible to stray switching due to interference.
  • C1 further filters any noise.

The schematic on the CNC shield page is a horrible low-quality JPEG but we can make out enough information.

enter image description here

Figure 3. The end-stop pinout. Note that CONN_3 allows selection of GND or 5V to the end-stop switches. Note also that you can fit end-stop switches on both ends of each axis but that they share a common input to the Arduino. (There are a limited number of pins available so some doubling up is required.) The controller will usually determine which endstop was hit by the direction of travel at the moment the input was triggered.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 4. (a) CONN_3 connection for switched positive. (b) Switched GND. (c) Three-wire sensor boards.

I recommend that you try wiring as shown in Figure 1c.

  • Jumper 1 and 2 on CONN_3. That will put out a +5 V on each of the X+, Y+ and Z+ pins.
  • Somehow connect up the limit switch black wires to any of the spare GND pins. Pin 3 on the select is available.
  • Wire the greens back to the X-, Y- and Z-.

Note that the schematic and board top-view pinout are not very clear so you may need to do some PCB tracing.

\$\endgroup\$
  • \$\begingroup\$ These are the switches and thank you for showing me that. the problem is that I have only +- on my grbl shield for the switches which is why i used the red and black. My switches would work when I pressed them during the set up wizard for universal g code sender so i think they were working fine, the issue was with them being triggered when they shouldn't. I just connected red and green to my + and - on my shield and the switches now don't register when i press them so I am very confused hahah. thanks for the help \$\endgroup\$ – Stephen Oct 25 '18 at 22:25
  • \$\begingroup\$ Why not post the link to the GRBL shield? It's very hard work without all the information. \$\endgroup\$ – Transistor Oct 25 '18 at 22:27
  • \$\begingroup\$ this is the one that I bought amazon.co.uk/Kuman-Engraver-Expansion-Arduino-Heatsink/dp/…. \$\endgroup\$ – Stephen Oct 25 '18 at 22:56
  • 1
    \$\begingroup\$ That's a link to the catalogue page. We need the circuit and pinout. Bedtime in Ireland. Goodnight. \$\endgroup\$ – Transistor Oct 25 '18 at 23:14
  • \$\begingroup\$ I edited the last comment to have another link but I don't think it update. Here's more info. osoyoo.com/2017/04/07/arduino-uno-cnc-shield-v3-0-a4988 \$\endgroup\$ – Stephen Oct 27 '18 at 13:45
0
\$\begingroup\$

An open switch means that there is no current conducting through the switch, causing the voltage at the terminals to be high, 5V in your case. When the switch is closed it means that the circuit is closed, causing a current to flow through the switch, pulling the voltage to the negative terminal, which in your case is 1V (this is probably non-zero because of some resistance you still have after your switch).

This image is similar to your situation where the switch is open and Vout is 5V. https://en.wikipedia.org/wiki/Pull-up_resistor#/media/File:Pullup_Resistor.png

\$\endgroup\$
  • \$\begingroup\$ thanks. I have 3 switches, 1 has about 30cm of cable between switch and MCU, another about 1m, and the third has about 2m. so i guess there is resistance in the wires but you would expect a larger voltage drop from the 2m cable switch than the 30cm cable? I don't see that, all three go from about 4.96V to 1.09V +- 0.01V. \$\endgroup\$ – Stephen Oct 25 '18 at 21:43
  • \$\begingroup\$ Since you measure with a high impedance MCU there is negligible voltage drop from the positive terminals of the switch to the MCU. The voltage drop is from the negative terminal of the switch to the ground of your power supply (and if the internal resistance of your switch is high maybe also in your switch). \$\endgroup\$ – JDvdK Oct 25 '18 at 21:51
0
\$\begingroup\$

It sounds like you have a normally-open single-pole switch, with a pullup resistor.

schematic

simulate this circuit – Schematic created using CircuitLab

This is a common arrangement. When the switch is not actuated, the controller sees 5V through the resistor. There's only a tiny amount of current flowing into the controller, so there is little drop across the resistor, and the voltage at the controller is very close to 5V.

When the switch is actuated, the controller input is grounded. Current flows through the resistor, but it's a trivial amount that causes no harm.

Why does it drop only to 1V when pressed, and not 0V? There's probably some resistance in the wire, or corroded switch contacts, or a loose connection somewhere.

\$\endgroup\$
  • \$\begingroup\$ This all sounds plausible, thank you. The issue I have is with false trips and the cnc machine stopping because it thinks an endstop is hit. I suspected interference and have shielded the wires but still no luck. I have 3 of these switches one for each of xyz and all go from 5V to 1V. They are all from the same pack and there is no sign of damage and corrosion/wear. \$\endgroup\$ – Stephen Oct 25 '18 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.