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 IR receiver and IR Remote with an Arduino.

Interfacing of IR receiver and IR Remote with an Arduino.

In this project, we will interface an IR Receiver and an IR Remote with an Arduino and controls the output devices that is LED and Buzzer.

An IR Receiver is an electronic device that emit light radiation and it receives the information in the form of light from IR Remote. The received information from the IR remote send it to the Microcontroller. There is various application of IR Receivers in day-to-day life like one used in TV remotes. When we pressed any key on the remote it generates infrared signals, IR receiver present in front of the TV receives that signal and send it to the microcontroller for decoding after this controller gives the required output. And also, main thing is it’s a wireless communication

Circuit Diagram:


Components Required:

§  Arduino UNO

§  IR Receiver

§  IR Remote

§  Red LED

§  Buzzer

§  Connecting wires


Connection:

The hardware a part of this project is quite simple and easy to place together. First of all, make the connections for the IR Receiver with the Arduino. The connections for the IR Receiver with the Arduino given in the above circuit diagram.

IR Receiver has three pins one is connected to the GND pin of an Arduino second pin is connected to the VCC pin of an Arduino and output pin of IR receiver is connected to the digital pin 10 of an Arduino.

Red LEDs Anode pin is connected to the digital pin 2 of an Arduino and cathode is connected to the GND Pin of an Arduino.

 Buzzer positive pin is connected to the digital pin 3 of an Arduino and negative pin is connected to the GND pin of an Arduino Connect the one terminal of force sensor to the GND of an Arduino.


Basics of IR Communication

Infrared Communication or IR is using the Infrared Light. Infrared Light has wavelength which is higher than the visible light. Hence human being not able to see the Infrared Light.

This is the reason it is good choice for Wireless Communication. But is has disadvantage that is line-of-sight error which means for Communication between the transmitter and receiver both should be in one line. Due to this reason IR communication cannot be used through walls.

IR Receiver

let us take a brief about the IR Receiver that we are using here i.e.TSOP1838.

TSOP1838 is a very popular type of IR receiver and its carrier frequency of 38kHZ. It has three pins namely: GND, VCC and OUT.

The output of the TSOP 1838 IR Receiver can be directly decoded by a microcontroller.  

Working of project:

The working of the remote controlled led and buzzer project is very simple. This project will demonstrate you how to interface IR Receiver and an IR Remote with an Arduino.

Whenever key “1” is pressed then red LED will flash and when the key “2” is pressed the buzzer will produce the sound. When we pressed the any key on the IR remote that decodes by the Micro-controller. Each key on the remote can be used for different task like turning on light, turn on motor etc.

Arduino Code Explanation:

Include the IR Remote Library after that define the output pin of IR Receiver it is connected to the pin 10 of an Arduino.

Define the LED and buzzer pins, led1 is connected to the pin 2 and buzzer is connected to the pin 3 of an Arduino.

#include <IRremote.h>

 

const int RECV_PIN = 10;

IRrecv irrecv(RECV_PIN);

decode_results results;

int led1=2;

int buzzer=3;

 

Inside the void setup we will define the pin which are input and which are output pin, this set of code runs only once.

Initialize the serial monitor for displaying the value at baud rate of 9600.

 

void setup(){

  Serial.begin(9600);

  irrecv.enableIRIn();

  irrecv.blink13(true);

  pinMode(led1,OUTPUT);

  pinMode(buzzer,OUTPUT);

 

}

 

the code inside the void loop runs over and over as long as the Arduino Board is turned on.

 Here inside the loop results.value stores the decoded code we can print that code on serial monitor as hex code using  Serial.println(results.value, HEX);

Now for printing decimal value of the IR remote Key pressed for that we can use Serial.println(results.value);

 

void loop(){

  if (irrecv.decode(&results)){

        Serial.println(results.value, HEX);

        irrecv.resume();

    Serial.println(results.value);

  }

  if (results.value==16582903)

  {

    digitalWrite(led1,HIGH);

    delay(200);

    digitalWrite(led1,LOW);

    delay(200);

   

  }

  if (results.value==16615543)

  {

    digitalWrite(buzzer,HIGH);

    delay(200);

    digitalWrite(buzzer,LOW);

    delay(200);

   

  }

}

Here wehave used  if() conditional statement  basic coding control structures. One can make something happen or not, it depends whether the condition is true or not. It looks like this:

When we pressed the “1” key on the IR remote then Arduino gives us the decimal output which is stored in results.value and the decimal output is 16582903.

If the if (results.value==16582903) then will create a led flashing effect by turning it on and off.

Same thing for the buzzer as well when we pressed the “2” key on the IR remote then Arduino gives us the decimal output which is stored in results.value and the decimal output for key 2 is 16615543.

 If the if (results.value==16615543)then turn on the buzzer.

Watch the Working video:


Arduino Sketch:

#include <IRremote.h>

 

const int RECV_PIN = 10;

IRrecv irrecv(RECV_PIN);

decode_results results;

int led1=2;

int buzzer=3;

void setup(){

  Serial.begin(9600);

  irrecv.enableIRIn();

  irrecv.blink13(true);

  pinMode(led1,OUTPUT);

  pinMode(buzzer,OUTPUT);

 

}

 

void loop(){

  if (irrecv.decode(&results)){

        Serial.println(results.value, HEX);

        irrecv.resume();

    Serial.println(results.value);

  }

  if (results.value==16582903)

  {

    digitalWrite(led1,HIGH);

    delay(200);

    digitalWrite(led1,LOW);

    delay(200);

   

  }

  if (results.value==16615543)

  {

    digitalWrite(buzzer,HIGH);

    delay(200);

    digitalWrite(buzzer,LOW);

    delay(200);

   

  }

}

 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...

Getting Started with the Arduino IoT Cloud using Esp32 & DHT-11

  Getting Started with the Arduino IoT Cloud using Esp32 Introduction: The Internet of Things has given rise to plenty of exciting new projects for makers. It's both interesting and practical to be able to develop remote sensors and gadgets. Allowing IoT devices from multiple manufacturers to interact with your innovations will open up a lot of possibilities, including some you might not have considered before. In this getting started guide of Arduino IOT cloud we will learn about how to use Arduino IOT cloud with Esp32 board. Arduino IOT cloud What is Arduino IOT cloud? Arduino IoT Cloud is a web-based service that allows users to create connected devices quickly, easily, and securely. Multiple devices can be linked together and data can be exchanged in real-time. Users can also able to monitor the data using a simple user interface from anywhere. one can also use the android application for monitoring and controlling the devices. Because Arduin...

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 }