Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Arduino Basics

Uploaded by

PRACHI RAUT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Arduino Basics

Uploaded by

PRACHI RAUT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

IOT SIMULATION PLATFORMS

WORKSHOP
Arduino Basics & Hands-on Tinkercad 1
Dr. Prachi Raut

Department of Information Technology, SFIT


11/29/2024
OVERVIEW
Arduino platform
Arduino boards
Arduino Uno
Tinkercad Hands-on
Assignment

Department of Information Technology, SFIT 11/29/2024 2


ARDUINO PLATFORM
Open source electronic platform
Easy to use hardware and software
Inexpensive
Used widely for rapid prototyping

Department of Information Technology, SFIT 11/29/2024 3


ARDUINO: FEATURES
 Cross-platform
 Simple, clear programming
environment
 Open source and extensible software
 Open source and extensible hardware

Department of Information Technology, SFIT 11/29/2024 4


ARDUINO BOARDS

Department of Information Technology, SFIT 11/29/2024 5


ARDUINO UNO : FEATURES
 Microcontroller : Atmega328p 8 bit AVR family microcontroller
 Analog input pins : 6
 Digital in/out pins : 14 (6 provide PWM output)
 Flash memory : 32 KB
 SRAM : 2 KB
 EEPROM : 1 KB
 Frequency : 15 MHz
 Operating voltage : 5 volts

Department of Information Technology, SFIT 11/29/2024 6


Department of Information Technology, SFIT 11/29/2024 7
TINKERCAD

Department of Information Technology, SFIT 11/29/2024 8


CIRCUITS
 Simple LED
 Simple LED with slide switch
 Simple LED with potentiometer
 LED blinking with 555 timer
 Simple LED with Arduino
 Temperature sensor with Arduino
 Gas sensor with Arduino
 LCD 16*2 with Arduino
 Assignment

Department of Information Technology, SFIT 11/29/2024 10


Department of Information Technology, SFIT 11/29/2024 11
Department of Information Technology, SFIT 11/29/2024 12
BLINKING LED ARDUINO :
CIRCUIT DIAGRAM

Department of Information Technology, SFIT 11/29/2024 13


BLINKING LED ARDUINO : CODE
// Code for blinking LED
int LEDPin=8; // Define pin number 8 as LEDPin
void setup()
{
pinMode(LEDPin, OUTPUT); //Set LEDPin as output
}
void loop()
{
digitalWrite (LEDPin,HIGH); //LEDPin is set HIGH
delay(1000); //Set delay time 1000 mS
digitalWrite (LEDPin,LOW); // LEDPin is set LOW
delay(1000);
Department of Information Technology, SFIT // Set delay time 1000 mS 11/29/2024 14
TEMPERATURE SENSOR WITH
ARDUINO : CIRCUIT DIAGRAM

Department of Information Technology, SFIT 11/29/2024 15


Temperature Sensor with Arduino :
Code
//Initializing values
void loop()
{
int baselineTemp = 0; baselineTemp = 40;
int celsius = 0; celsius = map(((analogRead(A0) - 20) * 3.04), 0,
int fahrenheit = 0; 1023, -40, 125);
fahrenheit = ((celsius * 9) / 5 + 32);
void setup() Serial.print(celsius);
{ Serial.print(" C, ");
pinMode(A0, INPUT); // Pin A0 set as INPUT Serial.print(fahrenheit);
Serial.begin(9600); // Serial communication Serial.println(" F");
with 9600 baud rate if (celsius > baselineTemp) {
pinMode(2, OUTPUT); // Pin 2 set as OUTPUT digitalWrite(2, HIGH);
}
} else
{
digitalWrite(2,LOW);
}

delay(1000);
Department of Information Technology, SFIT } 11/29/2024 16
s Sensor with Arduino : Circuit diagram

Department of Information Technology, SFIT 11/29/2024 17


as Sensor with Arduino : Code
int const GAS_Sensor = A1;
int Buzzer = 7;

void setup(){
pinMode(Buzzer, OUTPUT);
Serial.begin(9600);
}
void loop(){
int value = analogRead(GAS_Sensor);
value = map(value, 300, 750, 0, 100);
if (value > 50)
{
digitalWrite(Buzzer, HIGH);
}
else
{
digitalWrite(Buzzer, LOW) ;

}
Department of Information Technology, SFIT 11/29/2024 18
LCD 16*2 PINS
 Power pins :
 VCC , GND
 Vo : Contrast control
 LED+ , LED- : Backlight control

 Data pins:
 D7-D0

 Control pins:
 RS
 R/W
 Enable

Department of Information Technology, SFIT 11/29/2024 19


D 16*2 with Arduino : Circuit diagram
RS (LCD pin 4) to Arduino pin 12
RW (LCD pin 5) to Arduino pin 11
Enable (LCD pin 6) to Arduino pin 1
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduin

Department of Information Technology, SFIT 11/29/2024 20


CD 16*2 with Arduino : Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight
void setup()
{
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
lcd.print("Hello, TE-INFT"); // change text to whatever you like. keep it clean!
lcd.setCursor(0,1); // set cursor to column 0, row 1
lcd.print("IoT Workshop");
}
void loop()
{
delay(1000);
lcd.noDisplay();
delay(500);
Department of Information Technology, SFIT 11/29/2024 21
lcd.display();
ULTRA SONIC SENSOR WITH ARDUINO
: CODE
const int pingPin = 7;
const int ledPin = 13;

void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
.

Department of Information Technology, SFIT 11/29/2024 22


ULTRA SONIC SENSOR WITH ARDUINO
: CODE
Serial.print("Distance: ");
void loop() { Serial.print(cm);
long duration, cm; Serial.print("cm");
pinMode(pingPin, OUTPUT); Serial.println();

digitalWrite(pingPin, LOW); if(cm < 100) {


delayMicroseconds(2); digitalWrite(ledPin, HIGH);
digitalWrite(pingPin, HIGH); }
else {
delayMicroseconds(5); digitalWrite(ledPin, LOW);
digitalWrite(pingPin, LOW); }
pinMode(pingPin, INPUT);
delay(100);
duration = pulseIn(pingPin, HIGH); }
cm =
microsecondsToCentimeters(duration);
Department of Information Technology, SFIT 11/29/2024 23
ULTRA SONIC SENSOR WITH ARDUINO
: CODE
long microsecondsToCentimeters(long microseconds) {
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}

Department of Information Technology, SFIT 11/29/2024 24


ASSIGNMENTS
A game
A security system
An indoor environment monitoring
system
Decorative display lighting for festivals

Department of Information Technology, SFIT 11/29/2024 25

You might also like