Convert value

Everything about esp8266 and more.

Moderator: leecollings

Post Reply
Artic1980
Posts: 23
Joined: Monday 25 April 2016 17:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Convert value

Post by Artic1980 »

Good evening I'm trying to read the pH of the pool but I can not convert the value into ph.
I that 2.5v correspond to 7ph and 3.05 to 4ph how can i convert it?
The sensor is connected to an asd1115 and an esp8266
thank you
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Convert value

Post by Domosapiens »

Assuming the sensor is linear, you have something like this,
where x is Volt and looking for y as Ph
Image

So the formula is:
y=a+bx
You posted 2 answers for the formula:
7=a+2.5b (1)
4=a+3.05b (2)

Rework (1)
a=7-2.5b
Substitute in (2)
4=7-2.5b+3.05b
Calculate b=-5.4545
Substitute in (1)
Calculate a=20.6363
Your formula:
y=20.6363-5.4545b

In practice:
To get Ph: read the Voltage, multiply by 5.4545 and subtract it from 20.6363

But first do some input checking:
0V gives a Ph of 20 (rubbish!)
More than 3.78V gives a Ph lower than 0 (rubbish!)

Note 1:
the - sign for b gives a negative slope: the more volt, the lower the Ph
so .. the slope in the picture is just an example of a positive slope

Note 2:
Calculations with 1 decimal will be sufficient
Last edited by Domosapiens on Sunday 02 July 2017 13:10, edited 1 time in total.
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
Artic1980
Posts: 23
Joined: Monday 25 April 2016 17:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Convert value

Post by Artic1980 »

Thanks a lot tomorrow text


Inviato dal mio iPhone utilizzando Tapatalk
Artic1980
Posts: 23
Joined: Monday 25 April 2016 17:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Convert value

Post by Artic1980 »

Now is perfect. Thank


Inviato dal mio iPhone utilizzando Tapatalk
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest