Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO and Bluetooth HC-06 Based Smart Soil Moisture Monitoring System

View and Edit Project In Cirkit DesignerImage of Arduino UNO and Bluetooth HC-06 Based Smart Soil Moisture Monitoring System

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with a Bluetooth HC-06 module, a water sensor, a rain/snow sensor board, and a servo motor. The Arduino UNO reads data from the sensors and controls the servo motor. The Bluetooth module allows for wireless communication, enabling the transmission of sensor data to a remote device.

Component List

Arduino UNO

Bluetooth HC-06

Water Sensor

Rain/Snow Sensor - Board

Servo

Wiring Details

Arduino UNO

Bluetooth HC-06

Water Sensor

Rain/Snow Sensor - Board

Servo

Code Documentation

Arduino UNO Code

#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,2);
const int soilSensorPin = A0;
int moistureValue = 0;

Servo myServo;
const int servoPin = 7;

void setup() {
  Serial.begin(9600); //open the serial port
  mySerial.begin(9600); // open the bluetooth serial port
}

void loop() {
  moistureValue = analogRead(soilSensorPin);
  int percentage = map(moistureValue, 1023, 0, 0, 100);
  Serial.print("Вологість дорівнює:");
  Serial.print(percentage);
  Serial.println("%");

  mySerial.print("Вологість:");
  mySerial.print(percentage);
  mySerial.println("%");

  if(mySerial.available()){
    Serial.println(mySerial.readString()); // send from serial to bluetooth
  }
  if(Serial.available()){
    mySerial.println(Serial.readString()); // send from bluetooth to serial
  }
}

This code initializes a software serial connection on pins D3 and D2 for communication with the Bluetooth HC-06 module. It reads the moisture value from the rain/snow sensor connected to pin A0 and maps it to a percentage. The moisture percentage is then printed to both the serial monitor and the Bluetooth module. The code also handles data transmission between the serial monitor and the Bluetooth module.