I have a small problem with a reed switch on a water counter.
The counter on the VMB7IN counts more than the physical counter.
I think the problem is related to the bouncing of the reed switch.
What’s the best way to debounce the signal of the reed switch on a VMB7IN input ?
Is there a pull-up resistor on the inputs, if yes, what’s the value of this one ?
While I don’t use VMB7IN myself, I would be surprised if it did not debounce internally. After all, one of the intended use-cases for this module is to connect all sorts of mechanical (push) buttons to the inputs. These are generally bouncy, and it would be weird if every push button press would turn the light on/off a random number of times before arriving at a random new state. Same with the pull resistors – it would be weird if the inputs were left floating when the intended use is to attach a long wire that’s usually an antenna to it.
I guess one question worth asking is how many more triggers are you seeing? Is it some multiple? Is it an integer multiple? Mechanical switches will generally show you an significant multiple of signal edges, but you you won’t get exactly the same number of bounces every “trigger”. Whereas an integerish multiple would suggest that the meter triggers the reed switch multiple times for each blink of an indicator.
That said, it wouldn’t be super epxensive to just rule bouncing out with an experiment. Implementing Hardware Switch Debounce | DigiKey has some hardware-based debouncing recommendations. The cheapest to try would be the RC circuit. You’d connect your capacitor between - and PBx & a lead of your switch to - & the other lead to a resistor and then the resistor to PBx. There are calculators and equations to get charge/discharge times based on cap/resistor values out on the internets.
I DO have a VMB7IN here, just with two inputs connected to ordinary (240V, but used here at low voltage) rocker switches. They work fine for that but I am not counting anything.
I am surprised there are no debounce settings on the configuration for VMB7IN. I agree it is logical that it ought to be doing some sort of debounce in software internally because the kinds of thing it is typically connected to WOULD need that… but I see no such configuration options.
So I guess you would do best to explore some sort of hardware debounce. Personally I would reach for an Arduino nano in such circumstances but that does not work for most people. Standard simple hardware switch debounce methods might be your bets approach… but are you OK/comfortable with that?
I double-checked the ratio of the counter and it’s 1:1.
The faulty counts are random, which is a typical reed switch bouncing problem.
I don’t have an oscilloscope to check the signals and validate the cause.
Yep, I was thinking of doing a small test, but I think it was safer to ask on the forum before doing anything.
I’ve added a capacitor of 47µF (25 V) and a resistor of 1 kΩ and the problem is solved.
For people who face the same problem and need a schematic view of the modification :