top of page

Basic Soil Moisture Meter

This program uses a capacitive soil moisture probe connected to pin a1 of the JackBord to measure the moisture in some soil and display the reading using the USER LED on the JackBord. The color of the LED will match the soil moisture reading as follows:

>= 90% Green
>= 75% Cyan
>= 50% Navy
>= 25% Orange
>= 10% Magenta
>= 0% Red

Program


---

Basic Soil Moiture Meter Program

Get readings from the sensor on pin a1 and scale them

between the min and max calibration values to get a reading

between 0 and 100.

Display them using the JackBords USER LED.

That wy you dont need a web browser to use the meter.

---


prog_vars =

d/count 0

-- Calibration values

d/min_value 6

d/max_value 56

-- The final soil moisture reading

d/soil_moisture 0

d/moisture_color 0

prog_vars.


prog_start =

pclear

print "Program Start"

-- Setup the sensor on pin a1

gvr a1 100 0

prog_start.


prog_loop =

-- main program loop

-- Get a fresh reading

get_soil_moisture

-- Update the USER LED's color

display_moist_color /soil_moisture

print "/count a1 /a1 Soil moisture /soil_moisture"

-- Check if we have done 100 readings

inc /count

any /count >= 100 -> exitprog

-- New reading every second

d1000


prog_loop.

get_soil_moisture =

-- Get the reading from a1 and scale it

mapi /min_value /max_value 0 100 /a1 -> /soil_moisture


get_soil_moisture.



display_moist_color /moisture 0 =


-- Use ant command to shoose color to display.

-- >= 90% Green

-- >= 75% Cyan

-- >= 50% Navy

-- >= 25% Orange

-- >= 10% Magenta

-- >= 0% Red

-- NO Reading Dim white

ant /moisture ->

>= 90 -> l1 8

>= 75 -> l1 12

>= 50 -> l1 13

>= 25 -> l1 5

>= 10 -> l1 14

>= 0 -> l1 3

-> l1 1

ant.


display_moist_color.


prog_stop =

print "Bye"

prog_stop.



bottom of page