IND.I/O D21G with Keyence EM-030 Limit Switch

I am trying to read the status of a Keyence EM-030 inductive limit switch with an Industruino IND.I/O D21G. I am having some trouble because the NPN output of the limit switch is between 0 and 5V, at best. As this voltage does not get above the 11V threshold I am not able to detect this voltage fluctuation.

Does anyone have any ideas how I can get this to work?

Cameron Devine
Cameron Devine
14
| 0 0 0
Asked on 5/1/19, 10:20 PM
0
vote
225 Views

Hi, from the datasheet https://www.keyence.com/products/sensor/proximity/em/models/em-030/index.jsp i see that it is an NPN type sensor, NO (normally open), powered by 10.8 to 30V. This means the active state of the sensor will connect its output to GND.

So we can use inverted logic: put a pull-up resistor (e.g. 1K or less) from the INDIO's V+ to the INDIO's Channel 1, this will pull the channel HIGH in the normal (NO) state of the sensor. Now connect the sensor's output to the INDIO's Channel 1 as well. When the sensor is activated, the Channel 1 should go LOW.

You can use below sketch to test, please let us know how it goes.

#include <Indio.h>
#include <Wire.h>

void setup() {
   Indio.digitalMode(1, OUTPUT); // Set CH1 as an output
   Indio.digitalWrite(1, LOW);   // clear CH1 to LOW
   Indio.digitalMode(1, INPUT);  // Set CH1 as an input
  pinMode(26, OUTPUT);   // LCD backlight
}

void loop() {
  digitalWrite(26, Indio.digitalRead(1));
}

Tom
Tom
5415
| 0 0 1
Answered on 5/2/19, 3:56 AM
0
vote

the value of the pull-up resistor depends on your supply voltage; if you use 24V you'd better use a higher value resistor e.g. up to 4.7K to limit the current, then a 1/4W resistor will do.

Tom
on 5/3/19, 7:11 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

56 follower(s)

Stats

Asked: 5/1/19, 10:20 PM
Seen: 225 times
Last updated: 5/2/19, 3:56 AM