Water level controler

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dick60
Normal user
Posts: 243
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Water level controler

#1 Post by Dick60 » 11 Jul 2023, 20:57

I have a kind of tube and the floating part of it is connected to a kind of resistor. The resistor level is from 0-190 ohm. I tried to connect it to the AQ on my esp8266 (like an LDR) but no result. Also tried the lever regulator device but also nothing in the log. I use the latest firmware. I want to read the change in resistance to use it in a script.

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

Re: Water level controler

#2 Post by TD-er » 11 Jul 2023, 21:41

How is this connected to the ESP?

Typically you need an extra resistor so you can create a voltage divider.

Something like this:

3V3 --- Resistor --- AnalogPin --- VariableResistor --- GND

The "Resistor" is there to pull the AnalogPin up and the VariableResistor will try to pull the pin down to GND.
The "Resistor" is also needed to limit the current to some safe level.
Worst-case, when the variable resistor is 0 Ohm, this fixed resistor will determine the current through the variable resistor.

I would opt for an 1k resistor. This way the max. current will be 3.3 mA.

As input, you can use the ADC plugin.: https://espeasy.readthedocs.io/en/lates ... #p002-page

Dick60
Normal user
Posts: 243
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Water level controler

#3 Post by Dick60 » 11 Jul 2023, 22:05

I used the esp8266 for this test and connected one of the wires of the resistance vlotter to 3.3, the other wire of the vlotter to AO and from there a 10k resistor to gnd. Also selected the Anolog input internal device from the dropdown. But nothing in the log. Is a 10k a good option or another one ?

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

Re: Water level controler

#4 Post by TD-er » 11 Jul 2023, 22:17

10k is too much.
Also I would connect the variable resistor between the analog input and GND as not all ESP boards can measure upto 3V3.

What you want is to use as much from the range of 0 ... 3V3 as possible with your 0...190 Ohm variable resistor.
If you only use a small part of this range, it is hard to measure small changes in resistance.

Also you need some current limiting resistor.

I would start with 470 Ohm or 1k.

3V3 --- 470 Ohm --- A0 --- VariableResistor --- GND

This way you will have an analog voltage of 0 ... 0.95V on the analog input

Dick60
Normal user
Posts: 243
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Water level controler

#5 Post by Dick60 » 13 Jul 2023, 14:51

This solution "3V3 --- 470 Ohm --- A0 --- VariableResistor --- GND "worked perfectly. 470 ohm was the correct one. Did not have to test other values :arrow:

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

Re: Water level controler

#6 Post by TD-er » 13 Jul 2023, 16:41

Great! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests