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.
Any help is gladly appreciated
EDIT: Picture shows IRFZ44 but it should be IRFZ44N which is logic level