Magnetic Switch is not stable

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Koenig
Normal user
Posts: 17
Joined: 16 Jun 2019, 11:20

Magnetic Switch is not stable

#1 Post by Koenig » 08 Oct 2019, 18:20

I have a magnetic switch on the door, which I have connected via GPIO as a "normal switch". 1st problem: When the switch is open, it constantly sends alternating 0 and 1 signals. When closed, however, it reliably transmits the signal 1 (reversed logic). I have already put in a resistor in between, but that brings no improvement. 2nd question: Does such a normal switch actually constantly send its status? Is not it possible for it to send only state changes to the controller? If that works, what do I have to do? Is there possibly a solution over rules? I hope someone can help.

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Magnetic Switch is not stable

#2 Post by Patou » 08 Oct 2019, 18:50

Please monitor the voltage on the gpio input pin to see if it is stable
Please check if the used gpio input has a pull up resistor if not put one around 10 k
Your switch should be connected between gpio input and gnd
You can add a capacitor of about 10 mf between input and gnd
On the input configuration you can add a digital filter by programming a debounce time 100 ... 200 msec
Hope this can help

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

Re: Magnetic Switch is not stable

#3 Post by TD-er » 09 Oct 2019, 13:04

What is the configuration of the sensor plugin?
Does it have an interval set? Is that interval equal to the message interval?
Do you have a long cable between switch and ESP?
Does the reed switch (I assume you're using one of those) also trigger on vibrations?

If it is reacting to vibrations, you could add a small capacitor over it, to dampen the very short pulses. (also suggested by Patou)

Also what Patou suggests, enable filtering in the plugin settings.

Koenig
Normal user
Posts: 17
Joined: 16 Jun 2019, 11:20

Re: Magnetic Switch is not stable

#4 Post by Koenig » 09 Oct 2019, 21:26

What is the configuration of the sensor plugin? -> Enclosed
Does it have an interval set? Is that interval equal to the message interval? -> The interval is 10 sec., but the messages are changing much more often
Do you have a long cable between switch and ESP? -> 2 meters
Does the reed switch (I assume you're using one of those) also trigger on vibrations? -> Officially not, but it's a cheap chinese reed switch. Perhaps this is the reason.

If it is reacting to vibrations, you could add a small capacitor over it, to dampen the very short pulses. (also suggested by Patou) -> i will try, thank you!

Also what Patou suggests, enable filtering in the plugin settings. -> where can I enable filtering?

Thank you in advance!
Attachments
IMG_761269FD3BFF-1.jpeg
IMG_761269FD3BFF-1.jpeg (547.75 KiB) Viewed 6725 times

Koenig
Normal user
Posts: 17
Joined: 16 Jun 2019, 11:20

Re: Magnetic Switch is not stable

#5 Post by Koenig » 09 Oct 2019, 21:27

Thank you! I will check it!

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Magnetic Switch is not stable

#6 Post by Patou » 09 Oct 2019, 22:53

, enable filtering in the plugin settings. -> where can I enable filtering?
Answer : it is the denounce variable in the plugin

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

Re: Magnetic Switch is not stable

#7 Post by TD-er » 09 Oct 2019, 23:12

A 2 meter long cable is quite long. It could act as an antenna.
You may want to experiment also with the pull-up resistor settings for that pin.
Sometimes twisting the cable may help reducing interference, but only if some source of noise is near.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 85 guests