Code Usage

Viewing Sensor Data on PyPortal

You should see the PyPortal display update displaying the temperature value and moisture level.

The code reads the sensor every DELAY_SENSOR seconds. Adjust this value in the code to increase or decrease this delay.

The status indicator at the bottom of the PyPortal will display when it's sending data to Adafruit IO.

The PyPortal only sends data to Adafruit IO every DELAY_PUBLISH minutes. Adjust this value in the code to increase or decrease the delay.

Viewing Sensor Data on Adafruit IO

Navigate to the dashboard we created earlier. You'll notice the values on the gauges changing in real-time. The line graph block will also update depending on the interval you set. 

Hovering your mouse over the line graph will display both the moisture and temperature values.

Adjusting Soil Moisture Levels

In soil, the moisture level will generally range from about 300 to 500. This value does depend on how packed/loose the soil is. If you'd like to adjust the threshold for if the soil is dry or wet, use this example sketch in the STEMMA Soil Sensor guide to quickly determine the soil's moisture level.

Once you have a better idea of the moisture thresholds, adjust the SOIL_LEVEL_MAX and SOIL_LEVEL_MIN variables in your code.

This guide was first published on Feb 05, 2020. It was last updated on Feb 05, 2020.
This page (Code Usage) was last updated on Aug 06, 2020.