DIY Sensor "Vapour-pressure deficit" & "saturation vapour pressure of moist air"

hexthat

Well-Known Member
I made a VPD sensor thing with Adafruit products. This code is basic version that prints VPD and "Saturation vapour pressure". I would like to use this in a study to see if VPD needs adjusting at different altitudes.

I'm working on a correlation between VPD and SVP into one value? id call it "hexthat's pressure"

Python:
import board
import busio
import math
import adafruit_bmp280
import adafruit_si7021
import time
i2c = busio.I2C(board.SCL, board.SDA)
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
si7021 = adafruit_si7021.SI7021(i2c)

while True:
    rh = si7021.relative_humidity
    temp = si7021.temperature
    hPa = bmp280.pressure
    
    # Saturation Vapor Pressure *Arden Buck equation(1996)*
    if temp > 0:
        SP = 0.61121 * math.exp((18.678 - (temp / 234.5)) * (temp / (257.14 + temp)))
    else:
        SP = 0.61115 * math.exp((23.036 - temp / 333.7) * (temp / (279.82 + temp)))
    if rh > 20 and rh < 80:
        # actual partial pressure of water vapor in air
        ea = rh / 100 * SP
        # Vapour-pressure deficit
        VPD = SP - ea
    else:
        print("Humidity out of range 80 <> 20, RH:", rh)
        VPD = False
    # pressure function
    pf = 1.0016 + 3.15 * (math.pow(10, -6) * hPa) - (0.074 * math.pow(hPa, -1))
    # saturation vapour pressure of moist air
    SVP = pf * SP
    print('VPD :', VPD, 'SVP :', SVP)
    time.sleep(6)
sources:
 

OldMedUser

Well-Known Member
I'm just getting into playing around with a Raspberry Pi and should have my first Arduino kit next week.

That link to CircuitPython looks very interesting as I'll need to get into Python a bit one way or another.

I had the Pi online within a few hours of picking it up and most of that time was downloading Raspbian and setting it up. So far installed FireFox and ProtonVPN which has to be used in Terminal which kind of sux. as a Windows guy I love a GUI tho began computing back in '87 starting with IBM DOS 1.0 and was reluctant to move to Windows tho wish I'd bought some stock back then. lol

A forum buddy here has already built a 7 pot watering controller with the Arduino and helping me out with getting going.

I'm 65 and need a challenging hobby to keep from turning into an old fart!

:peace:
 

Mak'er Grow

Well-Known Member
I'm just getting into playing around with a Raspberry Pi and should have my first Arduino kit next week.

That link to CircuitPython looks very interesting as I'll need to get into Python a bit one way or another.

I had the Pi online within a few hours of picking it up and most of that time was downloading Raspbian and setting it up. So far installed FireFox and ProtonVPN which has to be used in Terminal which kind of sux. as a Windows guy I love a GUI tho began computing back in '87 starting with IBM DOS 1.0 and was reluctant to move to Windows tho wish I'd bought some stock back then. lol

A forum buddy here has already built a 7 pot watering controller with the Arduino and helping me out with getting going.

I'm 65 and need a challenging hobby to keep from turning into an old fart!

:peace:
I went with Arduino for my project because I read the Pi has issues with crashing since its running an OS.
Have you run into this problem?
Also the Arduino GUI is fairly simple...its basically C++...no new language to learn...I'm old too (50)...lol
 

Mak'er Grow

Well-Known Member
I made a VPD sensor thing with Adafruit products. This code is basic version that prints VPD and "Saturation vapour pressure". I would like to use this in a study to see if VPD needs adjusting at different altitudes.

I'm working on a correlation between VPD and SVP into one value? id call it "hexthat's pressure"
Are these basically the same as the ones you have used ?

If so I'd be interested in helping, if I can, with your project...I'm from SE Ontario, Canada...no idea about altitude...lol
 

OldMedUser

Well-Known Member
I went with Arduino for my project because I read the Pi has issues with crashing since its running an OS.
Have you run into this problem?
Also the Arduino GUI is fairly simple...its basically C++...no new language to learn...I'm old too (50)...lol
I've only had the Pi for 4 days so am barely crawling at this point. Been building my own computers and fixing peoples for almost 30 years but no real programming experience other than a little BASIC on my Sharp pocket computer. I should have took computer science when I went back to school in my 30s but took environmental chemistry instead. I had never even touched a computer back in '87 when I got a Commodore PC 10 II and damn near flunked out first term spending so much time learning how to use it. :D

