Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Cartierusm on April 12, 2018, 10:27:00 PM

Title: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 12, 2018, 10:27:00 PM
I'm going to use some proximity sensors for limit switches, they're NPN. Can I wire those directly to my Pokeys57CNC pins? I'm guessing I can't because it'll only provide a sinking signal to the pin and not act like a relay and have the board COM pass onto that pin?

So I'm guessing I have to wire the proximity sensor to a relay and then use that to bridge the COM to the pin?
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Roaster on April 13, 2018, 01:42:39 PM
If the input normally takes 5v as a signal, you have to pull up the pin and set the input to active low.
I have a Stepper3 Ether mach CS controller and, after modifying it by removing the input led's, use npn proximity sensors at 12v feeding the inputs through a 390 ohm resistor. The sensors have a 10K internal pull up. This gives about 3.7v at rest, enough to take the pin high, and it goes to 0v when proximity occurs.
I should note that the controller has 4.7K pull down resistors on the inputs. I removed the leds because they were also pulling down the pin with a 39 ohm resistor making them unusable. Long story.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on April 13, 2018, 05:43:34 PM
Hi,
most of the commonly available proximity sensors have a voltage input requirement of 6-36V.

The limit/home switch inputs of your 57CNC are 5V and PoKeys specify a maximum of 5.5V.

I would want to be 100% that the proximity switches didn't blow the 57CNC. At the very least I would have a current limiting resistor in series with the 57CNC input pin and the proximity sensor and a 4.7V Zener diode to earth
and thereby limit the voltage presented to the input.

Another alternative would be to use a transistor, either a BJT or a MOSFET, either would be a few cents each and would provide some measure of isolation between the proximity sensor and the input pin.

Craig
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 13, 2018, 10:34:05 PM
Uh, thanks. I'm not really following all the technical jargon, but I get the gist. I messaged Pokeys tech support and linked the sensor I have and they said I can use it directly with the Pokeys57CNC board. Just hook both COM on the board to the VDC negative on the power supply and so forth. The sensor is using 12VDC, but the board has an on board pull up resistor. So I messaged them back to clarify whether i can use it without doing anything else. Haven't heard back but will when I do.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on April 13, 2018, 11:15:26 PM
Hi,
section 3.2 page 18 of the manual shows the representative circuit diagram of a DI5P input pin.

My concern is that if your proximity sensor assumes a voltage greater than 5.5V it will be transferred via the LPF to the MCU of the controller. DON"T let that happen or you'll fry it!

Presumably the proximity senor is just an open collector outut in which case any supply voltage of the sensor cannot leak back into the 57CNC. If however there is anything resembling
a pull-up resistor in the proximity sensor that voltage will get back into the 57CNC with unpredictable results. I'm imagine you'd be rather annoyed if it transpired that a proximity sensor
had damaged your controller. I would recommend a current limit resistor and Zener diode to be safe.

Craig
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 13, 2018, 11:25:24 PM
Craig, totally appreciate your help. I understand in theory, but the terminology is beyond me. I'm quite capable with electronics, but all the stuff you're talking about dealing with pull up, resistors, etc... confused me and always has. I should learn.

Here's the sensor I'm using https://www.amazon.com/gp/product/B073VFRCCX/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 will this work alone on my board or do I have to use some sort of resistor or combination of things?

I'll look up what an open collector is and the other terms and see if I can wrap my head around it.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on April 14, 2018, 12:37:30 AM
Hi,
that link nor any that I googled really explain for sure what the output circuit of the sensor looks like.

If it just the collector of a transistor with its base controlled by the sensor there is no oppurtuiny for it to source any current and would be safe to hook direct to th 57CNC.
If for whatever reason the manufacturer put a pull up resistor or even a very low current leakage path from the 12V supply to the prox sensor to the output that voltage could
reverse bias the input of the 57CNC MCU and blow it up.

Do you want to risk it?
If you don't you'll need a resistor and a Zener diode.

Craig
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 14, 2018, 01:52:20 AM
What kind of verbiage am I looking for when looking the specs of a sensor?
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Roaster on April 14, 2018, 02:10:43 AM
http://www.ekt2.com/pdf/14_PROXIMITY_INDUCTIVE_18EX.pdf
This is the unit I believe.
Do you have two or three wires?

Note;  Correction to my above post. It was the BOB that had the led's on it, not the Stepper3 motion controller.

here is a diagram for the three wire type npn proximity sensor with a 10k internal pull up resistor.  When measured at rest there will be V+ on the black wire, so you shouldn't hook it directly to an input with a pull up. (will have Vcc on the input pin at rest)


Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on April 14, 2018, 02:37:59 AM
Hi,
that diagram that Roaster has come up with is exactly what I mean. There is a path from the supply of the prox sensor (12V) through a diode, a 10K resistor through the 2 ohm resistor to the
57CNC. You don't want to apply 12V to the 57CNC input, it will handle 5.5V max.

In the first pic you have the sensor represented as a plain open collector transistor, no problems, the series resistor and Zener diode are not required.
The second pic the sensor is depicted as an open collector transistor with a pull-up resistor R2. This is close to what Roaster has posted. The series resistor R1 and the Zener diode are now
required otherwise the supply of the proximity sensor has a path to the 57CNC. The Zener will ensure that the pin is not subjected to greater than 4.7V.
The last picture is an alternative. It requires a diode only, it will prevent the supply voltage via R2 getting into the 57NC.

Crai
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 14, 2018, 02:47:24 PM
Cool. I'll look this over. Consequently Pokeys support says my sensor has a built in resistor and is ok to use with my board.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on April 14, 2018, 02:58:15 PM
Hi,
if your sensor has even a high value resistance pull-up resistor it will feed supply voltage albeit at low current back into your 57CNC. DON"T do it!

You are trying to save a few cents worth of components and some time soldering but putting your $200 controller at risk...

The vast majority of 3.3V (5V tolerant) ICs are very susceptable to damage from excess voltage being applied to its inputs.

Craig
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Cartierusm on April 14, 2018, 03:06:42 PM
Ok got it. I'll have to wade through what you posted. I don't get most of it. Let me read it over and see if I can figure it out.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Kolbot on March 02, 2019, 07:14:12 AM
Hi, found this old post. Hope that it is okay to post here. I am looking to install proximity NPN switches too with my PoKeys57cnc board. I am not an electrical engineer. I understand from this thread, that I have to wire a pull down resistor between the sensor and the keys57 board, but in this manual https://www.poscope.com/wp-content/uploads/downloads/Pokeys/LibrariesAndPlugins/Mach4%20and%20PoKeys57CNC%20-%20step%20by%20step%20guide.pdf page 15 it just sounds like you can connect the switch directly, but they mention an built in pull up resistor. So i am kind of confused here. I would of course like to do the right thing, so that I don't blow up my keys57 board.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: MN300 on March 02, 2019, 12:12:59 PM
On page 15 it says
"Mechanical switches can be directly connected between the GND and the selected input terminal."

This tells me the 10K resistor in the figure at the bottom of the page is built in to the PoKeys57CNC.
A NPN sensor makes the same connection to ground as the mechanical switch.

The hazard occurs when the sensor has its own pull-up resistor to its power supply. If the sensor supply is over 5V the PoKeys input will see too much voltage.
Check the datasheet to see if your sensor has a pull-up resistor. If it does a 4.7V zener diode across the Pokeys input will limit the voltage.
Post the model number of your sensor if you have more questions.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Geoff_S on March 26, 2019, 11:10:44 PM
I'm in the same situation of wanting to use my pokeys57cnc board with inductive prox probes (Fotek PS-05N which have npn transistor with an inbuilt 4k7 pullup resistor and run off 12V). 

