Reed Switch problems

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
florianru1984
New user
Posts: 3
Joined: 08 Jan 2022, 12:53

Reed Switch problems

#1 Post by florianru1984 » 26 Feb 2023, 10:49

Hello,

i have connected an reed switch to an ESP32, to monitor my window. But if the window is open the state switches between seconds.

The wiring is GPIO19 -- reed switch an reed switch -- GND.

Code: Select all

64625261: SW  : GPIO=19 State=0 Output value=0
64625348: SW  : GPIO=19 State=1 Output value=1
64630162: SW  : GPIO=19 State=0 Output value=0
64630248: SW  : GPIO=19 State=1 Output value=1
64636285: WD   : Uptime 1077 ConnectFailures 0 FreeMem 190212 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
64638056: SW  : GPIO=19 State=0 Output value=0
64638148: SW  : GPIO=19 State=1 Output value=1
64642157: SW  : GPIO=19 State=0 Output value=0
64642248: SW  : GPIO=19 State=1 Output value=1
64655148: SW  : GPIO=19 State=0 Output value=0
64655248: SW  : GPIO=19 State=1 Output value=1
64656348: SW  : GPIO=19 State=0 Output value=0
64656448: SW  : GPIO=19 State=1 Output value=1
64656748: SW  : GPIO=19 State=0 Output value=0
64656871: SW  : GPIO=19 State=1 Output value=1
64656948: SW  : GPIO=19 State=0 Output value=0
64657050: SW  : GPIO=19 State=1 Output value=1
64657248: SW  : GPIO=19 State=0 Output value=0
64657648: SW  : GPIO=19 State=1 Output value=1
64657748: SW  : GPIO=19 State=0 Output value=0
64657850: SW  : GPIO=19 State=1 Output value=1
64658048: SW  : GPIO=19 State=0 Output value=0
64658148: SW  : GPIO=19 State=1 Output value=1
64658348: SW  : GPIO=19 State=0 Output value=0
64659150: SW  : GPIO=19 State=1 Output value=1
64659248: SW  : GPIO=19 State=0 Output value=0
64659849: SW  : GPIO=19 State=1 Output value=1
64659948: SW  : GPIO=19 State=0 Output value=0
64660749: SW  : GPIO=19 State=1 Output value=1
64661448: SW  : GPIO=19 State=0 Output value=0
64661551: SW  : GPIO=19 State=1 Output value=1
64661648: SW  : GPIO=19 State=0 Output value=0
64662850: SW  : GPIO=19 State=1 Output value=1
64663048: SW  : GPIO=19 State=0 Output value=0
64663951: SW  : GPIO=19 State=1 Output value=1
64664048: SW  : GPIO=19 State=0 Output value=0
64666285: WD   : Uptime 1078 ConnectFailures 0 FreeMem 191896 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
64668150: SW  : GPIO=19 State=1 Output value=1
64668348: SW  : GPIO=19 State=0 Output value=0
64670252: SW  : GPIO=19 State=1 Output value=1
64670348: SW  : GPIO=19 State=0 Output value=0
64673749: SW  : GPIO=19 State=1 Output value=1
64673948: SW  : GPIO=19 State=0 Output value=0
64674049: SW  : GPIO=19 State=1 Output value=1
64674148: SW  : GPIO=19 State=0 Output value=0
64675952: SW  : GPIO=19 State=1 Output value=1
64676061: SW  : GPIO=19 State=0 Output value=0
64679953: SW  : GPIO=19 State=1 Output value=1
64680048: SW  : GPIO=19 State=0 Output value=0
64680454: SW  : GPIO=19 State=1 Output value=1
64680748: SW  : GPIO=19 State=0 Output value=0
64681549: SW  : GPIO=19 State=1 Output value=1
64681648: SW  : GPIO=19 State=0 Output value=0
64682650: SW  : GPIO=19 State=1 Output value=1
64682748: SW  : GPIO=19 State=0 Output value=0
64683950: SW  : GPIO=19 State=1 Output value=1
64684048: SW  : GPIO=19 State=0 Output value=0
64684149: SW  : GPIO=19 State=1 Output value=1
64684248: SW  : GPIO=19 State=0 Output value=0
64685549: SW  : GPIO=19 State=1 Output value=1
64685648: SW  : GPIO=19 State=0 Output value=0
64686059: SW  : GPIO=19 State=1 Output value=1
64686148: SW  : GPIO=19 State=0 Output value=0
64686649: SW  : GPIO=19 State=1 Output value=1
64686748: SW  : GPIO=19 State=0 Output value=0
64687149: SW  : GPIO=19 State=1 Output value=1
64687648: SW  : GPIO=19 State=0 Output value=0
64688050: SW  : GPIO=19 State=1 Output value=1
64688148: SW  : GPIO=19 State=0 Output value=0

User avatar
Ath
Normal user
Posts: 3506
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Reed Switch problems

#2 Post by Ath » 26 Feb 2023, 13:34

Do you have pull-up resistors installed on the input GPIO's? (~ 10k, or even 4k7 when having long wires, > 1 meter) as the ESP built-in pull-ups are quite weak (~80k), and I expect the wiring between the ESP and the reed switches to be over 10 cm, so decent pull-ups are required.
/Ton (PayPal.me)

florianru1984
New user
Posts: 3
Joined: 08 Jan 2022, 12:53

Re: Reed Switch problems

#3 Post by florianru1984 » 26 Feb 2023, 14:05

OK, i will try. My wire is nearly 2 meters

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Reed Switch problems

#4 Post by TD-er » 26 Feb 2023, 21:44

florianru1984 wrote: 26 Feb 2023, 14:05 OK, i will try. My wire is nearly 2 meters
Sounds like it is a very nice antenna :)
What you also can do, is try to twist the wires between ESP and the reed switch.

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests