Flow water sensor tuning

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Flow water sensor tuning

#1 Post by hestia » 03 Sep 2021, 22:18

Hi
I have a flow water sensor USN-HS21TA https://www.aliexpress.com/item/3269628 ... 4c4d1W1pgh
I have set up a Generic - Pulse counter
How to tune the device to get accurate measure?
Build: 20113 - Mega
Build Time: May 3 2021 11:31:57
Binary Filename: ESP_Easy_mega_20210503_normal_ESP8266_4M1M
Pulse high or low or something else?
Debounce Time (mSec): how to choose a value?
Counter Type: I set Delta...?
Formula: in the doc it's writen F=10Q, so I set %value%*10
Do I have to set the same formula in the Total? or the Total is the Total of Count after the formula?

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#2 Post by hestia » 05 Sep 2021, 19:40

i did some more digging and testing...
I understood that F=10Q means F (Hz) =10Q (l/min)
So aAs my sensor is for 1 L/min to 30 L/min, I have a frequency from 10 Hz to 300 Hz, so a period form 100 ms to 3,3 ms
A rule of thumb given here Re: Pulse Counter Problem gives debounce time is 1/10 of the pulse low
so less than 3,3 ms for me :shock: I set 33... (x10)
I did some testing with Pulse Low, I seems to give twice the good value
I put Pulse High, It was ok with 10 liters
How to make it better? Stability, not always the sames vales. Perhaps I don't put enough water for the testing (5 liters)
I've tried the debug as mentioned in the docs but did catch any log with P003 :(
Do have I to set something in the Formula in the bottom of the Device? How ESP Easy knows how to transform pulse in liters?

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

Re: Flow water sensor tuning

#3 Post by TD-er » 05 Sep 2021, 20:48

The formula option in the counter may have a slight unexpected side-effect.
The formula does change the value in the task value array.
So it may be applied twice when the last value is restored at boot. (e.g. after a crash)

Not sure if the formula option is the best solution here as it is ran when the PLUGIN_READ function is called of the task.
This is called when:
- Interval set in the task settings has expired
- TaskRun is called

What is your intention with the flow sensor? To actually measure the flow, or to count water consumption?

10 pulses/sec => 10 liter/min, then your flow sensor reports 60 pulses per liter.
So each pulse is 1/60 liter.

I guess it may be a more 'stable' result if you measure over a longer period, but just to get a feeling for it, you may want to initially set the "interval" of this pulse task to 1 sec.
The "count" value (when selecting a "Counter type" with "delta" in it) is the change since the last update. (interval)

So with the interval set to 1 second, you simply get the "frequency" in the "Count" field.

If you measure over a longer period, you will get a more stable result as output value, but then you need to convert the value.
Since the 'count' value isn't that useful to keep and restore if you update it every N seconds, you can use the formula field of it.

e.g. "%value% / 60" for using an interval of 60 seconds.

About the difference between counting the rising and falling edge.
If there is a difference here, it might be the "high" or "low" value isn't really close to 3v3 or 0V respectively.
So you may want to have a look at that.
Maybe you use a long cable and the cable may pick up some noise when carrying a low signal value?
In this case I guess it is better to simply trigger on the "rising edge".
The reason for this is that the initial change of a signal may be fast, but then the changing rate slows down.
So it may be relatively long in a state between a logical "high" or "low" state and then it is better to have a "high" signal than a "low" signal during this state of slowly changing voltage.
Noise is relatively small compared to a "high" signal, while it can be significant compared to a "low" signal.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#4 Post by hestia » 06 Sep 2021, 11:48

Thanks TD-er for your reply
What is your intention with the flow sensor? To actually measure the flow, or to count water consumption?
The objective is to measure how much water I put in my garden, so it is more consumption than flow, event though, I need the flow to define the duration of the next watering. All of this could be computing after.
Not sure if the formula option is the best solution here
I’m going to remove them, and put some computing in the rule and in Domoticz
interval
I understand it is more accurate on a long period, so I set 10 sec; is it enough to get an accurate measure, or it will be better with more, like 30 sec?
10 pulses/sec => 10 liter/min, then your flow sensor reports 60 pulses per liter.
So each pulse is 1/60 liter.
For this sensor the Formula is “F=10Q”, so 1 pulse/sec = 10 l/min and not “10 pulses/sec => 10 liter/min”. Am I right?
So, 1 pulse = 1/6 liter => 1 liter = 6 pulse
So If I put 1 liter into the sensor, I think, I should get 6 pulses
About the difference between counting the rising and falling edge.
If there is a difference here, it might be the "high" or "low" value isn't really close to 3v3 or 0V respectively.
So you may want to have a look at that.
I made some measures. I have 2 systems, 1 for testing (only one sensor) and 1 for the production (several sensors) and they have different power. So I’ve got different values!
Prod:
High ~ 3,45
Low ~0 V
Sensor powered to the 5 V => 3,7 V in fact
Test:
High ~ 4,35
Low : I’ve forgotten to measure it…
Sensor powered to the 5 V => 4,95 V in fact
Anyway, I think I have a clear difference between high and low.
The high is greater than 3v3 ; is this a problem?
Maybe you use a long cable and the cable may pick up some noise when carrying a low signal value?
In this case I guess it is better to simply trigger on the "rising edge".
The cables are around 40 to 50 cm. Are they long or not?
Some pictures:
production
production
Capture d’écran 2021-09-06 113648.jpg (237.24 KiB) Viewed 9564 times
for testing
for testing
Capture d’écran 2021-09-06 113908.jpg (59.75 KiB) Viewed 9564 times
for testing
for testing
Arrosage_20210905_223756.jpg (509.5 KiB) Viewed 9564 times
Regarding the deboucing, as there is 1 pulse/sec = 10 l/min and the max is 30 l/min, so it is 3 pulse/sec, so 333 ms between each pulse, with the rule of thumb, I could start around 33

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

Re: Flow water sensor tuning

#5 Post by TD-er » 06 Sep 2021, 14:50

For "long" cables, you should consider the cable will work as an antenna and thus collect noise.
Tweaking with the debounce filter is one way, but I think it is better to filter using a small capacitor over the GPIO pin.

I noticed your flow sensor uses a hall-effect sensor, which already gives a clean signal.
So you may want to add a pull-up resistor and a small capacitor to it to filter out the noise.
You may however need to place the capactor close to the ESP. The resistor may already be present in your sensor. But if not, you may want to add it.

I think 100 nF as in the schematic here may be a bit too large, as it also limits the max. frequency you can use (in combination with the resistor)

The output of a hall-effect sensor is only slightly lower than the voltage you apply to it.
So it is best to add 2 resistors to make the voltage lower.
The GPIO pins of the ESP8266 seem to be 5V tolerant, according to some sources, but it is better to make the signal max 3V3.
So over the signal you can add 2 resistors, with a ratio of roughly 2:1 (e.g. 120k and 220k, since the signal itself is slightly less than 5V)

Sensor out ---- 120k ----- gpio ---- 220k ---- GND.

With a capacitor over the GPIO pin and the GND, you can probably ignore the debounce time.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#6 Post by hestia » 06 Sep 2021, 15:38

Sensor out ---- 120k ----- gpio ---- 220k ---- GND.
With a capacitor over the GPIO pin and the GND, you can probably ignore the debounce time.
Thank!
Just to be sure
do you mean this
120k to 5V
120k to 5V
Screenshot 2021-09-06 153237.png (64.17 KiB) Viewed 9547 times
or this
120k to GPIO
120k to GPIO
Screenshot 2021-09-06 153411.png (291.77 KiB) Viewed 9547 times
or ???

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

Re: Flow water sensor tuning

#7 Post by TD-er » 06 Sep 2021, 16:41

More like the last one.

Just assuming the Hall-effect sensor itself already has a pull-up resistor between 5V and the output on the hall effect sensor (not on the GPIO side)

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#8 Post by hestia » 06 Sep 2021, 17:24

Thanks!
I'll do a test asap
I don't have 220k, not 120k (220 Ohm only)
I have 10k
Can I put a 10k and 2 x 10k instead?
Screenshot 2021-09-06 172125.png
Screenshot 2021-09-06 172125.png (216.19 KiB) Viewed 9536 times

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

Re: Flow water sensor tuning

#9 Post by TD-er » 06 Sep 2021, 17:52

3x the same resistor is OK, but.... the reason I took larger values is to make sure the pull-up resistor (if any) is a factor stronger than the ones on the output.
With 30k on the output, I don't know how much effect the pull-up resistor is.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#10 Post by hestia » 06 Sep 2021, 19:17

I did it with 140k and 280k ; I had 2 of them for testing (big size xW)
Nothing on the device.
The voltage seems to move from 2,65 to 3,35V between GND and GPIO
I try others circuit diagram???

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#11 Post by hestia » 06 Sep 2021, 19:47

I did this one
https://components101.com/sites/default ... Sensor.png
with the sensor on 3v3 instead of 5v
The sensor still pulses... a lot
The voltage on the GPIO is from 0 to 3v3.
I'll try debounce

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

Re: Flow water sensor tuning

#12 Post by TD-er » 06 Sep 2021, 19:59

What value of the capacitor did you use?
Also the hall-effect sensor should run on 5V, not on 3V3.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#13 Post by hestia » 06 Sep 2021, 20:13

100nF
Screenshot 2021-09-06 201147.png
Screenshot 2021-09-06 201147.png (25 KiB) Viewed 9516 times
Is it a good one?

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

Re: Flow water sensor tuning

#14 Post by TD-er » 06 Sep 2021, 20:56

Well 100 nF is exactly what was mentioned in the schematic, of which I mentioned it would be too large, given it is charged with 140k resistor.
At 5V it wil take roughly 14 msec to charge it, so you apply too much filtering.

Let's go back to where we started:

Image

- Power the hall sensor with 5V, not 3V3 as it will show undefined behavior.
- On the "Digital output" on that image, add your voltage divider using 140k and 280k resistor, with: Out -- 140k -- gpio --- 280k --- GND
- Use the pull-up resistor as shown in the schematic, where the "R1" is significantly lower (factor 10 is OK) than the resistors used as voltage divider
- The R1 = 10k and C1 = 100 nF will have a RC time of 1 msec. => in roughly 1x ... 2x RC will the logic level switch.
- Don't use a value for R1 which is lower, as it will also cause more current to be drawn from the hall-effect sensor

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#15 Post by hestia » 06 Sep 2021, 22:43

Well 100 nF is exactly what was mentioned in the schematic, of which I mentioned it would be too large
I also have 22 pF, perhaps too small?
Screenshot 2021-09-06 221708.png
Screenshot 2021-09-06 221708.png (127.2 KiB) Viewed 9493 times
Let's go back to where we started:
I understood you described this diagram (I have a 280k not a 240k for the testing)
Screenshot 2021-09-06 224159.png
Screenshot 2021-09-06 224159.png (221.5 KiB) Viewed 9493 times
I'll do it tomorrow...

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

Re: Flow water sensor tuning

#16 Post by TD-er » 06 Sep 2021, 23:01

280k is fine, 240k was my typo :)
And the true value for the capacitor will be a bit experimental.
If you're using the 10k pull-up resistor, I think 100 nF is probably fine, but 22 pF is indeed too small :)

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#17 Post by hestia » 07 Sep 2021, 09:53

It seems that it doesn't work :-(
Between GND and GPIO the voltage (U) goes from 2v6 to 3v3 w/o going to 0
(between Y and GND it was 0 to 5v)
The same if I remove the capacitor
Did I miss something?
Screenshot 2021-09-07 095230.png
Screenshot 2021-09-07 095230.png (1.11 MiB) Viewed 9459 times

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

Re: Flow water sensor tuning

#18 Post by TD-er » 07 Sep 2021, 10:03

And what if you remove the pull-up resistor?
I don't know what specific hall-effect sensor is in there and how it is wired.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#19 Post by hestia » 07 Sep 2021, 11:11

And what if you remove the pull-up resistor?
It's the same: min 2v6
When the sensor is on 0v (between Y and B), it is 2v6 not 0!
I don't know what specific hall-effect sensor is in there and how it is wired.
I've just receive this link from the vendor
http://ultisensor.com/tech/32.html?spm= ... 3e5fVNwtax
It seems very light...
The model spec http://ultisensor.com/product/43.html

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

Re: Flow water sensor tuning

#20 Post by TD-er » 07 Sep 2021, 11:31

OK, so it is pulling the level down.
Still I find it strange you keep seeing these voltages.

Can you double check the resistor values?
It looks like you're using resistors which are too low.
And you should not draw too much current through the flow sensor as it might damage the internals.

Maybe to be sure, just test it how it was before, just to make sure the sensor is still working.

It is a bit hard to see on the photo, but it looks like you have not put the resistor and GND in the same row as the "B" header.
Also the "Y" header seems to be off by one row.
Please double check those.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#21 Post by hestia » 07 Sep 2021, 15:46

