SlideShare a Scribd company logo
INTRO TO ARDUINO
Lorlie B. Andres, MECOE
ARDUINO
 Arduino is a prototype platform (open-source) based on an easy-
to-use hardware and software.
 It consists of a circuit board, which can be programed (referred
to as a microcontroller) and a ready-made software called
Arduino IDE (Integrated Development Environment), which is
used to write and upload the computer code to the physical
board.
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
BOARD TYPES
Arduino boards have one thing in common: they are
programed through the Arduino IDE.
The differences are based on the number of inputs and
outputs (the number of sensors, LEDs, and buttons you can use
on a single board), speed, operating voltage, form factor etc.
Some boards are designed to be embedded and have no
programming interface (hardware), which you would need to
buy separately.
Some can run directly from a 3.7V battery, others need at least
5V.
DIFFERENT COMPONENTS ON THE ARDUINO
BOARD.
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
3 MAIN PARTS OF ARDUINO PROGRAM
Structure
Values (variables and constants)
Functions
TWO MAIN FUNCTIONS OF SOFTWARE
STRUCTURE
Setup( ) function
The setup() function is called when a sketch starts. Use it to
initialize the variables, pin modes, start using libraries, etc.
The setup function will only run once, after each power up
or reset of the Arduino board.
Loop( ) function
loop() function does precisely what its name suggests, and
loops consecutively, allowing your program to change
and respond. Use it to actively control the Arduino board.
Structure
• Software structure consist of
two main functions:
• Setup( ) function
• Loop( ) function
INTRODUCTION TO ARDUINO and sensors for arduino.pptx
INPUT/OUTPUT FUNCTION
pinMode() function
 The pinMode() function is used to configure a specific pin to
behave either as an input or an output.
 pinMode() Function Syntax
pinMode (pin , mode);
pin − the number of the pin whose mode you wish to
set
mode − INPUT, OUTPUT.
SAMPLE SKETCH
int button = 5 ; // button connected to pin 5
int LED = 6; // LED connected to pin 6
void setup () {
pinMode(button , INPUT);
// set the digital pin as input
pinMode(LED , OUTPUT);
// set the digital pin as output
}
digitalWrite() function
 the digitalWrite() function is used to write a HIGH or a LOW
value to a digital pin.
 If the pin has been configured as an OUTPUT with pinMode(),
its voltage will be set to the corresponding value: 5V (or 3.3V
on 3.3V boards) for HIGH, 0V (ground) for LOW.
 If the pin is configured as an INPUT, digitalWrite() will enable
(HIGH) or disable (LOW) the internal pullup on the input pin.
digitalWrite() function syntax
Syntax:
digitalWrite (pin ,value);
Parameters:
pin − the number of the pin whose mode you wish to set
value − HIGH, or LOW.
SAMPLE SKETCH
void loop () {
If (digitalRead(button ) == LOW) // if button pressed {
digitalWrite(LED,HIGH); // turn on led
delay(500); // delay for 500 ms
digitalWrite(LED,LOW); // turn off led
delay(500); // delay for 500 ms
}
}
digitalRead() function
 digitalRead is used to read the status of any digital Pin in Arduino.
 Syntax
digitalRead(pin)
 Parameters
pin: the Arduino pin number you want to read
 Returns
HIGH or LOW
SAMPLE SKETCH
int button = 5 ; // button connected to pin 5
int LED = 6; // LED connected to pin 6
void setup () {
pinMode(button , INPUT);
// set the digital pin as input
pinMode(LED , OUTPUT);
// set the digital pin as output
}
void loop () {
X=digitalRead(7);
If (digitalRead(button ) == LOW) // if button pressed {
digitalWrite(LED,HIGH); // turn on led
delay(500); // delay for 500 ms
digitalWrite(LED,LOW); // turn off led
delay(500); // delay for 500 ms
}
}
analogRead( ) function
 Arduino is able to detect whether there is a voltage applied to one of its pins and
report it through the digitalRead() function.
 There is a difference between an on/off sensor (which detects the presence of an
object) and an analog sensor, whose value continuously changes.
 In the lower-right part of the Arduino board, you will see six pins marked “Analog In”.
 These special pins not only tell whether there is a voltage applied to them, but also
its value.
 By using the analogRead() function, we can read the voltage applied to one of the
pins.
 This function returns a number between 0 and 1023, which represents voltages
between 0 and 5 volts.
 For example, if there is a voltage of 2.5 V applied to pin number 0, analogRead(0)
returns 512
analogRead() function syntax
 analogRead(pin);
pin − the number of the analog input pin to read from (0
to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the
Mega)
SAMPLE SKETCH
int analogPin = 3;//potentiometer wiper (middle terminal)
// connected to analog pin 3
int val = 0; // variable to store the value read
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
BLINKING LED
It is as simple as
turning a light on
and off.
Pin Configuration of
LED
BLINKING LED CIRCUIT CONNECTION
SOURCE CODE
int LED_OUTPUT_PIN = 3;
void setup() {
pinMode(LED_OUTPUT_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_OUTPUT_PIN, HIGH); // turn LED on (output 5V)
delay(1000); // wait one second
digitalWrite(LED_OUTPUT_PIN, LOW); // turn LED off (output 0V)
delay(1000); // wait another second
}
SENSOR AND THEIR
APPLICATIONS
WHAT IS A SENSOR?
A sensor is a device that detects and
responds to some type of input from the
physical environment.
 The input can be light, heat, motion, moisture,
pressure or any number of other environmental
phenomena. The output is generally a signal that is
converted to a human-readable display at the
sensor location or transmitted electronically over a
network for reading or further processing.
REAL TIME APPLICATION OF SENSORS
(Autopilot System In Aircrafts)
EXAMPLES OF SENSORS
CLASSIFICATION OF SENSOR
Analog Sensors produce an analog output i.e.,
a continuous output signal (usually voltage but
sometimes other quantities like Resistance
etc.) with respect to the quantity being
measured.
Digital Sensors work with discrete or digital
data. The data in digital sensors, which are
used for conversion and transmission, is digital
in nature.
SOIL MOISTURE SENSOR
 The Soil Moisture Sensor measures soil moisture
grace to the changes in electrical conductivity
of the earth ( soil resistance increases with
drought ).
 The electrical resistance is measured between
the two electrodes of the sensor. A comparator
activates a digital output when a adjustable
threshold is exceeded.
SOIL MOISTURE SENSOR CIRCUIT
CONNECTION
ARDUINO SKETCH FOR SOIL MOISTURE
SENSOR
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
}
void loop() {
sensorValue = analogRead(A0);
Serial.println("Analog Value : ");
Serial.println(sensorValue);
WATER LEVEL SENSOR
 This sensor can be used to measure the water
level, monitor a sump pit, detect rainfall or
detect leakage.
 The series of exposed parallel conductors,
together act as a variable resistor (just like a
potentiometer) whose resistance varies
according to the water level.
 The change in resistance corresponds to the
distance from the top of the sensor to the surface
of the water.
WATER LEVEL SENSOR CIRCUIT
CONNECTION
ARDUINO SKETCH FOR WATER LEVEL
SENSOR
void setup() {
pinMode(sensorPower, OUTPUT);
digitalWrite(sensorPower, LOW);
Serial.begin(9600);
}
void loop() {
int level = readSensor();
Serial.print("Water level: ");
Serial.println(level);
}
FINAL ACTIVITY
Develop an Arduino program that monitors
the soil moisture level using a sensor. If the
measured soil moisture falls below the
threshold value of 25, the program should
activate a LED and make it blink five times.
Conversely, if the soil moisture reading is equal
to or above 25, the LED should remain off.
THANK YOU AND GOD BLESS
Ad

More Related Content

Similar to INTRODUCTION TO ARDUINO and sensors for arduino.pptx (20)

Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
Ravikumar Tiwari
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Luki B. Subekti
 
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
 
Arduino . .
Arduino             .                             .Arduino             .                             .
Arduino . .
dryazhinians
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
sunilkumar652338
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
Jonah Marrs
 
Presentation of online Internship Program on Arduino completed at INTERNSHALA
Presentation of online Internship Program on Arduino completed at INTERNSHALAPresentation of online Internship Program on Arduino completed at INTERNSHALA
Presentation of online Internship Program on Arduino completed at INTERNSHALA
AviPatel16612
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
Yogendra Tamang
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
AditiBhushan3
 
arduino simulators OR microcontroller.pptx
arduino simulators OR microcontroller.pptxarduino simulators OR microcontroller.pptx
arduino simulators OR microcontroller.pptx
JohnMarkCatalua1
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
VilayatAli5
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
sachin chaurasia
 
publish manual
publish manualpublish manual
publish manual
John Webster
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
ssusere5db05
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
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
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
Jonah Marrs
 
Presentation of online Internship Program on Arduino completed at INTERNSHALA
Presentation of online Internship Program on Arduino completed at INTERNSHALAPresentation of online Internship Program on Arduino completed at INTERNSHALA
Presentation of online Internship Program on Arduino completed at INTERNSHALA
AviPatel16612
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
Yogendra Tamang
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
arduino simulators OR microcontroller.pptx
arduino simulators OR microcontroller.pptxarduino simulators OR microcontroller.pptx
arduino simulators OR microcontroller.pptx
JohnMarkCatalua1
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
VilayatAli5
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
sachin chaurasia
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
ssusere5db05
 

Recently uploaded (20)

C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptxC.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
quliyevlogman4
 
Spectrophotometer instrument basics -.pptx
Spectrophotometer instrument basics -.pptxSpectrophotometer instrument basics -.pptx
Spectrophotometer instrument basics -.pptx
muthulakshmitc
 
the-importance-of-learning-french-140722055824-phpapp01.ppt
the-importance-of-learning-french-140722055824-phpapp01.pptthe-importance-of-learning-french-140722055824-phpapp01.ppt
the-importance-of-learning-french-140722055824-phpapp01.ppt
LipicaJasujaWadhwa
 
ppt untuk seminar proposal dan persiapannya
ppt untuk seminar proposal dan persiapannyappt untuk seminar proposal dan persiapannya
ppt untuk seminar proposal dan persiapannya
Rasidinmamakidin
 
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).pptIntroduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
AshaManjhi
 
Multilingual hand gesture to speech conversion system
Multilingual hand gesture to speech conversion systemMultilingual hand gesture to speech conversion system
Multilingual hand gesture to speech conversion system
Himabindu905359
 
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptxADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
c2422429
 
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
usmankhan66g66
 
THE SCANNING ELECTRON MICROSOPE (SEM)....
THE SCANNING ELECTRON MICROSOPE (SEM)....THE SCANNING ELECTRON MICROSOPE (SEM)....
THE SCANNING ELECTRON MICROSOPE (SEM)....
RahulRajai
 
OSPF & DHCP PPT.pptx it is relATED TO NETWORKING
OSPF & DHCP PPT.pptx it is relATED TO NETWORKINGOSPF & DHCP PPT.pptx it is relATED TO NETWORKING
OSPF & DHCP PPT.pptx it is relATED TO NETWORKING
ritikghw
 
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
Taqyea
 
High Perfomance and Reliability Inverter
High Perfomance and Reliability InverterHigh Perfomance and Reliability Inverter
High Perfomance and Reliability Inverter
CarlosFranco13613
 
Mischief and cheating - yashita (2405230008).pptx
Mischief and cheating - yashita (2405230008).pptxMischief and cheating - yashita (2405230008).pptx
Mischief and cheating - yashita (2405230008).pptx
YashitaAhuja
 
How to Buy a Telegram Account_ Everything You Need to Know.pdf
How to Buy a Telegram Account_ Everything You Need to Know.pdfHow to Buy a Telegram Account_ Everything You Need to Know.pdf
How to Buy a Telegram Account_ Everything You Need to Know.pdf
buelljasonnn
 
Bone Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
Bone   Tubeoudgkaitaurauraurarhafhau4rculosis.pptxBone   Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
Bone Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
gaisga4er
 
