2 different voltages on the same ground

Hello everyone,

See the attached schematic.

Im trying to build an electronic lock that includes a sensor to see if the door is open or not.
While the electronic lock is off the sensor performs splendid. While the electronic lock is on the sensor goes all over the place.

The sensor pin for the switch is INPUT_PULLUP. so while it is floating, the sensor reads high, but I want that to become low when the sensor completes the circuit.

Is there an easy way to isolate the grounds? Can I simply add an resistor between the sensor and ground?

Im using an arduino mega but in the future I want to use all the pins so, I cant move my sensor to another ground.

Imgur link for image

Any help is gladly appreciated :slight_smile:

EDIT: Picture shows IRFZ44 but it should be IRFZ44N which is logic level

  • Note that the IRFZ44 isn't a logic level type.
  • I would suggest using an external 1K pullup resistor for the button input.

Small snipping error, it should be the IRFZ44N. and I'm gonna try the resistor.

I'll keep you up to date :slight_smile:

Look at using a logic level MOS FET version.

.