I'd like to read from a relay on a CNC machine with a microcontroller running at 3.3V, the wire will be 1-1.5m twisted pair from the micro to the relay and screwed in to a terminal.

There's a lot of noise in these machines as there's 3 phase servo drivers and lots of other stuff going on.

I'd like to ideally just be able to read a rising or falling edge to count the number of times the relay activates.

Having read around the subject:

Trying to keep it simple (No mosfets) I think there's reasonable noise suppression in this design. Since most of the time the Normally Closed(NC) switch will leave the input pin HIGH I think this is fairly robust. I'm wondering if you could help with the following questions please:

A) If I need a series inductor to deal with larger current spikes?

B) I won't be installing this unfortunately, and I can't guarantee someone won't short the GND (V+ should be OK since there's a current limiting resistor) to a positive voltage somewhere, or cause some kind of Electro-Static Discharge (ESD). I'm wondering if maybe a Resettable Fuse (PTC) in series with the GND return would be sensible? Or maybe a TVS to V+?


CNC Relay

Circuit Design:

Relay input design

Thanks in advance!

  • \$\begingroup\$ The caps could introduce more problems vs the field wired scenario (e.g. if charged up the wrong way). My usual answer is bidirectional TVS on the outside, series diode is good but make sure it has enough V rating (100V at least), unidirectional TVS on the inside, pullup is good, and series resistance. (but there's more than one way to do it). If you need the filtering, maybe use an RCR T filter in place of series R \$\endgroup\$ – Pete W Mar 5 at 18:25
  • \$\begingroup\$ Hi, thanks for the comments on the caps, might leave them unsoldered and see what happens without - by TVS on the outside do you mean in parallel at the last point before the connector? What do you mean by TVS on the inside please? \$\endgroup\$ – foldone Mar 6 at 9:36
  • \$\begingroup\$ sorry... was lazy / that's my own shorthand language, implying that "outside" is the side exposed to the field connection -- where the caps are drawn now. "inside" is the direction toward the node you are protecting -- the other side of the series diode as drawn. Should have just drawn it but I am on mobile for most of the weekend...... \$\endgroup\$ – Pete W Mar 6 at 15:06
  • \$\begingroup\$ No problem. I appreciate the help, and the clarification! Thanks very much, just needs building and testing now \$\endgroup\$ – foldone Mar 6 at 15:58
  • \$\begingroup\$ @PeteW Can I just ask for one last clarification please?! Does the diode on the inside (cathode to input) need to be a TVS, if so, why? Wouldn't a normal diode suffice here? Also, would this be considered equivalent to a TVS, even though it's just called an ESD protection diode? Thanks! \$\endgroup\$ – foldone Mar 9 at 11:51

Your Answer

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

Browse other questions tagged or ask your own question.