SlideShare a Scribd company logo
1 of 15
Level II Programming Piezo Sounder Alarm & Sensors In What??? Obviously easiest and fluent Arduino
Flash Back of previous session
What will you learn Today???  New methods of Arduino ,[object Object]
 analogRead ()
 analogWrite ()
 noTone ()Project ,[object Object]
	Project 2: Piezo Knock Sensor
	Project 3: Light Sensor,[object Object]
Project 1. Piezo Sounder Alarm Why use? By connecting a piezo sounder to a digital output pin, you can create a wailing 	alarm sound. What is required? 	Piezo Sounder (or piezo disc) 	2-Way Screw Terminal Piezo Sounder 2-Way Screw Terminal
How to connect? Now you know what has to be included in your code by watching at  pictorial representation above. But can you really code ??? Let’s try So you understood what is it that’s remaining…
// Project 1 - Piezo Sounder Alarm float sinVal; inttoneVal; void setup() { pinMode(8, OUTPUT); } void loop() { 	for (int x=0; x<180; x++) {  	 // convert degrees to radians then obtain sin value sinVal = (sin(x*(3.1412/180))); // generate a frequency from the sin value toneVal= 2000+(int(sinVal*1000)); 	tone(8, toneVal); 	delay(2); 	} }
The sinVal float variable holds the sin value that causes the tone to rise and fall The toneValvariable takes the value in sinVal and converts it to the frequency you require. You convert the value of x into radians : sinVal = (sin(x*(3.1412/180))); Then that value is converted into a frequency suitable for the alarm sound: toneVal = 2000+(int(sinVal*1000)); You take 2000 and add the sinVal multiplied by 1000. This supplies a good range of frequencies for the rising and falling tone of the sine wave. To make shrill sound and disturb someone who enters your room, I recommend you keep base value 1000 rather than 2000… :p
Project 2: Piezo Knock Sensor Why use? 	A piezo disc works when an electric current is passed over the ceramic material in the disc, causing it to change shape and hence make a sound (a click). The disc also works in reverse: when the disc is knocked or squeezed, the force on the material causes the generation of an electric current. You can read that current using the Arduino and you are going to do that now by making a Knock Sensor. What is required? 	Piezo Sounder (or piezo disc) 	2-Way Screw Terminal 	5mm LED (any color) 	1MΩ Resistor Piezo Sounder 2-Way Screw Terminal
//Project 2: Piezo knock sensor intledPin = 9;  int piezoPin = 5;  int threshold = 120; intsensorValue = 0;  float ledValue = 0; void setup() { pinMode(ledPin, OUTPUT);  digitalWrite(ledPin, HIGH); delay(150);  digitalWrite(ledPin, LOW); delay(150); digitalWrite(ledPin, HIGH); delay(150);  digitalWrite(ledPin, LOW); delay(150); } void loop() { sensorValue = analogRead(piezoPin);  	if (sensorValue >= threshold) {  ledValue= 255; 	} analogWrite(ledPin, int(ledValue) );  ledValue = ledValue - 0.05;  if (ledValue <= 0) { ledValue = 0;}  }

More Related Content

What's hot

All about ir arduino - cool
All about ir   arduino - coolAll about ir   arduino - cool
All about ir arduino - coolVlada Stoja
 
Design of all digital phase locked loop (d pll) with fast acquisition time
Design of all digital phase locked loop (d pll) with fast acquisition timeDesign of all digital phase locked loop (d pll) with fast acquisition time
Design of all digital phase locked loop (d pll) with fast acquisition timeeSAT Journals
 
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013Simen Li
 
RF Module Design - [Chapter 2] Noises
RF Module Design - [Chapter 2] NoisesRF Module Design - [Chapter 2] Noises
RF Module Design - [Chapter 2] NoisesSimen Li
 
Micro Assignment 1
Micro Assignment 1Micro Assignment 1
Micro Assignment 1babak danyal
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tunerplun
 
RF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsRF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsSimen Li
 
Circuit Network Analysis - [Chapter3] Fourier Analysis
Circuit Network Analysis - [Chapter3] Fourier AnalysisCircuit Network Analysis - [Chapter3] Fourier Analysis
Circuit Network Analysis - [Chapter3] Fourier AnalysisSimen Li
 
2012 1 arduino_rs232
2012 1 arduino_rs2322012 1 arduino_rs232
2012 1 arduino_rs232Don Doerres
 
