Skip to content

The gator:soil is an analog based sensor capable of reading the moisture level of some dirt to tell you how wet it is, and consequentially, when you need to water your plants.

License

Notifications You must be signed in to change notification settings

sparkfun/pxt-gator-soil

Repository files navigation

gator:soil Soil Moisture Sensor

Community Discord

The gator:soil, which can be used to read the moisture of soil can be purchased here.

SparkFun gator:soil

SparkFun gator:soil (15272)

~ hint

To use this extension, go to https://makecode.microbit.org, click Extension and search for gator-soil. The extension is located here

~

Basic usage

//Grabs moisture from the sensor connected to pin P1, powering it using pin P0 to avoid corrosion on the moisture sensing leads.
gatorSoil.moisture(AnalogPin.P0, gatorSoilType.soilMoisture, DigitalPin.P1)

Use ||Get moisture on pin P0 in adcVal using power pin P1|| to read the moisture value either as a value between 0 and 1 or the straight ADC value.

Example: Moisture Sensor

//Read moisture value and write to screen every 60 seconds
serial.redirectToUSB()
basic.forever(function () {
    serial.writeLine("Moisture: " + gatorSoil.moisture(AnalogPin.P0, gatorSoilType.soilMoisture, DigitalPin.P1))
    basic.pause(1000)
})

Supported targets

  • for PXT/microbit

License

MIT

gatorSoil=github:sparkfun/pxt-gator-soil

About

The gator:soil is an analog based sensor capable of reading the moisture level of some dirt to tell you how wet it is, and consequentially, when you need to water your plants.

Resources

License

Stars

Watchers

Forks

Packages