Want to create interactive content? It’s easy in Genially!
Them 2. Arduino -Soil Moisture Sensor + Servo motors
TEAM EGB4 TECHNOLOGY
Created on February 27, 2023
Start designing with a free template
Discover more than 1500 professional designs like these:
Transcript
SOIL MOISTURE SENSOR +SERVO MOTOR
Arduino: Soil Moisture Sensor + Servo motors
start
We will build a SOIL MOISTURE MEASURING INSTRUMENT, through the use of a MOISTURE SENSOR and a Servo Motor, which will move the needle of the equipment depending on the amount of humidity detected in the ground.
What is it about?
Project description
In this activity we will build a free design structure, in which we place the Servo Motor on top, which will have an arm assembled, and it will move in a semicircle (between 0° and 180°). Below, we will leave the SOIL MOISTURE Sensor free, in order to comfortably locate the probe (with two terminals) on the ground.
We will use the MOISTURE SENSOR in its analog mode, where the values obtained vary from «0» to «1023», where «1023» is the state of the soil «dry» and «0» the state of the soil «saturated with humidity», and the numbers between the two limits will indicate the variable amount of moisture.
The Servo Motor rotates between 0° and 180° and from the programming we will make it rotate an angular value, which represents the amount of moisture detected, the position being 0° when the soil is dry, and the position of its arm at 180° when the soil is saturated with moisture. The intermediate positions in which the Servo arm is positioned will indicate the variable percentages of humidity of the analyzed soil.
In this experience, we used 4 containers with earth, to which variable amounts of water were added, to observe the movement of the arm or measuring needle, depending on the humidity that the Sensor detects in each case. To make the visualization of the percentages more graphic humidity variables, on a sheet of paper we design a semicircle with variable colors, which we place behind the movable arm of the Servo.
Objective:
Objective:
- Approaching the knowledge and management of different electronic components by building a Robotic Instrument for the measurement of different values.
- Become familiar with the use of sensors that measure soil conditions and analyze the data obtained from them.
Parts and devices
To assemble the model we will need:
- R8 QROX DUO
- Battery
- Motor Servo
- Soil Moisture Sensor1
- Cable RJ111
- Cable USB
Sensors and Actuators
Soil Moisture Sensor
This sensor measures soil moisture, its most frequent use corresponds to automatic irrigation systems. Basically, it detects the presence of moisture in the earth by conductivity variation. It is made up of 2 parts, the first is the probe with two properly separated terminals, which are buried directly in the soil to be measured, the other part is the module that is responsible for receiving the data from the sensor and then transmitting it digitally or analog.
- Analog: The reading of values obtained by the module will oscillate between 0 and 1023. Where it is 0 when the sensor is submerged in water and 1023 when the sensor is in the air.
- Digital: Output high (5V) or low voltage if any threshold is exceeded. With the Potentiometer (screw in + on the plate) the humidity threshold is regulated.
Servomotor
Servomotor
The Servomotor is a motor to which we directly indicate the desired angle. The range of movement goes from 0° to 180º, that is, they are not prepared to make a complete turn. The rotation speed is fixed: 60° every 100 milliseconds. Internally it consists of a complex gear mechanism and for this reason it has a high torque (1.4 kg·cm) and an important degree of precision (tenths of degrees). It comes with insert parts for easy combination with the rest of the Qrox Duo parts and mechanisms. It is controlled with a digital signal.
To connect the components!
- Connect the Servo Motor to CON2 (Digital Pin 8 and 6) of the Smart Brick «R8».
- Connect the Soil Moisture Sensor to CON8 (Digital Pin 15 and Analog 4) of the Smart Brick «R8».
It's time to program!
The Servo is positioned at 0° and is held for 3 seconds. This happens only once, when the program starts.
Start of the Loop forever.
Step 1:
Step 1
The range of values read by the Soil Moisture Sensor (analog pin 2), which goes from "0" to "1023", is converted into a new range of values, which goes from 180 to 0. The Data from this last range is stored in a variable that we will call “degrees”. The value read by the Soil Humidity Sensor «1023» corresponds to «0°» and the value read by the Soil Humidity Sensor «0» corresponds to 180°.
Step 2:
Attention: do not open each file separately. Click on the "DOWNLOAD" icon at the top right.
Step 2
The Servomotor rotates its position between 0° and 180° according to the value stored in the variable «degrees«.
It returns to the beginning of the Loop forever.
Download the program at:
link
Control:
Arming of the Program
We will use the following blocks:
Events: "When turning on the R8"
Control:
- "Forever" that will execute the action indefinitely
- "Wait <time> seconds"
Given:
- "Map <pin/sensor> from ( <No.> , <No.>) to ( <No.> , <No.>)" It allows us to convert one range of variation into another in a very simple way
- «Set the servo in connector <No.> to <No.> degrees.»
- «Read the analog pin (A) <No.>» Acts as a reader of the Humidity Sensor
Pin:
Variables:
Variables
Variables are reserved spaces in memory and their content can change throughout the execution of a program. The data that we store in the variables can be of different types, for example: a character/symbol (char), text (string), integers (int) and decimals (float/double).
In mBlock it is automatically detected which data type is assigned to the variable.
- "change <variable> to <data>"
Ver
link
If you want to print the Moisture Diagram with colors, here is the PDF:
LINK
Challenge to Solve
Define two ranges of values that are associated with dry soils and with soils of excessive humidity. Then modify the program to generate an audible alarm that detects dry soils and a different audible alarm that detects soils with excessive humidity.
Challenge to Solve
- Define two ranges of values that are associated with dry land and land with excessive moisture.
- Then modify the program to generate an audible alarm that detects dry soils and a different audible alarm that detects excessively moist soils.
Luego del armado ¡comenzamos a programar!
Attention: Do not open each file separately. Upon entering the drive on the right side, click on the “DOWNLOAD” icon located at the top right.
Link
Link to download the Mblock program and start programming!
