End Stop Digital Pin stays "LOW" when 3.3V Teensy shares ground with 5V power supply - what is going on?

Hi everyone! I just ported my Arduino Mega project over to a Teensy 4.1 because I need the faster processing speed for my stepper motors. The Arduino Mega's digital pins output 5V whereas the Teensy 4.1 outputs 3.3V. I believe my problem is related to this.

The Setup

Hopefully the picture/diagram below explains my situation.

I have set up the End Stop so that it connects to Digital Pin 11 using
pinMode(11, INPUT_PULLUP);

I have connected the cables such that it remains HIGH when the switch is untouched (not pushed in), and LOW when the End Stop switch is closed (pushed in).

The Problem
This works UNTIL I turn on the 24V power supply which (through a 5V regulator) powers various devices, and shares a ground with the Teensy, at which point the Digital Pin 11 consistently reads "LOW", or sometimes erratically wavers between "LOW" and "HIGH."

Based on my research, I suspect this may be related to a floating voltage between the grounds since I'm using two power supplies (one is the 24V-5V regulator, and the other is the USB), but I'm not sure how to diagnose this or fix it. I tried using a multimeter to read the voltage difference between the "S" and "G" pins on the End Stop when the switch is open, and it reads ~3.3V when the Power Supply is off, and ~3.2V when the Power Supply is turned on, both of which should be sufficient to keep it as "HIGH". Yet turning the Power supply on causes the Teensy to read it as "LOW."
(The Teensy remains powered via a separate USB cable connected to my PC).

Any advice is appreciated! (and please let me know if you need more detail!)

I'm not sure it's a floating pin although I can see why you might think so.
To test that you could add a stronger (maybe 10k) pullup resistor between the wire on pin 11 to the 3.3v pin.

Have you tried disconnecting the devices on the 5v bus?
My worry is that maybe one of those devices(the I2C device?) is feeding 5v to the teensy causing your issues.

Sorry your picture diagram is far from complete. Please post a labeled schematic, not frizzy picture. The schgewmatic should be as you have wired it showing all connections. Also post links to "Technical" information on each hardware devices. Links to azon and other sales outlets do not provide technical information.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.