Can you double check the resistor values?
Sure!
They are 330k en 150k in fact (on the order)
The measures
150k
150k
Screenshot 2021-09-07 151618.png (1.06 MiB) Viewed 9415 times
330k
330k
Screenshot 2021-09-07 151529.png (1021.89 KiB) Viewed 9415 times
Maybe my meter is not very good for big resistor values?
So different from what discussed 140k -> 150k / 280k -> 330k
I also checked the 10k
Not the capacitor, but I have several to change if needed
The circuit "rebuilt"
circuit
circuit
Screenshot 2021-09-07 151815.png (1.23 MiB) Viewed 9415 times
the "free cables" are for the measures during the test
The testing
Between the measures, I drop a bit of water to get small moves and stop on high and low values
1/ before the voltage divider
5v
5v
Screenshot 2021-09-07 151959.png (771.27 KiB) Viewed 9415 times
0v
0v
Screenshot 2021-09-07 151912.png (661.95 KiB) Viewed 9415 times
The voltage goes from 0 to 5v
2/ with the voltage divider
3v
3v
Screenshot 2021-09-07 152046.png (742.52 KiB) Viewed 9415 times
low V
low V
Screenshot 2021-09-07 152551.png (641.82 KiB) Viewed 9415 times
When there is 0v before the voltage divider, there is 2v7 after. Not Zero :-(
I could change the position of the meter (red) to get a measure and the other, because the sensor is stopped on 0
I could do more checks and photos

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

Re: Flow water sensor tuning

#22 Post by TD-er » 07 Sep 2021, 16:20

Those 150k/330k is just fine. It is about the ratio of those resistors.
But this one is really strange.

Either the GPIO-4 pin is pulled up inside the ESP, or something really funky is happening to the hall-effect sensor when you apply a voltage to it.
Can you disconnect the wire to GPIO-4 and see if it then pulls down the voltage to 0 when the sensor pulls "y" down?
Do you have some pull-up resistor defined in ESPEasy?

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#23 Post by hestia » 07 Sep 2021, 17:10

Can you disconnect the wire to GPIO-4 and see if it then pulls down the voltage to 0 when the sensor pulls "y" down?
Yes, 0v if Y is disconnected, and if I put water it changes until 3v3
Do you have some pull-up resistor defined in ESPEasy?
I'm not sure where it is...
Screenshot 2021-09-07 170209.png
Screenshot 2021-09-07 170209.png (83.34 KiB) Viewed 9402 times
I've change the GPIO to GPIO-13 (D7), Ov until I declared it on the device, then same value.
Screenshot 2021-09-07 170901.png
Screenshot 2021-09-07 170901.png (676.21 KiB) Viewed 9402 times
I've rebooted the esp and got same 2v68

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#24 Post by hestia » 07 Sep 2021, 19:16

If I declare the GPIO as a switch, I could have 0 to 3v3 and changes of the state
Screenshot 2021-09-07 191325.png
Screenshot 2021-09-07 191325.png (684.49 KiB) Viewed 9394 times
Screenshot 2021-09-07 191427.png
Screenshot 2021-09-07 191427.png (600.63 KiB) Viewed 9394 times
Screenshot 2021-09-07 191527.png
Screenshot 2021-09-07 191527.png (737.41 KiB) Viewed 9394 times

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#25 Post by hestia » 08 Sep 2021, 19:23

I did a Switch input - Switch and a Generic - Dummy Device
Screenshot 2021-09-08 192023.png
Screenshot 2021-09-08 192023.png (32.91 KiB) Viewed 9331 times
and this rule

Code: Select all

on water2#State=1 do
TaskValueSet 4,1,[WaterMeterDmy2#Count]+1
endon
The WaterMeterDmy2 is updated "like" a pulse counter and the voltage is from 0 to 3v3
The switch seems to react differently from a pulseCounter

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#26 Post by hestia » 08 Sep 2021, 20:16

hestia wrote: 06 Sep 2021, 11:48 Thanks TD-er for your reply
10 pulses/sec => 10 liter/min, then your flow sensor reports 60 pulses per liter.
So each pulse is 1/60 liter.
For this sensor the Formula is “F=10Q”, so 1 pulse/sec = 10 l/min and not “10 pulses/sec => 10 liter/min”. Am I right?
So, 1 pulse = 1/6 liter => 1 liter = 6 pulse
Erratum on my side I think
1 L/min => 10 p/sec => 600 p/sec
1L -> 600p
If it's right, too fast to be seen with my meter
And it seems too fast for a switch instead of a pulse counter

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

Re: Flow water sensor tuning

#27 Post by TD-er » 09 Sep 2021, 23:27

Maybe you can "trigger" it using a magnet?
After all the internals use a magnet and a hall effect sensor.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#28 Post by hestia » 10 Sep 2021, 00:56

I'm not sure to understand... A magnet?
What do you think about the difference of voltage if the device is a switch or a pulse counter?
Would it be the same with a direct code INO instead of ESP Easy?

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

Re: Flow water sensor tuning

#29 Post by TD-er » 10 Sep 2021, 08:46

The internals of the flow sensor are:
- A rotating magnet
- A hall-effect sensor
- some transistor to get a more "digital" output.

So when sticking a magnet to the sensor and moving it around a bit, you may get a more consistent behavior as the flow sensor may be stuck somewhere between "open" and "close" on the hall-effect sensor.
The position of the magnet is easier to repeat than trying to measure the voltage on a guessed orientation of the wheel.


I have no idea why the voltage may differ so much between the "switch" and "pulse counter" plugin.
The only reason I can imagine is that the GPIO pin may be set to have the internal pull-up resistor activated.
Or maybe the switch plugin really drives the pin state down.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#30 Post by hestia » 12 Sep 2021, 19:48

I still don't understand the magnet thing :-(
And what about something like a 3.3V 5V TTL Bi-directional Logic Level Converter for Arduino?
https://www.banggood.com/fr/10-Pcs-3_3V ... mds=search

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

Re: Flow water sensor tuning

#31 Post by TD-er » 12 Sep 2021, 21:49

You only need to convert it in 1 direction, so it should still be doable using resistors.
No idea yet why not and so it might also not work on such a level converter.

About using a magnet... I wonder if the flow sensor can be put in some "inbetween" state, where the hall-effect sensor is not fully triggered.
By placing a magnet on the sensor, you can force it (reproducible) in a specific state without having to turn the wheel inside the sensor to a specific position to trigger "high" or "low".

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#32 Post by hestia » 13 Sep 2021, 23:37

I've got some information from the manufacturer
1/ I've a confirmation that there could be 300 pulse/sec as the sensor is from 1 L/min to 30 L/min and the formula is F = 10 Q. I wanted to be sure to what to be expected. So 1 L => from 516 to 600 pulses (calibration to do)
2/ I could power the sensor with 3v3 instead of 5v. The answer is, if there are pulses, it works!
I did some testing:
pulse active high, no debounce, 1L (objective between 516 and 600 pulses)
3v3 => 544 pulse => OK
5v => 534 p => OK
5v + 10k R-Y => 507 p => ~KO
3v3 + 10k R-Y => 515 p => OK/KO
3v3 + 10k Y-GPIO+100nF => 550 p => OK

So perhaps, the easier would be to 3v3 + 10k Y-GPIO+100nF

There are 2 magnets on the wheel inside the sensor, it could go to 150 rounds per second!

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

Re: Flow water sensor tuning

#33 Post by TD-er » 14 Sep 2021, 10:18

150 rpsec sounds a bit too much.
That's 9000 rpm.

I think the turbine wheel may be (partly) metal, so the hall effect sensor only needs to count the passing arm of the turbine wheel.

And indeed if it works fine on 3V3, please use that.
It is simpler and does help to reduce any picked up noise.
I am a bit surprised by the 100 nF. I would expect it to round off the edges too much at that rate, so I expected a smaller one.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#34 Post by hestia » 14 Sep 2021, 23:37

I have another answer from the manufacturer: "There is no need extra resistor"
So for them nothing is needed to wire this sensor.
On the other hand I read from you here Pulse Counter P003 enhancement. How to give back? that "100 nF + 10k resistor already filter out pulses smaller than roughly 1 msec" .The max frequency I have is 3 msec, so it could be good... I also have a 10nF, perhaps better, or nothing?
Do I have to filter something?
I think the turbine wheel may be (partly) metal, so the hall effect sensor only needs to count the passing arm of the turbine wheel.
I have a spare one, I'll look inside by the end of the testing...
And indeed if it works fine on 3V3, please use that.
Good for me ;-) I did the testing with a test Wemos. Some days ago I discovered that the production one is not powered as required 5v only instead of 9 to 24v (Wemos D1 R2). So when I power the sensors with 5v I've got only 3v7. All the other part of the Wemos seems to work. Do I have the change this or could it be tolerant?

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

Re: Flow water sensor tuning

#35 Post by TD-er » 15 Sep 2021, 00:03

Hmm a Wemos module powered with > 5V?
I expect the voltage regulator on the Wemos too hot to touch when using a higher voltage.

If you don't need a pull-up resistor, then that means it is already present inside the flow sensor.

Whether or not you need filtering depends on the length of the cable and the amount of false pulses you count (especially when there are no pulses to count)
The resistor may also help limit the charging current of the capacitor, through the hall effect sensor.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#36 Post by hestia » 15 Sep 2021, 09:01

Code: Select all

Hmm a Wemos module powered with > 5V?
https://wiki.geekworm.com/WEMOS_ESP8266_D1_R2_V2.1
Micro USB connection
Power jack, 9-24V power input
Whether or not you need filtering depends on the length of the cable and the amount of false pulses you count (especially when there are no pulses to count)
Testing on going with noting for all the day...

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#37 Post by hestia » 15 Sep 2021, 15:34

I've got a reboot around every day.
Could it be due to the power, not enough voltage?
Perhaps due to there WiFi, but I think there is a good WiFi in this area.
Other causes?
For me it is not a problem if there a reboot from time to time, but perhaps there is some bad root causes...

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

Re: Flow water sensor tuning

#38 Post by TD-er » 15 Sep 2021, 21:18

hestia wrote: 15 Sep 2021, 09:01

Code: Select all

Hmm a Wemos module powered with > 5V?
https://wiki.geekworm.com/WEMOS_ESP8266_D1_R2_V2.1
Micro USB connection
Power jack, 9-24V power input
Whether or not you need filtering depends on the length of the cable and the amount of false pulses you count (especially when there are no pulses to count)
Testing on going with noting for all the day...
Ah that one has a switching power supply.
So that's the reason it could use such a high input voltage.

Can you see what are the reboot reasons?
For example Watchdog timer? Exception?

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#39 Post by hestia » 15 Sep 2021, 21:33

Can you see what are the reboot reasons?
For example Watchdog timer? Exception?
I've just discovered that I could see the reboot reasons
So the last one

Code: Select all

Boot:	Manual reboot (65)
Reset Reason:	Exception
Last Action before Reboot:	Const Interval: TIMER_MQTT
What was sure, it was NOT a "Manual reboot" ; I wasn't there!
Perhaps, I could set a rule to read the reason and send it to domoticz
Easy to read it? Relevant?

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

Re: Flow water sensor tuning

#40 Post by TD-er » 15 Sep 2021, 22:48

"Manual reboot" can still happen and those are then some indication of power issues.

Exception can be just about anything.
But since it was probably happening in the MQTT related code, it is more likely it was a WiFi issue, where the node was actually disconnected but not registered as disconnected.

Can you check the "send with max TX power" (tools->advanced, bottom page)

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#41 Post by hestia » 16 Sep 2021, 08:23

Can you check the "send with max TX power" (tools->advanced, bottom page)
Empty!

I didn't succeed with %bootcause% :-(

Code: Select all

LogEntry, [%bootcause%]
=> [%bootcause%]

Code: Select all

LogEntry, %bootcause%
=> %bootcause%

How to use it (stupid question on variables probably!)

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

Re: Flow water sensor tuning

#42 Post by TD-er » 16 Sep 2021, 08:48

The bootcause is not yet present as a variable.
And besides that, a variable should not be wrapped in []
See the system variables page (not included in 1M or "testing" builds) for all supported variables.

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#43 Post by hestia » 16 Sep 2021, 20:55

Can you check the "send with max TX power" (tools->advanced, bottom page)
Empty!
Is empty a good value or should I put something else?

another reboot reason => Const Interval: TIMER_100MSEC

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

Re: Flow water sensor tuning

#44 Post by TD-er » 16 Sep 2021, 21:09

Check as in, it should be checked. :)

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#45 Post by hestia » 20 Sep 2021, 21:24

TD-er wrote: 12 Sep 2021, 21:49 [...]
About using a magnet... I wonder if the flow sensor can be put in some "inbetween" state, where the hall-effect sensor is not fully triggered.
By placing a magnet on the sensor, you can force it (reproducible) in a specific state without having to turn the wheel inside the sensor to a specific position to trigger "high" or "low".
Screenshot 2021-09-20 211140.png
Screenshot 2021-09-20 211140.png (178.11 KiB) Viewed 8523 times
No need a magnet, direct access to the wheel.
There is a "high" on each blade
I did more testing
1/ voltage divider 10k and 20k no capacitor
input 5v, output 0v49 to 3v ; no ZERO !
=> I've got pulses on espeasy

2/ with a diode N4728A - 1w - 3.3v
output 0,7v to 2v2 !!! why not 3v3?

I did more testing because with a 3v3 input, it seems that I've not a stability in the measures

hestia
Normal user
Posts: 81
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Flow water sensor tuning

#46 Post by hestia » 22 Sep 2021, 22:59

More testing:
sensor powered by 5v (5v1 in fact)
10k from the output Y (5v) to GND (no more) => 0v4 to 3v45 => good pulses
I think I'll go with this

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

Re: Flow water sensor tuning

#47 Post by TD-er » 22 Sep 2021, 23:16

Yep, if it works, keep it :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests