mcThings
Published © GPL3+

Wireless IoT Soil Moisture Sensor Using mcThings!

Coin-cell operated, wireless IoT soil moisture sensor using mcThings! Alerts, status levels, temperature!

EasyFull instructions provided2 hours2,076
Wireless IoT Soil Moisture Sensor Using mcThings!

Things used in this project

Hardware components

mcModule120 Dev Kit
mcThings mcModule120 Dev Kit
We recommend the kit as it provides everything you need to get started! (Not required but you will need at least one mcModule, one mcGateway and an mcDongle)
×1
mcMod120 Module
mcThings mcMod120 Module
Make sure you have updated your modules to the latest firmware
×1
mcGateway110
mcThings mcGateway110
Make sure you have updated your gateway to the latest firmware
×1
mcDongle
mcThings mcDongle
Required to completed firmware updates on the mcModules and mcGateway
×1
Resistor 100k ohm
Resistor 100k ohm
Used as a voltage divider
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
These aren't the ones we used, but just to add it to the list of components required
×1
Soil Moisture Sensor
These can be purchased at many different sites for a very inexpensive price.
×1
Hammond Plastic Enclosure (1551 Series)
We purchased them from a local electronic store.
×1
Android device
Android device
×1

Software apps and online services

mcStudio
mcThings mcStudio
Maker service
IFTTT Maker service
IOT MQTT Dashboard (Android App)
MQTT
MQTT

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

mcMod120 Schematic

Code

Code

VBScript
Define PinMode Pin0 As AnalogInput Alias MoistureLevel 
Define PinMode Pin6 As DigitalOutput Alias enableMoistureLevel 
    
    Class RainSensor         
        Shared Event measureMoisture() RaiseEvent Every 30 Seconds 
            enableMoistureLevel = True 'turn on voltage divider 
            Thread.Sleep(40000) 'sleep 40ms for voltage to stabilize
            Dim voltage As Short = MoistureLevel
            Dim payload As ListOfByte = New ListOfByte
            Dim payString As String = "" 
            If voltage > 1500 Then
                payString = "Dry - I NEED WATER"
            ElseIf voltage <= 1499 And voltage >= 600 Then
                payString = "Fairly Moist" 
            ElseIf voltage <= 599 And voltage >= 335 Then
                payString = "Moist" 
            ElseIf voltage < 355 Then 
                payString = "OVERWATERED"
            Else 
            End If 
            enableMoistureLevel = False 'turn off voltage divider
            payload.Add(payString)
            Lplan.Publish("mcThings/MoistureLevel", payload)
        End Event
        Shared Event sendMQTT() RaiseEvent Every 1 Minutes 
            Dim payload As ListOfByte = New ListOfByte() 
            Dim TempC As Float = TempSensor.GetTemp
            Dim TempString As String = TempC.ToString() 
            payload.Add(TempString) 
            Lplan.Publish("mcThings/GardenTemp", payload) 
        End Event
        Shared Event measureVoltage() RaiseEvent Every 2 Hours
            Dim BattVolt As Short = Device.BatteryVoltage
            If BattVolt < 2200 Then 
            Lplan.IFTTT("YOURIFTTTKEYHERE", "MoistureSensorBatt")
            Else
  
            End If
        End Event
    End Class

Credits

mcThings

mcThings

17 projects • 48 followers
Use mcThings to quickly & easily create, test and deploy IoT solutions for industrial, business/commercial and individual needs!
Thanks to mcThings Team.

Comments

Add projectSign up / Login