Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding VPD to the SCD40 component #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

solarslurpi
Copy link

We are not able to cause an event to trigger based on a function of the parameters of a sensor. In this case, I want the vpd (Vapor Pressure Deficit) - an important metric for a plant's leaf health that needs both the humidity and temperature to calculate.

Since we cannot use rules (and functions) in wippersnapper, I believe the best "hack" to be augment the SCD40 I2C component with the vpd reading and name the device different (scd40_VPD).

@brentru
Copy link
Member

brentru commented Sep 1, 2022

Since we cannot use rules (and functions) in wippersnapper

Correct, we're not able to pass i2c sensor options/rules/arguments yet! However, I don't see an option/argument for VPD in the Sensirion SCD4x library we use, https://github.com/Sensirion/arduino-i2c-scd4x

I believe the best "hack" to be augment the SCD40 I2C component with the vpd reading and name the device different (scd40_VPD).

I'm unsure how this would look in WipperSnapper Arduino, or that we'd want to do this within the firmware because the official library does not provide this reading (VPD) as a function we can expose.

I have two ideas:

  1. Add the VPD formula to the SCD4x Library and create a pull request over there. Once it's pulled in, and the library is released, we can support this measurement in WipperSnapper.
  2. I've started preliminarily looking into using NodeRED's rule engine with WipperSnapper nodes but have been focused on PWM/Servo work. This would be an ideal use-case. If you end up going this route, - we'd appreciate some notes on connecting these two engines (maybe we can do a guide on this for others!).

@tyeth tyeth mentioned this pull request Sep 14, 2022
@solarslurpi
Copy link
Author

solarslurpi commented Oct 11, 2022 via email

@tyeth
Copy link
Contributor

tyeth commented Oct 24, 2022

There must be some good examples. I've got a flow that subscribes to one of my QTPY-S2 wippersnapper feeds and gets the CO2 value, which is just two steps away from what you need (the other feeds/values - temp/humidity, and then lastly a function node for a calculated VPD value). At the end of the comment:
adafruit/Adafruit_Wippersnapper_Arduino#325 (comment)
You can find your feeds here https://io.adafruit.com/feeds and then when you visit a feed the url shows the feed name, e.g. https://io.adafruit.com/tyeth/feeds/qtpy-esp32s214035171.ws-0x62-co2

@brentru
Copy link
Member

brentru commented Oct 24, 2022

@tyeth @solarslurpi Thinking about this more - I wouldn't be opposed to us having a "sensor type" for VPD, similar to how we have one for degrees F now.

It's not a major priority for me right now, though, I might get to it in the coming weeks.

@tyeth
Copy link
Contributor

tyeth commented Oct 26, 2022

So I'm no true expert, but a science lover let's say and this link is worth the two minutes of your time (calculator+graph on left, explanation on right)...
I worried that the ideal VPD measurement includes the plant canopy temperature in the equation, but having seen graphs for standard use in the past, and now just read this https://www.omnicalculator.com/biology/vapor-pressure-deficit , I see it is common to just use the assumption 'the canopy temperature is the air temperature'. You can get closer-fit graphs if you include canopy temperature instead. I also just noticed the calculator has a very limited VPD range for seedlings (0.3-0.4) compared to Generic Crop (0.5-1.2kpa), so I'm probably murdering more seedlings than necessary, whoopsie...

@brentru
Copy link
Member

brentru commented Oct 26, 2022

You can get an estimate of leaf temperature by measuring canopy temperature with an infrared sensor, or an air temperature sensor (aspirated is best) located near the plant canopy.

Seems like we can reuse the air temp as canopy temp as well in the calculation.

@solarslurpi
Copy link
Author

solarslurpi commented Oct 26, 2022 via email

@TheGodMotherG
Copy link
Contributor

Hey guys this would be epic! Especially with the new sht45 released today.

I great example of a VPD chart is

https://www.cropsaltvpd.com/

Yes the LST plays a huge roll. That's what I am actually trying to do. Use one of those IR or FLIR chips and have it do real VPD.

For now just using the sensors Temperature and humidity to get vpd would be great.

Ideally latter having the option to get a reading from another sensor for lst would be ideal.

Or having a menu like in the linked VPD chart to have the ability to set a LST manually would be amazing also.

I can't really help with the coding but if anyone has any questions about VPD or how it works I would love to help.

It is the most essential part of growing after the lighting.

Hopefully this one works out 🤞🏻

@solarslurpi
Copy link
Author

Hello wonderful person (AKA TheGodMotherG) and fellow lover of vpd! I am glad to meet you.

Wow - thanks for the chart. I've been using the chart in FLU's PDF. I've been wondering about taking the leaf temperature. But this can be very challenging. Given the range of "ideal" vpd values for a given humidity/temperature, perhaps direct taking of the leaf is only necessary in scientific discovery versus home growing? I do believe it should be available. I just find it a bit more challenging than I have time for right now. What I do is "guestimate" the leaf temp to be 2 degrees F cooler than air temp.

I ended up writing a bunch of buddies (I call them GrowBuddies ) to help me with vpd. SnifferBuddy, MistBuddy, and Gus (just Gus - Gus is a grumpy Raspberry Pi). I use SnifferBuddy to get readings, then Gus calculates the vpd. MistBuddy then turns on and off a humidifier for the amount of time needed (my house is climate controlled. It will always be too dry, not too moist so I focus on humidity).

Anyways, happy growing!!!!! and take care.

@brentru
Copy link
Member

brentru commented Jan 5, 2023

I've added a new component request for the SHT45, #112. I'll add it once I get it delivered from Adafruit HQ.

re: VPD
Likely this is what we'd do on the firmware and on the backend:

  • We’d expose VPD as a sensor type and have the base WipperSnapper_I2C_Driver class implement a formula for synthesizing VPD from a sensor's temperature and humidity readings

Questions remaining:

  1. Is there a way to do this without a lookup chart or references?
  2. How, in a practical use case, is the leaf temperature measured? Is this a separate sensor? For example, would this be possible with one SHT45? Would we need another?

@solarslurpi
Copy link
Author

