Gas reed contact

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wasserwerk33
New user
Posts: 3
Joined: 20 Feb 2022, 12:14

Gas reed contact

#1 Post by Wasserwerk33 » 20 Feb 2022, 12:38

Hello
First of all sorry for the english it comes from google.

Now to my problem.
I have a Metrix Ni3 pickup for my gas meter. Unfortunately I can't get it to read it properly. He always tells me too much. Opposite the counter of the gas meter. I've tried quite a few things. Debounce to 32000 but also to 3msc. But I've tried a few things in between. I've read that I can also trim it moderately with software. With which he queries the status more precisely and only lets a signal through. I think he bounces. I would hate to do it with a hardware solution. But I don't know how I should manage it via the software solution. I'm a total novice when it comes to ESBEasy. I've read posts, but don't understand how to implement it. I already unlocked Rules.

viewtopic.php?p=52594&hilit=pulse+Count ... lem#p52594
I also read this article and that's why I'm invited here.

https://www.mikrocontroller.net/articles/Entprellung
I read this too. But where and how do I have to enter my D2 pin there?? Or do I need that at all? I have this software on my D1 mini 4MB (Git-Build: mega-20211224_f162ebf )

I just do not get any further.

this seems to me to be the right one, but how do I insert it correctly? Where do I have to enter my D2 if I still need it at all??
#define TASTERPORT PINC
#define TASTERBIT PINC1

char taster(void)
{
static unsigned char zustand;
char rw = 0;

if(zustand == 0 && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gedrueckt (steigende Flanke)
{
zustand = 1;
rw = 1;
}
else if (zustand == 1 && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gehalten
{
zustand = 2;
rw = 0;
}
else if (zustand == 2 && (TASTERPORT & (1<<TASTERBIT))) //Taster wird losgelassen (fallende Flanke)
{
zustand = 3;
rw = 0;
}
else if (zustand == 3 && (TASTERPORT & (1<<TASTERBIT))) //Taster losgelassen
{
zustand = 0;
rw = 0;
}

return rw;
}

Eine Erweiterung, damit beliebig lange das Halten einer Taste erkannt wird kann man ganz einfach so implementieren:

// zustand kann entweder zum ersten mal als gehalten detektiert werden oder aber jedes weitere mal
else if (((zustand == 1) || (zustand == 2)) && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gehalten
{
zustand = 2;
rw = 0;
}
Thanks in advance for your help
Attachments
Bildschirmfoto vom 2022-02-20 12-33-01.png
Bildschirmfoto vom 2022-02-20 12-33-01.png (73.44 KiB) Viewed 7461 times
Bildschirmfoto vom 2022-02-20 12-27-26.png
Bildschirmfoto vom 2022-02-20 12-27-26.png (94.16 KiB) Viewed 7461 times
Last edited by Wasserwerk33 on 20 Feb 2022, 13:05, edited 1 time in total.

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

Re: Gas reed contact

#2 Post by Ath » 20 Feb 2022, 13:04

Have you installed a pull-up resistor on the gpio pin the sensor is connected to? If not, the cable works like an antenna, causing possibly many false pulses.
/Ton (PayPal.me)

Wasserwerk33
New user
Posts: 3
Joined: 20 Feb 2022, 12:14

Re: Gas reed contact

#3 Post by Wasserwerk33 » 20 Feb 2022, 13:08

Yes I built a 10K ohm resistor in between. comes from +. If the reed is open, I also have 0V. When it is closed, I have a clean 3.3 V borrowed

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

Re: Gas reed contact

#4 Post by Ath » 20 Feb 2022, 13:24

The code you showed, where is that installed? Doesn't look like ESPEasy code (and there is no need to have that anywhere, I'd guess, the pulse counter has quite a stable reputation, usually there are electrical issues, that's why I asked my previous question :))
/Ton (PayPal.me)

Wasserwerk33
New user
Posts: 3
Joined: 20 Feb 2022, 12:14

Re: Gas reed contact

#5 Post by Wasserwerk33 » 20 Feb 2022, 13:54

this is what my setup looks like. I got the code from a website named.
https://www.mikrocontroller.net/articles/Entprellung.

Or could it be the screw terminal for the reed contact?

Blue=GND
RED= +
Black= Data

the circuit board is no longer continuous from below, but the conductors have been removed by me
Attachments
photo_2022-02-20_13-51-24.jpg
photo_2022-02-20_13-51-24.jpg (103.88 KiB) Viewed 7446 times
photo_2022-02-20_13-51-24 (2).jpg
photo_2022-02-20_13-51-24 (2).jpg (76.88 KiB) Viewed 7446 times

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 28 guests