8
Most read
13
Most read
20
Most read
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

PDF
Arduino programming part1
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino
PDF
Mini CNC PROJECT
PDF
Introduction to Arduino
PDF
MX Lap Timer - An automatic stopwatch for Motocross
PPTX
PDF
Design and Development of CNC Writing and Drawing Machine
Arduino programming part1
Introduction to Arduino
Introduction to Arduino
Mini CNC PROJECT
Introduction to Arduino
MX Lap Timer - An automatic stopwatch for Motocross
Design and Development of CNC Writing and Drawing Machine

What's hot (20)

PDF
2009 11-17-arduino-basics
PPTX
Arduino Programming Familiarization
PPTX
Robotics camp'17 part2
PPT
2D Plotter Presentation
PPT
Multi Sensory Communication 2/2
PDF
Iaetsd vlsi based implementation of a digital
PDF
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
PDF
Easy GPS Tracker using Arduino and Python
PPTX
Arduino uno
PPTX
Mini Cnc Printer
PPSX
Embedded systems الانظمة المدمجة
PDF
Research and Prototyping Ground Robot Platform
PPTX
DIgital clock using verilog
PDF
CNC plotter controlled using Android application
PPTX
Controller Implementation in Verilog
PPTX
Embedded Systems & Robotics
PPTX
Arduino Microcontroller
PDF
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
PDF
WCAN mini ActionScript Vol.4
PPSX
Arduino اردوينو
2009 11-17-arduino-basics
Arduino Programming Familiarization
Robotics camp'17 part2
2D Plotter Presentation
Multi Sensory Communication 2/2
Iaetsd vlsi based implementation of a digital
Color Recognition with Matlab Image Processing and Matlab Interfacing with Ar...
Easy GPS Tracker using Arduino and Python
Arduino uno
Mini Cnc Printer
Embedded systems الانظمة المدمجة
Research and Prototyping Ground Robot Platform
DIgital clock using verilog
CNC plotter controlled using Android application
Controller Implementation in Verilog
Embedded Systems & Robotics
Arduino Microcontroller
Siemens s7 300-400-s7 graph for s7-300 400 programming sequential control sys...
WCAN mini ActionScript Vol.4
Arduino اردوينو
Ad

Similar to Arduino programming part 2 (20)

PPTX
Arduino Interfacing with different sensors and motor
PDF
FPGA based synchronous multi-channel PWM generator for humanoid robot
PDF
Edge_AI_Assignment_3.pdf
PDF
IRJET- Automatic Mini CNC Machine for PCB Drawing using Arduino
PPT
Hexapod ppt
PPTX
Introduction to Arduino
PDF
IRJET - Mobile Application Base Voice Command Wireless CNC Writing Machine
DOCX
Temperature Controlled Fan Report
PDF
Manuale Instatore User Manual
DOCX
Program, Code of Program and Screen Shot of Output (UNIVERSAL DRIVER USING µ...
PDF
Work Hour Measurement System for Tractor
PPTX
Micro-processor, Micro-controller and Peripherals
DOCX
IISC CPDM Task 1 Report
PDF
Analog to Digital Converter
PPTX
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
PDF
Joystick Controlled Wheelchair
PDF
Automatic mini CNC machine for PCB drawing and drilling
PDF
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
PPTX
presentation_28 (1).pptx
Arduino Interfacing with different sensors and motor
FPGA based synchronous multi-channel PWM generator for humanoid robot
Edge_AI_Assignment_3.pdf
IRJET- Automatic Mini CNC Machine for PCB Drawing using Arduino
Hexapod ppt
Introduction to Arduino
IRJET - Mobile Application Base Voice Command Wireless CNC Writing Machine
Temperature Controlled Fan Report
Manuale Instatore User Manual
Program, Code of Program and Screen Shot of Output (UNIVERSAL DRIVER USING µ...
Work Hour Measurement System for Tractor
Micro-processor, Micro-controller and Peripherals
IISC CPDM Task 1 Report
Analog to Digital Converter
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
Joystick Controlled Wheelchair
Automatic mini CNC machine for PCB drawing and drilling
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
presentation_28 (1).pptx
Ad

More from Amarjeetsingh Thakur (17)

PPTX
“Introduction to MATLAB & SIMULINK”
PDF
Python code for servo control using Raspberry Pi
PDF
Python code for Push button using Raspberry Pi
PDF
Python code for Buzzer Control using Raspberry Pi
PDF
Python openCV codes
PDF
Python Numpy Source Codes
PDF
Steemit html blog
PDF
Python OpenCV Real Time projects
PPTX
Adafruit_IoT_Platform
PDF
Core python programming tutorial
PDF
Python openpyxl
PPTX
Introduction to Internet of Things (IoT)
PPTX
Introduction to Node MCU
PPTX
Introduction to Things board (An Open Source IoT Cloud Platform)
PPTX
Introduction to MQ Telemetry Transport (MQTT)
PPTX
Image processing in MATLAB
PPTX
Image Processing Using MATLAB
“Introduction to MATLAB & SIMULINK”
Python code for servo control using Raspberry Pi
Python code for Push button using Raspberry Pi
Python code for Buzzer Control using Raspberry Pi
Python openCV codes
Python Numpy Source Codes
Steemit html blog
Python OpenCV Real Time projects
Adafruit_IoT_Platform
Core python programming tutorial
Python openpyxl
Introduction to Internet of Things (IoT)
Introduction to Node MCU
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to MQ Telemetry Transport (MQTT)
Image processing in MATLAB
Image Processing Using MATLAB

Recently uploaded (20)

PPTX
CyberSecurity Mobile and Wireless Devices
PPTX
ai_satellite_crop_management_20250815030350.pptx
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PPTX
Principal presentation for NAAC (1).pptx
PPTX
Building constraction Conveyance of water.pptx
PPTX
Amdahl’s law is explained in the above power point presentations
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PDF
Design Guidelines and solutions for Plastics parts
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
Software Engineering and software moduleing
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
PDF
Unit1 - AIML Chapter 1 concept and ethics
PDF
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
PDF
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Measurement Uncertainty and Measurement System analysis
PDF
First part_B-Image Processing - 1 of 2).pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
CyberSecurity Mobile and Wireless Devices
ai_satellite_crop_management_20250815030350.pptx
Module 8- Technological and Communication Skills.pptx
Computer System Architecture 3rd Edition-M Morris Mano.pdf
Principal presentation for NAAC (1).pptx
Building constraction Conveyance of water.pptx
Amdahl’s law is explained in the above power point presentations
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
Design Guidelines and solutions for Plastics parts
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Software Engineering and software moduleing
Exploratory_Data_Analysis_Fundamentals.pdf
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
Unit1 - AIML Chapter 1 concept and ethics
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Measurement Uncertainty and Measurement System analysis
First part_B-Image Processing - 1 of 2).pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf

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