Thank you. (one thing I want to point out. I remember vpd being talked about when I was taking a indoor container growing course. But for the most thing, I am most familiar with vpd in the space of growing Cannabis. I want to note that because growing Cannabis is not legal everywhere. I just want to make sure Adafruit is aware of that? i.e.: any indoor Cannabis enthusiast has heard of vpd. I would guess only professional growers (like those growing plants for places like Home Depot or perhaps vertical farms) are into vpd. Even = although weirdly named, makes more sense than humidity/temperature because it is a reflection on the happiness of the plant.

What I do is just calculate the vpd and include the reading with the rest of my scd-30 or 40 readings (how cool!! The scd-45!! I did not know...yippee!!!). Then, another service (I call it MistBuddy) uses the vpd against a chart to keep my indoor grow tent at the "ideal" vpd range.

Code

Here is what I did in SnifferBuddyReadings_code.py:
leaf_T = air_T - 2
vpd = 3.386 * (
math.exp(17.863 - 9621 / (leaf_T + 460)) - ((RH / 100) * math.exp(17.863 - 9621 / (air_T + 460)))
)
return round(vpd, 2)

I got this from a Quest page.

@solarslurpi
Copy link
Author

oh. in the above, notice I make an assumption the leaf temperature is 2 degrees less than the air temp. Ideally, this measurement comes from a sensor pointed at a leaf that gives the real leaf temperature. I'm not doing that. Mostly because the ideal vpd is a range.

@tyeth
Copy link
Contributor

tyeth commented Jan 5, 2023

I've been wondering about taking the leaf temperature. But this can be very challenging.

Strap a DS18b20 waterproof digital temperature sensor under one of the leaves mid-canopy.
You wont do much better, although I tried using a chopstick to hold an SHT35 under a leaf (under to avoid heating via direct sun and because that's where the stomata are...), but got a bit corroded after winter.
I should have coated them or bought IP rated, as they wont take 100% humidity otherwise (most of the mems sensors are 95% max and most also say - sensirion for example - No condensing humidity), but the protection slows the reaction times.

Also, I'm just trying to reduce plant death in a greenhouse, and eventually move to promoting growth. It's not as precious as the other industrial sector mentioned above...

@solarslurpi
Copy link
Author

i wonder what the pros do? Here's the thing. Since the ideal vpd is a range value, how necessary is it to measure the leaf temperature? I totally realize the calculation without it is at best a guestimate. But my results are great. Just with the estimate. I tie it with a DIY humidifier I use and turn the humidifier on / off based on a PID controller that takes the vpd and converts it to the number of seconds to turn on the humidifier. While all that sounds great, I am pretty clueless. Yet I am growing stuff and they look really really good. It really helps as far as the health of the plant. They look so happy. Then I become happy.

@brentru
Copy link
Member

brentru commented Jan 5, 2023

@solarslurpi Thanks for the disclaimer, we'll support this measurement. I am concerned about the leaf_T baseline as I'm not sure how we'll set it in Adafruit IO and send it to the WipperSnapper firmware without writing a new API or exposing "advanced options" for every temperature/humidity sensor (a whole lot of em and this will be something mid-term).

For now, would you be OK with having leaf_T within the firmware, as a hard-coded value? What would be a potential value? This variable would need to be changed, by you (or whoever uses this) and the firmware would need to be re-compiled & uploaded to get an accurate leaf_T measurement.

@solarslurpi
Copy link
Author

Hi @brentru A challenge: The leaf temp is dependent on the environment just like the air temp. So I am not sure I understand. Just like the air temp, the leaf temp will vary. Without having a "real" value for the leaf temp using a sensor, a "kludge" that seems to be fine for me is always have the leaf temp be 2 degrees less than the air temp.

My context is always "good enough." for others, the above kludge is a travesty of justice (ok, I overdid it...but...)...which then backs me down like a little kitten stuck up a big 'ol tree to say don't do vpd in an scd driver because the scd line is all about quality air temp values not quality leaf temp values. And perhaps that's the valid way of looking at it. i.e.: imagine the leaf temp sensor. So I'm seeing this sensor stuck at the bottom of a grow tent (mine would be sitting in the soil ... yah...indoors with a bed of soil!!!) The sensor senses the most green area it can find (it's little head - like a security camera - can move around searching for the greenest of greens. So it's looking up and around. It finds the greenest of greens, and takes an IR reading that gets the leaf temp. Which makes me wonder, is the leaf temp at the top of a plant the same as a leaf plant hidden by other leaves not getting as much light? Wouldn't the highest leaves have a higher leaf temp because it has to transpire more? It's thoughts like these that make me move on and just say leaf_t = air_t -2. I want to emphasize I am not that smart. So add that in as you read.

@tyeth
Copy link
Contributor

tyeth commented Jan 5, 2023

For now, would you be OK with having leaf_T within the firmware, as a hard-coded value? What would be a potential value? This variable would need to be changed, by you (or whoever uses this) and the firmware would need to be re-compiled & uploaded to get an accurate leaf_T measurement.

That would need to be a leaf temperature offset, not a fixed temperature, leaf_offset_T. That way it can be safely zero, or -2 for @solarslurpi, and the VPD equation will still include it and work across the whole range of temperatures/humidities.

I had similar designs in mind regarding a smart-eye that would drive up and sample each plant occasionally, for temperature and also spectral reflectivity (green and red tell you a lot) like https://www.sparkfun.com/products/15050, or just using camera and software. There was some good research done by the plant genomics / phenotyping experts, but it seems like you really want to x-ray the roots for the full picture 🔬
Have you seen farmbot.io? It has a nice UTM univeral tool mount, with water/vacuum/power/data, which I was going to borrow (make a new tool head) and mount on a tank, of course assuming I progress past an idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants