rypsmith
Published © GPL3+

Micro:bit Moisture sensor

In this quick and easy project, you build a micro:bit moisture sensor

BeginnerProtip1 hour6,006
Micro:bit Moisture sensor

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
SparkFun JST Jumper 3 Wire Assembly
×1
SparkFun micro:bit Breakout (with Headers)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

pxt.microbit.org
micro:bit pxt.microbit.org

Story

Read more

Custom parts and enclosures

Code for Micro:Bit Makecode

Schematics

Option A: With breadboad

Connect using a breakout board and bread board

Option B: With out bread board/breakout board

Use wires to connect micro:bit to moisture sensor. Use diagram for guidance.

Code

Code for Micropython

Python
from microbit import *

while True:
    lightSensor = pin1.read_analog()
    if lightSensor > 200:
        smile = Image(  "00000:"
                        "09090:"
                        "00000:"
                        "90009:"
                        "09990")
        display.show(smile)
    elif lightSensor < 200:
        frown = Image(  "00000:"
                        "09090:"
                        "00000:"
                        "09990:"
                        "90009")
        display.show(frown)

Credits

rypsmith

rypsmith

1 project • 1 follower

Comments