humidity_sensor

Humidity sensor

The moisture sensor is a smart solution for projects that respond to soil or ambient moisture. It allows for easy connection via Dupont wires and instant moisture measurement using the micro:bit in the MakeCode environment. Try dry soil detection, automatic watering or sending alerts while learning the basics of programming, electronics and working with sensors in a fun way.

Description

The moisture sensor is a simple input module that allows you to detect the moisture of the soil or other environment. It is suitable for plant experiments, irrigation measurements or demonstration ecological models. Thanks to Dupont, you can easily connect it to the micro:bit via a universal fixture.

Specifications

  • Connector: Dupont
  • Exit: analog (humidity value)
  • Power supply: 3,3-5 V
  • Operating principle: change in soil conductivity
  • Use: measuring the moisture content of soil or other material
  • Dimensions: approx. 30 × 20 × 5 mm

Connection

LED display connection

  • GOD – the display data pin is connected to yellow bar, e.g. to pin P1. It is necessary to set in the program which pin it is connected to.
  • CLK – the display clock signal is connected to yellow bar, e.g. to pin P2. Here too it is necessary to set the appropriate pin in the program.
  • VCC – power supply (+3V), connected to white bar.
  • GND – ground (–), connects to black bar.

Connecting a capacitive humidity sensor

  • GOD – the AOUT signal pin is connected to yellow bar, to pin P2. In the program it is necessary to set which pin it is connected to.
  • VCC – power supply (+3V), connected to white bar.
  • GND – ground (–), connects to black bar.
  Warning: When connecting, the expansion board must be turned off and the micro:bit disconnected from the power supply.

Programme

Basic program

First, we connected the capacitive sensor and LED display according to the instructions. If we have the sensor connected via a cable, we connect it to the expansion board so that the yellow signal wire goes to the yellow terminal block. If we are not sure how to program the LED display, we go to the relevant section with instructions for working with the display.

To display the values from the capacitive sensor in the program, we add the block "display show number 0" to the repeating loop, where instead of zero we insert a block for reading the value from the pin and select the appropriate yellow pin. If the display does not work, we check the wiring of the wires to the yellow strip (CLK and DIO). If the sensor does not display any values, we check which pin the sensor is connected to and whether we have the pin set correctly in the program.

Tasks

Task 1: Reading values from a sensor

Connect the humidity sensor according to the attached diagram. Observe the measured values on the display. Touch the sensor with dry fingers and record the displayed values. Then repeat the experiment with moistened fingers and compare the difference. Be careful not to get the rest of the electronics or the computer wet during the experiment.

Task 2: Recording substrate moisture values before and after potting

Choose a potted plant that has not been watered today. Carefully insert the sensor into the soil, taking care not to damage the roots. Write down the current moisture reading. After reading the reading, water the plant and watch the reading change.

  • Record the highest and lowest readings.
  • Monitor changes every 15 minutes.
  • Describe how quickly changes in humidity occur.

Task 3: Comparison of output values in different soil types

Prepare different types of soil – for example, sand, regular soil, clay or gravel. First, take a measurement without adding water. Insert the sensor into each substrate in turn, wiping it with a paper towel after each measurement. Record the results.

Then moisten each substrate with the same amount of water and measure again. Evaluate which substrate was the wettest before watering and which after watering. Record the results and compare the properties of the individual soils.