Set A - Notes - Iot - 3rd Unit
Set A - Notes - Iot - 3rd Unit
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Course Outlines
1. Introduction to Node MCU
2. Arduino Timer Registers
3. Arduino Timer Interrupts
3
Introduction to NodeMCU
• NodeMCU is an open-source firmware and development board based on the ESP8266 Wi-Fi
module. It combines the capabilities of an ESP8266 module with a built-in Lua scripting
environment, making it a popular choice for Internet of Things (IoT) projects. NodeMCU allows
developers to quickly prototype and build Wi-Fi-enabled devices with ease.
• The NodeMCU board provides numerous GPIO (General Purpose Input/Output) pins, which allow
for connecting and controlling various electronic components such as sensors, switches, LEDs, and
motors. Additionally, it includes built-in Wi-Fi connectivity, enabling seamless integration with the
internet and the ability to communicate with remote servers, cloud platforms, and other IoT
devices.
• The ESP8266 module, upon which NodeMCU is built, is a low-cost, low-power Wi-Fi chip that
gained significant attention in the IoT community due to its affordability and versatility. It features a
microcontroller unit (MCU) that can be programmed to interact with various sensors, actuators, and
other electronic components.
NodeMCU Diagram
• VIN: Power supply input pin (5V to 12V).
• GND: Ground pin.
• 3V3: 3.3V power output pin.
• RST: Reset pin. Used to reset the board.
• A0: Analog input pin.
• D0-D8: Digital input/output pins.
• D9-D10: Digital input/output/pulse-width modulation (PWM) pins.
• D11-D12: Digital input/output/pulse-width modulation (PWM) pins.
• D13: Digital input/output/pulse-width modulation (PWM) pin.
• D14 (SCL): I2C clock pin.
• D15 (SDA): I2C data pin.
• D16 (LED_BUILTIN): Built-in LED pin.
Arduino Timer Registers
To change the configuration of the timers, timer registers are used.
1. Timer/Counter Control Registers (TCCRnA/B):
This register holds the main control bits of the timer and used to control the prescalers of
timer. It also allows to control the mode of timer using the WGM bits.
Prescaler
The CS12, CS11, CS10 bits in TCCR1B sets the prescaler value. A prescaler is used to setup the clock
speed of the timer. Arduino Uno has prescalers of 1, 8, 64, 256, 1024.
Timer/Counter Register (TCNTn)
This Register is used to control the counter value and to set a preloader value.
Whenever the timer reaches to its maximum value say for example (16 Bit-65535) the Timer
Overflow Interrupt occurs. So, an ISR interrupt service routine is called when the Timer Overflow
Interrupt bit enabled in the TOIEx present in timer interrupt mask register TIMSKx.
Arduino Timer Interrupts
ISR Format:
ISR(TIMERx_OVF_vect)
{
}
Output Compare Register (OCRnA/B):
Here when the Output Compare Match Interrupt occurs then the interrupt service ISR
(TIMERx_COMPy_vect) is called and also OCFxy flag bit will be set in TIFRx register. This ISR is
enabled by setting enable bit in OCIExy present in TIMSKx register. Where TIMSKx is Timer Interrupt
Mask Register.
Timer Input Capture:
Next when the timer Input Capture Interrupt occurs then the interrupt service ISR
(TIMERx_CAPT_vect) is called and also the ICFx flag bit will be set in TIFRx (Timer Interrupt Flag
Register). This ISR is enabled by setting the enable bit in ICIEx present in TIMSKx register.
Circuit Diagram
12
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
University Vision
To be globally recognized as a Centre of Excellence for Research, Innovation, Entrepreneurship and disseminating
knowledge by providing inspirational learning to produce professional leaders for serving the society.
University Mission
M1: Providing world-class infrastructure, renowned academicians, and an ideal environment for Research,
Innovation, Consultancy, and Entrepreneurship relevant to society.
M2: Offering programs & courses in consonance with National policies for nation-building and meeting global
challenges.
M3: Designing Curriculum to match international standards, and needs of Industry, civil society, and for inculcation
of traits of Creative Thinking and Critical Analysis as well as Human and Ethical values.
M4: Ensuring students delight by meeting their aspirations through blended learning, corporate mentoring,
professional grooming, flexible curriculum, and a healthy atmosphere based on co-curricular and extra-curricular
activities.
M5: Creating a scientific, transparent, and objective examination/evaluation system to ensure an ideal certification.
M6: Establishing strategic relationships with leading National and International corporates and universities for
academic as well as research collaborations.
M7: Contributing for the creation of a healthy, vibrant, and sustainable society by involving in Institutional Social
Responsibility (ISR) activities like rural development, the welfare of senior citizens, women empowerment,
community service, health and hygiene awareness, and environmental protection
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-3 Application of Embedded Systems and IoT. Contact Hours: 30
Chapter 3.1 Embedded System Applications :
Introduction to Node MCU, Pin diagram, Programming of Node MCU, Introduction
of cloud (BLYNK/Thingspeak/Cayenne), Connecting NodeMCU to WIFI network and
cloud, Collect and analyze data of sensors over the cloud.
Chapter 3.2 Applications of IoT:
Design smart home systems, smart parking systems, Smart dustbins for a clean
environment, Water level controller systems, and other various applications
Chapter 3.3 Experiment 9:
Interfacing NodeMCU with sensors (Gas Sensor/ Ultrasonic sensor/DHT11/TMP36)
and actuators and getting data over the cloud.
Chapter 3.4 Experiment 10:
Design one live project on the basis of sensors and microcontroller Arduino Uno or
Node MCU.
Course Outlines
1. Introduction to Node MCU
2. Pin Diagram
3. Programming of Node MCU
4. Introduction to Cloud (BLYNK/ThingSpeak/Cayenne)
5. Connecting NodeMCU to Wi-Fi Network and Cloud
6. Collecting and Analyzing Data of Sensors Over the Cloud
6
Introduction to Timer
• The Arduino Programming language is very easy to understand as most of the work is done by
pre-built functions like digitalWrite(), AnalogWrite(), Delay() etc.
• Hence, to understand what is happening inside the pre-built functions we need to dig behind
these terms. For example when a delay() function is used it actual sets the Timer and Counter
Register bits of the ATmega microcontroller.
• So, we are going to avoid the usage of delay() function and instead actually deal with the
Registers themselves. The good thing is we can use the same Arduino IDE for this. We will set our
Timer register bits and use the Timer Overflow Interrupt to toggle an LED every time the interrupt
occurs.
• Timer is kind of interrupt. It is like a simple clock which can measure time interval of an event.
Every microcontroller has a clock (oscillator), say in Arduino Uno it is 16Mhz. This is responsible for
speed. Higher the clock frequency higher will be the processing speed. A timer uses counter which
counts at certain speed depending upon the clock frequency. In Arduino Uno it takes 1/16000000
seconds or 62nano seconds to make a single count. Meaning Arduino moves from one instruction to
another instruction for every 62 nano second.
Timers in Arduino UNO
In Arduino UNO there are three timers used for different functions.
Timer0:
It is an 8-Bit timer and used in timer function such as delay(), millis().
Timer1:
It is a 16-Bit timer and used in servo library.
Timer2:
It is an 8-Bit Timer and used in tone() function.
Arduino Timer Registers
To change the configuration of the timers, timer registers are used.
1. Timer/Counter Control Registers (TCCRnA/B):
This register holds the main control bits of the timer and used to control the prescalers of
timer. It also allows to control the mode of timer using the WGM bits.
Prescaler
The CS12, CS11, CS10 bits in TCCR1B sets the prescaler value. A prescaler is used to setup the clock
speed of the timer. Arduino Uno has prescalers of 1, 8, 64, 256, 1024.
Timer/Counter Register (TCNTn)
This Register is used to control the counter value and to set a preloader value.
Whenever the timer reaches to its maximum value say for example (16 Bit-65535) the Timer
Overflow Interrupt occurs. So, an ISR interrupt service routine is called when the Timer Overflow
Interrupt bit enabled in the TOIEx present in timer interrupt mask register TIMSKx.
Arduino Timer Interrupts
ISR Format:
ISR(TIMERx_OVF_vect)
{
}
Output Compare Register (OCRnA/B):
Here when the Output Compare Match Interrupt occurs then the interrupt service ISR
(TIMERx_COMPy_vect) is called and also OCFxy flag bit will be set in TIFRx register. This ISR is
enabled by setting enable bit in OCIExy present in TIMSKx register. Where TIMSKx is Timer Interrupt
Mask Register.
Timer Input Capture:
Next when the timer Input Capture Interrupt occurs then the interrupt service ISR
(TIMERx_CAPT_vect) is called and also the ICFx flag bit will be set in TIFRx (Timer Interrupt Flag
Register). This ISR is enabled by setting the enable bit in ICIEx present in TIMSKx register.
Circuit Diagram
15
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
University Vision
To be globally recognized as a Centre of Excellence for Research, Innovation, Entrepreneurship and disseminating
knowledge by providing inspirational learning to produce professional leaders for serving the society.
University Mission
M1: Providing world-class infrastructure, renowned academicians, and an ideal environment for Research,
Innovation, Consultancy, and Entrepreneurship relevant to society.
M2: Offering programs & courses in consonance with National policies for nation-building and meeting global
challenges.
M3: Designing Curriculum to match international standards, and needs of Industry, civil society, and for inculcation
of traits of Creative Thinking and Critical Analysis as well as Human and Ethical values.
M4: Ensuring students delight by meeting their aspirations through blended learning, corporate mentoring,
professional grooming, flexible curriculum, and a healthy atmosphere based on co-curricular and extra-curricular
activities.
M5: Creating a scientific, transparent, and objective examination/evaluation system to ensure an ideal certification.
M6: Establishing strategic relationships with leading National and International corporates and universities for
academic as well as research collaborations.
M7: Contributing for the creation of a healthy, vibrant, and sustainable society by involving in Institutional Social
Responsibility (ISR) activities like rural development, the welfare of senior citizens, women empowerment,
community service, health and hygiene awareness, and environmental protection
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-3 Application of Embedded Systems and IoT. Contact Hours: 30
Chapter 3.1 Embedded System Applications :
Introduction to Node MCU, Pin diagram, Programming of Node MCU, Introduction
of cloud (BLYNK/Thingspeak/Cayenne), Connecting NodeMCU to WIFI network and
cloud, Collect and analyze data of sensors over the cloud.
Chapter 3.2 Applications of IoT:
Design smart home systems, smart parking systems, Smart dustbins for a clean
environment, Water level controller systems, and other various applications
Chapter 3.3 Experiment 9:
Interfacing NodeMCU with sensors (Gas Sensor/ Ultrasonic sensor/DHT11/TMP36)
and actuators and getting data over the cloud.
Chapter 3.4 Experiment 10:
Design one live project on the basis of sensors and microcontroller Arduino Uno or
Node MCU.
Course Outlines
1. Key Concept of Timer
2. Arduino Timer Registers
3. Arduino Timer Interrupts
6
Introduction to Timer
• The Arduino Programming language is very easy to understand as most of the work is done by
pre-built functions like digitalWrite(), AnalogWrite(), Delay() etc.
• Hence, to understand what is happening inside the pre-built functions we need to dig behind
these terms. For example when a delay() function is used it actual sets the Timer and Counter
Register bits of the ATmega microcontroller.
• So, we are going to avoid the usage of delay() function and instead actually deal with the
Registers themselves. The good thing is we can use the same Arduino IDE for this. We will set our
Timer register bits and use the Timer Overflow Interrupt to toggle an LED every time the interrupt
occurs.
• Timer is kind of interrupt. It is like a simple clock which can measure time interval of an event.
Every microcontroller has a clock (oscillator), say in Arduino Uno it is 16Mhz. This is responsible for
speed. Higher the clock frequency higher will be the processing speed. A timer uses counter which
counts at certain speed depending upon the clock frequency. In Arduino Uno it takes 1/16000000
seconds or 62nano seconds to make a single count. Meaning Arduino moves from one instruction to
another instruction for every 62 nano second.
Timers in Arduino UNO
In Arduino UNO there are three timers used for different functions.
Timer0:
It is an 8-Bit timer and used in timer function such as delay(), millis().
Timer1:
It is a 16-Bit timer and used in servo library.
Timer2:
It is an 8-Bit Timer and used in tone() function.
Arduino Timer Registers
To change the configuration of the timers, timer registers are used.
1. Timer/Counter Control Registers (TCCRnA/B):
This register holds the main control bits of the timer and used to control the prescalers of
timer. It also allows to control the mode of timer using the WGM bits.
Prescaler
The CS12, CS11, CS10 bits in TCCR1B sets the prescaler value. A prescaler is used to setup the clock
speed of the timer. Arduino Uno has prescalers of 1, 8, 64, 256, 1024.
Timer/Counter Register (TCNTn)
This Register is used to control the counter value and to set a preloader value.
Whenever the timer reaches to its maximum value say for example (16 Bit-65535) the Timer
Overflow Interrupt occurs. So, an ISR interrupt service routine is called when the Timer Overflow
Interrupt bit enabled in the TOIEx present in timer interrupt mask register TIMSKx.
Arduino Timer Interrupts
ISR Format:
ISR(TIMERx_OVF_vect)
{
}
Output Compare Register (OCRnA/B):
Here when the Output Compare Match Interrupt occurs then the interrupt service ISR
(TIMERx_COMPy_vect) is called and also OCFxy flag bit will be set in TIFRx register. This ISR is
enabled by setting enable bit in OCIExy present in TIMSKx register. Where TIMSKx is Timer Interrupt
Mask Register.
Timer Input Capture:
Next when the timer Input Capture Interrupt occurs then the interrupt service ISR
(TIMERx_CAPT_vect) is called and also the ICFx flag bit will be set in TIFRx (Timer Interrupt Flag
Register). This ISR is enabled by setting the enable bit in ICIEx present in TIMSKx register.
Circuit Diagram
15
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Programming Arduino UNO Timers
In this we will use the TIMER OVERFLOW INTERRUPT and use it to blink the LED ON and OFF
for certain duration by adjusting the preloader value (TCNT1) using pushbuttons. Complete
code for Arduino Timer is given at the end. Here we are explaining the code line by line:
As 16x2 LCD is used in the project to display the preloader value, so liquid crystal library is
used.
As 16x2 LCD is used in the project to display the preloader value, so liquid crystal library
is used.
#include<LiquidCrystal.h>
The LED anode pin that is connected with Arduino pin 7 is defined as ledPin.
#define ledPin 7
Next the object for accessing Liquid Crystal class is declared with the LCD pins (RS, E,
D4, D5, D6, D7) that are connected with Arduino UNO.
LiquidCrystal lcd(8,9,10,11,12,13);
Programming Arduino UNO Timers
Then set the preloader value 3035 for 4 seconds. Check the formula above to calculate the
preloader value.
float value = 3035;
Next in void setup(), first set the LCD in 16x2 mode and display a welcome message for few
seconds.
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("ARDUINO TIMERS");
delay(2000);
lcd.clear();
Next set the LED pin as OUTPUT pin and the Push buttons are set as INPUT pins
pinMode(ledPin, OUTPUT);
pinMode(2,INPUT);
pinMode(4,INPUT);
Programming Arduino UNO Timers
Next disable all the interrupts:
noInterrupts();
Next the Timer1 is initialized.
TCCR1A = 0;
TCCR1B = 0;
The preloader timer value is set (Initially as 3035).
TCNT1 = value;
Then the Pre scaler value 1024 is set in the TCCR1B register.
TCCR1B |= (1 << CS10)|(1 << CS12);
The Timer overflow interrupt is enabled in the Timer Interrupt Mask register so that the ISR can
be used.
TIMSK1 |= (1 << TOIE1);
At last all interrupts are enabled.
interrupts();
Programming Arduino UNO Timers
Now write the ISR for Timer Overflow Interrupt which is responsible for turning LED ON and OFF using
digitalWrite. The state changes whenever the timer overflow interrupt occurs.
ISR(TIMER1_OVF_vect)
{
TCNT1 = value;
digitalWrite(ledPin, digitalRead(ledPin) ^ 1);
}
In the void loop() the value of preloader is incremented or decremented by using the push button inputs and
also the value is displayed on 16x2 LCD.
Programming Arduino UNO Timers
if(digitalRead(2) == HIGH)
{
value = value+10; //Incement preload value
}
if(digitalRead(4)== HIGH)
{
value = value-10; //Decrement preload value
}
lcd.setCursor(0,0);
lcd.print(value);
}
• So this is how a timer can be used to produce delay in Arduino program. Check the video below
where we have demonstrated the change in delay by increasing and decreasing the preloader
value using Push buttons.
Learning Outcomes
10
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Relay Module
• A relay is an electrically operated switch that can be turned on or off, letting the current go
through or not, and can be controlled with low voltages, like the 5V provided by the Arduino pins.
• This relay module has two channels (those blue cubes). There are other models with one, four
and eight channels. This module should be powered with 5V, which is appropriate to use with an
Arduino. There are other relay modules that are powered using 3.3V, which is ideal for ESP32,
ESP8266, and other microcontrollers.
Relay Module
The following figure shows the relay module pinout.
Relay Module
The six pins on the left side of the relay module connect high voltage, and the pins on the right side
connect the component that requires low voltage—the Arduino pins.
NC (Normally Closed): the normally closed configuration is used when you want the relay to be
closed by default, meaning the current is flowing unless you send a signal from the Arduino to the
relay module to open the circuit and stop the current.
NO (Normally Open): the normally open configuration works the other way around: the relay is
always open, so the circuit is broken unless you send a signal from the Arduino to close the circuit.
Components Required
✓ Arduino Uno
✓ LED
✓ 5V Relay Module
✓ Bread Board
✓ Jumper Wires
Description
✓ GND pin of 5V Relay – GND pin of Arduino
12
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Interfacing HC-05 Bluetooth Module
with Arduino Uno
• Bluetooth Communication is a 2.4GHz frequency based RF Communication with a range of
approximately 10 meters. It is one of the most popular and most frequently used low range
communication for data transfer, audio systems, handsfree, computer peripherals etc.
✓ Arduino Uno
✓ LED
✓ Jumper Wires
✓ Bread Board
Software Required
✓ Arduino IDE
RXD : This is UART RX pin. This pin is used to send AT command when the module is in command
mode. And it is used to send data to the connected device when the module is in data mode.
TXD : This is UART TX pin. This pin is used push out responses to AT command when the module is in
command mode. And it is used push out data send by the connected device when the module is in
data mode.
Circuit Diagram
GND : Power supply -ive.
KEY : This input is used to switch between command and data mode. If this pin is set HIGH, the
module will be in command mode. Similarly if this pin is set LOW, the module will be in data mode.
Description
• RXD pin of HC-05 Bluetooth – TXD pin of Arduino Uno
Arduino Bluetooth Controller: This app can be download from Google Play Store. This app will act
as a Bluetooth remote controller for Arduino. It is very easy to use this app. Open the app and
connect to the HC-05 device. Then select the option as switch mode. Now you can control the LED
using the app.
Program
Reference
Description
• Initialize the serial port (UART) with the default baudrate of HC-05 Bluetooth module.
• In the loop() we keep checking any data is available to read from the serial port.
• If the data read is ‘1’ then the LED is turned ON, else LED will be turned OFF.
Learning Outcomes
13
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Introduction to DC motor
✓ A DC motor is any of a class of rotary electrical motors that converts direct current electrical
energy into mechanical energy. The most common types rely on the forces produced by magnetic
fields.
✓ Nearly all types of DC motors have some internal mechanism, either electromechanical or
electronic, to periodically change the direction of current in part of the motor.
✓ DC motors were the first form of motor widely used, as they could be powered from existing
direct-current lighting power distribution systems.
✓ A DC motor's speed can be controlled over a wide range, using either a variable supply voltage or
by changing the strength of current in its field windings. Small DC motors are used in tools, toys,
and appliances.
Introduction to DC motor
The universal motor can operate on direct current but is a lightweight brushed motor used for
portable power tools and appliances. Larger DC motors are currently used in propulsion of electric
vehicles, elevator and hoists, and in drives for steel rolling mills. The advent of power electronics
has made replacement of DC motors with AC motors possible in many applications
Types of DC Motors
✓ In order to appreciate the benefits of DC motors, it is important to understand the various types.
Each type of DC motor has beneficial characteristics that must be examined before purchase and
use.
✓ Two of the main advantages of DC motors over alternating current (AC) motors are how easy they
are to install and that they require little maintenance.
✓ DC motors are differentiated by the connections between the field winding and the armature. The
field winding can be connected parallel to the armature or connected in a series. In some cases,
the connection is both parallel and in a series.
✓ A further distinction of DC motors is how the rotor is powered; it can be brushed or brushless. In
brush DC motors, current is applied to the rotor by brushes. In a brushless DC motor, the rotor has
a permanent magnet.
Types of DC Motors
Since DC motors are everywhere and used for a wide variety of applications, there is a different type to
meet the needs of every application. Regardless of your need for DC motors, it is important to
understand each type since they can be found in every aspect of life.
Brushed DC Motor
excited. The stator is the enclosure that contains the components of the motor and contains the
magnetic field. The winding of the coil on the rotor can be in a series or parallel to form either a series
wound DC motor or shunt wound DC motor.
Types of DC Motors
Separately Excited DC Motor
In a separately excited DC motor, the motor has separate electrical supplies to the armature winding
and field winding, which are electrically separate from each other. The operations of the armature
current and field current do not interfere with each other‘s actions, but the input power is their total
sum.
DC Motors
A DC motor (Direct Current motor) is the most common type of motor. DC motors normally have just
two leads, one positive and one negative. If you connect these two leads directly to a battery, the
motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.
Warning − Do not drive the motor directly from Arduino board pins. This may damage the board. Use a
driver Circuit or an IC. In this practical we are using L293D IC.
Learning Outcomes
11
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Introduction to L293D IC
L293D IC - The L293D is a popular 16-Pin Motor Driver IC. As the name suggests it is mainly used to
drive motors. A single L293D IC is capable of running two DC motors at the same time; also the
direction of these two motors can be controlled independently. So if the motors which has
operating voltage less than 36V and operating current less than 600mA, which are to be controlled
by digital circuits like Op-Amp, 555 timers, digital gates or even Microcontrollers like Arduino, PIC,
ARM etc. this IC will be used.
Assembly
Follow the circuit diagram and hook up the components on the breadboard as
shown in the image given below.
Learning Outcomes
7
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Stepper motor
✓ A stepper motor is an electro-mechanical device it converts electrical power into mechanical
power. Also, it is a brushless, synchronous electric motor that can divide a full rotation into an
expansive number of steps.
✓ The motor’s position can be controlled accurately without any feedback mechanism, as long as the
motor is carefully sized to the application. Stepper motors are similar to switched.
✓ The stepper motor uses the theory of operation for magnets to make the motor shaft turn a
precise distance when a pulse of electricity is provided.
✓ The stator has eight poles, and the rotor has six poles. The rotor will require 24 pulses of electricity
to move the 24 steps to make one complete revolution. Another way to say this is that the rotor
will move precisely 15° for each pulse of electricity that the motor receives.
Stepper motor
Construction & Working Principle
• The It includes a permanent magnet like Rotor which is in the middle & it will turn once force
acts on it. This rotor is enclosed through a no. of the stator which is wound through a magnetic
coil all over it. The stator is arranged near to rotor so that magnetic fields within the stators can
control the movement of the rotor.
• The stepper motor can be controlled by energizing every stator one by one. So the stator will
magnetize & works like an electromagnetic pole which uses repulsive energy on the rotor to
move forward. The stator’s alternative magnetizing as well as demagnetizing will shift the rotor
gradually &allows it to turn through great control.
Construction & Working Principle
The stepper motor working principle is Electro-Magnetism. It includes a rotor which is made with a
permanent magnet whereas a stator is with electromagnets. Once the supply is provided to the
winding of the stator then the magnetic field will be developed within the stator. Now rotor in the
motor will start to move with the rotating magnetic field of the stator. So this is the fundamental
working principle of this motor.
In this motor, there is a soft iron that is enclosed through the electromagnetic stators. The poles of the
stator as well as the rotor don’t depend on the kind of stepper. Once the stators of this motor are
energized then the rotor will rotate to line up itself with the stator otherwise turns to have the least
gap through the stator. In this way, the stators are activated in a series to revolve the stepper motor.
Driving Techniques
Stepper motor driving techniques can be possible with some special circuits due to their complex
design. There are several methods to drive this motor, some of them are discussed below by taking an
example of a four-phase stepper motor.
The basic method of driving a stepper motor is a single excitation mode. It is an old method and not
used much at present but one has to know about this technique. In this technique every phase
otherwise stator next to each other will be triggered one by one alternatively with a special circuit. This
will magnetize & demagnetize the stator to move the rotor forward.
Driving Techniques
Full Step Drive
In this technique, two stators are activated at a time instead of one in a very less time period. This
technique results in high torque & allows the motor to drive the high load.
This technique is fairly related to the Full step drive because the two stators will be arranged next to
each other so that it will be activated first whereas the third one will be activated after that. This kind
of cycle for switching two stators first &after that third stator will drive the motor. This technique will
result in improved resolution of the stepper motor while decreasing the torque.
Micro Stepping
This technique is most frequently used due to its accuracy. The accuracy of every step can be enhanced
by this small step current. This technique is extensively used because it provides high accuracy as well
as decreases operating noise to a large extent.
Stepper Motor Circuit & Its
Operation
Stepper motors operate differently which rotate when voltage is applied to their terminals. Stepper
motors, on the other hand, effectively have multiple toothed electromagnets arranged around a
central gear-shaped piece of iron. The electromagnets are energized by an external control circuit, for
example, a microcontroller.
Types of Stepper Motor
There are three main types of stepper motors, they are:
Permanent magnet motors use a permanent magnet (PM) in the rotor and operate on the attraction or
repulsion between the rotor PM and the stator electromagnets.
This is the most common type of stepper motor as compared with different types of stepper motors
available in the market. This motor includes permanent magnets in the construction of the motor. This
kind of motor is also known as tin-can/can-stack motor. The main benefit of this stepper motor is less
manufacturing cost. For every revolution, it has 48-24 steps.
Types of Stepper Motor
Variable Reluctance Stepper Motor
Variable reluctance (VR) motors have a plain iron rotor and operate based on the principle that
minimum reluctance occurs with minimum gap, hence the rotor points are attracted toward the stator
magnet poles.
The stepper motor like variable reluctance is the basic type of motor and it is used for the past many
years. As the name suggests, the rotor’s angular position mainly depends on the magnetic circuit’s
reluctance that can be formed among the teeth of the stator as well as a rotor.
Types of Stepper Motor
Hybrid Synchronous Stepper Motor
Hybrid stepper motors are named because they use a combination of permanent magnet (PM) and
variable reluctance (VR) techniques to achieve maximum power in small package sizes.
The most popular type of motor is the because it gives a good performance as compared with a
permanent magnet rotor in terms of speed, step resolution, and holding torque. But, this type of
stepper motor is expensive as compared with permanent magnet stepper motors. This motor
combines the features of both the permanent magnet and variable reluctance stepper motors.
These motors are used where less stepping angle is required like 1.5, 1.8 & 2.5 degrees.
Types of Stepper Motor
How to Select a Stepper Motor?
Before selecting a stepper motor for your requirement, it is very significant to examine the torque-
speed curve of the motor. So this information is available from the designer of the motor, and it is a
graphical symbol of the torque of the motor at a specified speed. The motor’s torque-speed curve
should match closely the necessities of the application; or else, the expected system performance
cannot be obtained.
Learning Outcomes
16
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Gas Sensor
✓ Gas sensor is a device which detects the concentration level of the gases present in the atmosphere.
Nowadays, sensors play a major role in safety systems. In order to detect smoke and fire, smoke
sensors are used. They provide appropriate action on time for safety purposes. There are numerous
types of sensors available to measure environmental characteristics like light, noise, smoke, etc.
✓ One such sensor used in safety systems to detect harmful gases is the MQ2 Gas sensor. If you want
to make an indoor air quality monitoring system, breath checker, or early fire detection system, the
MQ2 sensor is a suitable choice.
Sensing Elements
The sensor has a sensing element in order to sense the smoke or any gaseous material. In this sensor,
the sensing material is a stainless steel mesh. This mesh contains aluminium-oxide-based ceramic,
coated with tin dioxide.
There are mainly 6 leads in the sensing element. Two are used for heating of sensing elements, the
remaining four are used for the output signal.
Let's consider that we want to identify the Oxygen gas, the oxygen atoms get absorbed on the sensing
element when it will be heated at a higher temperature.
Sensing Elements
In oxide has donor electrons present in it, which are attracted towards oxygen. So by identifying the
donor electrons, we can detect the amount of oxygen that gets absorbed as well as we can oppose the
flow of current to give the signal.
When reducing gases are present on the sensor, oxygen atoms try to interact with reducing gases and
reduce the absorbed surface density of the oxygen atom. Hence current can flow through the sensor to
generate an analog output signal.
This output signal generates the voltage values by which we will get an idea about the concentration of
gases. When the concentration of gas is high voltage will be high.
What is MQ2 Gas Sensor?
✓ The MQ2 module of the gas sensor is useful for gas leakage detection in the home as well as in the
industries. It observes the level of gases present in the atmosphere. The gas sensor operates on 5V
and 800mW.
✓ Depending on the level of concentration, the sensor observes the potential difference and this
changes the resistance of the material inside the sensor. The output voltage value gives us the
type of gas.
✓ Normally these sensors are available as a comparator. These comparators are able to set up a
threshold value for gas concentration. The digital pin will go high only when the concentration of
the gas is above the threshold value. The sensor will work in analog mode to detect the
concentration of the gas.
Construction
Construction
Generally, all types of gas sensors including MQ2 gas sensors are constructed by metal oxide
semiconductors. These gas sensors have one sensing element which is consists of the following
elements.
➢ Tubular ceramic
➢ Electrodes
➢ Heater Coil
➢ Electrode line
This sensing element is responsible to process all the parameters and detect the type of gas.
Pinout of the Gas Sensor
VCC provides power to the sensor comparator board and needs to be connected to the 5V of the
Arduino
GND is the ground pin and needs to be connected to the GND pin of the Arduino.
D0 is the digital output pin, which shows the digital representation of the detected gas.
A0 is the analog output pin from which we can detect the gas type by analyzing analog values.
Sensitivity adjustment
In order to adjust the sensitivity of this sensor for the particular type of gas, you need to keep this
sensor in the particular gas type you want to detect. Now we have to rotate the potentiometer on the
sensor.
✓ Rotate it till the Red LED on the sensor gets ON. If we have to increase the sensitivity, rotate it
clockwise, and if we have to decrease the sensitivity we have to rotate it anticlockwise.
✓ When we are rotating this potentiometer basically we are adjusting the threshold value of the
sensor. The comparator on this board is constantly checking the threshold value.
✓ Once this threshold gets crossed the digital pin goes high and the LED will turn on. In this way
calibrate your sensor, it may take some time but once you calibrate it, it will give you accurate
readings.
Assembly
Description
Connect your MQ2 sensor with the Arduino as shown in the above diagram.
Connect the digital pin of the sensor D0 to the digital pin number 8 of the Arduino
Connect the analog pin of the sensor to the analog pin A0 of the Arduino.
Learning Outcomes
15
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
LM35 Temperature Sensor
✓ The LM35 is a low voltage, precision centigrade temperature sensor manufactured by Texas
Instruments. It is a chip that provides a voltage output that is linearly proportional to the
temperature in °C and is, therefore, very easy to use with an Arduino.
✓ The LM35 temperature sensor is fairly precise, never wears out, works under many environmental
conditions and requires no external components to work. In addition, the LM35 sensor does not
require calibration and provides a typical accuracy of ±0.5°C at room temperature and ±1°C over a
full −55°C to +155°C temperature range.
✓ The sensor can be powered with a 4V to 30V power supply and consumes less than 60µA
during active temperature conversions, providing very low self-heating (less than 0.08°C
in still air).
LM35 Temperature Sensor
✓ The LM35 series are precision integrated-circuit temperature devices with an output voltage
linearly proportional to the Centigrade temperature. The LM35 device has an advantage over
linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large
constant voltage from the output to obtain convenient Centigrade scaling.
✓ LM35 is a temperature sensor which can measure temperature in the range of -55°C to 150°C.
✓ It is a 3-terminal device that provides analog voltage proportional to the temperature. Higher the
temperature, higher is the output voltage.
✓ The output analog voltage can be converted to digital form using ADC so that a microcontroller
can process it.
Assembly
To build our circuit with Arduino Uno, follow the steps below:
8
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
University Institute of Computing
Master of Computer Applications
Internet of Things (IoT)
Sub Code: 21CAH-733
Designed By :
Er. Sachin Chawla
Assistant Professor (ECE) 1
Syllabus
1. Embedded System
2. IOT & UNIT 1 Pi
Raspberry
3. Arduino Programming
Embedded Programming
1.
1. Interfacing of Devices
2. Basic LawsUNIT 2
and Components
3. Various
Interface Sensor
Digital and Devices
and Analog I/O Devices
2.
1. Embedded System
Application
UNIT using3Arduino
Application of Embedded systems
3.
Syllabus
Unit-1 Embedded Programming Contact Hours: 15
Chapter 1.1 Embedded Systems
Embedded system: Introduction to Microcontroller, Difference between
microprocessor and Microcontroller, Embedded System Characteristics & its
examples, AVR microcontroller: Types, Architecture Internal Architectural and Block
diagram of controller (-ATmega 328), Essential Peripheral circuits: Crystal Circuit,
Power supply, Oscillator Circuit.
Chapter 1.2 Introduction to IOT and Raspberry Pi
Trends in the Adoption of the Internet of Things (IoT), The Importance of the
Internet of Things (IoT) in Society, Introduction of Raspberry Pi, Pin Diagram of
Raspberry, Comparison of Arduino and Raspberry Pi
4
Interfacing HC-05 Bluetooth Module
with Arduino Uno
• Bluetooth Communication is a 2.4GHz frequency based RF Communication with a range of
approximately 10 meters. It is one of the most popular and most frequently used low range
communication for data transfer, audio systems, handsfree, computer peripherals etc.
✓ Arduino Uno
✓ LED
✓ Jumper Wires
✓ Bread Board
Software Required
✓ Arduino IDE
RXD : This is UART RX pin. This pin is used to send AT command when the module is in command
mode. And it is used to send data to the connected device when the module is in data mode.
TXD : This is UART TX pin. This pin is used push out responses to AT command when the module is in
command mode. And it is used push out data send by the connected device when the module is in
data mode.
Circuit Diagram
GND : Power supply -ive.
KEY : This input is used to switch between command and data mode. If this pin is set HIGH, the
module will be in command mode. Similarly if this pin is set LOW, the module will be in data mode.
Description
• RXD pin of HC-05 Bluetooth – TXD pin of Arduino Uno
Arduino Bluetooth Controller: This app can be download from Google Play Store. This app will act
as a Bluetooth remote controller for Arduino. It is very easy to use this app. Open the app and
connect to the HC-05 device. Then select the option as switch mode. Now you can control the LED
using the app.
Program
Reference
Description
• Initialize the serial port (UART) with the default baudrate of HC-05 Bluetooth module.
• In the loop() we keep checking any data is available to read from the serial port.
• If the data read is ‘1’ then the LED is turned ON, else LED will be turned OFF.
Learning Outcomes
13
References
1. http://clipart-library.com/thinking-images.html
2. http://www.pef.uni-lj.si/eprolab/comlab/introdaq/moreinfo/ADC.htm
3. http://www.except.nl/en/services/61-communication-strategy
4. https://electricalfundablog.com/smart-card-works-specifications-types/
5. https://www.electronics-notes.com/articles/test-methods/frequency-counter-timer/how-to-
use-frequency-counter-interval-
6. https://www.amazon.in/Compatible-Bluetooth-Electronic-Security-Apartment/dp/B07P18PSPN
7. timer.phphttps://www.amazon.com/Padgene-Bluetooth-Smart-Watch-
Camera/dp/B00X9L90RG
8. https://www.electronicshub.org/arduino-rf-transmitter-receiver-module/
9. https://www.youtube.com/watch?v=eGXo5K19iqs
10. https://circuitdigest.com/microcontroller-projects/arduino-timer-
tutorial#:~:text=A%20timer%20uses%20counter%20which,for%20every%2062%20nano%20sec
ond.
THANK YOU
Email Id :
[email protected]
Handson Technology
User Manual V1.3
1 www.handsontec.com
Table of Contents
1. Specification: .......................................................................................................................................................... 3
2. Pin Definition: ......................................................................................................................................................... 3
3. Using Arduino IDE ................................................................................................................................................... 3
3.1 Install the Arduino IDE 1.6.4 or greater........................................................................................................... 4
3.2 Install the ESP8266 Board Package ................................................................................................................. 4
3.3 Setup ESP8266 Support................................................................................................................................... 5
3.4 Blink Test......................................................................................................................................................... 7
3.5 Connecting via WiFi......................................................................................................................................... 9
4. Flashing NodeMCU Firmware on the ESP8266 using Windows ............................................................................ 12
4.1 Parts Required: ................................................................................................................................................... 12
4.2 Pin Assignment: .................................................................................................................................................. 12
4.3 Wiring: ................................................................................................................................................................ 13
4.4 Downloading NodeMCU Flasher for Windows.................................................................................................... 13
4.5 Flashing your ESP8266 using Windows ............................................................................................................... 13
5. Getting Started with the ESPlorer IDE................................................................................................................... 15
5.1 Installing ESPlorer ............................................................................................................................................... 15
5.2 Schematics .......................................................................................................................................................... 18
5.3 Writing Your Lua Script ....................................................................................................................................... 18
6. NodeMCU GPIO for Lua ............................................................................................................................................ 22
7. Web Resources: ........................................................................................................................................................ 22
2 www.handsontec.com
1. Specification:
Voltage:3.3V.
Wi-Fi Direct (P2P), soft-AP.
Current consumption: 10uA~170mA.
Flash memory attachable: 16MB max (512K normal).
Integrated TCP/IP protocol stack.
Processor: Tensilica L106 32-bit.
Processor speed: 80~160MHz.
RAM: 32K + 80K.
GPIOs: 17 (multiplexed with other functions).
Analog to Digital: 1 input with 1024 step resolution.
+19.5dBm output power in 802.11b mode
802.11 support: b/g/n.
Maximum concurrent TCP connections: 5.
2. Pin Definition:
3 www.handsontec.com
The most basic way to use the ESP8266 module is to use serial commands, as the chip is basically a WiFi/Serial
transceiver. However, this is not convenient. What we recommend is using the very cool Arduino ESP8266 project,
which is a modified version of the Arduino IDE that you need to install on your computer. This makes it very
convenient to use the ESP8266 chip as we will be using the well-known Arduino IDE. Following the below step to
install ESP8266 library to work in Arduino IDE environment.
4 www.handsontec.com
Click ‘Tools’ -> ‘Board:’ -> ‘Board Manager…’ to access this panel.
Scroll down to ‘ esp8266 by ESP8266 Community ’ and click “Install” button to install the ESP8266 library package.
Once installation completed, close and re-open Arduino IDE for ESP8266 library to take effect.
Select 80 MHz as the CPU frequency (you can try 160 MHz overclock later)
5 www.handsontec.com
Select ‘115200’ baud upload speed is a good place to start - later on you can try higher speeds but 115200 is a good
safe place to start.
Go to your Windows ‘Device Manager’ to find out which Com Port ‘USB-Serial CH340’ is assigned to. Select the
matching COM/serial port for your CH340 USB-Serial interface.
6 www.handsontec.com
Find out which Com Port is assign for CH340 Select the correct Com Port as indicated on ‘Device Manager”
Note: if this is your first time using CH340 “ USB-to-Serial ” interface, please install the driver first before proceed
the above Com Port setting. The CH340 driver can be download from the below site:
https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers
Enter this into the sketch window (and save since you'll have to). Connect a LED as shown in Figure3-1.
void setup() {
pinMode(5, OUTPUT); // GPIO05, Digital Pin D1
}
void loop() {
digitalWrite(5, HIGH);
delay(900);
digitalWrite(5, LOW);
delay(500);
}
Now you'll need to put the board into bootload mode. You'll have to do this before each upload. There is no timeout
for bootload mode, so you don't have to rush!
7 www.handsontec.com
When you release the ‘RST’ button, the blue indication will blink once, this means its ready to bootload.
Once the ESP board is in bootload mode, upload the sketch via the IDE, Figure 3-2.
8 www.handsontec.com
Figure 3.2: Uploading the sketch to ESP8266 NodeMCU module.
The sketch will start immediately - you'll see the LED blinking. Hooray!
OK once you've got the LED blinking, let’s go straight to the fun part, connecting to a webserver. Create a new sketch
with this code:
to your WiFi access point and password, then upload the same way: get into bootload mode, then upload code via
IDE.
/*
* Simple HTTP get webclient test
*/
#include <ESP8266WiFi.h>
const char* ssid = "handson"; // key in your own SSID
const char* password = "abc1234"; // key in your own WiFi access point
password
9 www.handsontec.com
const char* host = "www.handsontec.com";
void setup() {
Serial.begin(115200);
delay(100);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
int value = 0;
void loop() {
delay(5000);
++value;
Serial.print("connecting to ");
Serial.println(host);
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
}
10 www.handsontec.com
Open up the IDE serial console at 115200 baud to see the connection and webpage printout!
That's it, pretty easy right ! This section is just to get you started and test out your module.
11 www.handsontec.com
4. Flashing NodeMCU Firmware on the ESP8266 using Windows
NodeMCU is a firmware that allows you to program the ESP8266 modules with LUA script. And you’ll find it very
similar to the way you program your Arduino. With just a few lines of code you can establish a WiFi connection,
control the ESP8266 GPIOs, turning your ESP8266 into a web server and a lot more.
In this tutorial we are going to use another ESP8266 module with pin header adapter board which is breadboard
friendly.
12 www.handsontec.com
4.3 Wiring:
After wiring your circuit, you have to download the NodeMCU flasher. This is a .exe file that you can download using
one of the following links:
You can find all the information about NodeMCU flasher here.
Open the flasher that you just downloaded and a window should appear (as shown in the following figure).
13 www.handsontec.com
Press the button “Flash” and it should start the flashing process immediately, showing the Module MAC address if
successful connected.
After finishing this flashing process, it should appear a green circle with a check icon at lower left corner.
14 www.handsontec.com
5. Getting Started with the ESPlorer IDE
ESPlorer is an IDE (Integrated Development Environment) for ESP8266 devices. It‟s a multi platform IDE, can be
used in any OS environment, this simply means that it runs on Windows, Mac OS X or Linux.
Supported platforms:
Windows(x86, x86-64)
Linux(x86, x86-64, ARM soft & hard float)
Solaris(x86, x86-64)
Mac OS X(x86, x86-64, PPC, PPC64)
This software allows you to establish a serial communications with your ESP8266 module, send commands, and
upload code and much more.
Requirements:
You need to have JAVA installed in your computer. If you don’t have, go to this website:
http://java.com/download, download and install the latest version. It requires JAVA (SE version 7 and above)
installed.
In order to complete the sample project presented in this Guide you need to flash your ESP8266 with
NodeMCU firmware. Refer to chapter-4 in this guide on how to flash the NodeMCU firmware.
Main Resources:
Now let’s download the ESPlorer IDE, visit the following URL: http://esp8266.ru/esplorer/#download
Grab the folder that you just downloaded. It should be named “ESPlorer.zip” and unzip it. Inside that folder you
should see the following files:
Execute the “ESPlorer.jar” file and the ESPlorer IDE should open after a few seconds (the “ESPlorer.jar” file is what
you need to open every time you want to work with the ESPlorer IDE).
15 www.handsontec.com
Note: If you’re on Mac OS X or Linux you simply use this command line in your terminal to run the ESPlorer: sudo
java –jar ESPlorer.jar.
When the ESPlorer first opens, that’s what you should see:
The ESPlorer IDE has a couple of main sections, let‟s break it down each one.
In the top left corner you can see all the regular options that you find in any software. Create a New file, Open a new
file, Save file, Save file as, Undo, Redo, etc.
16 www.handsontec.com
In the top right corner you have all the options you need to establish a serial communication (you‟re going to learn
how to use them later in this Guide).
This next screenshot shows your Code Window, that‟s where you write your scripts (your scripts are highlighted with
your code syntax).
Below the Code Window, you have 12 buttons that offer you all the functions you could possible need to interact with
your ESP8266. Here‟s the ones you‟ll use most: “Save to ESP” and “Send to ESP”.
This screenshot shows the Output Window which tells you exactly what‟s going on in your ESP8266. You can see
errors and use prints in your code to debug your projects.
17 www.handsontec.com
5.2 Schematics
To upload code to your ESP8266, you should connect your ESP8266 to your PL2303HX USB-UART Programming Cable
like the figure below:
Right now you don‟t need to worry how this code works, but how you can upload it to your ESP8266.
18 www.handsontec.com
Having your ESP8266+PL2303HX Programmer connected to your computer, go to the ESPlorer IDE:
Look at the top right corner of your ESPlorer IDE and follow these instructions:
Then in the top left corner of your ESPlorer IDE, follow these instructions:
1. Select NodeMCU
2. Select Scripts
3. Create a new filled called “init.lua”
19 www.handsontec.com
Copy your Lua script to the code window (as you can see in the Figure below):
20 www.handsontec.com
Note: If you want to delete your “init.lua” file, you can do that easily. Simply type file.remove(“init.lua”) and press
the button “Send” (see Figure above). Or you can type the command file.format() to remove all the files saved in your
ESP8266. You can type any commands and send them to your ESP8266 through that window.
After uploading your code to your ESP8266, unplug your ESP8266 from your computer and power up the ESP8288
module.
Congratulations, you‟ve made it! The blue LED at the upper right corner should be blinking every 2 seconds!
21 www.handsontec.com
6. NodeMCU GPIO for Lua
The GPIO(General Purpose Input/Output) allows us to access to pins of ESP8266 , all the pins of ESP8266 accessed
using the command GPIO, all the access is based on the I/O index number on the NoddMCU dev kits, not the internal
GPIO pin, for example, the pin „D7‟ on the NodeMCU dev kit is mapped to the internal GPIO pin 13, if you want to
turn „High‟ or „Low‟ that particular pin you need to called the pin number „7‟, not the internal GPIO of the pin. When
you are programming with generic ESP8266 this confusion will arise which pin needs to be called during
programming, if you are using NodeMCU devkit, it has come prepared for working with Lua interpreter which can
easily program by looking the pin names associated on the Lua board. If you are using generic ESP8266 device or any
other vendor boards please refer to the table below to know which IO index is associated to the internal GPIO of
ESP8266.
D0 or GPIO16 can be used only as a read and write pin, no other options like PWM/I2C are supported by
this pin.
In our example in chapter 5 on blinking the blue LED, the blue LED in connected to GPIO2, it is defined as
Pin4 (D4) in Lua script.
7. Web Resources:
22 www.handsontec.com
Handsontec. com
23 www.handsontec.com
The Face behind our product quality…
In a world of constant change and continuous technological development, a new or replacement
product is never far away – and they all need to be tested.
Many vendors simply import and sell wihtout checks and this cannot be the ultimate interests of
anyone, particularly the customer. Every part sell on Handsotec is fully tested. So when buying from
Handsontec products range, you can be confident you’re getting outstanding quality and value.
We keep adding the new parts so that you can get rolling on your next project.
P
Engineering Material Mechanical Hardware Electronics Components
24 www.handsontec.com
Understanding Arduino:
Page 1 of 17
Slide 1: Introduction
Concept of Timer:
- Foundation of precise timing in Arduino projects.
- Introduces the idea of a digital timer controlling various aspects of the project.
1. Definition of a Timer:
- A timer in Arduino is a built-in feature that counts time or events.
Page 3 of 17
- PWM (Pulse Width Modulation): Generates analog-like signals.
- Fast PWM: Similar to PWM but with a different counting method.
Page 4 of 17
Slide 3: Timer Registers in Arduino
1. Introduction to Registers:
- Registers are small memory locations in Arduino that store data or configuration settings.
Page 5 of 17
Slide 4: Timer/Counter Modes in Arduino
Page 6 of 17
4. Fast PWM Mode:
- Similar to PWM, but uses a different counting method for faster operation.
- Offers high-frequency PWM signals for applications requiring rapid adjustments.
Page 7 of 17
Slide 5: Configuring Timer Registers
Page 9 of 17
4. Compare Match Interrupt:
- Triggered when the timer value matches a pre-defined comparison value.
- Useful for precise event timing or triggering actions at specific timer values.
Page 10 of 17
Slide 7: Handling Timer Interrupts in Arduino
2. Enabling/Disabling Interrupts:
- Enable: Allows interrupts to be processed.
- Disable: Temporarily stops the execution of interrupts.
- Controlling interrupts helps manage when certain events are handled.
Page 11 of 17
Slide 8: Practical Examples
Page 12 of 17
Slide 9: Troubleshooting and Common Pitfalls
Page 13 of 17
Slide 10: Conclusion
Page 14 of 17
Slide 11: Q&A
- Now explore these questions:
1. Concept of Timer:
a. What is the primary purpose of a timer in Arduino?
b. How does a timer contribute to precise timekeeping in projects?
c. Can you briefly explain the significance of timers in event triggering?
2. Arduino Timer Registers:
a. What is the role of registers in Arduino timer functionality?
b. Name three commonly used timer registers and their functions.
c. How do you load initial values into timer registers?
3. Arduino Timer Interrupts:
a. What is an interrupt, and how does it relate to timers in Arduino?
b. Differentiate between Timer Overflow Interrupt and Compare Match Interrupt.
c. How can interrupts be utilized for achieving precise timing in Arduino projects?
Page 15 of 17
Slide 12: Resources
1. "Arduino Cookbook" by Michael Margolis:
- A comprehensive resource covering various aspects of Arduino, including timers, with practical examples and
projects.
2. "Arduino: A Technical Reference" by J. M. Hughes:
- This book provides an in-depth technical reference, offering insights into timer configurations and advanced usage.
3. "Programming Arduino: Getting Started with Sketches" by Simon Monk:
- A beginner-friendly book that introduces Arduino programming, including the basics of timers.
4. "AVR Programming: Learning to Write Software for Hardware" by Elliot Williams:
- Focuses on programming AVR microcontrollers, which is relevant to understanding Arduino timers at a deeper level.
5. Arduino Official Documentation:
- The official Arduino website (https://www.arduino.cc/) offers extensive documentation, including datasheets and
reference materials for timers.
6. Online Resources:
- Websites like Stack Overflow (https://stackoverflow.com/) and the Arduino Forum (https://forum.arduino.cc/)
provide a platform for community discussions and problem-solving related to timers.
Page 16 of 17
Conclusion!
endless possibilities."
Page 17 of 17