Electronic – Continuity with NodeMCU on metal door

#nodemcucontinuity

I want to have a sensor to let me know if a door is locked or not. I've placed two wires inside the lock mechanism of the door, so when the door is locked the continuity test on the multimeter make a sound, if is unlocked it doesn't make a sound (no continuity).

I've tried to replicate that with a NodeMCU. I have follow the same example as a push button,

3V3 -> BUTON Pin 1 |-| Button Pin 2 -> 10k Ohms -> GND 
                                    -> D7 (Digital 7 GPIO)

schematic

simulate this circuit – Schematic created using CircuitLab

This works fine with the switch button, but when I replace the switch button with the wires on the door, nothing happen.

I checked the Ohms on both cases, the switch on rest have 10M Ohms, and when pressed have 0.4 Ohms.

The door when is closed have continuity with 16 Ohms, when is open it doesn't have anything (no continuity, no ohms, open circuit).

What I am missing here ? Another question, if a person touch the door (has metal on it) it can catch a spark or anything ? It's safe ?

The final goal is mimic the behaviour of the multimeter.

EDIT: Looks like some alligator cables I was using were in a bad shape. I've replaced but still it doesn't work. After checking everything and trying again, it is WORKING!

I will try to start solder some cable to proper connect each other without using alligators.

Video with this working: https://youtu.be/a3UFyRAJedA
Cables: https://imgur.com/a/2ByPSY6

Best Answer

Based on what you explained, it should work. Two wires touching is the same as a push button. 16 Ohms may not be a good connection for carrying a load, but a GPIO like this is not affected by that. The voltage divider created by this would put 3.29V at the GPIO, enough to trigger the pin as high/on/1.

So the only thing we can assume is that either there is a physical issue, or the issue is in your code.

You say With the push button I have 0.674v when not pressed, and 3.24v when pressed. I suspect you have the internal pull-up enabled. Try disabling it. You have an external pull-down, so you they can conflict.

Update: Based on OP's comment, it was (likely) a bad physical connection.