SlideShare a Scribd company logo
GENERATING
PROJECTS IDEA
ON
bishalbtry@gmail.com
1
BY:BISHAL BHATTARAI
IOE, Pashchimanchal Campus
Pokhara, Nepal
TOPICS:
1. Introduction to Arduino
2. Arduino Boards
3. Integrated Development Environment-IDE
4. What it can do?
5. Why arduino?
6. Arduino Uno complete description
7. Projects
bishalbtry@gmail.com 2
1. Introduction:
• First Arduino was introduced in 2005
• Arduino is an open-source prototyping platform
• It is based on easy-to-use hardware and software
• Microcontroller board design manufactured
primarily by Smart Projects in Italy
bishalbtry@gmail.com 3
Open Source
Hardware
2. Arduino Boards:
bishalbtry@gmail.com 4
2. Arduino Boards cont…
bishalbtry@gmail.com 5
Arduino miniFLORA
3. Integrated Development
Environment(IDE):
•IDE a cross-platform application written in Java
• Designed to introduce programming to artists and
other newcomers unfamiliar with software development
• Code editor with features such as:
i. syntax highlighting
ii. brace matching
iii. automatic indentation
• Compiling and uploading programs to the board with
a single click
• A program or code written for Arduino is called a
"sketch”
• Arduino programs are written in C or C++
bishalbtry@gmail.com 6
3. IDE cont…
• The Arduino IDE comes with a software
library called "Wiring”
• Two functions to make an executable cyclic
executive program:
•setup(): function run once at the start of a
program that can initialize settings
•loop(): function called repeatedly until the
board powers off
bishalbtry@gmail.com 7
3. IDE cont…
Functions in Setup()
1. pinMode(13,OUTPUT)://makes pin 13 as output pin
2. pinMode(8, INPUT);//makes pin 8 as input pin
3. Serial.begin(9600) ;//starts serial communication
with Baudrate 9600
Functions in loop()
• 1. digitalWrite(13, HIGH): makes pin 13 high ie pin13=ON;
• 2. delay(500) : delays system by 500 ms.
• 3. analogRead() : Reads analog value
• 4. analogWrite() : writes anlog value(PWM)
• 5. Serial.print() : Prints at serial monitor
• 6. Serial.println() : prints at serial monitor with line break
bishalbtry@gmail.com 8
3. IDE cont…
bishalbtry@gmail.com 9
1.Verify
2.Upload
3.NEW
4.Open :Library,
example
5.Save
7.Message Panel
6.Code Panel
*Port connected to
IDE/Arduino board
*Tool: port setting, board
selection
*Serial
Monitor
4. What it can do?
• Sensors ( to sense stuff )
– Push buttons*, touch pads, tilt switches.
– Variable resistors* (eg. volume knob / sliders)
– Photoresistors* (sensing light levels)
– Thermistors* (temperature)
– Ultrasound (proximity range finder)
• Actuators ( to do stuff )
– Lights, LED’s*
– Motors*
– Speakers
– Displays (LCD)*
bishalbtry@gmail.com 10
5.Why Arduino?
• Simplify working with microcontr
• Inexpensive compare to other u-controller
platform
• Cross platform
• Simple, clear programming environment
• Simple, clear programming environment
• Open source and extensible hardware
bishalbtry@gmail.com 11
6.Arduino Uno Description:
bishalbtry@gmail.com 12
Digital output
~: PWM.
1,0: Serial port Tx
and Rx
In circuit Serial
programming
Atmel
MicroController
Analog input.
Power out and In
USB port for
power or
programming
12v Power
input
13 pin LED
POWER
on/off LED
6.Arduino Uno Description cont..
bishalbtry@gmail.com 13
6.Arduino Uno Description cont..
bishalbtry@gmail.com 14
7. Projects Idea:
1. LED Blink program
2. LED Fading
3. Variable Resistor controlled LED Blink
4. Variable Resistor controlled LED Intensity
5. LCD Interface
6. Keyboard Interface
bishalbtry@gmail.com 15
7. Projects Idea cont…
7. Digital thermometer
8. Motor control via Button
9. Variable Resistor Controlled Servo Motor
10. Ultra Sonic Sensor Interface for Distance
calculation
bishalbtry@gmail.com 16
1. LED BLINK
// the setup function runs once when you press reset or power the
board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13 LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
}
bishalbtry@gmail.com 17
1. LED BLINK
Proteus circuit
bishalbtry@gmail.com 18
2.LED FADING:
int ledPin = 9; // LED connected to digital pin 9
void setup() {
pinMode(ledPin, OUTPUT); // nothing happens in setup
}
void loop() {
// fade in from min to max in increments of 5 points:
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
bishalbtry@gmail.com 19
2.LED FADING cont….
}
// fade out from max to min in increments of 5 points:
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
bishalbtry@gmail.com 20
2.LED FADING
Proteus circuit:
bishalbtry@gmail.com 21
3.Variable resistor controlled
LED BLINK
bishalbtry@gmail.com 22
3.Variable resistor controlled
LED BLINK cont..
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(lsensorPin, INPUT);
}
void loop() {
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}
bishalbtry@gmail.com 23
4. Variable resistor controlled
LED Intensity
Do Yourself……..
IDEA to program this:
1. Read variable resistor value assign it to ‘C’
2. Convert this ‘C’ value so that you supply that
amount voltage to output pin
3. write this value to PWM pin using
analogWrite() function
bishalbtry@gmail.com 24
LCD Introduction:
bishalbtry@gmail.com 25
6.LCD Interface:
*4 to 4lcd
*5 to 6lcd
*6,7,8,9
To 11, 12
13, 14 resp
*VSS , R/W to Gnd
*VDD to power
bishalbtry@gmail.com 26
6.LCD Interface:
• #include <LiquidCrystal.h>
• LiquidCrystal lcd(4, 5, 6, 7, 8, 9); // pins for RS, E, DB4, DB5, DB6, DB7
• void setup()
• {
• lcd.begin(16,2);
• lcd.clear();
• }
• void loop()
• {
• lcd.setCursor(5,0);
• lcd.print("Hello");
• lcd.setCursor(5,1);
• lcd.print("world!");
• delay(10000);
• }
bishalbtry@gmail.com 27
7. Keyboard interface:
bishalbtry@gmail.com 28
7. Keyboard interface:
LCD:RS,E,11,12,13,14
To:A0,A1,A2,A3,A4,A5
*Vss –Gnd, *VDD-power
*R/W- Gnd
Keyboard:
(8,7,6)A to (1,2,3)K
(5,4,3,2)A to (ABCD)K
bishalbtry@gmail.com 29
5
4
3
2
8 7 6
7. Keyboard interface cont..
• #include <LiquidCrystal.h>
• #include <Keypad.h>
• LiquidCrystal lcd(A0,A1,A2, A3, A4, A5);
• const byte ROWS = 4; //four rows
• const byte COLS = 3; //three columns
• char keys[ROWS][COLS] = {
• {'1','2','3'},
• {'4','5','6'},
• {'7','8','9'},
• {'*','0','#'}
• };
• byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
• byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
• Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
bishalbtry@gmail.com 30
7. Keyboard interface cont..
• void setup(){
• lcd.begin(16,2);
• lcd.clear();
• lcd.setCursor(0,0);
• keypad.setHoldTime(500); // Default is 1000mS
• keypad.setDebounceTime(50); // Default is 50mS
• }
• void loop(){
• char key = keypad.getKey();
• if(key)
• {
• lcd.print(key);
• }
• }
bishalbtry@gmail.com 31
8. Digital thermometer:
bishalbtry@gmail.com 32
REQUREMENT:
16X2 LCD
Arduino uno
8. Digital thermometer:
Circuit Diagram
bishalbtry@gmail.com 33
8. Digital thermometer:
CODE:
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 6, 7, 8, 9);
int sensorPin = A0; //analog pin location
void setup()
{
Serial.begin(9600); //Start the serial connection with the computer
lcd.begin(16,2); //Must be defined or it goes to 16X1
lcd.clear(); // Starts with a clean screen
}
bishalbtry@gmail.com 34
8. Digital thermometer:
CODE cont..
void loop()
{
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// now print out the temperature (voltage-0.5)
float temperatureC = (voltage ) * 100 ; //converting from 10 mv per
degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
bishalbtry@gmail.com 35
8. Digital thermometer:
CODE cont..
lcd.setCursor(0,0);
lcd.print(temperatureC);
lcd.println(" Celsius "); //Shows reading on LCD
// now convert to Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
lcd.setCursor(0,1);
lcd.print(temperatureF);
lcd.println(" Fahrenheit"); //Shows reading on LCD
delay(500); //Update every 5 seconds, the value is
measured in milliseconds )
}
bishalbtry@gmail.com 36
9. Motor Control:
Requirements:
1. Keyboard interface idea
2. Motor interface with digital o/p pin
3. Condition checking process in program
if…else, switch(), OR anything….
bishalbtry@gmail.com 37
9. Motor Control cont..
bishalbtry@gmail.com 38
9. Motor Control cont..
• const int motorR = 13; //right direction motion assign pin
• const int motorRB = 12;//right direction backward motion assign pin
• const int motorL = 11; //left direction motion assign pin
• const int motorLB = 10;//left direction backward motion assign pin
• #include <Keypad.h>
• const byte ROWS = 2; //2 rows
• const byte COLS = 2;//2 column
• char keys[ROWS][COLS] = {
• {'1','2'},
• {'3','4'},
• };
• byte rowPins[ROWS] = {5, 4}; //connect to the row pinouts of the keypad
• byte colPins[COLS] = {8, 7};// to coloumn pinout
• Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
bishalbtry@gmail.com 39
9. Motor Control cont..
• void setup() {
• // initialize the LED pin as an output:
• pinMode(motorR, OUTPUT);
• pinMode(motorRB, OUTPUT);
• pinMode(motorL, OUTPUT);
• pinMode(motorLB, OUTPUT);
• pinMode(9, OUTPUT);
• pinMode(6, OUTPUT);
• // initialize the pushbutton pin as an input:
• keypad.setHoldTime(500);
• }
bishalbtry@gmail.com 40
9. Motor Control cont..
• void loop() {
• char key = keypad.getKey();
• if(key)
• {
• switch(key)
• {
• case ('1'):
• right();
• break;
• case ('2'):
• left();
• break;
• case ('3'):
• forward();
• break;
• case ('4'):
• backward();
• break;
• default:
• stopp();
• }
•
• }
• }
bishalbtry@gmail.com 41
9. Motor Control cont..
• void right()
• { digitalWrite(9,HIGH);
• digitalWrite(6,LOW);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,LOW);
• delay(300);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,HIGH);
• }
• void left()
• { digitalWrite(6,HIGH);
• digitalWrite(9,LOW);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,LOW);
• delay(300);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,HIGH);
• }
• void forward()
• { digitalWrite(9,HIGH);
• digitalWrite(6,HIGH);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,LOW);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,LOW);
• delay(300);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,HIGH);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,HIGH);
• }
• void backward()
• { digitalWrite(9,HIGH);
• digitalWrite(6,HIGH);
• digitalWrite(motorR,LOW);
• digitalWrite(motorRB,HIGH);
• digitalWrite(motorL,LOW);
• digitalWrite(motorLB,HIGH);
• delay(300);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,HIGH);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,HIGH);
• }
• void stopp()
• { digitalWrite(9,HIGH);
• digitalWrite(6,HIGH);
• digitalWrite(motorL,HIGH);
• digitalWrite(motorLB,HIGH);
• digitalWrite(motorR,HIGH);
• digitalWrite(motorRB,HIGH);
• }
bishalbtry@gmail.com 42
10. Controlling Servo motor:
Requirements:
1. Potentiometer interface
2. Motor interface
3. Variable data from POT applying to motor
interface pin
4. Code on IDE: File>>Example>>servo>>knob
OR follow the note code
bishalbtry@gmail.com 43
10. Controlling Servo motor:
bishalbtry@gmail.com 44
10. Ultra sonic sensor for Distance
calculation
Requirements:
1. Ultrasonic sensor
2. LCD
3. Arduino
4. Concept:
Vcc (+5V)
Trig (Trigger)
Echo
GND
bishalbtry@gmail.com 45
10. Ultra sonic sensor
CODE:
#define trigPin1 8
#define echoPin1 7
long duration, distance, UltraSensor;
void setup()
{
Serial.begin (9600);
pinMode(trigPin1, OUTPUT);
pinMode(echoPin1, INPUT);
}
void loop() {
SonarSensor(trigPin1, echoPin1);
UltraSensor = distance;
Serial.println(UltraSensor);
}
bishalbtry@gmail.com 46
void SonarSensor(int trigPin,int echoPin)
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
delay(100);
}
10. Ultra sonic sensor for Distance
calculation cont..
bishalbtry@gmail.com 47
THANK YOU
bishalbtry@gmail.com

More Related Content

What's hot

Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Jikrul Sayeed
 
Make: Tokyo Meeting 03
Make: Tokyo Meeting 03Make: Tokyo Meeting 03
Make: Tokyo Meeting 03
Shigeru Kobayashi
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
Marcus Tarquinio
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
Jason Griffey
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
Qtechknow
 
Arduino technical session 1
Arduino technical session 1Arduino technical session 1
Arduino technical session 1
Audiomas Soni
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
James Lewis
 
WHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power PlantWHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power Plant
José Enrique Crespo Moreno
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
June-Hao Hou
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
Punit Goswami
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
jhcid
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
Giorgio Aresu
 
CTC - What is Arduino
CTC - What is ArduinoCTC - What is Arduino
CTC - What is Arduino
David Cuartielles
 
Blinking LED's Animation Connected to a Port
Blinking LED's Animation Connected to a PortBlinking LED's Animation Connected to a Port
Blinking LED's Animation Connected to a Port
Rihab Rahman
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaIulius Bors
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started
동호 손
 
Html5 game, websocket e arduino
Html5 game, websocket e arduinoHtml5 game, websocket e arduino
Html5 game, websocket e arduino
monksoftwareit
 

What's hot (20)

Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
 
Make: Tokyo Meeting 03
Make: Tokyo Meeting 03Make: Tokyo Meeting 03
Make: Tokyo Meeting 03
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino technical session 1
Arduino technical session 1Arduino technical session 1
Arduino technical session 1
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
WHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power PlantWHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power Plant
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
 
CTC - What is Arduino
CTC - What is ArduinoCTC - What is Arduino
CTC - What is Arduino
 
Simply arduino
Simply arduinoSimply arduino
Simply arduino
 
Blinking LED's Animation Connected to a Port
Blinking LED's Animation Connected to a PortBlinking LED's Animation Connected to a Port
Blinking LED's Animation Connected to a Port
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuinta
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started
 
Html5 game, websocket e arduino
Html5 game, websocket e arduinoHtml5 game, websocket e arduino
Html5 game, websocket e arduino
 

Viewers also liked

PROTEUS - ARDUNIO PROGRAMMING FOR LCD
PROTEUS - ARDUNIO PROGRAMMING FOR LCDPROTEUS - ARDUNIO PROGRAMMING FOR LCD
PROTEUS - ARDUNIO PROGRAMMING FOR LCD
Hassan Khan
 
Arduino
ArduinoArduino
Arduino
vipin7vj
 
Your Future HTML: The Evolution of Site Design with Web Components
Your Future HTML: The Evolution of Site Design with Web ComponentsYour Future HTML: The Evolution of Site Design with Web Components
Your Future HTML: The Evolution of Site Design with Web Components
Ken Tabor
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoAhmed Sakr
 
Ppt on seminar
Ppt on seminarPpt on seminar
Ppt on seminar
Madhuri Bind
 
