Skip to main content

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }

Interfacing of LDR sensor with an Arduino using Tinkercad

 Interfacing of LDR sensor with arduino using Tinkercad

In this project, we are using LDR as a  Light Sensor with an Arduino to control a LED light and Buzzer as per light condition of the room. The LED light and Buzzer will turns ON automatically when there is less light intensity outside or inside the room  and turns off when it is  bright outside or inside the room. For this, we need LDR sensor to detect the light intensity inside or outside the room. And an Arduino to control the Buzzer and LED It’s like a dark detecting circuit.


Circuit Diagram:



Components Required:

§  Arduino UNO

§  LDR (Light Dependent Resistor)

§  Resistor (10k)

§  LED - 1

§  Buzzer  Connecting wires


Connection:

The hardware a part of this project is extremely easy to place together. First of all, make the connections for the LDR sensor with the Arduino. The connections for the LDR sensor with the Arduino given in above circuit diagram:

Connect one pin of the LDR sensor to the 5V pin on the Arduino.

Connect another pin of LDR with resistor and then connect it to the GND terminal of An Arduino.

Connect the LED anode pin to pin no 4 of an Arduino.

Connect the positive pin of the Buzzer to pin no 3 of an Arduino.

Connect the cathode of LED and negative of Buzzer to the Arduino GND.


About LDR Sensor :

LDR is a Light Dependent Resistor (LDR) is also known as photo resistor or a cadmium sulfide (CdS) cell. It is a photocell which works on the principle of photoconductivity. The principle is when the intensity of light is more resistance value decreases and when the intensity of light is less then resistance value increases. This type of sensor is mostly used in light controlled sensor circuit, and light and dark detecting circuits. Few practical applications of LDR  smart street lights, clock radios, light beam alarms, reflective smoke alarms, and outdoor clocks.


LDR Structure:



Advantages:

LDR’s are cheap and are easily available in different sizes and shapes. Practical LDRs are available in different packages and size. The most useful size having a diameter of approximately 10 mm. it requires very small power and voltage for its operation.

Disadvantages:

Very inaccurate with a response time of about tens or hundreds of milliseconds.

Working of LDR controlled LED & Buzzer using Arduino:

As per the circuit diagram, we have created a voltage divider across LDR using 10K resistor. The output of voltage divider is connected to the analog input pin of an Arduino. The analog Pin A0 reads the voltage and gives some analog value to Arduino. The analog value varies according to the resistance of LDR. So, when the light falls on the LDR the resistance of it gets decreased and due to that the voltage value increase. we have stored this analog value in variable named ldr and printed on serial monitor.

Intensity of light decreases – Resistance increases - Voltage at analog pin decreases - LED turns ON.


Code Explanation (Block Based):

First of all, we declare variable named ldr, to store the light intensity value of a LDR sensor To declare the variable click on variable block and create variable, see the below picture.


After declaring the variable set variable to analog pin A0


Now we want to print the light intensity  value on the screen for that we will use the serial monitor, we will assign the ldr variable to the serial monitor.

Now we will use the main conditional statement of the program that is ‘if’ block



In if block we will use the condition for that we need the comparison operator here we have used the less than “<” comparison operator.

Condition:

 if the ldr sensor value is less than 100 then pin 4 will be high and buzzer on pin no 3 will be on for 1 sec.

Arduino Sketch :


int ldr = 0;

 

void setup()

{

  pinMode(A0, INPUT);

  Serial.begin(9600);

 

  pinMode(4, OUTPUT);

  pinMode(3, OUTPUT);

}

 

void loop()

{

  ldr = analogRead(A0);

  Serial.println(ldr);

  if (ldr < 100) {

    digitalWrite(4, HIGH);

    tone(3, 523, 1000); // play tone 60 (C5 = 523 Hz)

  } else {

    digitalWrite(4, LOW);

  }

  delay(10); // Delay a little bit to improve simulation performance

}


Watch Working Video:



Like share and comment :

                                                     Our FaceBook Page                                                           







For Any queries please contact:

impulseTech101@gmail.com


Comments

Popular posts from this blog

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 Hello Everyone! I have come up with new tutorial Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 For Code & Circuit Diragram: In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to setup web dashboard 3. How to create template in blynk iot 4. How to interface ultrasonic sensor with node mcu esp8266. 5. How to read ultrasonic sensor with esp8266 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT https://youtu.be/GTdxD5vQwy0 4.Water level monitoring system using IoT | IoT based

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud   Hello Everyone! I have come up with new tutorial based on the all new Blynk IoT platform. which is DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud #iot #blynk In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to interface DS18B20 sensor with esp32 4. How to configure mobile blynk IoT platform 5. How to setup Automation in Blynk IoT 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app | #iot #blynk #esp32 https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 #blynk #esp32 #iot https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT #iot #blynk #esp32 https://youtu.be/GTdxD5vQwy0 4.Water