Dtmf Detection
Dtmf DetectionDtmf Detection
Dtmf Detectionbiometria
 
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state Analysis
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state AnalysisCircuit Network Analysis - [Chapter2] Sinusoidal Steady-state Analysis
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state AnalysisSimen Li
 
Dsp U Lec09 Iir Filter Design
Dsp U   Lec09 Iir Filter DesignDsp U   Lec09 Iir Filter Design
Dsp U Lec09 Iir Filter Designtaha25
 
Cn1 connection details 36pins
Cn1 connection details 36pinsCn1 connection details 36pins
Cn1 connection details 36pinsravi_kaneria
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino MajdyShamasneh
 
RF Module Design - [Chapter 6] Power Amplifier
RF Module Design - [Chapter 6]  Power AmplifierRF Module Design - [Chapter 6]  Power Amplifier
RF Module Design - [Chapter 6] Power AmplifierSimen Li
 

What's hot (20)

All about ir arduino - cool
All about ir   arduino - coolAll about ir   arduino - cool
All about ir arduino - cool
 
DPLL PRESENTATION
DPLL PRESENTATIONDPLL PRESENTATION
DPLL PRESENTATION
 
Design of all digital phase locked loop (d pll) with fast acquisition time
Design of all digital phase locked loop (d pll) with fast acquisition timeDesign of all digital phase locked loop (d pll) with fast acquisition time
Design of all digital phase locked loop (d pll) with fast acquisition time
 
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013
Voltage Controlled Oscillator Design - Short Course at NKFUST, 2013
 
RF Module Design - [Chapter 2] Noises
RF Module Design - [Chapter 2] NoisesRF Module Design - [Chapter 2] Noises
RF Module Design - [Chapter 2] Noises
 
Micro Assignment 1
Micro Assignment 1Micro Assignment 1
Micro Assignment 1
 
Digital Tuner
Digital TunerDigital Tuner
Digital Tuner
 
USB 2.0 Compliance Testing
USB 2.0 Compliance TestingUSB 2.0 Compliance Testing
USB 2.0 Compliance Testing
 
RF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsRF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked Loops
 
Circuit Network Analysis - [Chapter3] Fourier Analysis
Circuit Network Analysis - [Chapter3] Fourier AnalysisCircuit Network Analysis - [Chapter3] Fourier Analysis
Circuit Network Analysis - [Chapter3] Fourier Analysis
 
2012 1 arduino_rs232
2012 1 arduino_rs2322012 1 arduino_rs232
2012 1 arduino_rs232
 
R Study LT 02
R Study LT 02R Study LT 02
R Study LT 02
 
Dtmf Detection
Dtmf DetectionDtmf Detection
Dtmf Detection
 
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state Analysis
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state AnalysisCircuit Network Analysis - [Chapter2] Sinusoidal Steady-state Analysis
Circuit Network Analysis - [Chapter2] Sinusoidal Steady-state Analysis
 
Programming arduino makeymakey
Programming arduino makeymakeyProgramming arduino makeymakey
Programming arduino makeymakey
 
Hexapod ppt
Hexapod pptHexapod ppt
Hexapod ppt
 
Dsp U Lec09 Iir Filter Design
Dsp U   Lec09 Iir Filter DesignDsp U   Lec09 Iir Filter Design
Dsp U Lec09 Iir Filter Design
 
Cn1 connection details 36pins
Cn1 connection details 36pinsCn1 connection details 36pins
Cn1 connection details 36pins
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
 
RF Module Design - [Chapter 6] Power Amplifier
RF Module Design - [Chapter 6]  Power AmplifierRF Module Design - [Chapter 6]  Power Amplifier
RF Module Design - [Chapter 6] Power Amplifier
 

Viewers also liked

All-Star Champions
All-Star ChampionsAll-Star Champions
All-Star Championsemberfoster
 
Link building strategy
Link building strategyLink building strategy
Link building strategyAmit Dhiman
 
Orora group 2014 AGM presentation slides ASX release
Orora group 2014 AGM presentation slides ASX releaseOrora group 2014 AGM presentation slides ASX release
Orora group 2014 AGM presentation slides ASX releaseMonika Lancucki
 
Social Media for Crisis Management - Tips from the Coalface
Social Media for Crisis Management - Tips from the CoalfaceSocial Media for Crisis Management - Tips from the Coalface
Social Media for Crisis Management - Tips from the CoalfaceMonika Lancucki
 