The Programmer
The ProgrammerThe Programmer
The Programmer
Kevlin Henney
 

Viewers also liked (6)

PROTEUS - ARDUNIO PROGRAMMING FOR LCD
PROTEUS - ARDUNIO PROGRAMMING FOR LCDPROTEUS - ARDUNIO PROGRAMMING FOR LCD
PROTEUS - ARDUNIO PROGRAMMING FOR LCD
 
Arduino
ArduinoArduino
Arduino
 
Your Future HTML: The Evolution of Site Design with Web Components
Your Future HTML: The Evolution of Site Design with Web ComponentsYour Future HTML: The Evolution of Site Design with Web Components
Your Future HTML: The Evolution of Site Design with Web Components
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Ppt on seminar
Ppt on seminarPpt on seminar
Ppt on seminar
 
The Programmer
The ProgrammerThe Programmer
The Programmer
 

Similar to Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal

arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
rajalakshmi769433
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019
Jong-Hyun Kim
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
mayur1432
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
Research Design Lab
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
srknec
 
Arduino programming part1
Arduino programming part1Arduino programming part1
Arduino programming part1
Amarjeetsingh Thakur
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Amarjeetsingh Thakur
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Amarjeetsingh Thakur
 
Arduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityArduino Workshop @ MSA University
Arduino Workshop @ MSA University
Ahmed Magdy Farid
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
Kishor Mhaske
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
ZainIslam20
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
AkhandPratapSingh86
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2
Satoru Tokuhisa
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
Md. Nahidul Islam
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
Vasily Ryzhonkov
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
Intel® Developer Zone Россия
 
Arduino
ArduinoArduino
Arduino
Jerin John
 
Intel galileo
Intel galileoIntel galileo
Intel galileo
Sofian Hadiwijaya
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
Jingfeng Liu
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
Amarjeetsingh Thakur
 

Similar to Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal (20)

arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
Arduino programming part1
Arduino programming part1Arduino programming part1
Arduino programming part1
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityArduino Workshop @ MSA University
Arduino Workshop @ MSA University
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Arduino
ArduinoArduino
Arduino
 
Intel galileo
Intel galileoIntel galileo
Intel galileo
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
 

Recently uploaded

一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
benykoy2024
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 

Recently uploaded (20)