Are these basically the same as the ones you have used ?
If so I'd be interested in helping, if I can, with your project...I'm from SE Ontario, Canada...no idea about altitude...lol
I haven't used any sensors yet but I'll check the PMs for what he uses. He uses the same kind of sensors as in this kit. They are for sensing moisture levels in pots tho so different I guess. He uses those esp8266 chips for the programming. He didn't buy that kit tho. Just the sensors.


I'm getting this Arduino kit sometime next week.


And I got this Pi kit a few days ago.


Like I said I'm a babe in the woods when it comes to this stuff. Joined a couple of Pi and Arduino forums but most of it is way past my pay grade tho they have good tutorials for beginners too.

Just want to get going on the basics and see where it leads me. Got a feeling it's gonna get addictive. lol

:peace:
 

ToFarGone

Well-Known Member
I love the Arduino. But so new with it at this point. Hell of a learning experience. My codes written like a wasted mess I’m sure programmers would just laugh and delete it all
 

Mak'er Grow

Well-Known Member
I've only had the Pi for 4 days so am barely crawling at this point. Been building my own computers and fixing peoples for almost 30 years but no real programming experience other than a little BASIC on my Sharp pocket computer. I should have took computer science when I went back to school in my 30s but took environmental chemistry instead. I had never even touched a computer back in '87 when I got a Commodore PC 10 II and damn near flunked out first term spending so much time learning how to use it. :D



I haven't used any sensors yet but I'll check the PMs for what he uses. He uses the same kind of sensors as in this kit. They are for sensing moisture levels in pots tho so different I guess. He uses those esp8266 chips for the programming. He didn't buy that kit tho. Just the sensors.


I'm getting this Arduino kit sometime next week.


And I got this Pi kit a few days ago.


Like I said I'm a babe in the woods when it comes to this stuff. Joined a couple of Pi and Arduino forums but most of it is way past my pay grade tho they have good tutorials for beginners too.

Just want to get going on the basics and see where it leads me. Got a feeling it's gonna get addictive. lol

:peace:
I had my own repair shop for a few years...3 local pawn shops sent me broken equipment to repair/fix and I did PC repairs/builds too...then closed up and worked for a PC OEM for awhile on tech support, but started out on a VIC 20 (showing my age there...lol) with teaching myself Basic and after a few years the IBM came out and I taught myself a little DOS, but nothing of real use beyond simple routines really.
I have a feeling I know your helper...followed some posts on another site where someone was doing auto watering system with moisture sensors and esp8266's...prob same person...lol
I bought my first Arduino (knock-off) locally and then found out China sells the same things for about 1/3 of the cost, so now I order from there for most of my parts and pieces...some day I may get a Pi just to see what they are like. :)
Yes, these projects are VERY addicting...I have stayed up many nights working on code, but I'm far from a pro at coding and just kind of try different things until it works...borrow some posted code and edit it to my needs...that kind of thing. :P

@ToFarGone ...I'm in the same boat...mine is a big mess all over, but it works...for the most part...lol
 

OldMedUser

Well-Known Member
I had my own repair shop for a few years...3 local pawn shops sent me broken equipment to repair/fix and I did PC repairs/builds too...then closed up and worked for a PC OEM for awhile on tech support, but started out on a VIC 20 (showing my age there...lol) with teaching myself Basic and after a few years the IBM came out and I taught myself a little DOS, but nothing of real use beyond simple routines really.
I have a feeling I know your helper...followed some posts on another site where someone was doing auto watering system with moisture sensors and esp8266's...prob same person...lol
I bought my first Arduino (knock-off) locally and then found out China sells the same things for about 1/3 of the cost, so now I order from there for most of my parts and pieces...some day I may get a Pi just to see what they are like. :)
Yes, these projects are VERY addicting...I have stayed up many nights working on code, but I'm far from a pro at coding and just kind of try different things until it works...borrow some posted code and edit it to my needs...that kind of thing. :P