Topik 1 pengenalan kepada pangkalan data
Topik 1   pengenalan kepada pangkalan dataTopik 1   pengenalan kepada pangkalan data
Topik 1 pengenalan kepada pangkalan dataVivian Wmn
 
Contoh karangan jenis fakta (1)
Contoh karangan jenis fakta (1)Contoh karangan jenis fakta (1)
Contoh karangan jenis fakta (1)Vivian Wmn
 

Viewers also liked (7)

All-Star Champions
All-Star ChampionsAll-Star Champions
All-Star Champions
 
Link building strategy
Link building strategyLink building strategy
Link building strategy
 
Orora group 2014 AGM presentation slides ASX release
Orora group 2014 AGM presentation slides ASX releaseOrora group 2014 AGM presentation slides ASX release
Orora group 2014 AGM presentation slides ASX release
 
Social Media for Crisis Management - Tips from the Coalface
Social Media for Crisis Management - Tips from the CoalfaceSocial Media for Crisis Management - Tips from the Coalface
Social Media for Crisis Management - Tips from the Coalface
 
Topik 1 pengenalan kepada pangkalan data
Topik 1   pengenalan kepada pangkalan dataTopik 1   pengenalan kepada pangkalan data
Topik 1 pengenalan kepada pangkalan data
 
Contoh karangan jenis fakta (1)
Contoh karangan jenis fakta (1)Contoh karangan jenis fakta (1)
Contoh karangan jenis fakta (1)
 
Pitot tube
Pitot tubePitot tube
Pitot tube
 

Similar to Session3

Arduino projects &amp; tutorials
Arduino projects &amp; tutorialsArduino projects &amp; tutorials
Arduino projects &amp; tutorialsAnshu Pandey
 
Electronz_Chapter_6.pptx
Electronz_Chapter_6.pptxElectronz_Chapter_6.pptx
Electronz_Chapter_6.pptxMokete5
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseElaf A.Saeed
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final Report[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final ReportNicholas Ambrosio
 
Mom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labMom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labAnnamaria Lisotti
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptxHebaEng
 
Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Ziddan Kundrat
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...Faqih Fadhila Ardiansyah
 
Porte à puce - Smart Safety Door based on Arduino UNO R3
Porte à puce - Smart Safety Door based on Arduino UNO R3Porte à puce - Smart Safety Door based on Arduino UNO R3
Porte à puce - Smart Safety Door based on Arduino UNO R3Meifani Sumadijaya
 
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...Rohde & Schwarz North America
 
Arduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz RadiosArduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz Radiosroadster43
 
Arduino frequency counter
Arduino frequency counterArduino frequency counter
Arduino frequency counternasyith_hananur
 
INT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfINT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfMSingh88
 

Similar to Session3 (20)

Arduino projects &amp; tutorials
Arduino projects &amp; tutorialsArduino projects &amp; tutorials
Arduino projects &amp; tutorials
 
Electronz_Chapter_6.pptx
Electronz_Chapter_6.pptxElectronz_Chapter_6.pptx
Electronz_Chapter_6.pptx
 
Arduino
ArduinoArduino
Arduino
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
Arduino
ArduinoArduino
Arduino
 
[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final Report[Best]Chromatic Tuner Project Final Report
[Best]Chromatic Tuner Project Final Report
 
Mom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labMom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics lab
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
 
Porte à puce - Smart Safety Door based on Arduino UNO R3
Porte à puce - Smart Safety Door based on Arduino UNO R3Porte à puce - Smart Safety Door based on Arduino UNO R3
Porte à puce - Smart Safety Door based on Arduino UNO R3
 
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
Synchronous Time / Frequency Domain Measurements Using a Digital Oscilloscope...
 
Arduino based applications part 1
Arduino based applications part 1Arduino based applications part 1
Arduino based applications part 1
 
Smart Blind stick by using arduino uno and sensor
 Smart Blind stick  by using arduino  uno  and sensor Smart Blind stick  by using arduino  uno  and sensor
Smart Blind stick by using arduino uno and sensor
 
Arduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz RadiosArduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz Radios
 
Arduino frequency counter
Arduino frequency counterArduino frequency counter
Arduino frequency counter
 
publish manual
publish manualpublish manual
publish manual
 
INT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfINT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdf
 

Recently uploaded

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

Session3

  • 1. Level II Programming Piezo Sounder Alarm & Sensors In What??? Obviously easiest and fluent Arduino
  • 2. Flash Back of previous session
  • 3.
  • 4.
  • 7.
  • 8. Project 2: Piezo Knock Sensor
  • 9.
  • 10. Project 1. Piezo Sounder Alarm Why use? By connecting a piezo sounder to a digital output pin, you can create a wailing alarm sound. What is required? Piezo Sounder (or piezo disc) 2-Way Screw Terminal Piezo Sounder 2-Way Screw Terminal
  • 11. How to connect? Now you know what has to be included in your code by watching at pictorial representation above. But can you really code ??? Let’s try So you understood what is it that’s remaining…
  • 12. // Project 1 - Piezo Sounder Alarm float sinVal; inttoneVal; void setup() { pinMode(8, OUTPUT); } void loop() { for (int x=0; x<180; x++) { // convert degrees to radians then obtain sin value sinVal = (sin(x*(3.1412/180))); // generate a frequency from the sin value toneVal= 2000+(int(sinVal*1000)); tone(8, toneVal); delay(2); } }
  • 13. The sinVal float variable holds the sin value that causes the tone to rise and fall The toneValvariable takes the value in sinVal and converts it to the frequency you require. You convert the value of x into radians : sinVal = (sin(x*(3.1412/180))); Then that value is converted into a frequency suitable for the alarm sound: toneVal = 2000+(int(sinVal*1000)); You take 2000 and add the sinVal multiplied by 1000. This supplies a good range of frequencies for the rising and falling tone of the sine wave. To make shrill sound and disturb someone who enters your room, I recommend you keep base value 1000 rather than 2000… :p
  • 14. Project 2: Piezo Knock Sensor Why use? A piezo disc works when an electric current is passed over the ceramic material in the disc, causing it to change shape and hence make a sound (a click). The disc also works in reverse: when the disc is knocked or squeezed, the force on the material causes the generation of an electric current. You can read that current using the Arduino and you are going to do that now by making a Knock Sensor. What is required? Piezo Sounder (or piezo disc) 2-Way Screw Terminal 5mm LED (any color) 1MΩ Resistor Piezo Sounder 2-Way Screw Terminal
  • 15. //Project 2: Piezo knock sensor intledPin = 9; int piezoPin = 5; int threshold = 120; intsensorValue = 0; float ledValue = 0; void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, HIGH); delay(150); digitalWrite(ledPin, LOW); delay(150); digitalWrite(ledPin, HIGH); delay(150); digitalWrite(ledPin, LOW); delay(150); } void loop() { sensorValue = analogRead(piezoPin); if (sensorValue >= threshold) { ledValue= 255; } analogWrite(ledPin, int(ledValue) ); ledValue = ledValue - 0.05; if (ledValue <= 0) { ledValue = 0;} }
  • 16. Project 3: Light Sensor Why use? The more light, the lower the resistance. By reading the value from the sensor, you can detect if it is light, dark, or anywhere between. In this project, you use an LDR to detect light and a piezo sounder to give audible feedback of the amount of light detected. This setup could be used as an alarm that indicates when a door has been opened, for example. Alternatively, you could use it to create a musical instrument similar to a Theremin. What is required? Piezo Sounder (or piezo disc) 2-Way Screw Terminal Light Dependent Resistor 10kΩ Resistor Piezo Sounder 2-Way Screw Terminal
  • 17. How is it connected…
  • 18. Code… // Project 14 - Light Sensor int piezoPin = 8; int ldrPin = 0; intldrValue = 0; void setup() { // nothing to do here } void loop() { ldrValue = analogRead(ldrPin); tone(piezoPin,1000); delay(25); noTone(piezoPin); delay(ldrValue); }
  • 19. Mechanism: LDR Working Vout = Vin * R2/(R2+R1) Table 4-1. Vout values for a LDR with 5v as Vin R1 R2 (LDR) Vout Brightness 10kΩ 100kΩ 4.54v Darkest 10kΩ 73kΩ 4.39v 25% 10kΩ 45kΩ 4.09v 50% 10kΩ 28kΩ 3.68v 75% 10kΩ 10kΩ 2.5v Brightest As you can see, as the brightness increases, the voltage at Vout decreases. As a result, the value you read at the sensor gets less and the delay after the beep gets shorter, causing the beeps to occur more frequently. If you were to switch the resistor and LDR, the voltage would increase as more light fell onto the LDR. Either way will work; it just depends how you want your sensor to be read.