一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 

Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal

  • 2. TOPICS: 1. Introduction to Arduino 2. Arduino Boards 3. Integrated Development Environment-IDE 4. What it can do? 5. Why arduino? 6. Arduino Uno complete description 7. Projects bishalbtry@gmail.com 2
  • 3. 1. Introduction: • First Arduino was introduced in 2005 • Arduino is an open-source prototyping platform • It is based on easy-to-use hardware and software • Microcontroller board design manufactured primarily by Smart Projects in Italy bishalbtry@gmail.com 3 Open Source Hardware
  • 5. 2. Arduino Boards cont… bishalbtry@gmail.com 5 Arduino miniFLORA
  • 6. 3. Integrated Development Environment(IDE): •IDE a cross-platform application written in Java • Designed to introduce programming to artists and other newcomers unfamiliar with software development • Code editor with features such as: i. syntax highlighting ii. brace matching iii. automatic indentation • Compiling and uploading programs to the board with a single click • A program or code written for Arduino is called a "sketch” • Arduino programs are written in C or C++ bishalbtry@gmail.com 6
  • 7. 3. IDE cont… • The Arduino IDE comes with a software library called "Wiring” • Two functions to make an executable cyclic executive program: •setup(): function run once at the start of a program that can initialize settings •loop(): function called repeatedly until the board powers off bishalbtry@gmail.com 7
  • 8. 3. IDE cont… Functions in Setup() 1. pinMode(13,OUTPUT)://makes pin 13 as output pin 2. pinMode(8, INPUT);//makes pin 8 as input pin 3. Serial.begin(9600) ;//starts serial communication with Baudrate 9600 Functions in loop() • 1. digitalWrite(13, HIGH): makes pin 13 high ie pin13=ON; • 2. delay(500) : delays system by 500 ms. • 3. analogRead() : Reads analog value • 4. analogWrite() : writes anlog value(PWM) • 5. Serial.print() : Prints at serial monitor • 6. Serial.println() : prints at serial monitor with line break bishalbtry@gmail.com 8
  • 9. 3. IDE cont… bishalbtry@gmail.com 9 1.Verify 2.Upload 3.NEW 4.Open :Library, example 5.Save 7.Message Panel 6.Code Panel *Port connected to IDE/Arduino board *Tool: port setting, board selection *Serial Monitor
  • 10. 4. What it can do? • Sensors ( to sense stuff ) – Push buttons*, touch pads, tilt switches. – Variable resistors* (eg. volume knob / sliders) – Photoresistors* (sensing light levels) – Thermistors* (temperature) – Ultrasound (proximity range finder) • Actuators ( to do stuff ) – Lights, LED’s* – Motors* – Speakers – Displays (LCD)* bishalbtry@gmail.com 10
  • 11. 5.Why Arduino? • Simplify working with microcontr • Inexpensive compare to other u-controller platform • Cross platform • Simple, clear programming environment • Simple, clear programming environment • Open source and extensible hardware bishalbtry@gmail.com 11
  • 12. 6.Arduino Uno Description: bishalbtry@gmail.com 12 Digital output ~: PWM. 1,0: Serial port Tx and Rx In circuit Serial programming Atmel MicroController Analog input. Power out and In USB port for power or programming 12v Power input 13 pin LED POWER on/off LED
  • 13. 6.Arduino Uno Description cont.. bishalbtry@gmail.com 13
  • 14. 6.Arduino Uno Description cont.. bishalbtry@gmail.com 14
  • 15. 7. Projects Idea: 1. LED Blink program 2. LED Fading 3. Variable Resistor controlled LED Blink 4. Variable Resistor controlled LED Intensity 5. LCD Interface 6. Keyboard Interface bishalbtry@gmail.com 15
  • 16. 7. Projects Idea cont… 7. Digital thermometer 8. Motor control via Button 9. Variable Resistor Controlled Servo Motor 10. Ultra Sonic Sensor Interface for Distance calculation bishalbtry@gmail.com 16
  • 17. 1. LED BLINK // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(13 LOW); // turn the LED off by making the voltage LOW delay(100); // wait for a second } bishalbtry@gmail.com 17
  • 18. 1. LED BLINK Proteus circuit bishalbtry@gmail.com 18
  • 19. 2.LED FADING: int ledPin = 9; // LED connected to digital pin 9 void setup() { pinMode(ledPin, OUTPUT); // nothing happens in setup } void loop() { // fade in from min to max in increments of 5 points: for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) { analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); bishalbtry@gmail.com 19
  • 20. 2.LED FADING cont…. } // fade out from max to min in increments of 5 points: for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); } } bishalbtry@gmail.com 20
  • 22. 3.Variable resistor controlled LED BLINK bishalbtry@gmail.com 22
  • 23. 3.Variable resistor controlled LED BLINK cont.. int sensorPin = A0; // select the input pin for the potentiometer int ledPin = 13; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor void setup() { pinMode(ledPin, OUTPUT); pinMode(lsensorPin, INPUT); } void loop() { sensorValue = analogRead(sensorPin); digitalWrite(ledPin, HIGH); delay(sensorValue); digitalWrite(ledPin, LOW); delay(sensorValue); } bishalbtry@gmail.com 23
  • 24. 4. Variable resistor controlled LED Intensity Do Yourself…….. IDEA to program this: 1. Read variable resistor value assign it to ‘C’ 2. Convert this ‘C’ value so that you supply that amount voltage to output pin 3. write this value to PWM pin using analogWrite() function bishalbtry@gmail.com 24
  • 26. 6.LCD Interface: *4 to 4lcd *5 to 6lcd *6,7,8,9 To 11, 12 13, 14 resp *VSS , R/W to Gnd *VDD to power bishalbtry@gmail.com 26
  • 27. 6.LCD Interface: • #include <LiquidCrystal.h> • LiquidCrystal lcd(4, 5, 6, 7, 8, 9); // pins for RS, E, DB4, DB5, DB6, DB7 • void setup() • { • lcd.begin(16,2); • lcd.clear(); • } • void loop() • { • lcd.setCursor(5,0); • lcd.print("Hello"); • lcd.setCursor(5,1); • lcd.print("world!"); • delay(10000); • } bishalbtry@gmail.com 27
  • 29. 7. Keyboard interface: LCD:RS,E,11,12,13,14 To:A0,A1,A2,A3,A4,A5 *Vss –Gnd, *VDD-power *R/W- Gnd Keyboard: (8,7,6)A to (1,2,3)K (5,4,3,2)A to (ABCD)K bishalbtry@gmail.com 29 5 4 3 2 8 7 6
  • 30. 7. Keyboard interface cont.. • #include <LiquidCrystal.h> • #include <Keypad.h> • LiquidCrystal lcd(A0,A1,A2, A3, A4, A5); • const byte ROWS = 4; //four rows • const byte COLS = 3; //three columns • char keys[ROWS][COLS] = { • {'1','2','3'}, • {'4','5','6'}, • {'7','8','9'}, • {'*','0','#'} • }; • byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad • byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad • Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); bishalbtry@gmail.com 30
  • 31. 7. Keyboard interface cont.. • void setup(){ • lcd.begin(16,2); • lcd.clear(); • lcd.setCursor(0,0); • keypad.setHoldTime(500); // Default is 1000mS • keypad.setDebounceTime(50); // Default is 50mS • } • void loop(){ • char key = keypad.getKey(); • if(key) • { • lcd.print(key); • } • } bishalbtry@gmail.com 31
  • 32. 8. Digital thermometer: bishalbtry@gmail.com 32 REQUREMENT: 16X2 LCD Arduino uno
  • 33. 8. Digital thermometer: Circuit Diagram bishalbtry@gmail.com 33
  • 34. 8. Digital thermometer: CODE: #include <LiquidCrystal.h> LiquidCrystal lcd(4, 5, 6, 7, 8, 9); int sensorPin = A0; //analog pin location void setup() { Serial.begin(9600); //Start the serial connection with the computer lcd.begin(16,2); //Must be defined or it goes to 16X1 lcd.clear(); // Starts with a clean screen } bishalbtry@gmail.com 34
  • 35. 8. Digital thermometer: CODE cont.. void loop() { //getting the voltage reading from the temperature sensor int reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3.3 float voltage = reading * 5.0; voltage /= 1024.0; // now print out the temperature (voltage-0.5) float temperatureC = (voltage ) * 100 ; //converting from 10 mv per degree wit 500 mV offset //to degrees ((voltage - 500mV) times 100) bishalbtry@gmail.com 35
  • 36. 8. Digital thermometer: CODE cont.. lcd.setCursor(0,0); lcd.print(temperatureC); lcd.println(" Celsius "); //Shows reading on LCD // now convert to Fahrenheit float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; lcd.setCursor(0,1); lcd.print(temperatureF); lcd.println(" Fahrenheit"); //Shows reading on LCD delay(500); //Update every 5 seconds, the value is measured in milliseconds ) } bishalbtry@gmail.com 36
  • 37. 9. Motor Control: Requirements: 1. Keyboard interface idea 2. Motor interface with digital o/p pin 3. Condition checking process in program if…else, switch(), OR anything…. bishalbtry@gmail.com 37
  • 38. 9. Motor Control cont.. bishalbtry@gmail.com 38
  • 39. 9. Motor Control cont.. • const int motorR = 13; //right direction motion assign pin • const int motorRB = 12;//right direction backward motion assign pin • const int motorL = 11; //left direction motion assign pin • const int motorLB = 10;//left direction backward motion assign pin • #include <Keypad.h> • const byte ROWS = 2; //2 rows • const byte COLS = 2;//2 column • char keys[ROWS][COLS] = { • {'1','2'}, • {'3','4'}, • }; • byte rowPins[ROWS] = {5, 4}; //connect to the row pinouts of the keypad • byte colPins[COLS] = {8, 7};// to coloumn pinout • Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); bishalbtry@gmail.com 39
  • 40. 9. Motor Control cont.. • void setup() { • // initialize the LED pin as an output: • pinMode(motorR, OUTPUT); • pinMode(motorRB, OUTPUT); • pinMode(motorL, OUTPUT); • pinMode(motorLB, OUTPUT); • pinMode(9, OUTPUT); • pinMode(6, OUTPUT); • // initialize the pushbutton pin as an input: • keypad.setHoldTime(500); • } bishalbtry@gmail.com 40
  • 41. 9. Motor Control cont.. • void loop() { • char key = keypad.getKey(); • if(key) • { • switch(key) • { • case ('1'): • right(); • break; • case ('2'): • left(); • break; • case ('3'): • forward(); • break; • case ('4'): • backward(); • break; • default: • stopp(); • } • • } • } bishalbtry@gmail.com 41
  • 42. 9. Motor Control cont.. • void right() • { digitalWrite(9,HIGH); • digitalWrite(6,LOW); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,LOW); • delay(300); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,HIGH); • } • void left() • { digitalWrite(6,HIGH); • digitalWrite(9,LOW); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,LOW); • delay(300); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,HIGH); • } • void forward() • { digitalWrite(9,HIGH); • digitalWrite(6,HIGH); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,LOW); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,LOW); • delay(300); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,HIGH); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,HIGH); • } • void backward() • { digitalWrite(9,HIGH); • digitalWrite(6,HIGH); • digitalWrite(motorR,LOW); • digitalWrite(motorRB,HIGH); • digitalWrite(motorL,LOW); • digitalWrite(motorLB,HIGH); • delay(300); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,HIGH); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,HIGH); • } • void stopp() • { digitalWrite(9,HIGH); • digitalWrite(6,HIGH); • digitalWrite(motorL,HIGH); • digitalWrite(motorLB,HIGH); • digitalWrite(motorR,HIGH); • digitalWrite(motorRB,HIGH); • } bishalbtry@gmail.com 42
  • 43. 10. Controlling Servo motor: Requirements: 1. Potentiometer interface 2. Motor interface 3. Variable data from POT applying to motor interface pin 4. Code on IDE: File>>Example>>servo>>knob OR follow the note code bishalbtry@gmail.com 43
  • 44. 10. Controlling Servo motor: bishalbtry@gmail.com 44
  • 45. 10. Ultra sonic sensor for Distance calculation Requirements: 1. Ultrasonic sensor 2. LCD 3. Arduino 4. Concept: Vcc (+5V) Trig (Trigger) Echo GND bishalbtry@gmail.com 45
  • 46. 10. Ultra sonic sensor CODE: #define trigPin1 8 #define echoPin1 7 long duration, distance, UltraSensor; void setup() { Serial.begin (9600); pinMode(trigPin1, OUTPUT); pinMode(echoPin1, INPUT); } void loop() { SonarSensor(trigPin1, echoPin1); UltraSensor = distance; Serial.println(UltraSensor); } bishalbtry@gmail.com 46 void SonarSensor(int trigPin,int echoPin) { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; delay(100); }
  • 47. 10. Ultra sonic sensor for Distance calculation cont.. bishalbtry@gmail.com 47