@ToFarGone ...I'm in the same boat...mine is a big mess all over, but it works...for the most part...lol
So far the Pi would make a great cheap little computer to use for basic web surfing and hooking everything up for a media center. I downloaded the full Raspbian setup to the 64Gig Micro SD card that came with the kit I bought then using a small prog on my PC formatted a 128gig FAT32 then using the Copy SD app in Raspian and the tiny card reader in the kit copied the 64 to the 128, shutdown and booted right back up off the 128. Not a hitch. I'm running Win7. The used PC I bought came with a fresh install of Win10, hated it so using a new 1000gig drive installed Win7 and 158 updates later had it working fine.

I'd rather pay a little extra and not have to dick around ordering from china. Too long a wait sometimes as there is a huge backlog here in Canada and the states. I could have bought the Pi kit direct from Canakits for the same price and that's where mine shipped from. Good start to establishing a relationship with business can really help. Buy your computer or grow gear from the local guy and go get free help a lot of times. On your own mostly buying online or sporadic email help.

I haven't even fired up the Pi today. Was waiting for the ProtonVPN guy to get back to me about a list of servers I can input in terminal to pick the country and server I want to represent me online. I bought a 2 year plan last month on their Black Friday sale. Was still almost $250CAN.

I'm a long way from where You're at in northern Alberta up a little northwest of Peace River. -27 tonight. cold2.gif
 

Mak'er Grow

Well-Known Member
So far the Pi would make a great cheap little computer to use for basic web surfing and hooking everything up for a media center. I downloaded the full Raspbian setup to the 64Gig Micro SD card that came with the kit I bought then using a small prog on my PC formatted a 128gig FAT32 then using the Copy SD app in Raspian and the tiny card reader in the kit copied the 64 to the 128, shutdown and booted right back up off the 128. Not a hitch. I'm running Win7. The used PC I bought came with a fresh install of Win10, hated it so using a new 1000gig drive installed Win7 and 158 updates later had it working fine.

I'd rather pay a little extra and not have to dick around ordering from china. Too long a wait sometimes as there is a huge backlog here in Canada and the states. I could have bought the Pi kit direct from Canakits for the same price and that's where mine shipped from. Good start to establishing a relationship with business can really help. Buy your computer or grow gear from the local guy and go get free help a lot of times. On your own mostly buying online or sporadic email help.

I haven't even fired up the Pi today. Was waiting for the ProtonVPN guy to get back to me about a list of servers I can input in terminal to pick the country and server I want to represent me online. I bought a 2 year plan last month on their Black Friday sale. Was still almost $250CAN.

I'm a long way from where You're at in northern Alberta up a little northwest of Peace River. -27 tonight. View attachment 4454563
I do like the Pi feature of the SD card for the OS, but with all the extras I wanted it got costly fast and being on a limited budget the Arduino was my best option.
I have Arduino, 2.8" LCD display+SD card+ touch screen, RTC, 4 x Temp+Humidity+Pressure sensors and 2 x Relay boards with 4 relays on each...so far.
Win7...yup I did an install a few weeks ago and 2 days of updates...think I had a little over 200 when it finally finished...oh well it was fun. And I hate Win 10 too...still running Win 7 myself. :)

Where I'm at the current temp is like +2, feels like -3, and rainy for about 3 days now so all the snow is gone. Been a few cold days here and there, but not even close to typical weather we normally have at this time of year, should be -10 to -20 and snow on the ground...I like the snow over this crappy rain...lol

Wonder if @hexthat is gonna be back...post is from Oct and last online was Dec...guess we wait and see. bongsmilie
 

OldMedUser

Well-Known Member
That buddy that built that watering system is @Timezone. He's on the east side of the states and probably gone to bed by now but now he'll drop by and see what we're up to.

We were just today talking about starting up a thread in this forum about his system to get the ball rolling on a discussion just like this one. I wanna build a damn drone man! But that can wait for a bit. ;)
 

Mak'er Grow

Well-Known Member
That buddy that built that watering system is @Timezone. He's on the east side of the states and probably gone to bed by now but now he'll drop by and see what we're up to.

We were just today talking about starting up a thread in this forum about his system to get the ball rolling on a discussion just like this one. I wanna build a damn drone man! But that can wait for a bit. ;)
Ah maybe wrong fellow then..."Adam" was the one I was watching.
Yes, I want to do a drone myself...maybe some day...lol
 

OldMedUser

