Flow sensor reboots ESP E12

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Flow sensor reboots ESP E12

#1 Post by JackG » 21 Oct 2017, 10:16

Hi there :) I have problem with "pulse counter" feature in EasyEsp firmware 120

I heve got hall efect flow sensor - FS400A http://www.hotmcu.com/g1-water-flow-sensor-p-312.html
I tested it with arduino skatch from this link https://diyhacking.com/arduino-flow-rate-sensor/ and it works perfectly.


I decided to connect it to my ESP E12 like others sensors. Because I need ext 12VDC power....I used this schamatic from official site:
https://www.letscontrolit.com/wiki/inde ... ogic_input -> section HARDWARE "Please refer to this page for pulse levels that are higher than 3.3V (or 5V for some ESP units)"

I have two problems:
1. Esp E12 module reboot after few minutes, with diffrent period of time....after 5 - 38 minutes max
2. How I should config tihis dev in easyesp? Now I've got something like this and doesn't work soo good like @arduino
Image

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#2 Post by rayE » 26 Oct 2017, 13:03

Hi,
I had the same problem, some others did not. Thread here. Hope it helps.
viewtopic.php?f=2&t=3647

Ray

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#3 Post by Shardan » 26 Oct 2017, 17:35

Hello,

atm I'm testing a nodeMCU (ESPEasy 2.0.0-DEV12 normal) with four counters defined and getting "ticked" from a function generator with
different pulse clocks.
It is running now for a day without rebooting so I'm not convinced this is a problem of the counter plugin.

At first the circuit for voltage adaption you mentioned itches me a bit.
The diode and the transistor sum up to about 1 volt as "low" level which is on the limit the ESP recognizes as "low".
Second, theconnection to 12V might intriduce spikes to the ESP.
I'd suggest to change the circuit to this:
.
Oneway_12V-3v3.jpg
Oneway_12V-3v3.jpg (220.57 KiB) Viewed 17128 times
.

A far more simple way to adapt the voltage level securely is a zener diode.
It might need a bit of testing with the resistor value:
.
Level-adapt_Zener.jpg
Level-adapt_Zener.jpg (110.47 KiB) Viewed 17127 times
.
Please remember that GND must be connected to both sides, GND on sensor and ESP.

On another note check the power supply of the ESP.
It might help to filter the sensor and check the voltage regulation if you use the 12V supply for the ESP too.
https://www.letscontrolit.com/wiki/inde ... _positives

Voltage regulators usually need some capacitors around to prevent regulation oscillations.
The usual types (LM1117-3.3, LF-33 for example) need a 100nF ceramic type on input and output and
an eleectrolytic capacitor of about 100µF on the output. Make sure you use really ceramic types.
Film capacitors are not suitable here.

Regards
Regards
Shardan

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#4 Post by JackG » 30 Oct 2017, 11:16

Hi Shardan
Thx for your reply :)
I made some changes before I read your post.
Firstly I switched to 5V - nothing change to me (resets stil are present)
Changeing of firmware also nothing change

In the evening I'll post some details and ad some charts from my counter.
Shardan wrote: 26 Oct 2017, 17:35 atm I'm testing a nodeMCU (ESPEasy 2.0.0-DEV12 normal) with four counters defined and getting "ticked" from a function generator with
different pulse clocks.
How do you generate a pulse signal? With what?

Greetings
Jack

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Flow sensor reboots ESP E12

#5 Post by grovkillen » 30 Oct 2017, 11:38

You could use a simple momentary switch or simply short 3.3V with the GPIO in order to get something pulsing.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#6 Post by Shardan » 30 Oct 2017, 15:08

JackG wrote: 30 Oct 2017, 11:16 Hi Shardan
Thx for your reply :)
I made some changes before I read your post.
Firstly I switched to 5V - nothing change to me (resets stil are present)
Changeing of firmware also nothing change

In the evening I'll post some details and ad some charts from my counter.
Shardan wrote: 26 Oct 2017, 17:35 atm I'm testing a nodeMCU (ESPEasy 2.0.0-DEV12 normal) with four counters defined and getting "ticked" from a function generator with
different pulse clocks.
How do you generate a pulse signal? With what?

Greetings
Jack
Hello Jack,

I'm using a cheap function generator with two independent channels so I'm able to generate two rectangle signals with different frequencies.

To be honest it was the cheapest function generator i could find - i need it very rarely and don't need high precision so i checked ebay and found this:
http://www.ebay.de/itm/Signalgenerator- ... SwhvFZDB9w

I tested with two frequencies, 10 + 13 Hz to simulate pulse sources with different clock ticks.
ESPEasy was set up with four counters, two for each pulse.

The test was stopped yesterday after about 50 hours without issues.

Regards
Shardan
Regards
Shardan

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#7 Post by JackG » 01 Nov 2017, 16:44

HI
Like I said, I made some changes / tests:
1) I switched to 5V/1A power supply from USB connected directly to ESP. Wiring same as yours, but R1=1kohm. Below 24h chart with 12 down peaks (resets) Soft: dev10
Image

2) Next option - an old Nokia charger 7,2V/890mA connected to Vin / gnd ESP pins. The same wiring. Below 24h chart with 35 down peaks (resets). Soft : dev12
Image

3) Last option: LED's power supply 12V/6000mA connected to Vin / gnd ESP pins. The same circut as yours R1=22kohm. Below 24h chart with 43 down peaks (resets). Soft : dev12
Image

I think wiring diagram in my case is not good. I think there are lots of noises and "trashes" in signal. This in not a pure and fine rectagle signal.
I found diagram on web site to this flow sensor but in this shape it would kill esp
Image

ehhh......

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#8 Post by Shardan » 01 Nov 2017, 21:35

Hm....

At first: Make sure your power supply is clean.
Many problems result from power supply.
I'd try to use separate power supplies for ESP and the flow sensor for a test.
Let the ESP run for a while without sensor to make sure this is stable, then start the sensor.

I'm not sure but i doubt that the signal itself from the sensor reboots the ESP.
Some unstable ground connections or spikes on the power line is more likely.

If the power supply is clean you may try a Schmitt-Triger to shape the signal,
I'll see if i can make a drawing then.

Regards
Shardan
Regards
Shardan

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#9 Post by JackG » 02 Nov 2017, 11:15

Definitely restarts are causes by signal from the flow sensor.
ESP itself works stably.
The same ESP attached to development board with sensors: 4x DS18B20, BME260, 4x relays and soil moisture - works perfect.

I checked the flow sensor itself. Pinned under arduino UNO works perfectly - accuracy of measurements is + - 40-60mL.

Regards
Jacek

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#10 Post by rayE » 02 Nov 2017, 11:28

I will second that. My ESP12E has adequate decoupling and built on a PCB. It's been running non stop now for 3 weeks with a different application and no reboots. Start up the pulse counter device and it reboots at least every 30 seconds.

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#11 Post by rayE » 02 Nov 2017, 11:43

Hi Jacek,
What value pull up resistor is on the flow sensor? i take it the capacitor is 0.1uF ceramic? I use this type which gives nice square waves with 3K3 + 0.1uF, works fine on a PIC BUT not with the pulse counter device, iv also tried a signal generator and it still constantly reboots, a firmware problem i think.

https://www.google.com.ph/search?q=flow ... Hnqrm6gYUM:

Ray

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Flow sensor reboots ESP E12

#12 Post by grovkillen » 02 Nov 2017, 12:13

rayE wrote: 02 Nov 2017, 11:43 Hi Jacek,
What value pull up resistor is on the flow sensor? i take it the capacitor is 0.1uF ceramic? I use this type which gives nice square waves with 3K3 + 0.1uF, works fine on a PIC BUT not with the pulse counter device, iv also tried a signal generator and it still constantly reboots, a firmware problem i think.

https://www.google.com.ph/search?q=flow ... Hnqrm6gYUM:

Ray
What versions are you on? I tried a self compiled version (code base 2017-10-16) which did not work correctly with the pulse counter plugin. Downgraded to dev7 (which I use for another pulse counter unit) and it worked...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#13 Post by rayE » 02 Nov 2017, 12:20

My setup:
v2.0.0-dev12

Device = Pulse Counter
I/O = CH5
Type = delta/total/time
Mode = Rising
Delay = 10s

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#14 Post by rayE » 02 Nov 2017, 12:31

Just a thought, if the pulse counter device digital input from the flow sensor is configured as a D/O (in the device driver) that would cause current sink problems and probably reboots. Look at the horrible scope graphs previously presented?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#15 Post by Shardan » 02 Nov 2017, 13:11

Hello,

I've been testing dev12 these days with four counters on a two channel signal generator without issues.
Anyways i have a suspicion.
Can you please test different settings with "Falling" - "Raising" - "Low" settings?
I tested here for some hardware things and that's something i did not try.

On another note i'm thinking about an active filter/schmitt-trigger gate but thats
somewhat complex and will not help if there is a firmware bug so it's senseless at this point.

Regards,
Shardan
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#16 Post by Shardan » 02 Nov 2017, 14:37

So. I did some tinkering with signal generator, nodeMCU (dev12) and one single counter task.
No reporting to any homecontrol or such (Controller deactivated), no other tasks configured.

I've found some behaior to higher pulse frequencies that might bring troubles with a flow sensor.
I think the pulse counter was originally made for energy meters.
My energy meters give 2 pulses per wh. At maximum (16A) we get:
16 A * 230V * 2Pulses = 7360 pulses/h or 2.04 pulses/s.

So i tested frequencies up to 15 Hz first - that worked.

Today I increased frequency. Up to 50 Hz it works fine.
Higher frequencies slow down the web frontend, but main page says memory is OK.
From about 150...200 Hz and higher it gets really into trouble, blocking, crashing and so on.

So the question is: Which frequency does your flow sensor give?
Sadly i don't have a sample to test with so i can't say.

Regards
Shardan
Regards
Shardan

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#17 Post by JackG » 04 Nov 2017, 09:30

grovkillen wrote: 02 Nov 2017, 12:13
rayE wrote: 02 Nov 2017, 11:43 Hi Jacek,
What value pull up resistor is on the flow sensor? i take it the capacitor is 0.1uF ceramic? I use this type which gives nice square waves with 3K3 + 0.1uF, works fine on a PIC BUT not with the pulse counter device, iv also tried a signal generator and it still constantly reboots, a firmware problem i think.

https://www.google.com.ph/search?q=flow ... Hnqrm6gYUM:

Ray
What versions are you on? I tried a self compiled version (code base 2017-10-16) which did not work correctly with the pulse counter plugin. Downgraded to dev7 (which I use for another pulse counter unit) and it worked...
@rayE and @grovkillen

I understand you mean this scheme?
Image
I do not use it. At the moment I'm using the exact schema proposed by Shardan in post # 3.
The flow sensor was tested on revisions from R147 to 2.0.0 dev12.

Regards

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#18 Post by rayE » 04 Nov 2017, 10:07

The above diagram is the way im using the flow sensor. Vcc is 3.3V, decoupling capacitor is 0.1uF ceramic and pull up resistor is 10K. Looking at the pulse O/P on a scope it is VERY clean and works on a PIC MCU with no problems.

Here is the sensor
https://www.google.com.ph/search?q=flow ... Hnqrm6gYUM:

the data sheet says Vcc = 5V BUT iv been running 2 of these on 2 seperate PIC's @ 3V3 for around 2 months and NO problems, accuracy is +/-3% which is adequate for my application. Also i do NOT think it has anything to do with the pulse input as iv seen the reboot problem on both the flow sensor as well as a signal generator. I understand that the ESP module has no hardware pulse counter so presumably it is driven by software polling meaning the system will probably slow with increasing frequency. So for a flow rate of 10 liters per minute that would equate to 7.5 * 10 = 75Hz.

Ray

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#19 Post by JackG » 04 Nov 2017, 10:46

@RAy

I will check your wiring after I come back home.
THX

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#20 Post by JackG » 04 Nov 2017, 10:53