Editor's Notes

  1. Arduino is an open-source computer hardware and software company, project and user community that designs and manufacturesmicrocontroller-based kits for building digital devices and interactive objects that can sense and control the physical world.[1] The project is based on a family of microcontroller board designs manufactured primarily by SmartProjects in Italy,[2] and also by several other vendors, using various 8-bit Atmel AVR microcontrollers or 32-bit Atmel ARM processors. These systems provide sets of digital and analog I/O pins that can be interfaced to various expansion boards ("shields") and other circuits. The boards feature serial communications interfaces, including USB on some models, for loading programs from personal computers. For programming the microcontrollers, the Arduino platform provides an integrated development environment (IDE) based on the Processing project, which includes support for C,C++ and Java programming languages. The first Arduino was introduced in 2005, aiming to provide an inexpensive and easy way for novices and professionals to create devices that interact with their environment using sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, thermostats, and motion detectors.
  2. The Arduino integrated development environment (IDE) is a cross-platform application written in Java, and derives from the IDE for the Processing programming language and the Wiring projects. It is designed to introduce programming to artists and other newcomers unfamiliar with software development. It includes a code editor with features such as syntax highlighting, brace matching, and automatic indentation, and is also capable of compiling and uploading programs to the board with a single click. A program or code written for Arduino is called a "sketch".[18] Arduino programs are written in C or C++. The Arduino IDE comes with a software library called "Wiring" from the original Wiring project, which makes many common input/output operations much easier. The users need only to define two functions to make an executable cyclic executive program: setup(): a function run once at the start of a program that can initialize settings loop(): a function called repeatedly until the board powers off
  3. There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems: Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50 Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows. Simple, clear programming environment - The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino Open source and extensible software- The Arduino software is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if you want to. Open source and extensible hardware - The Arduino is based on Atmel's ATMEGA8 and ATMEGA168 microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money.
  4. The fading effect can not be detected on LED, so use Oscilloscope at that pin 9, so that you can see the varying pulse width on it. This simulates thae fading effect.
  5. Make sure that the used variable resistor in proteus is POT-HG , and you can also change the value of POT , by just clicking on the “1k” written text of it.
  6. int sensorPin = A0; // select the input pin for the potentiometer int ledPin = 13; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor void setup() { // declare the ledPin as an OUTPUT: pinMode(ledPin, OUTPUT); } void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); // turn the ledPin on digitalWrite(ledPin, HIGH); // stop the program for <sensorValue> milliseconds: delay(sensorValue); // turn the ledPin off: digitalWrite(ledPin, LOW); // stop the program for for <sensorValue> milliseconds: delay(sensorValue); }
  7. LCD we use for this interface is LM016L on proteus.
  8. Follow the pin connection , this is shown by brown color text
  9. We must be clear about the second command , here 4 pin is connected to RS pin of LCD and 5 to Enable and so on…
  10. 4x3 Keyboard work on the principle of row or column scan method
  11. Follow the pin connection ,
  12. #include <LiquidCrystal.h> LiquidCrystal lcd(4, 5, 6, 7, 8, 9); int sensorPin = A0; //analog pin location void setup() { Serial.begin(9600); //Start the serial connection with the computer lcd.begin(16,2); //Must be defined or it goes to 16X1 lcd.clear(); // Starts with a clean screen } void loop() { //getting the voltage reading from the temperature sensor int reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3.3 float voltage = reading * 5.0; voltage /= 1024.0; // now print out the temperature (voltage-0.5) float temperatureC = (voltage ) * 100 ; //converting from 10 mv per degree wit 500 mV offset //to degrees ((voltage - 500mV) times 100) lcd.setCursor(0,0); lcd.print(temperatureC); lcd.println(" Celsius "); //Shows reading on LCD // now convert to Fahrenheit float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; lcd.setCursor(0,1); lcd.print(temperatureF); lcd.println(" Fahrenheit"); //Shows reading on LCD delay(500); //Update every 5 seconds, the value is measured in milliseconds ) }
  13. const int motorR = 13; //right direction motion assign pin const int motorRB = 12;//right direction backward motion assign pin const int motorL = 11; //left direction motion assign pin const int motorLB = 10;//left direction backward motion assign pin #include <Keypad.h> const byte ROWS = 2; //2 rows const byte COLS = 2;//2 column char keys[ROWS][COLS] = { {'1','2'}, {'3','4'}, }; byte rowPins[ROWS] = {5, 4}; //connect to the row pinouts of the keypad byte colPins[COLS] = {8, 7};// to coloumn pinout Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup() { // initialize the LED pin as an output: pinMode(motorR, OUTPUT); pinMode(motorRB, OUTPUT); pinMode(motorL, OUTPUT); pinMode(motorLB, OUTPUT); pinMode(9, OUTPUT); pinMode(6, OUTPUT); // initialize the pushbutton pin as an input: keypad.setHoldTime(500); } void loop() { char key = keypad.getKey(); if(key) { switch(key) { case ('1'): right(); break; case ('2'): left(); break; case ('3'): forward(); break; case ('4'): backward(); break; default: stopp(); } } } void right() { digitalWrite(9,HIGH); digitalWrite(6,LOW); digitalWrite(motorR,HIGH); digitalWrite(motorRB,LOW); delay(300); digitalWrite(motorR,HIGH); digitalWrite(motorRB,HIGH); } void left() { digitalWrite(6,HIGH); digitalWrite(9,LOW); digitalWrite(motorL,HIGH); digitalWrite(motorLB,LOW); delay(300); digitalWrite(motorL,HIGH); digitalWrite(motorLB,HIGH); } void forward() { digitalWrite(9,HIGH); digitalWrite(6,HIGH); digitalWrite(motorR,HIGH); digitalWrite(motorRB,LOW); digitalWrite(motorL,HIGH); digitalWrite(motorLB,LOW); delay(300); digitalWrite(motorL,HIGH); digitalWrite(motorLB,HIGH); digitalWrite(motorR,HIGH); digitalWrite(motorRB,HIGH); } void backward() { digitalWrite(9,HIGH); digitalWrite(6,HIGH); digitalWrite(motorR,LOW); digitalWrite(motorRB,HIGH); digitalWrite(motorL,LOW); digitalWrite(motorLB,HIGH); delay(300); digitalWrite(motorL,HIGH); digitalWrite(motorLB,HIGH); digitalWrite(motorR,HIGH); digitalWrite(motorRB,HIGH); } void stopp() { digitalWrite(9,HIGH); digitalWrite(6,HIGH); digitalWrite(motorL,HIGH); digitalWrite(motorLB,HIGH); digitalWrite(motorR,HIGH); digitalWrite(motorRB,HIGH); }
  14. CODE : #include <Servo.h> Servo myservo; // create servo object to control a servo int potpin = 0; // analog pin used to connect the potentiometer int val; // variable to read the value from the analog pin void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there }
  15. What is an Ultrasonic Sensor? Ultrasonic Sensor is a simple sensor used for measuring the distance between sensor itself and any obstacle in front. The sensor has a transmitter and a receiver on it. I am gonna use HC-SR04 ultrasonic sensor for this project. This sensor consists of four pins, which are: Vcc (+5V) Trig (Trigger) Echo GND Trigger pin is an output pin while the Echo pin is an input pin, we will discuss them in Working section in detail. Moreover, it requires +5V to start operating. It is normally used to detect objects in front of it or to measure the distance between different objects. Working of Ultrasonic Sensor Its working is quite simple, as discussed above, it has a trigger and an echo pin. A signal of +5V is sent over to Trigger pin for around 10 microseconds in order to trigger the sensor. When ultrasonic sensor gets a trigger signal on its trigger pin then it emits an ultrasonic signal from the transmitter. This ultrasonic senor, then goes out and reflected back after hitting some object in front. This reflected ultrasonic signal is then captured by the receiver of ultrasonic sensor. As the sensor gets this reflected signal, it automatically make the Echo pin high. The time for which the Echo pin will remain HIGH, depends on the reflected signal. What we need to do is, we need to read this time for which the echo pin is high, which we are gonna do in our next section. Interfacing of Ultrasonic Sensor With Arduino Now we have seen the working of Ultrasonic sensor, so we have some idea what we need to do in order to get the values from it. First of all, we need to generate a signal of 10 microsecond and then send it over to trigger pin. After sending the trigger pin we then need to read the echo pin and wait for it to get HIGH. Once it got HIGH then we need to count the time for how long it remained HIGH. On the basis of this time, we are gonna calculate the distance of the object from the ultrasonic sensor. So, first of all, interface your ultrasonic sensor with arduino as shown in below figure #define trigPin1 8 #define echoPin1 7 long duration, distance, UltraSensor; void setup() { Serial.begin (9600); pinMode(trigPin1, OUTPUT); pinMode(echoPin1, INPUT); } void loop() { SonarSensor(trigPin1, echoPin1); UltraSensor = distance; Serial.println(UltraSensor); } void SonarSensor(int trigPin,int echoPin) { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; delay(100); } Now if you check in the SonarSensor() function, we are generating a pulse of 10 microsecond and sending it to trigPin, which is the trigger pin of our ultrasonic sensor. After sending this pulse weare using a funcion pulseIn() , its a builtin arduinofunction and is used to check for how long the echoPin remains HIGH. This value is further saved in the duration value and after that we have divided this duration by 2 because the pulse is first sent and then received so in actual it covers double distance, so we need to divide it by 2 in order to get distance between object and the sensor. Furthermore, it is again divided by 29.1, which is basically the speed of ultrasonic sound and finally we saved it in a variable named distance which is now in centimeters. After uploading the sketch in Arduino, you need to open the Serial Terminal and you will start receving the values of distance. //Button Press Detection int buttonPin = 7; void setup(){ pinMode(buttonPin, INPUT);//this time we will set the pin as INPUT Serial.begin(9600);//initialize Serial connection } void loop(){ if (digitalRead(buttonPin)==HIGH){//if button pressed Serial.println("pressed"); } else { Serial.println("unpressed"); } }