This guide uses multiple Adafruit IO Actions for:
- Calculating the Photosynthetic Photon Flux Density (PPFD) from the VEML7700 sensor.
- Calculating the Vapor Pressure Deficit (VPD) from multiple sensors.
- Sending a SMS Alert when any measurement (we'll use VPD as an example) goes out of bounds
If you do not know what Adafruit IO Actions are - check out this guide here >>>
Create an Action to Calculate VPD
The Vapor Pressure Deficit (VPD) is the measure of the drying power of air. VPD can help a plant grower adjust their watering schedule and even mitigate against crop diseases. It is a measurement that is incredibly important to plant physiology and growth.
First create a new feed to store the resulting PPFD value. Navigate to your Feeds page and click New Feed.
First, let's create a new feed to store the resulting VPD value.
- Navigate to your Feeds page
- Click New Feed
- Name the new feed VPD
- Click Create
After clicking create, you will be brought to the Actions Editor.
The simplest trigger - any data - runs your Action every single time ANY new data arrives at a feed, regardless of what the value is.
Open the Block Toolbox by clicking on the Triggers
Select the any data block and drag it into your root block, placing it underneath the Triggers section.
Change the feed within the Any Data Block to the SCD40's temperature sensor.
Whenever the SCD40's temperature sensor gets a new reading, this Action will execute the blocks underneath the Actions heading.
Next, let's talk math!
The VPD is the difference between the vapor pressure of the leaf and the vapor pressure of the air,
VPD = VPleaf - VPair
Calculate Leaf VPD
To get the vapor pressure of the leaf, use the following formula:
VPleaf = 610.7 * 107.5*leaf_temp/(237.3+leaf_temp) / 1000
While this calculation looks may appear scary, Actions has enough math blocks to get us through this equation without programming! By breaking down these formulas using the order of operations, you're able to create an Action that can combine multiple data sources from different sensors.
First, calculate the value inside the parenthesis: 237.3+leaf_temp
First, create a new variable since we'll reference it later in Blocks.
To create a new variable,
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable something you can remember, like leaf-parens.
- You should now see two blocks for the variable within Variables in your toolbox.
- Select the Set Variable block and connect it to the root block's Actions section.
Next, use this block to calculate the leaf temperature.
- Open the Toolbox and select the Arithmetic Block.
- On the diagram, connect the Arithmetic Block to the Set Variable block.
Change the left-hand side of the Arithmetic Block's equation to 237.3
- Open the Toolbox and select the Get Feed Value block.
- On the diagram, connect the Get Feed Value Block to the right-hand side of the Arithmetic Block.
On the Get Feed Value Block, modify the feed to match the MLX90632 sensor's Measured Object Temperature value.
Your diagram should match the following screenshot.
Create a new variable named leaf-numerator:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable leaf-numerator
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value of the leaf numerator:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Update the number on the left-hand side of the Arithmetic Block to
7.5. - Change the Arithmetic Block's operation to multiply.
- Connect the Get Feed block for the MLX90632 to the right-hand side of the Arithmetic Block.
Your diagram should look like the screenshot below.
Create a new variable named leaf-exponent:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable leaf-exponent
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value of the leaf exponent:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Drag and drop the Get Variable Block (toolbox->variables) for the
leaf-numeratorvariable to the left-hand side of the Arithmetic Block. - Change the Arithmetic Block's operation to division.
- Connect the Variable block for the
leaf-parensvariable to the right-hand side of the Arithmetic Block
Your diagram should look like the screenshot below.
Create a new variable named leaf-10 to hold the value of the exponentiation.
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable leaf-10
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value of the 10^n operation:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the number on the left-hand side of the Arithmetic Block to 10.
- Change the Arithmetic Block's operation to exponentiation (
^). - Connect the Variable block for the
leaf-exponentvariable to the right-hand side of the Arithmetic Block
Your diagram should look like the screenshot below.
Create a new variable named leaf-vpd:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable leaf-vpd
- Drag and drop the Set Variable Block underneath the previous block.
Finally, to obtain the value of the Leaf VPD:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the number on the left-hand side of the Arithmetic Block to
0.6107. - Change the Arithmetic Block's operation to multiplication.
- Connect the Variable block for the
leaf-10variable to the right-hand side of the Arithmetic Block
Your diagram should look like the screenshot below.
The final diagram for calculating Leaf VPD should look like the screenshot below.
Calculate Air VPD
Next, to calculate the VPD for the air around the plant. This equation can be modeled as:
VPair = 610.7 * 107.5*Tair/(237.3+Tair)/1000 * RH/100
where:
VPair - vapor pressure of the air in kPaTair - air temperature in CelsiusRH - air relative humidity
Following the Order of Operations, break this equation down into steps on the diagram.
Create a new variable named air-parens:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable air-parens
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value for air-parens:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the number on the left-hand side of the Arithmetic Block to
237.3. - Change the Arithmetic Block's operation to addition.
- Connect the Get Feed Block to the right-hand side of the Arithmetic Block.
- Set the feed to the SCD30 Temperature.
Your diagram should look like the screenshot below.
Create a new variable named air-numerator:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable air-numerator
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value for air-numerator:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the number on the left-hand side of the Arithmetic Block to
237.3. - Change the Arithmetic Block's operation to addition.
- Connect the Get Feed Block to the right-hand side of the Arithmetic Block.
- Set the feed to the SCD30 Temperature.
Your diagram should look like the screenshot below.
Create a new variable named air-exponent:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable air-exponent
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value for air-exponent:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Add a Get Variable block to the left-hand side of the Arithmetic Block.
- Select the
air-numeratorvalue.
- Select the
- Change the Arithmetic Block's operation to division.
- Add a Get Variable block to the left-hand side of the Arithmetic Block.
- Select the
air-parensvalue.
- Select the
Your diagram should look like the screenshot below.
Create a new variable named air-10:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable air-10
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value for air-10:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the value on the right-hand side of the Arithmetic Block to
10. - Change the Arithmetic Block's operation to exponentiation (
^). - Add a Get Variable block to the left-hand side of the Arithmetic Block.
- Select the
air-exponentvalue.
- Select the
Your diagram should look like the screenshot below.
Create a new variable named VPair:
- Click the Variables button on the Toolbox
- Click Create New Variable
- Name the variable VPair
- Drag and drop the Set Variable Block underneath the previous block.
To obtain the value for VPair:
- Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the value on the left-hand side of the Arithmetic Block to
0.006107. - Change the Arithmetic Block's operation to multiplication (
x). - Add a Get Variable block to the right-hand side of the Arithmetic Block.
- Select the
air-10value.
- Select the
Your diagram should look like the screenshot below.
- Drag and drop another Set Variable Block to the diagram, placing it underneath the previous block.
- Configure the Set Variable block to the
VPairvariable. - Drag and drop the Arithmetic Block into the Set Variable Block.
- Set the value on the left-hand side of the Arithmetic Block to the
VPairvariable. - Change the Arithmetic Block's operation to multiplication (
x). - Add a Get Feed Block to the right-hand side of the Arithmetic Block.
- Select the QT PY S3's SCD40 Humidity Sensor value
Your diagram should look like the screenshot below.
Finally, to calculate the VPD. The total VPD is the difference between the leaf VPD and the air VPD.
- On the toolbox, select the Set Feed Value Block and connect it to your diagram.
- Drag and drop the Arithmetic Block into the Set Feed Value Block.
- Set the value on the left-hand side of the Arithmetic Block to the
leaf-VPDvariable. - Change the Arithmetic Block's operation to subtraction (-).
- Set the value on the right-hand side of the Arithmetic Block to the
VPairvariable./
Double-check that your diagram looks like the following diagram before proceeding.
Click the Enable button to Enable, Save, and Run the action.
After running the action, the VPD Feed should show the calculated VPD value.
Create an Action to Calculate PPFD
The next first measurement is Photon Flux Density, or PPFD. While PPFD is best measured using a PAR meter, it can be approximated using the Lux value read by the VEML7700 sensor.
The PPFD measurement is produced by multiplying your lux measurement with a conversion factor. The conversion factor varies depending on the light source.
For example, if the light source is sunlight, the conversion factor (according to this website) is 0.0185. So, multiply the VEML7700 sensor's lux measurement by 0.0185 to obtain a resulting PPFD value.
WipperSnapper doesn't allow you to do math directly on the Device Page so quickly assemble an Action to do this conversion and store it on a new feed called PPFD.
First, create a new feed to store the resulting PPFD value.
- Navigate to your Feeds page
- Click New Feed
- Name the new feed PPFD
- Click Create
Next, navigate to your Actions page.
- Click + New Action
- Name the new feed, Calculate PPFD
- Click Create
After clicking create, you will be brought to the Actions Editor.
The simplest trigger - any data - runs your Action every single time ANY new data arrives at a feed, regardless of what the value is.
Open the Block Toolbox by clicking on the Triggers
Select the any data block and drag it into your root block.
After connecting the any block to the trigger section of the root block, change the feed to your VEML7700 light sensor.
The Set Feed Value Block publishes a data point to a Feed. You'll want to publish the calculated PPFD value to the PPFD feed.
- On the toolbox, click Feeds
- Click the Set Feed Value Block
- Connect the Set Feed Value Block to the Actions block.
The arithmetic block can perform mathematical calculations using sensor data, feed values, or any numbers. You will use it to calculate the PPFD value.
- On the Toolbox, click Math
- Click the arithmetic block
- Connect the arithmetic block to the right-hand side of the Set Feed Value Block.
The Get Feed Value block obtains the last value of a feed or component. You will use to to get the lux measurement from the VEML7700.
- On the toolbox, click Feeds
- Select the Get Feed Value Block
- Connect the Get Feed Value block to the left-hand side of the arithmetic block.
On the arithmetic block, change the operation to multiplication. Then enter 0.0185 (the conversion factor) on the right-hand side of the arithmetic block.
Pause here and verify your diagram looks like the following image:
Above the diagram, click Save and Run.
Enable the Action and run it.
Check that the run report shows a successful run, indicated by Validation: Succeeded.
If validation succeeded, the Action's output is saved on the PPFD feed.
Page last edited September 30, 2025
Text editor powered by tinymce.