Shardan wrote: 02 Nov 2017, 14:37 So the question is: Which frequency does your flow sensor give?
Sadly i don't have a sample to test with so i can't say.
@ Shardan
Unfortunately I do not have an oscilloscope to check it out :( .... BUT !!! theoretically ........

I have checked the actual flow of water. I poured a certain amount of water eg 800ml through a flow sensor and verified with a properly functioning scatch on Arduino UNO. This gives me confidence that the flowmeter measures correctly.

At this moment, the flow meter is plugged into a closed water system with a small pump
which gives a 4.8L / m flow -> checked on Arduino UNO

The water hall-effect flow sensor output pulses are proportional to the water flow with: Pulse Frequency (Hz) = Flow (L/min) * Calibration Factor.
In my case calibration factor is 4.5 wich means that: My freq = 4,8 * 4.5 = 21,6 Hz

Greets
Jacek

JackG
New user
Posts: 9
Joined: 16 Oct 2017, 18:21

Re: Flow sensor reboots ESP E12

#21 Post by JackG » 04 Nov 2017, 10:57

rayE wrote: 02 Nov 2017, 12:20 My setup:
v2.0.0-dev12

Device = Pulse Counter
I/O = CH5
Type = delta/total/time
Mode = Rising
Delay = 10s
And what about DEBOUNCING TIME ?

themanfrommoon
Normal user
Posts: 48
Joined: 23 May 2017, 21:38
Location: Malente / Germany

Re: Flow sensor reboots ESP E12

#22 Post by themanfrommoon » 04 Nov 2017, 12:12

Today I increased frequency. Up to 50 Hz it works fine.
Are you really sure it makes no problems until 50Hz?

I have the same problems with 3 counters running around 10 to 30 Hz.
I have a very good strong short power supply with 3A.
If I reduce from 3 to 1 counter, or from 3 to 2 counters than I have less warm reboots.
I have 275 warm boots within 4 days.
These warm boots does not occur in the same period.
Sometimes it runs 1 hour withaut any problem.
And than within 10 minutes it has 3 warm boots.
And of course everything between these two extrems.
I'm using moules which give a very good frequency output signal.
PulseCounter17warmboots.PNG
PulseCounter17warmboots.PNG (138.03 KiB) Viewed 17092 times
IR Sensor.jpg
IR Sensor.jpg (162.27 KiB) Viewed 17092 times
PulseCounter11.jpg
PulseCounter11.jpg (97.94 KiB) Viewed 17092 times

So the problem I have is not causes by the power supply and not caused by the frequency signal.
I think it is a softwareproblem caused by the Interrupts of the three frequency counting channels and the ESP8266 core which needs time for the WLAN connectivity.

Any idea to solve it?

Thanks and best regards,
Chris

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#23 Post by Shardan » 04 Nov 2017, 16:01

I've set my test nodeMCU to 22Hz pulse from my signal generator and will monitor uptime.

Regards
Shardan
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#24 Post by Shardan » 04 Nov 2017, 16:03

themanfrommoon wrote: 04 Nov 2017, 12:12
Today I increased frequency. Up to 50 Hz it works fine.
Are you really sure it makes no problems until 50Hz?
No i'm not - i tested it for a short time only as i don't use counters myself atm.

As said i've just setup some testing and will monitor for longer terms.
If this is a firmware bug it makes the counter function somewhat useless.

Regards
Shardan
Regards
Shardan

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Flow sensor reboots ESP E12

#25 Post by rayE » 05 Nov 2017, 11:28

And what about DEBOUNCING TIME ?
Im sure i would have set debounce time to a minimum setting as the pulse comes from a hall element therefore the waveform is clean. Debounce is only realy needed for things like relays and switches where you get mechanical bouncing of the contacts.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#26 Post by Shardan » 05 Nov 2017, 12:25

rayE wrote: 05 Nov 2017, 11:28
And what about DEBOUNCING TIME ?
Im sure i would have set debounce time to a minimum setting as the pulse comes from a hall element therefore the waveform is clean. Debounce is only realy needed for things like relays and switches where you get mechanical bouncing of the contacts.
Definitely.
Debouncing is for mechanical contacts as they tend to generate noise on closing/opening.
With clean electronic signals it's just not necessary.
Anyways it should not crash ....

On another note:
I had to reset log - we obviously had some power outage over night so all my devices reset... :roll:

Regards
Shardan
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Flow sensor reboots ESP E12

#27 Post by Shardan » 09 Nov 2017, 18:38

Hello all,

after some time of testing i'm not sure if that is a firmware bug.

I've quickly nailed together a nodeMCU with a transistor on a GPIO and fed the transistor with 22Hz as this is what the sensor gives here at max.

At first i had a bunch of resets:
I changed to another power supply and then got these uptimes:
- 383 min
- 1195 min
- 80 min
- 31 min
- 83 min.

I changed to another power supply and then got these uptimes:

- 3127 min
- and now up and running for ~900 min and counting.

Regards,
Shardan
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests