Arduino Tinkercad Experiments

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

S. No. Lab Experiment on Arduino Uno using Autodesk TinkerCad Simulation.

1 a)Write the code to blink an LED on Arduino Uno. Compile and verify the result on the serial
monitor of Arduino IDE.
Additional Programs:
i) To blink two LED’s alternatively
ii) To blink odd and even leds
iii) To scroll an LED’s
2 Interfacing of Arduino Uno with LED and switch. Write a program to
control LED using Switch.
Additional Programs:
i)Single switch to control multiple LED’s
ii)Multi switches to control multiple LED’s
3 Interfacing of Arduino Uno with potentiometer and LED. Write a program to vary the intensity of
LED using a potentiometer.
Additional Programs:
i)Adjust the brightness of LED without potentiometer.

4 (a)Interfacing of Ultrasonic sensor with Arduino Uno. Write a program to measure the distance
from obstacle and display on the serial monitor.
(b)Interface an IR sensor with Arduino Uno. Write a program to detect obstacle and display on the
serial monitor.
5
(a) Interfacing of Temperature sensor with Arduino Uno. Write a program to read the specific
temperature of a room and display on the serial monitor.
(b) Interfacing of LDR with Arduino Uno. Write a program to control the intensity of LED using LDR.

6 (a) Interfacing of DC motor with Arduino Uno. Write a program to rotate the motor in clockwise
and anticlockwise direction with using a delay of 2 sec.
(b) Familiarize the concept of pulse width modulation. Write a program to control the speed of DC
motor using PWM.
7 (a) Interfacing of a display device, i.e., LCD x2 with Arduino Uno. Write a
program to display “HELLO IOT” on LCD.
(b) Write a program to scroll the message “Welcome to IoT Lab.”
(c) Write a program to blink the message “Hello IoT.”
EXPERIMENT 1
Aim of the Experiment: To Blink LED

Components Used: Arduino UNO, LED, Resistor, Tinkercad Simulator.

Circuit Diagram:

Figure : Blinking of LED

Software program:
void setup()
{
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(13, HIGH);
Serial.println("LED : ON");
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
Serial.println("LED : OFF");
delay(1000); // Wait for 1000 millisecond(s)
}
Screenshot of Serial monitor:
EXPERIMENT 2
Aim of the Experiment: Controlling LED with Switch.

Components Used: Arduino UNO, LED, Resistor, Tinkercad Simulator, Switch.

Circuit Diagram:

Figure : Control of LED using Switch


Software program:
int button = 8;
void setup()
{
pinMode(13, OUTPUT);
pinMode(button, INPUT);
}
void loop()
{
int value = digitalRead(button);
if(value==HIGH)
{
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, LOW);
}
}
EXPERIMENT 3

Aim of the Experiment : Intensity of Led using Potentiometer .

Components Used : Arduino UNO,Led,Potentiometer,Resistor,Tinckercad simulator .

Circuit Diagram:

Figure : Intensity of Led using Potentiometer

Software program:
int value=0;
void setup()
{
pinMode(A0, INPUT);
pinMode(11, OUTPUT);
}
void loop()
{
value = analogRead(A0);
digitalWrite(11,HIGH);
delay(value);

digitalWrite(11, LOW);
delay(value);
}
EXPERIMENT 4(a)
Aim of the Experiment: Measure the distance from obstacle and display on the serial
monitor using ultrasonic sensor

Components Used: Arduino UNO, Ultrasonic sensor, Tinkercad Simulator.

Circuit Diagram:

Figure : Ultrasonic Sensor

Software program:
const int trigpin =6;
const int echopin =7;
int distance;
int duration;
void setup()
{
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(trigpin, LOW);
delayMicroseconds(2);
digitalWrite(trigpin, HIGH);
delayMicroseconds(10);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = (0.034*duration)/2;
Serial.print("Distance is =");
Serial.println(distance);
}

Screenshot of Serial monitor:


EXPERIMENT 4(b)

Aim of the Experiment: To Detect Obstacle.

Components Used: Arduino UNO, IR Sensor, IR Remote, Tinkercad Simulator.

Circuit Diagram :

Figure : Setup of IR Sensor

Software program:
int ir;
void setup()
{
pinMode(11,INPUT);
Serial.begin(9600);
}
void loop()
{
ir=digitalRead(11);
Serial.println(ir);
}
Screenshot of Serial monitor:
EXPERIMENT 5(a)

Aim of the Experiment: To read the specific temperature of a room.

Components Used: Arduino UNO, Temprature Sensor, Resistor, LCD, Potentiometre,


Tinkercad Simulator.

Circuit Diagram:

Figure : Temprature Sensor

Software program:
#include <LiquidCrystal.h>

int sensePin = A0;


int sensorInput;
double temp;
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{

Serial.begin(9600);
lcd.begin(16,2);
}
void loop()
{
sensorInput = analogRead(A0);
temp = (double)sensorInput / 1024;
temp = temp * 5;
temp = temp - 0.5;
temp = temp * 100;
lcd.setCursor(0,0);
lcd.print("Temp:");
lcd.setCursor(6,0);
lcd.print(temp);
Serial.print("Current Temperature: ");
Serial.println(temp);
}

Screenshot of Serial monitor:


EXPERIMENT 5(b)
Aim of the Experiment: Controlling the intensity of LED using LDR.

Components Used: Arduino UNO, LED, Photoresistor, Resistor,Tinkercad Simulation.

Circuit Diagram:

Figure Controlling intensity of LED using LDR


Software program:
const int ledPin = 7;
const int ldrPin = A0;
void setup()
{

Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);

void loop()
{
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 200)
{

digitalWrite(ledPin, HIGH);
Serial.print("Its DARK, Turn on the LED : ");
Serial.println(ldrStatus);

}
else
{

digitalWrite(ledPin, LOW);
Serial.print("Its BRIGHT, Turn off the LED : ");
Serial.println(ldrStatus);

}
}

Screenshot of Serial monitor:


EXPERIMENT 6(a)

Aim of the Experiment: Rotating a DC Motor in clockwise & anticlockwise direction using delay.

Components Used: Arduino UNO, DC Motor, H- Bridge Motor Driver, Tinkercad Stimulation.

Circuit Diagram:

Figure Rotating DC motor


Software program:
int In1=12;
int In2=9;
void setup()
{

pinMode(In1,OUTPUT);
pinMode(In2,OUTPUT);
Serial.begin(9600);

}
void loop()
{
digitalWrite(In1,HIGH);
digitalWrite(In2,LOW);
Serial.println(“Clockwise”);
delay(2000);
digitalWrite(In1,LOW);
digitalWrite(In2,HIGH);
Serial.println(“Anti Clockwise”);
delay(2000);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println(“Stop”);
delay(2000);
}

Screenshot of Serial Monitor:


EXPERIMENT 6(b)

Aim of the Experiment: Control the speed of DC motor using PWM.

Components Used: Arduino UNO, DC Motor, Tinkercad Simulator.

Circuit Diagram:

Figure : Rotating DC Motor

Software program:
int en=5;
int In1=12;
int In2=9;
void setup()
{

pinMode(en,OUTPUT);
pinMode(In1,OUTPUT);
pinMode(In2,OUTPUT);
Serial.begin(9600);

}
void loop()
{
analogWrite(en,255);
digitalWrite(In1,HIGH);
digitalWrite(In2,LOW);
Serial.println("Clockwise");
delay(2000);
analogWrite(en,255);
digitalWrite(In1,LOW);
digitalWrite(In2,HIGH);
Serial.println("Anti Clockwise");
delay(2000);
analogWrite(en,255);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println("Stop");
delay(2000);
}

Screenshot of Serial monitor:


EXPERIMENT 7(a)

Aim of the Experiment: Display “HELLO IOT” on LCD.

Components Used: Arduino UNO, LCD, Potentiometer, Resistor,Tinkercad Simulator.

Circuit Diagram:

Figure : Setup for Print of Hello Iot

Software program:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(4,0);
lcd.print("Hello IoT");
delay(1000);
}
201

EXPERIMENT 7(b)

Aim of the Experiment: Scroll the message “Welcome to IoT Lab”.

Components Used: Arduino UNO, Tinkercad Simulation, LCD, Potentiometer, Resistor.

Circuit Diagram:

Figure Setup for Scrolling.


Software program:
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{ lcd.begin(16, 2);
lcd.print("hello, world!");
delay(1000); }
void loop()
{ for (int positionCounter = 0; positionCounter < 13; positionCounter++)
{ lcd.scrollDisplayLeft();
delay(150); }
for (int positionCounter = 0; positionCounter < 16; positionCounter++)
{ lcd.scrollDisplayLeft();
delay(150); }
}

3
EXPERIMENT 7(c)

Aim of the Experiment: Blinking the message “Hello IoT”.

Components Used: Arduino UNO, Tinkercad Simulation, LCD, Resistor, Potentiometer.

Circuit Diagram:

Figure Setup for Blinking


Software program:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{ lcd.begin(16, 2); }
void loop()
{
lcd.setCursor(4,0);
lcd.print("Hello IoT");
delay(1000);
lcd.clear();
delay(500);
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy