SlideShare a Scribd company logo
ARDUINO PROGRAMMING
SESSION 2
1
Presented By
Amarjeetsingh Thakur
9/28/2020
What is the principle behind variable
output voltage?
PWM Concept
29/28/2020
What is PWM(Pulse width Modulation)?
39/28/2020
PWM power control
49/28/2020
Fan example
You can run the fan at
different speeds
How do you make the choice
of speed?
Table fan button
59/28/2020
Keypad Module
69/28/2020
Keypad Program
79/28/2020
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
89/28/2020
Contd..
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins,
ROWS, COLS);
void setup(){
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
}
99/28/2020
SENSORS
What is a sensor?
“A sensor is an object whose purpose is to detect events
or changes in its environment, and then provide a
corresponding output”.
Why do we need sensor?
• A sensor is the guy who provides data to the a system
via its input.
• We need sensor to feed data to the system and tells
the controller when to take action
109/28/2020
Most used sensors for Arduino
1. Temperature + Humidity Sensor
This is a temperature/humidity sensor. It
monitors the ambient temperature or
humidity.
119/28/2020
2. IR Sensor:
• This is a multipurpose infrared sensor which can
be used for color detection.The sensor provides a
digital as well as analog output. An on board LED
is used to indicate the presence of an object. This
digital output can be directly connected to an
Arduino, Raspberry Pi or any other
microcontroller to read the sensor output.
129/28/2020
IR sensor Program
139/28/2020
//IR sensor with digital input at pin no. 2
const int IR_Sensor=2;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED on Arduino boards:
pinMode(13, OUTPUT);
//Pin 2 is connected to the output of IR_Sensor
pinMode(IR_Sensor,INPUT);
}
void loop() {
if(digitalRead(IR_Sensor)==HIGH) //Check the sensor output
{
149/28/2020
digitalWrite(13, HIGH); // set the LED on
}
else
{
digitalWrite(13, LOW); // set the LED off
}
delay(1000); // wait for a second
}
Contd..
159/28/2020
Do you remember which actuator was used in
this Access gate?
Stepper Motor
169/28/2020
Working principle
179/28/2020
• Stepper motors are called as Digital motor
– It takes digital input to move by a step.
• Stepper motor is specified by step angle of say
200 steps per revolution
– 1.8 degree per step
189/28/2020
• To move a step we need to provide a digital
input sequence to windings.
• The sequence for bipolar/unipolar is
1000 // 1st step
0100 // 2nd step
0010 // 3rd step
0001 // 4th step
1000 // repeat of sequence for 5th step
199/28/2020
Activity 2.1
Type : Team of 2 Duration : 30 Minutes
Write a program to run stepper motor in
clockwise direction
209/28/2020
Stepper Motor Speed Control
219/28/2020
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
*/
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per
revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
229/28/2020
Contd..
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);//Without delay stepper motor will rotate continuosly
}
239/28/2020
Topic Learning Outcomes
At the end of the topic you should be able to:
1. Interface a sensor/s, device/s with Arduino
for data acquisition and display the data.
2. Interface Actuators with Arduino to Control
motion to build an application.
3. Build a mechatronic system using Arduino,
sensors, actuators and modules.
249/28/2020

More Related Content

What's hot (20)

2009 11-17-arduino-basics
2009 11-17-arduino-basics2009 11-17-arduino-basics
2009 11-17-arduino-basics
Jhonny Wladimir Peñaloza Cabello
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
Amit Kumer Podder
 
Robotics camp'17 part2
Robotics camp'17 part2Robotics camp'17 part2
Robotics camp'17 part2
Mohamed Okasha
 
2D Plotter Presentation
2D Plotter Presentation2D Plotter Presentation
2D Plotter Presentation
Mahmoud Kandil
 
Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Multi Sensory Communication 2/2
Multi Sensory Communication 2/2
Satoru Tokuhisa
 
Iaetsd vlsi based implementation of a digital
Iaetsd vlsi based implementation of a digitalIaetsd vlsi based implementation of a digital
Iaetsd vlsi based implementation of a digital
Iaetsd Iaetsd
 
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Sayan Seth
 
Easy GPS Tracker using Arduino and Python
Easy GPS Tracker using Arduino and PythonEasy GPS Tracker using Arduino and Python
Easy GPS Tracker using Arduino and Python
Núria Vilanova
 
Arduino uno
Arduino unoArduino uno
Arduino uno
creatjet3d labs
 
Mini Cnc Printer
Mini Cnc PrinterMini Cnc Printer
Mini Cnc Printer
Mauryasuraj98
 
Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة
salih mahmod
 
Research and Prototyping Ground Robot Platform
Research and Prototyping Ground Robot PlatformResearch and Prototyping Ground Robot Platform
Research and Prototyping Ground Robot Platform
charlesk
 
DIgital clock using verilog
DIgital clock using verilog DIgital clock using verilog
DIgital clock using verilog
Abhishek Sainkar
 
CNC plotter controlled using Android application
CNC plotter controlled using Android applicationCNC plotter controlled using Android application
CNC plotter controlled using Android application
Yuval Yoskovits
 
Controller Implementation in Verilog
Controller Implementation in VerilogController Implementation in Verilog
Controller Implementation in Verilog
Anees Akhtar
 
Embedded Systems & Robotics
Embedded Systems  & RoboticsEmbedded Systems  & Robotics
Embedded Systems & Robotics
spoorani
 
Arduino Microcontroller
Arduino Microcontroller Arduino Microcontroller
Arduino Microcontroller
creatjet3d labs
 
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Dien Ha The
 
WCAN mini ActionScript Vol.4
WCAN mini ActionScript Vol.4WCAN mini ActionScript Vol.4
WCAN mini ActionScript Vol.4
Shigeru Kobayashi
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
Amit Kumer Podder
 
Robotics camp'17 part2
Robotics camp'17 part2Robotics camp'17 part2
Robotics camp'17 part2
Mohamed Okasha
 
2D Plotter Presentation
2D Plotter Presentation2D Plotter Presentation
2D Plotter Presentation
Mahmoud Kandil
 
Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Multi Sensory Communication 2/2
Multi Sensory Communication 2/2
Satoru Tokuhisa
 
Iaetsd vlsi based implementation of a digital
Iaetsd vlsi based implementation of a digitalIaetsd vlsi based implementation of a digital
Iaetsd vlsi based implementation of a digital
Iaetsd Iaetsd
 
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Sayan Seth
 
Easy GPS Tracker using Arduino and Python
Easy GPS Tracker using Arduino and PythonEasy GPS Tracker using Arduino and Python
Easy GPS Tracker using Arduino and Python
Núria Vilanova
 
Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة
salih mahmod
 
Research and Prototyping Ground Robot Platform
Research and Prototyping Ground Robot PlatformResearch and Prototyping Ground Robot Platform
Research and Prototyping Ground Robot Platform
charlesk
 
DIgital clock using verilog
DIgital clock using verilog DIgital clock using verilog
DIgital clock using verilog
Abhishek Sainkar
 
CNC plotter controlled using Android application
CNC plotter controlled using Android applicationCNC plotter controlled using Android application
CNC plotter controlled using Android application
Yuval Yoskovits
 
Controller Implementation in Verilog
Controller Implementation in VerilogController Implementation in Verilog
Controller Implementation in Verilog
Anees Akhtar
 
Embedded Systems & Robotics
Embedded Systems  & RoboticsEmbedded Systems  & Robotics
Embedded Systems & Robotics
spoorani
 
Arduino Microcontroller
Arduino Microcontroller Arduino Microcontroller
Arduino Microcontroller
creatjet3d labs
 
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
Dien Ha The
 
WCAN mini ActionScript Vol.4
WCAN mini ActionScript Vol.4WCAN mini ActionScript Vol.4
WCAN mini ActionScript Vol.4
Shigeru Kobayashi
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 

Similar to Arduino programming part 2 (20)

Arduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motorArduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motor
Amarjeetsingh Thakur
 
Edge_AI_Assignment_3.pdf
Edge_AI_Assignment_3.pdfEdge_AI_Assignment_3.pdf
Edge_AI_Assignment_3.pdf
ShivamMishra603376
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
AntonAndreev13
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
MajdyShamasneh
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
Vishnu
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
Qtechknow
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
SanthanaMari11
 
Arduino learning
Arduino   learningArduino   learning
Arduino learning
Anil Yadav
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
sunilkumar652338
 
Ardui no
Ardui no Ardui no
Ardui no
Amol Sakhalkar
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdf
AbdErrezakChahoub
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Brian Huang
 
Physical prototyping lab6-motors
Physical prototyping lab6-motorsPhysical prototyping lab6-motors
Physical prototyping lab6-motors
Tony Olsson.
 
Arduino tutorial A to Z
Arduino tutorial A to ZArduino tutorial A to Z
Arduino tutorial A to Z
Md. Asaduzzaman Jabin
 
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
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and Arduino
Brian Huang
 
Unit 4 Part I.ppt this contains notes for
Unit 4 Part I.ppt this contains notes forUnit 4 Part I.ppt this contains notes for
Unit 4 Part I.ppt this contains notes for
vaishnavibhapkar1207
 
01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt
pindi2197
 
Arduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motorArduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motor
Amarjeetsingh Thakur
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
MajdyShamasneh
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
Vishnu
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
Qtechknow
 
Arduino learning
Arduino   learningArduino   learning
Arduino learning
Anil Yadav
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdf
AbdErrezakChahoub
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Brian Huang
 
Physical prototyping lab6-motors
Physical prototyping lab6-motorsPhysical prototyping lab6-motors
Physical prototyping lab6-motors
Tony Olsson.
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
ZainIslam20
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and Arduino
Brian Huang
 
Unit 4 Part I.ppt this contains notes for
Unit 4 Part I.ppt this contains notes forUnit 4 Part I.ppt this contains notes for
Unit 4 Part I.ppt this contains notes for
vaishnavibhapkar1207
 
01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt
pindi2197
 
Ad

More from Amarjeetsingh Thakur (17)

“Introduction to MATLAB & SIMULINK”
“Introduction to MATLAB  & SIMULINK”“Introduction to MATLAB  & SIMULINK”
“Introduction to MATLAB & SIMULINK”
Amarjeetsingh Thakur
 
Python code for servo control using Raspberry Pi
Python code for servo control using Raspberry PiPython code for servo control using Raspberry Pi
Python code for servo control using Raspberry Pi
Amarjeetsingh Thakur
 
Python code for Push button using Raspberry Pi
Python code for Push button using Raspberry PiPython code for Push button using Raspberry Pi
Python code for Push button using Raspberry Pi
Amarjeetsingh Thakur
 
Python code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry PiPython code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry Pi
Amarjeetsingh Thakur
 
Python openCV codes
Python openCV codesPython openCV codes
Python openCV codes
Amarjeetsingh Thakur
 
Python Numpy Source Codes
Python Numpy Source CodesPython Numpy Source Codes
Python Numpy Source Codes
Amarjeetsingh Thakur
 
Steemit html blog
Steemit html blogSteemit html blog
Steemit html blog
Amarjeetsingh Thakur
 
Python OpenCV Real Time projects
Python OpenCV Real Time projectsPython OpenCV Real Time projects
Python OpenCV Real Time projects
Amarjeetsingh Thakur
 
Adafruit_IoT_Platform
Adafruit_IoT_PlatformAdafruit_IoT_Platform
Adafruit_IoT_Platform
Amarjeetsingh Thakur
 
Core python programming tutorial
Core python programming tutorialCore python programming tutorial
Core python programming tutorial
Amarjeetsingh Thakur
 
Python openpyxl
Python openpyxlPython openpyxl
Python openpyxl
Amarjeetsingh Thakur
 
Introduction to Internet of Things (IoT)
Introduction to Internet of Things (IoT)Introduction to Internet of Things (IoT)
Introduction to Internet of Things (IoT)
Amarjeetsingh Thakur
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
Amarjeetsingh Thakur
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)
Amarjeetsingh Thakur
 
Introduction to MQ Telemetry Transport (MQTT)
Introduction to MQ Telemetry Transport (MQTT)Introduction to MQ Telemetry Transport (MQTT)
Introduction to MQ Telemetry Transport (MQTT)
Amarjeetsingh Thakur
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
Amarjeetsingh Thakur
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
“Introduction to MATLAB & SIMULINK”
“Introduction to MATLAB  & SIMULINK”“Introduction to MATLAB  & SIMULINK”
“Introduction to MATLAB & SIMULINK”
Amarjeetsingh Thakur
 
Python code for servo control using Raspberry Pi
Python code for servo control using Raspberry PiPython code for servo control using Raspberry Pi
Python code for servo control using Raspberry Pi
Amarjeetsingh Thakur
 
Python code for Push button using Raspberry Pi
Python code for Push button using Raspberry PiPython code for Push button using Raspberry Pi
Python code for Push button using Raspberry Pi
Amarjeetsingh Thakur
 
Python code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry PiPython code for Buzzer Control using Raspberry Pi
Python code for Buzzer Control using Raspberry Pi
Amarjeetsingh Thakur
 
Introduction to Internet of Things (IoT)
Introduction to Internet of Things (IoT)Introduction to Internet of Things (IoT)
Introduction to Internet of Things (IoT)
Amarjeetsingh Thakur
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)
Amarjeetsingh Thakur
 
Introduction to MQ Telemetry Transport (MQTT)
Introduction to MQ Telemetry Transport (MQTT)Introduction to MQ Telemetry Transport (MQTT)
Introduction to MQ Telemetry Transport (MQTT)
Amarjeetsingh Thakur
 
Ad

Recently uploaded (20)

4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...
ijait
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design exampleTEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quizgrade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Structural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant ConversionStructural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant Conversion
DanielRoman285499
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
Impurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptxImpurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptx
dhanashree78
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptxFundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...4th International Conference on Computer Science and Information Technology (...
4th International Conference on Computer Science and Information Technology (...
ijait
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design exampleTEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quizgrade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Structural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant ConversionStructural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant Conversion
DanielRoman285499
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
Impurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptxImpurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptx
dhanashree78
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptxFundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 

Arduino programming part 2

  • 1. ARDUINO PROGRAMMING SESSION 2 1 Presented By Amarjeetsingh Thakur 9/28/2020
  • 2. What is the principle behind variable output voltage? PWM Concept 29/28/2020
  • 3. What is PWM(Pulse width Modulation)? 39/28/2020
  • 5. Fan example You can run the fan at different speeds How do you make the choice of speed? Table fan button 59/28/2020
  • 8. #include <Keypad.h> const byte ROWS = 4; const byte COLS = 4; char hexaKeys[ROWS][COLS] = { {'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'} }; byte rowPins[ROWS] = {9, 8, 7, 6}; byte colPins[COLS] = {5, 4, 3, 2}; 89/28/2020
  • 9. Contd.. Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); void setup(){ Serial.begin(9600); } void loop(){ char customKey = customKeypad.getKey(); if (customKey){ Serial.println(customKey); } } 99/28/2020
  • 10. SENSORS What is a sensor? “A sensor is an object whose purpose is to detect events or changes in its environment, and then provide a corresponding output”. Why do we need sensor? • A sensor is the guy who provides data to the a system via its input. • We need sensor to feed data to the system and tells the controller when to take action 109/28/2020
  • 11. Most used sensors for Arduino 1. Temperature + Humidity Sensor This is a temperature/humidity sensor. It monitors the ambient temperature or humidity. 119/28/2020
  • 12. 2. IR Sensor: • This is a multipurpose infrared sensor which can be used for color detection.The sensor provides a digital as well as analog output. An on board LED is used to indicate the presence of an object. This digital output can be directly connected to an Arduino, Raspberry Pi or any other microcontroller to read the sensor output. 129/28/2020
  • 14. //IR sensor with digital input at pin no. 2 const int IR_Sensor=2; void setup() { // initialize the digital pin as an output. // Pin 13 has an LED on Arduino boards: pinMode(13, OUTPUT); //Pin 2 is connected to the output of IR_Sensor pinMode(IR_Sensor,INPUT); } void loop() { if(digitalRead(IR_Sensor)==HIGH) //Check the sensor output { 149/28/2020
  • 15. digitalWrite(13, HIGH); // set the LED on } else { digitalWrite(13, LOW); // set the LED off } delay(1000); // wait for a second } Contd.. 159/28/2020
  • 16. Do you remember which actuator was used in this Access gate? Stepper Motor 169/28/2020
  • 18. • Stepper motors are called as Digital motor – It takes digital input to move by a step. • Stepper motor is specified by step angle of say 200 steps per revolution – 1.8 degree per step 189/28/2020
  • 19. • To move a step we need to provide a digital input sequence to windings. • The sequence for bipolar/unipolar is 1000 // 1st step 0100 // 2nd step 0010 // 3rd step 0001 // 4th step 1000 // repeat of sequence for 5th step 199/28/2020
  • 20. Activity 2.1 Type : Team of 2 Duration : 30 Minutes Write a program to run stepper motor in clockwise direction 209/28/2020
  • 21. Stepper Motor Speed Control 219/28/2020
  • 22. /* Stepper Motor Control - one revolution This program drives a unipolar or bipolar stepper motor. The motor is attached to digital pins 8 - 11 of the Arduino. The motor should revolve one revolution in one direction, then one revolution in the other direction. */ #include <Stepper.h> const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution // for your motor // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); 229/28/2020
  • 23. Contd.. void setup() { // set the speed at 60 rpm: myStepper.setSpeed(60); // initialize the serial port: Serial.begin(9600); } void loop() { // step one revolution in one direction: Serial.println("clockwise"); myStepper.step(stepsPerRevolution); delay(500);//Without delay stepper motor will rotate continuosly } 239/28/2020
  • 24. Topic Learning Outcomes At the end of the topic you should be able to: 1. Interface a sensor/s, device/s with Arduino for data acquisition and display the data. 2. Interface Actuators with Arduino to Control motion to build an application. 3. Build a mechatronic system using Arduino, sensors, actuators and modules. 249/28/2020