On the previous page, joeaverage posted two options: either zener diode with series resistor, or blocking diode.  Is there any reason to prefer one option over the other ?  Seems like the single diode option would be just as good as any other, and simpler.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on March 26, 2019, 11:29:54 PM
Hi,
a blocking diode will work IF the input to the 57CNC has a pull up resistor.  With the proximity sensor transistor
off the diode is reverse biased and the 57CNC pull up resistor takes the input high. When the proximity sensor transistor
is conducting the input pin of the 57CNC is pulled one diode drop (0.7V) above earth, to all intents and purposes
low.

If you use the zener and 470Ohm resistor  when the proximity sensor transistor is off the 12V of the proximity
sensor is limited by the dropper resistor (470 Ohm) and clamped to no more than the zener voltage (4.7V). In identical
manner when the proximity sensor transistor is conducting the input pin of the 57CNC will be pulled low but
without the diode drop.

In short both work. I personally would go with the zener/resitor because then I can be assured that at no time will excess voltage
be presented to the 57CNC, I consider that to be safer than the blocking diode alone.

Craig

Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: MN300 on March 27, 2019, 12:38:04 AM
When a transistor is used as a switch the VCE(sat), the collector saturation voltage, is typically around 0.05-0.2 Volts. This is what the input would see as a low level.
A blocking diode in series with the input raises the low level about 0.6 volts, lowering the noise margin a bit.

If the pull-up of the sensor is just the 4700 ohm resistor, adding another 470 ohms in series makes little difference. Just the zener across the input will protect it.

If the sensor had an active pull up to 12 volts that would be a different case, the 470 ohm resistor would limit the current into the zener.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: joeaverage on March 27, 2019, 01:53:30 AM
Hi MN300,

Quote
If the pull-up of the sensor is just the 4700 ohm resistor, adding another 470 ohms in series makes little difference. Just the zener across the input will protect it.
Yes 100% correct, as you say IF the sensor has an active pull up then the 470 Ohm resistor will save the either the sensor, the
zener and/or the 57CNC. That is the reason I suggested its inclusion, just in case. If OP chooses to leave it out and he
lets the smoke out it wont be because I didn't think about making the solution I recommended to him robust.

Craig
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: Geoff_S on March 27, 2019, 04:00:55 AM
Thanks for the suggestions.  I think I'll go with the zener+470R combination even though not strictly necessary for my current situation (sensor has 4k7 pullup), just in case I change the sensors in the future and forget how I had things wired up.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: MN300 on March 27, 2019, 08:48:04 AM
The zener plus 470 ohms is a practical solution for this application.
The 470 ohm resistor will see about 1/8 watt so use 1/4 watt resistors.
Like a blocking diode, it's in series with the 10k pull-up resistor. The voltage drop will be about 0.23 volts. On a system with a lower value pull-up that voltage would be higher so others should check before copying this method.
This combination will also work with systems that can be configured for a pull-down resistor.
Title: Re: Can you wire a proximity sensor directly to a motion control board like a pokeys
Post by: EngelenH on June 12, 2019, 11:04:23 AM
Actually there is an even better option ... But it is a little more work to implement (well, I guess if you are already talking about using diodes and transistors about the same).

Use an opto coupler (ako opto isolator), their purpose is to galvanically seperate two circuits that still need to 'talk' to one another.

Essentially (grossly oversimplified) it is a combo of a LED and Photodiode, the signalling side gets the LED and when the LED lights up the Photodiode will allow current to flow on the receiving side. Thus there needs not be a direct link between signalling and receiving side.

Typically a PC817 is used here.

Example schematic would be (this one is for connecting an inductive proximity sensor to an arduino, same idea, courtesy of a small 'local' electronics store I frequent) :

(https://benselectronics.nl/files/15180/afbeeldingen/schermafbeelding-2018-03-22-om-15.51.43.png)

edit: should point out that there are some cheap ready made boards that are specifically designed for purposes like this that you can probably find on ebay, amazon etc.