Clip Studio Paint EX Crack Download (Latest Version 2025)
Clip Studio Paint EX Crack Download (Latest Version 2025)Clip Studio Paint EX Crack Download (Latest Version 2025)
Clip Studio Paint EX Crack Download (Latest Version 2025)
usmankhan66g66
 
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptxSlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
huyenpham220998
 
Linepro - Product Profile- Capacitive Panels
Linepro - Product Profile- Capacitive PanelsLinepro - Product Profile- Capacitive Panels
Linepro - Product Profile- Capacitive Panels
PaulMalpan1
 
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdfWindows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
yamicsoft458
 
pharmacology.pdffffffffffffffffffffffffff
pharmacology.pdffffffffffffffffffffffffffpharmacology.pdffffffffffffffffffffffffff
pharmacology.pdffffffffffffffffffffffffff
anooshaazam312
 
C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptxC.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
C.Mehrac_Englisjdjdjdjdjdjdjsjsjsjsjdh.pptx
quliyevlogman4
 
Spectrophotometer instrument basics -.pptx
Spectrophotometer instrument basics -.pptxSpectrophotometer instrument basics -.pptx
Spectrophotometer instrument basics -.pptx
muthulakshmitc
 
the-importance-of-learning-french-140722055824-phpapp01.ppt
the-importance-of-learning-french-140722055824-phpapp01.pptthe-importance-of-learning-french-140722055824-phpapp01.ppt
the-importance-of-learning-french-140722055824-phpapp01.ppt
LipicaJasujaWadhwa
 
ppt untuk seminar proposal dan persiapannya
ppt untuk seminar proposal dan persiapannyappt untuk seminar proposal dan persiapannya
ppt untuk seminar proposal dan persiapannya
Rasidinmamakidin
 
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).pptIntroduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
Introduction-to-Robotics-PowerPoint-Presentation-on-Robotics (1).ppt
AshaManjhi
 
Multilingual hand gesture to speech conversion system
Multilingual hand gesture to speech conversion systemMultilingual hand gesture to speech conversion system
Multilingual hand gesture to speech conversion system
Himabindu905359
 
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptxADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
ADRENAL CORTbsbsbshEX 3 & 4 - 22MBBS.pptx
c2422429
 
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
Auslogics File Recovery Professional 12.0.1 Crack New Version Latest 2025
usmankhan66g66
 
THE SCANNING ELECTRON MICROSOPE (SEM)....
THE SCANNING ELECTRON MICROSOPE (SEM)....THE SCANNING ELECTRON MICROSOPE (SEM)....
THE SCANNING ELECTRON MICROSOPE (SEM)....
RahulRajai
 
OSPF & DHCP PPT.pptx it is relATED TO NETWORKING
OSPF & DHCP PPT.pptx it is relATED TO NETWORKINGOSPF & DHCP PPT.pptx it is relATED TO NETWORKING
OSPF & DHCP PPT.pptx it is relATED TO NETWORKING
ritikghw
 
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
荷兰代尔夫特理工大学毕业证书文凭定制TUDelft成绩单定制
Taqyea
 
High Perfomance and Reliability Inverter
High Perfomance and Reliability InverterHigh Perfomance and Reliability Inverter
High Perfomance and Reliability Inverter
CarlosFranco13613
 
Mischief and cheating - yashita (2405230008).pptx
Mischief and cheating - yashita (2405230008).pptxMischief and cheating - yashita (2405230008).pptx
Mischief and cheating - yashita (2405230008).pptx
YashitaAhuja
 
How to Buy a Telegram Account_ Everything You Need to Know.pdf
How to Buy a Telegram Account_ Everything You Need to Know.pdfHow to Buy a Telegram Account_ Everything You Need to Know.pdf
How to Buy a Telegram Account_ Everything You Need to Know.pdf
buelljasonnn
 
Bone Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
Bone   Tubeoudgkaitaurauraurarhafhau4rculosis.pptxBone   Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
Bone Tubeoudgkaitaurauraurarhafhau4rculosis.pptx
gaisga4er
 
Clip Studio Paint EX Crack Download (Latest Version 2025)
Clip Studio Paint EX Crack Download (Latest Version 2025)Clip Studio Paint EX Crack Download (Latest Version 2025)
Clip Studio Paint EX Crack Download (Latest Version 2025)
usmankhan66g66
 
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptxSlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
SlideEgg_22923-Music PowerPoint Templates-4-Blue.pptx
huyenpham220998
 
Linepro - Product Profile- Capacitive Panels
Linepro - Product Profile- Capacitive PanelsLinepro - Product Profile- Capacitive Panels
Linepro - Product Profile- Capacitive Panels
PaulMalpan1
 
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdfWindows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
Windows Repair or Tweak Guide Powered by Yamicsoft Windows Manager.pdf
yamicsoft458
 
pharmacology.pdffffffffffffffffffffffffff
pharmacology.pdffffffffffffffffffffffffffpharmacology.pdffffffffffffffffffffffffff
pharmacology.pdffffffffffffffffffffffffff
anooshaazam312
 
Ad

INTRODUCTION TO ARDUINO and sensors for arduino.pptx

  • 1. INTRO TO ARDUINO Lorlie B. Andres, MECOE
  • 2. ARDUINO  Arduino is a prototype platform (open-source) based on an easy- to-use hardware and software.  It consists of a circuit board, which can be programed (referred to as a microcontroller) and a ready-made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board.
  • 4. BOARD TYPES Arduino boards have one thing in common: they are programed through the Arduino IDE. The differences are based on the number of inputs and outputs (the number of sensors, LEDs, and buttons you can use on a single board), speed, operating voltage, form factor etc. Some boards are designed to be embedded and have no programming interface (hardware), which you would need to buy separately. Some can run directly from a 3.7V battery, others need at least 5V.
  • 5. DIFFERENT COMPONENTS ON THE ARDUINO BOARD.
  • 12. 3 MAIN PARTS OF ARDUINO PROGRAM Structure Values (variables and constants) Functions
  • 13. TWO MAIN FUNCTIONS OF SOFTWARE STRUCTURE Setup( ) function The setup() function is called when a sketch starts. Use it to initialize the variables, pin modes, start using libraries, etc. The setup function will only run once, after each power up or reset of the Arduino board. Loop( ) function loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.
  • 14. Structure • Software structure consist of two main functions: • Setup( ) function • Loop( ) function
  • 17. pinMode() function  The pinMode() function is used to configure a specific pin to behave either as an input or an output.  pinMode() Function Syntax pinMode (pin , mode); pin − the number of the pin whose mode you wish to set mode − INPUT, OUTPUT.
  • 18. SAMPLE SKETCH int button = 5 ; // button connected to pin 5 int LED = 6; // LED connected to pin 6 void setup () { pinMode(button , INPUT); // set the digital pin as input pinMode(LED , OUTPUT); // set the digital pin as output }
  • 19. digitalWrite() function  the digitalWrite() function is used to write a HIGH or a LOW value to a digital pin.  If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.  If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin.
  • 20. digitalWrite() function syntax Syntax: digitalWrite (pin ,value); Parameters: pin − the number of the pin whose mode you wish to set value − HIGH, or LOW.
  • 21. SAMPLE SKETCH void loop () { If (digitalRead(button ) == LOW) // if button pressed { digitalWrite(LED,HIGH); // turn on led delay(500); // delay for 500 ms digitalWrite(LED,LOW); // turn off led delay(500); // delay for 500 ms } }
  • 22. digitalRead() function  digitalRead is used to read the status of any digital Pin in Arduino.  Syntax digitalRead(pin)  Parameters pin: the Arduino pin number you want to read  Returns HIGH or LOW
  • 23. SAMPLE SKETCH int button = 5 ; // button connected to pin 5 int LED = 6; // LED connected to pin 6 void setup () { pinMode(button , INPUT); // set the digital pin as input pinMode(LED , OUTPUT); // set the digital pin as output } void loop () { X=digitalRead(7); If (digitalRead(button ) == LOW) // if button pressed { digitalWrite(LED,HIGH); // turn on led delay(500); // delay for 500 ms digitalWrite(LED,LOW); // turn off led delay(500); // delay for 500 ms } }
  • 24. analogRead( ) function  Arduino is able to detect whether there is a voltage applied to one of its pins and report it through the digitalRead() function.  There is a difference between an on/off sensor (which detects the presence of an object) and an analog sensor, whose value continuously changes.  In the lower-right part of the Arduino board, you will see six pins marked “Analog In”.  These special pins not only tell whether there is a voltage applied to them, but also its value.  By using the analogRead() function, we can read the voltage applied to one of the pins.  This function returns a number between 0 and 1023, which represents voltages between 0 and 5 volts.  For example, if there is a voltage of 2.5 V applied to pin number 0, analogRead(0) returns 512
  • 25. analogRead() function syntax  analogRead(pin); pin − the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)
  • 26. SAMPLE SKETCH int analogPin = 3;//potentiometer wiper (middle terminal) // connected to analog pin 3 int val = 0; // variable to store the value read void setup() { Serial.begin(9600); // setup serial } void loop() { val = analogRead(analogPin); // read the input pin Serial.println(val); // debug value }
  • 27. BLINKING LED It is as simple as turning a light on and off. Pin Configuration of LED
  • 28. BLINKING LED CIRCUIT CONNECTION
  • 29. SOURCE CODE int LED_OUTPUT_PIN = 3; void setup() { pinMode(LED_OUTPUT_PIN, OUTPUT); } void loop() { digitalWrite(LED_OUTPUT_PIN, HIGH); // turn LED on (output 5V) delay(1000); // wait one second digitalWrite(LED_OUTPUT_PIN, LOW); // turn LED off (output 0V) delay(1000); // wait another second }
  • 31. WHAT IS A SENSOR? A sensor is a device that detects and responds to some type of input from the physical environment.  The input can be light, heat, motion, moisture, pressure or any number of other environmental phenomena. The output is generally a signal that is converted to a human-readable display at the sensor location or transmitted electronically over a network for reading or further processing.
  • 32. REAL TIME APPLICATION OF SENSORS (Autopilot System In Aircrafts)
  • 34. CLASSIFICATION OF SENSOR Analog Sensors produce an analog output i.e., a continuous output signal (usually voltage but sometimes other quantities like Resistance etc.) with respect to the quantity being measured. Digital Sensors work with discrete or digital data. The data in digital sensors, which are used for conversion and transmission, is digital in nature.
  • 35. SOIL MOISTURE SENSOR  The Soil Moisture Sensor measures soil moisture grace to the changes in electrical conductivity of the earth ( soil resistance increases with drought ).  The electrical resistance is measured between the two electrodes of the sensor. A comparator activates a digital output when a adjustable threshold is exceeded.
  • 36. SOIL MOISTURE SENSOR CIRCUIT CONNECTION
  • 37. ARDUINO SKETCH FOR SOIL MOISTURE SENSOR void setup() { Serial.begin(9600); pinMode(A0, INPUT); } void loop() { sensorValue = analogRead(A0); Serial.println("Analog Value : "); Serial.println(sensorValue);
  • 38. WATER LEVEL SENSOR  This sensor can be used to measure the water level, monitor a sump pit, detect rainfall or detect leakage.  The series of exposed parallel conductors, together act as a variable resistor (just like a potentiometer) whose resistance varies according to the water level.  The change in resistance corresponds to the distance from the top of the sensor to the surface of the water.
  • 39. WATER LEVEL SENSOR CIRCUIT CONNECTION
  • 40. ARDUINO SKETCH FOR WATER LEVEL SENSOR void setup() { pinMode(sensorPower, OUTPUT); digitalWrite(sensorPower, LOW); Serial.begin(9600); } void loop() { int level = readSensor(); Serial.print("Water level: "); Serial.println(level); }
  • 41. FINAL ACTIVITY Develop an Arduino program that monitors the soil moisture level using a sensor. If the measured soil moisture falls below the threshold value of 25, the program should activate a LED and make it blink five times. Conversely, if the soil moisture reading is equal to or above 25, the LED should remain off.
  • 42. THANK YOU AND GOD BLESS