I know I should know this...but does the OPTA need PNP or NPN sensors for the digital inputs? I think NPN???
I'd have to check the specs but I'm assuming you'd want PNP sensor. The PNP sensor will provide voltage and the OPTA will sink it.
I am assuming digital inputs are referring to logic level inputs. The input does not care what you use to drive it, it needs a high and low voltage for 1's and 0's. What does the instruction manual say?
As far as NPN and PNP you could use either depending on the configuration and input requirements. I have not read the manual and you did not state which inputs you are talking about.
NPN is recommended for all circuits with common GND (-). Then the operating voltage of the sensor does not matter, the NPN transistor shorts the controller input to GND just like any button does. The HIGH input level must be supplied by a pullup resistor to the controller Vcc, often the INPUT_PULLUP mode will be sufficient.
With PNP the input voltage will rise up to the sensor operating voltage, so that a circuit has to be designed that converts that unknown/unsafe voltage to something harmless to a GPIO pin.
Which, for the OPTA, is 24V, an industry standard. If the sensor is powered by 24V, either PNP or NPN outputs are fine.
That's the crux with PNP: big IF...
The OP should know that, but a 5V sensor won't work, unless there is a pullup to higher voltages.
Ok . But i hooked up a berm cdd-40n npn sensor in that the black wire went to input 1 and i cant get the opta to see it.
I grab a old pnp inductive sensor and hook the black to input 1 and the opta sees it and activates my code.
If i can use either...what am i doing wrong with the wiring?
Sorry, that is meaningless to me. Post a link to the sensor data sheet and a complete wiring diagram, with all connections shown and clearly labeled. Hand drawn is preferred.
If it is an open collector/drain sensor, make sure to show how you wired the pullup connection.
Hello spyder0552,
Excellent question!
This is a good starting point for industrial control. A closely related topic is the concept of sourcing and sinking.
The short answer is to use PNP sensors as they provide an easy direct connection to the PLC. Recall that the PNP sensor "pulls" up when active. For a typical 3-wire sensor, we connect to 24 VDC and ground, the third wire goes directly to the PLC.
A NPN can be used. However, we would need something for the sensor to "pull" against. A resistor connected to the 24 VDC would be appropriate. The Opta would then be connected to the sensor / resistor node. Given the Opta's 8.9 kΩ input resistance, the pull up resistor would need to overcome this resistance in order for a logic high to be registered. Starting with a 1.0 kΩ should be sufficient.
If Arduino will allow, I'd like to share related material posted to DigiKey. You can see the schematic in the thumbnail below. The post describes how to connect contact type and PNP type sensors.
Best Wishes,
APDahlen