Well-Known Member
Ah maybe wrong fellow then..."Adam" was the one I was watching.
Yes, I want to do a drone myself...maybe some day...lol
I was into model rockets when I was a kid. Me and my buddy were designing one that could pack about two kilos and fly it far enough to cross a border then go down to Mexico and shoot coke across then haul it back to Vancouver. Nowadays with small GPS trackers we could have pulled it off. Kinda like Easy Rider without the Harleys. lol
 

Cheech.o

New Member
I made a VPD sensor thing with Adafruit products. This code is basic version that prints VPD and "Saturation vapour pressure". I would like to use this in a study to see if VPD needs adjusting at different altitudes.

I'm working on a correlation between VPD and SVP into one value? id call it "hexthat's pressure"

Python:
import board
import busio
import math
import adafruit_bmp280
import adafruit_si7021
import time
i2c = busio.I2C(board.SCL, board.SDA)
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
si7021 = adafruit_si7021.SI7021(i2c)

while True:
    rh = si7021.relative_humidity
    temp = si7021.temperature
    hPa = bmp280.pressure
  
    # Saturation Vapor Pressure *Arden Buck equation(1996)*
    if temp > 0:
        SP = 0.61121 * math.exp((18.678 - (temp / 234.5)) * (temp / (257.14 + temp)))
    else:
        SP = 0.61115 * math.exp((23.036 - temp / 333.7) * (temp / (279.82 + temp)))
    if rh > 20 and rh < 80:
        # actual partial pressure of water vapor in air
        ea = rh / 100 * SP
        # Vapour-pressure deficit
        VPD = SP - ea
    else:
        print("Humidity out of range 80 <> 20, RH:", rh)
        VPD = False
    # pressure function
    pf = 1.0016 + 3.15 * (math.pow(10, -6) * hPa) - (0.074 * math.pow(hPa, -1))
    # saturation vapour pressure of moist air
    SVP = pf * SP
    print('VPD :', VPD, 'SVP :', SVP)
    time.sleep(6)
sources:
What sensor did you use to take the temperature on the leaves?
 

pahval

Well-Known Member
I made a VPD sensor thing with Adafruit products. This code is basic version that prints VPD and "Saturation vapour pressure". I would like to use this in a study to see if VPD needs adjusting at different altitudes.

I'm working on a correlation between VPD and SVP into one value? id call it "hexthat's pressure"

Python:
import board
import busio
import math
import adafruit_bmp280
import adafruit_si7021
import time
i2c = busio.I2C(board.SCL, board.SDA)
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
si7021 = adafruit_si7021.SI7021(i2c)

while True:
    rh = si7021.relative_humidity
    temp = si7021.temperature
    hPa = bmp280.pressure
  
    # Saturation Vapor Pressure *Arden Buck equation(1996)*
    if temp > 0:
        SP = 0.61121 * math.exp((18.678 - (temp / 234.5)) * (temp / (257.14 + temp)))
    else:
        SP = 0.61115 * math.exp((23.036 - temp / 333.7) * (temp / (279.82 + temp)))
    if rh > 20 and rh < 80:
        # actual partial pressure of water vapor in air
        ea = rh / 100 * SP
        # Vapour-pressure deficit
        VPD = SP - ea
    else:
        print("Humidity out of range 80 <> 20, RH:", rh)
        VPD = False
    # pressure function
    pf = 1.0016 + 3.15 * (math.pow(10, -6) * hPa) - (0.074 * math.pow(hPa, -1))
    # saturation vapour pressure of moist air
    SVP = pf * SP
    print('VPD :', VPD, 'SVP :', SVP)
    time.sleep(6)
sources:
svp and vpd would be the same if your leaf temp are the same, which irl arent... and you got your formula for vpd wrong... cause you need vpd that measures difference of svp in air and in leaf, and since rh in leaf is 100%, formula for vpd that we can use to check how will our stomata function is:

vapor_pressure_deficit = vapor_pressure_leaf - vapor_pressure_atmosphere;

vapor_pressure_deficit = (0.61121 * pow(e, ((18.678 - leafTemp / 234.5) * leafTemp) / (leafTemp + 257.14))) - (0.61121 * pow(e, ((18.678 - airTemp / 234.5) * airTemp) / (airTemp + 257.14)) * rh);

where e = euler constant = 2.7182818284590452353602875
 
Top