Introduction
If sensors are used in your equipment or control systems, having these signal converter modules like this NPN to PNP converter readily available could effectively eliminate the last-minute problems that you encounter when your controller and the type of sensor you are using have a mismatched signal. This signal converter is designed to convert NPN signal to PNP and is equipped with surge absorption and over-current protection to further protect your device.
Specification
- Working Voltage: 5~24V DC
- Current Protection: Overcurrent protection, surge absorption
- Load Current: 100mA max
- Operating Temperature: -20℃~70℃
- Operating Humidity: 35~85%RH
- Response Time: 1us
- Model: BM-NP
- Conversion: NPN.NO-PNP.NO
Pinout
Tutorial
Connection Diagram
Sample Code
Click to download Arduino IDE
int ledPin = 13; // LED connected to digital pin 13
int inPin = 7; // pushbutton connected to digital pin 7
int val = 0; // variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pin 7 as input
}
void loop()
{
val = digitalRead(inPin); // read the input pin
if (val == LOW) { // judge the key state,the low is pressed
digitalWrite(ledPin, HIGH); //set the LED on and off
} else {
digitalWrite(ledPin, LOW); //set the LED on and off
}
}
Result
The light is off when the button is pressed and on when the button is released.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.