Issue with floating digital pins.

Hi all,

I am using a PLC (norvi.lk) that can handle 24V in it's digital input pins.

The idea is to have an interrupt triggered when a voltage pulse is sent to the pin. Unfortunately this won't work because the pins are floating and therefore always reading high.

Is it possible to correct this through software, or do I need to do a hardware modification? If a hardware modification is needed what would you recommend doing?

Thanks very much,

Zeb

Where is the Arduino in this question?

It is an ESP32 chip and is programmed with the Arduino IDE, does that count as Arduino?

I have exactly the same problem with an ESP32 Dev module.

Thanks,

Zeb

If the input pin is 24volts and floating, and the PLC can be configured to interrupt on a falling edge, I'd pull it lightly high, say with a 47k resistor and I'd use a simple NPN transistor (in open collector configuration) to pull it low to force the interrupt. Use, say, a 1k base resistor.
If you want a rising 24volt pulse (or a pulse of a higher voltage than the ESP32 pin can deliver), instead, use two transistors (a PNP and an NPN) configured as a high side switch, to deliver the pulse.

EDIT

Forget that. I've just looked here. https://norvi.lk/industrial-esp32-norvi-iiot/ . It seems this device you are trying to interrupt is an ESP32. I assumed that the esp32 was sending the pulse.

I am guessing that the "24volts capable" pins are already an open collector configuration with a pullup resistor. Your option is then to trigger the interrupt on a falling edge.

The documentation available is not clear about how is implemented, unless you have found something better. Have you a schematic diagram of your particular model ?

Hi 6v6gt,

Thanks for your help, sorry for not explaining clearly! You are correct I am using Industrial IoT ESP32 PLC to detect the pulses.

Device (I am using the AE04-I model)

I have attached a diagram of one almost exactly like mine except mine has analog pins instead of relays.

Can you tell anything from that diagram?

Thanks,

Zeb

Question: How do you know that the pins are floating? Please explain how you reached that conclusion.

It won't be possible to learn anything from a diagram of a different device.

How to post images so every one can see them:
How to post an image.
Another page on posting images.

Hi all,

Sorry, I completely forgot you can attach images that way!

aarg are you saying that the picture doesn't help? That is the only diagram I can find of a device like my mine.

Thanks,

Zeb

Then how does anyone use the product? Is it out of production?

From what I have seen in the datasheet here (which may only be similar to your device, https://norvi.lk/wp-content/uploads/2020/07/AE04-Datasheet-V9.pdf, the 24volt input pins have a logic low of <= 5 volts and an a logic HIGH of >= 15 volts.

To create a positive pulse for that from a 3.3volt or 5.0v volt device would require, as far as I see, a 2 transistor level shifter (configured as a high side switch). However, here may be an easier way.

It is a bit difficult to know what exactly is sitting between the ESP32 GPIO pins and the 24volt screw terminal inputs of that module.

Thanks very much 6v6gt that's really helpful!

But shouldn't that mean I should get a "LOW" reading when I run this program? (nothing attached to pin 5)

int inPin = 5;
void setup() {
  Serial.begin(115200);
  pinMode(inPin, INPUT);
  digitalWrite(inPin, LOW);
}
void loop() {
  Serial.println(digitalRead(inPin));
}

And the pin always read "HIGH" unless I grounded it.

Thanks,

Zeb

What does happen when you ground it? If it reads HIGH when open and LOW when grounded, then the processor can read the input, no?

If the situation is as described in post #9, then you would need a translation circuit between your 5V pulse and the 24V input.

Sounds like a s simple NPN that is normally is needed.
If the roles are reversed, that is ESP32 on the right side, change 3.3V and 24V pullups, and resistor values accordingly.

That's awesome! Thank you all for your help!

Thanks again,

Zeb