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 }

LED brightness control using Arduino and potentiometer in tinkercad

 

LED brightness control using Arduino and potentiometer.

In this tutorial, we are controlling the LED brightness using the potentiometer. This is an easy tutorial for demonstrating how can we control the brightness of an LED or adjust the speed of a DC motor using Arduino Board, and potentiometer. in this tutorial we have used the three LEDs yellow, blue, green to control the brightness of the same.

 

Circuit Diagram:


Components Required:

§  Arduino UNO

§  Yellow LED

§  Blue LED

§  Green LED

§  Potentiometer 10K

§  Connecting wires

 

Connection:

The hardware part of this project is very simple and easy to place together. First of all, make the connections for LEDs with the Arduino.

Connect the anode of the yellow LED to the digital pin12 of an Arduino.

Connect the anode of the Blue LED to the digital pin 8 of an Arduino.

Connect the anode of the Green LED to the digital pin 4 of an Arduino.

Connect the cathode pin of all LEDs to the GND pin of an Arduino.

Let’s do the connection for the potentiometer now,

Connect the terminal-1 of the potentiometer to the GND of an Arduino.

Connect the terminal-2 of the potentiometer to the +5V of an Arduino.

Connect the middle terminal of the potentiometer to the analog input A0 of an Arduino.


What is a Potentiometer?

A potentiometer (also called the pot) it’s a 3 terminal variable resistor in which the resistance is manually controlled or varied by rotating the nob clockwise or anticlockwise. Thus by varying resistance, we can able to produce the changing voltage output.




Applications of Potentiometer:

following are the practical application of the potentiometer.

  1. The pot is used as a voltage divider in many electronic circuitries.
  2. The potentiometer is used in radio, television, and media players for volume control
  3. Potentiometers are widely used in sound controls in various amplifiers.

 

Working on the project:

As per the circuit diagram, the output voltage of the potentiometer is connected to the analog input pin A0 of an Arduino. The potentiometer gives the Analog output when it is rotated. The output of the potentiometer is stored in a variable named inputval. Three LEDs are connected to the digital pin 12,8,4 respectively.

Whenever the pot rotated clockwise the output voltage increases thus the brightness of all three LEDs also increases.

Whenever the pot rotated anticlockwise the output voltage decreases thus the brightness of all three LEDs also decreases.

Arduino Code Explanation:

Define the LED and pot pin led1 is connected to pin 12, led2 is connected to pin 8, led3 is connected to pin 4, and the pot is connected to the analog input A0. Declare the variable name inputval and set it to “0”

int led1=12;

int led2=8;

int led3=4;

int pot=A0;

int inputval=0;

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

 

void setup()

{

pinMode(led1,OUTPUT);

 pinMode(led2,OUTPUT);

 pinMode(led3,OUTPUT);

 pinMode(pot,INPUT);

}

 

 

 

 

 

 

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

 Here inside the loop store the pot value in the variable named potval.

void loop()

{

  inputval=analogRead(pot);

  analogWrite(led1,inputval);

  analogWrite(led2,inputval);

  analogWrite(led3,inputval);

  delay (100);

}

Here we have to use the analogWrite function for all 3 LEDs to control the brightness.

Watch Working Video:



Thanks for subscribing to my Youtube channel, here is the good news for you!! now you can join my Udemy course for FREE. fill the below form and you will receive the free Udemy coupon code in your mail. Click on the below link.


FREE Udemy course

https://docs.google.com/forms/d/e/1FAIpQLSfY7sanjTlF6qgfFOo5mY68J8izOklnZ_f5-fJ3ecuQFsImmw/viewform?usp=sf_link


Arduino Sketch:

int led1=12;

int led2=8;

int led3=4;

int pot=A0;

int inputval=0;

void setup()

{

pinMode(led1,OUTPUT);

 pinMode(led2,OUTPUT);

 pinMode(led3,OUTPUT);

 pinMode(pot,INPUT);

}

void loop()

{

  inputval=analogRead(pot);

  analogWrite(led1,inputval);

  analogWrite(led2,inputval);

  analogWrite(led3,inputval);

  delay (100);

}

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