6 Nodemcu Esp32 Peripherals and Interfaces
6 Nodemcu Esp32 Peripherals and Interfaces
Team Emertxe
Interfaces
Arduino
Interface – What?
VP
SENS_VP AD1_C0 GPIO36 GPIO22 I2C_SCL
VN
SENS_VN AD1_C3 GPIO39 GPIO1 U0_TXD
D13 D12 D14 D27 D26 D25 D33 D32 D35 D34
D4 RX2 TX2
DAC_2 AD2_C9 GPIO26 GPIO17 U2_TXD
D15 D2
HSPI_Q TOUCH5 AD2_C5 GPIO12 GPIO2 AD2_C2 TOUCH2 HSPI_WP
U0_CTS HSPI_D TOUCH4 AD2_C4 GPIO13 GPIO15 AD2_C3 TOUCH3 HSPI_C0 U0_RTS
3V3 GND
GND GND
VIN GND
VIN 3.3V
EN
BOOT
VIN
EN
Light Emitting Diodes
Arduino
Interface - LEDs
●
Simplest device used in most on the embedded
applications as feedback
●
Works just like diodes
●
Low energy consumption, longer life, smaller size, faster
switching make it usable in wide application fields like
– Home lighting,
– Remote Controls, Surveillance,
– Displays and many more!!
Arduino
Interface - LEDs
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
GND
GPIO12
R1
D1
Tactile Switch
Arduino
Interface - Tactile Switches
●
Provides simple and cheap interface
●
Comes in different shapes and sizes
●
Preferable if the no of user inputs are less
●
Some common application of tactile keys are
– HMI
– Mobile Phones
– Computer Mouse etc,.
Arduino
Interface - Tactile Switches
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
GND
3.3V
GPIO15
GPIO16
R1
R2
R3
SW1
SW2
Analog Input
Arduino
Interface – Analog Inputs
●
Very important peripheral in embedded systems for real
time activities
●
The controller understands only digital signals, so an real
time linear signals have to be converted into digital form
●
Multiplexed with GPIO
●
Comes with different architecture, SAR is most commonly
used
Arduino
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
Interface - Analog Inputs - Potentiometer
GND
3.3V
AD2_C0
R1
Interrupts
Arduino
Peripheral – Interrupt - Contents
●
Basic Concepts
●
Interrupt Source
●
Interrupt Classification
●
Interrupt Handling
Arduino
Peripheral – Interrupt – Basic Concept
●
An interrupt is a communication process set up in a
microprocessor or microcontroller in which:
– An internal or external device requests the MPU to stop the
processing
– The MPU acknowledges the request
– Attends to the request
– Goes back to processing where it was interrupted
●
Polling
Arduino
Peripheral – Interrupt – Vs Polling
●
Events Detection
●
Response
●
Power Management
Arduino
Peripheral – Interrupt – Sources
●
Timers
●
External
●
Peripherals
Arduino
Peripheral – Interrupt – Classifications
Interrupts
Hardware Software
External Internal
Arduino
Peripheral – Interrupt – Handling
Interrupt
Occurs Here
i
i+1
Arduino
Peripheral – Interrupt – Handling - ISR
●
Similar to a subroutine
●
When an interrupt occurs, the MPU:
– Completes the instruction being executed
– Disables global interrupt enable
– Places the address from the program counter on the stack
●
Attends to the request of an interrupting source
– Clears the interrupt flag
– Should save register contents that may be affected by the code in the
ISR
– Must be terminated with the instruction RETFIE
●
Return from interrupt
Arduino
Peripheral – Interrupt – Handling - ISR
●
What / What Not
Arduino
Peripheral – Interrupt – Handling - ISR
●
Latency is determined by:
– Instruction time (how long is the longest)
– How much of the context must be saved
– How much of the context must be restored
– The effort to implement priority scheme
– Time spend executing protected code
Arduino
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
Peripheral – Interrupt – Interface
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
GND
3.3V
GPIO15
GPIO16
R1
R2
R3
SW1
SW2
Timers
Arduino
Peripherals - Timers
●
Resolution Register Width
●
Tick Up Count or Down Count
●
Quantum System Clock settings
●
Scaling Pre or Post
●
Modes
– Counter
– PWM or Pulse Generator
– PW or PP Measurement etc.,
Arduino
Peripherals – Timers - Example
●
Requirement – 5 pulses of 8 µsecs
●
Resolution – 8 Bit
●
Quantum – 1 µsecs
●
General
Arduino
Peripherals – Timers - Example
Timer Register
Overflows
28μs 20μs 12μs 4μs
Relay
Arduino
Interface - Relay
●
Most commonly used electromechanical switch
●
Uses a electromagnet to operate
●
Used to control high power devices using low power
signal
●
Provides isolation between the control and controlled
circuit
– Home Automation,
– Automotive applications
– Industrial application and many more !!
Arduino
Interface - Relay
Arduino
Interface - Relay
VIN
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
GND
GPIO17
R1
D1
VIN
Q1
K1
C
NC
NO
CLCD
Arduino
Interface - CLCD
●
Most commonly used
display ASCII
characters
●
Some customization in
symbols possible
●
Communication Modes
– 8 Bit Mode
– 4 Bit Mode
Arduino
Interface - CLCD
VIN
U1
VP
16 VDD Q1 4 D4
VN
Q2 5 D5
Q3 6 D6
D13 D12 D14 D27 D26 D25 D33 D32 D35 D34
HCF4094
D15 D2
3V3 GND
GND
VIN GND
VIN 3.3V
EN
BOOT
VIN
EN
Sensors
DHT11
Arduino
Interface – Sensors - DHT11
●
A cheap and very simple sensor to measure Temperature
and Humidity
●
It uses a capacitive humidity sensor and a thermistor to
measure the surrounding air, and sends digital signal on
the data pin
Arduino
Interface - Sensors - DHT11
VIN GND D13 D12 D14 D27 D26 D25 D33 D32 D35 D34 VN VP EN
EN
VIN
EN
BOOT
3V3 GND D15 D2 D4 RX2 TX2 D5 D18 D19 D21 RX0 TX0 D22 D23
GND
3.3V
GPIO16
1 - Vcc
2 – Data
U1
3 – NC
R1
DHT11
4 – Gnd
Thank You