IoTtinkerCAD LAB Manual
IoTtinkerCAD LAB Manual
Edited By
Er. K . VIVEKANANTH
IoT Engineer
RiyasaaLabs Centre for Innovation
17, First Floor, JS Plaza Kottar, Nagercoil629002
TINKER CAD
• In the world of 3D modeling, Tinkercad has established itself as a worthy introduction to
computer-aided design (CAD). It’s a free and intuitive web-based CAD program that anyone
can use. In fact, if you want to get started with Tinkercad, we even have a beginner’s tutorial to
get you going.
• Recently, Tinkercad has introduced something new: An expansion to include circuits in its design
capability called Tinkercad Circuits. This brings a whole new side to Tinkercad, revolving around
simulating circuits with Arduino.
• In this article, we’ll be showing you how to program a basic Arduino in Tinkercad, but first, let’s
take a closer look at the new capabilities Tinkercad Circuits offers.
Use Any Type of Web Browser for Create a
New Account or Login Account in TINKER CAD
Search TINKER CAD or
https://www.tinkercad.com/ in Web Browser
Click and Enter Into TINKER CAD
CREATE A NEW ACCOUNT IN TINKER CAD
Select Student Accounts
Sign in Gmail Id
AFTER CREATING A NEW ACCOUNT
CREATE A NEW CIRCUIT IN TINKERCAD
Bread board Connection
Lab : 1 Ohms Law
Lab:2 LED in Arduino UNO (LED L blink)
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
Lab:3 Two LED Blink
// C++ code
//
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(10, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(10, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(10, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
}
Lab:4 Push Button in LED
// C++ code
//
int pushbutton=2;
void setup()
{
pinMode(10, OUTPUT);
pinMode(pushbutton,INPUT);
}
void loop()
{
int inputval=digitalRead(pushbutton);
if(inputval==1){
digitalWrite(10,HIGH);
}
if(inputval==0){
digitalWrite(10,LOW);
}
}
Lab:5 POT Output in Serial Monitor
// C++ code
//
void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(500);
}
Lab:6 POT Used LED
(LED ON in Limits Across)
// C++ code
//
void setup()
{
pinMode(10, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
if (sensorValue>=512) {
digitalWrite(10, HIGH);
} else {
digitalWrite(10, LOW);
}
delay(500);
}
Lab7: POT Used LED (LED FADING)
void setup()
{
pinMode(10, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
int brightness = map(sensorValue, 0, 1023, 0, 255);
analogWrite(10, brightness);
delay(50);
}
Lab: 8 LED Control in Serial Monitor
// C++ code
//
void setup()
{
pinMode(10, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if (Serial.available()) {
char c=Serial.read();
if(c=='A')
{
digitalWrite(10, HIGH);
Serial.println("led on");
}
else if(c=='B')
{
digitalWrite(10, LOW);
Serial.println("led off");
}
}
}
Lab:9 RGB LED (Colours Changing)
int redPin= 10;
int greenPin = 9;
int bluePin = 8;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
setColor(255, 0, 0); // Red Color
delay(1000);
setColor(0, 255, 0); // Green Color
delay(1000);
setColor(0, 0, 255); // Blue Color
delay(1000);
setColor(255, 255, 255); // White Color
delay(1000);
setColor(170, 0, 255); // Purple Color
delay(1000);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}
Lab:10 Servo Motor
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0;
void setup() {
myservo.attach(9);
}
void loop() {
/* goes from 0 degrees to 180 degrees in steps of 1 degree tell servo to go to
position in variable 'pos' waits 15ms for the servo to reach the position */
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
/* goes from 180 degrees to 0 degrees tell servo to go to position in variable 'pos'
waits 15ms for the servo to reach the position */
void setup()
{
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop()
{
PIR = digitalRead(2);
Serial.println(PIR);
delay(10); // Delay a little bit to improve simulation performance
}
Lab: 12 PIR Sensor with LED(LED Indication)
// C++ code
//
int buttonState = 0;
void setup()
{
pinMode(2, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
// read the state of the pushbutton
buttonState = digitalRead(2);
// check if pushbutton is pressed. if it is, the
// button state is HIGH
if (buttonState == HIGH) {
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
delay(10); // Delay a little bit to improve simulation performance
}
Lab: 13 IR Sensor
// C++ code
//
int IR = 0;
void setup()
{
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop()
{
IR = digitalRead(2);
Serial.println(IR);
delay(10); // Delay a little bit to improve simulation performance
}
Lab:14 Arduino Interface in
Ultrasonic Sensor
int inches =0;
int cm =0;
long readUltrasonicDistance(int triggerPin,int echoPin)
{
pinMode(triggerPin,OUTPUT);
digitalWrite(triggerPin,LOW);
delayMicroseconds(2);
digitalWrite(triggerPin,HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin,LOW);
pinMode(echoPin,INPUT);
return pulseIn(echoPin ,HIGH);
}
void setup()
{
Serial.begin(9600);
}
void loop()
{
cm=0.01723*readUltrasonicDistance(8,8);
inches=(cm/2.54);
Serial.print(inches);
Serial.print("in,");
Serial.print(cm);
Serial.print("cm");
delay(100);
}
Lab:15 LDR Sensor
void setup()
{
Serial.begin(9600);
pinMode(A0,INPUT);
}
void loop()
{
int sensorread= analogRead(A0);
Serial.print("LDR value:");
Serial.println(sensorread);
delay(500);
}
Lab:16 I2C Display
#include<Adafruit_LiquidCrystal.h>
Adafruit_LiquidCrystal lcd_1(0);
void setup()
{
lcd_1.begin(16,2);
}
void loop()
{
lcd_1.setCursor(0,0);
lcd_1.print(" RIYASAA LABS");
lcd_1.setCursor(0,1);
lcd_1.print(“IoT");
lcd_1.setBacklight(1);
delay(500);
lcd_1.setBacklight(0);
delay(500);
}