Robotics

Cards (21)

  • Soil Moisture Sensor is a device used in building your smart irrigation system or automatic plant watering system.
  • The Soil moisture sensor a.k.a the soil humidity sensor 
  • The Soil moisture sensor has four pins VCC, GND, Aout, Dout.
  • VCC is the power supply pin of the soil moisture sensor that can be connected to 3.3V or 5V of the supply. But do note that the analog output will vary depending upon the provided supply voltage.
  • GND is the ground pin of the board and it should be connected to the ground pin of the Arduino
  • DOUT is the Digital output pin of the board, output low indicates soil moisture is appropriate, and high indicates soil moisture is low.
  • AOUT is the Analog output pin of the board that will give us an analog signal in between vcc and ground.
  • The entire soil humidity sensor consists of two parts: the first one is the soil moisture sensor probe and the second one is an electronic module. The module processes the incoming data from the probe and that gets processed by a microcontroller like Arduino and we get the final output.
  • Applications of Soil Moisture Sensor
    1. Moisture sensoring
    2. Liquid level detection
    3. Botanical gardening
    4. Flood detection
    5. Consistency measurement
  • setup()
    1. pinMode (in1, OUTPUT)
    2. pinMode (in2, OUTPUT)
    3. pinMode (in3, OUTPUT)
    4. pinMode (in4, OUTPUT)
    5. pinMode (LED, OUTPUT)
    6. Serial.begin(9600)
  • loop()
    1. If (Serial.available()>0)
    2. command = Serial.read()
    3. Switch (command)
    4. Case 'F': forward()
    5. Case 'B': back()
    6. Case 'L': left()
    7. Case 'R': right()
    8. Case 'G': forwardleft()
    9. Case 'I': forwardright()
    10. Case 'H': backleft()
    11. Case 'J': backright()
    12. Case '0': Speed = 100
    13. Case '1': Speed = 140
    14. Case '2': Speed = 156
    15. Case '3': Speed = 165
    16. Case '4': Speed = 178
    17. Case '5': Speed = 191
    18. Case '6': Speed = 204
    19. Case '7': Speed = 216
    20. Case '8': Speed = 229
    21. Case '9': Speed = 242
    22. Case 'q': Speed = 255
    23. Speedsec = Turnradius
    24. If (brkonoff == 1): brakeOn()
    25. Else: brakeOff()
  • forward()
    1. analogWrite( in1, Speed)
    2. analogWrite( in3, Speed)
  • back()
    1. analogWrite ( in2, Speed)
    2. analogWrite ( in4, Speed)
  • left()
    1. analogWrite ( in3, Speed)
    2. analogWrite ( in2, Speed)
  • right()
    1. analogWrite (in4, Speed)
    2. analogWrite (in1, Speed)
  • forwardleft()
    1. analogWrite (in1, Speedsec)
    2. analogWrite (in3, Speed)
  • forwardright()
    1. analogWrite (in1, Speed)
    2. analogWrite (in3, Speedsec)
  • backright()
    1. analogWrite (in2, Speed)
    2. analogWrite (in4, Speedsec)
  • backleft()
    1. analogWrite (in2, Speedsec)
    2. analogWrite (in4, Speed)
  • stop()
    1. analogWrite (in1, 0)
    2. analogWrite (in2, 0)
    3. analogWrite (in3, 0)
    4. analogWrite (in4, 0)
  • brakeOn()
    1. ButtonState = command
    2. If (ButtonState != lastButtonState)
    3. If (ButtonState == 'S')
    4. If (lastButtonState != ButtonState)
    5. digitalWrite (in1, HIGH)
    6. digitalWrite (in2, HIGH)
    7. digitalWrite (in3, HIGH)
    8. digitalWrite (in4, HIGH)
    9. delay(brakeTime)
    10. stop()