pull+filter

Moderators: grovkillen, Stuntteam, TD-er

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

pull+filter

#1 Post by hestia » 17 Jun 2021, 23:40

Hi,
I use an esp8266 (wemos R1D2) to make a water meter.
I made a circuit with a pull resistor and a filter as explained in Pulse Counter P003 enhancement. How to give back?
Screenshot 2021-06-17 232406.png
Screenshot 2021-06-17 232406.png (571.2 KiB) Viewed 7259 times
It seemed to work with GPIO 5, 4 and 13. But not with GPIO 0.
For GPIO 0, I removed the filter resistor and it seemed to work
Screenshot 2021-06-17 232406b.png
Screenshot 2021-06-17 232406b.png (548.37 KiB) Viewed 7259 times
But is it a correct circuit? Was the first one a correct circuit?
Any other way to do it?

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

Re: pull+filter

#2 Post by TD-er » 17 Jun 2021, 23:50

First, see this page of the documentation: https://espeasy.readthedocs.io/en/lates ... on-esp8266
Better not to use GPIO 0 for a switch that may be in the 'closed' state (thus pull to GND) when the ESP boots.
Other special pins are GPIO-2 and -15.

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

Re: pull+filter

#3 Post by TD-er » 17 Jun 2021, 23:51

What is the "out" in your schematic?

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

Re: pull+filter

#4 Post by hestia » 18 Jun 2021, 08:22

Thanks for your reply
The "out" is a Flow Sensor Water (USN-HS21TA Ultisolar Hall Effect), but it is the same when testing with a simple switch.
I've read the doc several times but it seems that I didn't understood it enough ;-)
As I need several GPIO, I ended using GPIO 0...
At the present time, I have:
GPIO 5, 4, 13, 0 => Flow Sensor Water
GPIO 12 => switch (low level indicator 0 / 1)
GPIO 16 => DS18b20
Screenshot 2021-06-18 080717.png
Screenshot 2021-06-18 080717.png (176.79 KiB) Viewed 7247 times
schema.jpg
schema.jpg (192.48 KiB) Viewed 7247 times
The "whole" presentation in another post Watering and tank level control

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

Re: pull+filter

#5 Post by TD-er » 18 Jun 2021, 09:05

You're using the 5V pin for pull-up.
The ESP may be 5V tolerant, but better to use the 3v3.

In your drawing you are still using GPIO-0, which may be pulled somewhere by "3".
But I don't know what this signal is coming from 1...4
That circuit is connected to both 5V and GND.
Do inputs 1...4 switch between 5V and GND like a relay?
If so, then I don't know if the resistors are (still) needed.

Do you have a schematic or something that's connected at the top of the drawing?
Also the "low level" indicator. I assume it is a switch that is normally closed ? (if normally open, the state will be logically inverted)

Another tip, as you seem to be using a non-standard board for ESP's based on the original Arduino board dimensions.
PLease measure the voltage between each GND and 5V and each GND and 3v3, just to make sure you do have the voltages where you expect them.
Wouldn't be the first time the silk screen text on a PCB is wrong for non-standard boards.

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

Re: pull+filter

#6 Post by hestia » 18 Jun 2021, 16:16

You're using the 5V pin for pull-up.
that's a mistake, because I needed to give power to the flow sensors, I mixed the power and the pull-up!
Another drawing with both separate
schema_V1R1.jpg
schema_V1R1.jpg (203.49 KiB) Viewed 7231 times
What this signal is coming from 1...4
something that's connected at the top of the drawing?
These are the flow sensors https://fr.aliexpress.com/item/32696287 ... 6c37eqxc4Y
The yellow wire is the signal. I've planned to put all the "plus" together and connected to the Wemos 5V and idem for the "minus" to the GND. Perhaps it could have been better to wire the 5V to another power, but I think I need to have the minus to the Wemos GND.
"low level" indicator. I assume it is a switch that is normally closed
I'm not sure to understand the point :-(
It's a float switch like this https://fr.aliexpress.com/item/40010374 ... 1c104af3-0. I don't have this exact model on hands but I think it is "ok" when opened and "low" when closed (at the present time it is inside my tank, I need to look at it...)
Screenshot 2021-06-18 154052.png
Screenshot 2021-06-18 154052.png (36.27 KiB) Viewed 7231 times
Screenshot 2021-06-18 160828.png
Screenshot 2021-06-18 160828.png (40.78 KiB) Viewed 7231 times
you are still using GPIO-0, which may be pulled somewhere by "3"
yes. Can I use another GPIO (need to be available ; when testing there was no other solution). Do you have any advise on this?
measure the voltage between each GND and 5V and each GND and 3v3
Done, they are OK

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

Re: pull+filter

#7 Post by hestia » 18 Jun 2021, 18:01

Some testing
I've modified the circuit like the drawing and tested with a simple wire (to connect B to Y).
It is the same: OK for 4, 1, 2 KO for 3
I've shunted the filter resistor and it worked.
I've remove the pull-up resistor and set pull-up in the hardware and it is the same: KO with the filter resistor and OK without
Yesterday I had tested the "line '3' was OK for '3' to the GPIO pin connecting the pin to another GPIO

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

Re: pull+filter

#8 Post by TD-er » 18 Jun 2021, 19:20

Please be aware that GPIO-0 does already have a pull-up resistor on the ESP board (or else the ESP would not boot if GPIO-0 is pulled to GND)
So that being said, it is a bad idea to use GPIO-0 for signaling a state that can remain in that state for a while.

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

Re: pull+filter

#9 Post by hestia » 18 Jun 2021, 23:34

Understood!
According to the documentation: https://espeasy.readthedocs.io/en/lates ... on-esp8266, I could have used GPIO 14, if I understand well this documentation.
I think I already have tested all the GPIO, and keep the only ones that worked, but I going to test this one once again

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

Re: pull+filter

#10 Post by hestia » 19 Jun 2021, 09:13

GPIO 14
tested and it works!
my mistake!
I'm going to modify the circuit and make more testing...

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 29 guests