Esd Practicals
Esd Practicals
AIM: To interface an LED with Arduino and ESP8266, and control its state using GPIO pins.
Apparatus Required:
1. Arduino (e.g., Arduino Uno)
2. ESP8266 module
3. LED
4. Resistors (220Ω)
5. Breadboard, wires
6. Power supply (USB)
Basic Theory: An LED emits light when current passes through it. By using the GPIO pins
of Arduino or ESP8266, we can control the LED (turn it on/oT) through programming.
• Arduino: A microcontroller platform that uses GPIO pins to control devices like
LEDs.
• ESP8266: A Wi-Fi module with GPIO pins that can control devices and connect to
the internet.
Working:
1. Arduino: Connect the LED to a digital pin (e.g., 13), add a 220Ω resistor, and
upload the code to blink the LED.
2. ESP8266: Connect the LED to a GPIO pin (e.g., GPIO2) with a resistor, and upload
the code to blink the LED.
3. Arduino + ESP8266: Use serial communication for Arduino to send data to
ESP8266, which controls the LED based on the input.
EXPERIMENT 2
AIM: To interface a potentiometer with Arduino Uno and ESP8266 and read analog values
using their ADC (Analog to Digital Converter) pins.
Apparatus Required:
1. Arduino Uno
2. ESP8266 module
3. Potentiometer
4. Breadboard
5. Jumper wires
6. Power supply (USB)
Working:
1. Arduino Uno:
o Connect the middle pin of the potentiometer to the analog pin (A0) of
Arduino.
o Connect the other two pins to 5V and GND.
o Upload code to read and display the analog values via the serial monitor.
2. ESP8266:
• Connect the middle pin of the potentiometer to the analog pin (A0) of
ESP8266.
• Connect the other two pins to 3.3V and GND.
• Upload code to read and display the analog values.
EXPERIMENT 3
AIM: To write a program that controls the brightness of an LED using Pulse Width
Modulation (PWM) to create a fading eTect.
Apparatus Required:
1. Arduino (e.g., Arduino Uno)
2. ESP8266 module (optional for ESP8266 code)
3. LED
4. Resistor (220Ω)
5. Breadboard
6. Jumper wires
7. Power supply (USB)
Basic Theory: Pulse Width Modulation (PWM) is a technique where the duty cycle of a
digital signal is varied to control the power delivered to devices like LEDs or motors. By
adjusting the duty cycle, we can control the brightness of the LED. A higher duty cycle
means the LED stays on longer and is brighter; a lower duty cycle dims the LED.
• Arduino: Arduino supports PWM on specific pins (e.g., pins 3, 5, 6, 9, 10, and 11).
• ESP8266: ESP8266 also supports PWM on GPIO pins, typically using software to
vary the duty cycle.
Working:
1. Arduino:
o Connect the anode (+) of the LED to a PWM pin (e.g., pin 9) of the Arduino
through a 220Ω resistor.
o Connect the cathode (-) to GND.
o Upload the following code to create a fading eTect.
2. ESP8266:
• Connect the LED in the same way, using a GPIO pin (e.g., GPIO5).
• Use the following code to control LED brightness using PWM on ESP8266.
EXPERIMENT 4
AIM: To interface a push button and LED with Arduino or ESP8266 and control the LED’s
state (ON/OFF) using the button input.
Apparatus Required:
1. Arduino Uno / ESP8266 module
2. Push button
3. LED
4. Resistor (220Ω for LED, 10kΩ for the button)
5. Breadboard
6. Jumper wires
7. Power supply (USB)
Basic Theory: A push button is a simple input device that closes the circuit when
pressed, allowing current to flow. The button can be connected to a microcontroller to
detect when it's pressed. The LED is an output device that can be controlled based on the
button’s state.
• Arduino/ESP8266: Both microcontrollers can read input from a button and output
control signals to an LED using their GPIO pins. The button connects one terminal
to a digital input pin and the other to ground, and a pull-up resistor is used to
maintain a stable logic level.
Working:
1. Arduino:
o Connect one terminal of the button to digital pin 2 and the other terminal
to GND.
o Connect the LED anode (+) to digital pin 13 (or any GPIO) via a 220Ω
resistor, and the cathode (-) to GND.
o Add a pull-up resistor (internal or external) for the button.
o Upload the following code to control the LED based on the button press.
2. ESP8266:
• Connect the push button to GPIO pin 0 (or another GPIO) and GND.
• Connect the LED to a GPIO pin (e.g., GPIO5) with a 220Ω resistor.
• Use the following code for controlling the LED with the button on ESP8266.
EXPERIMENT 5
AIM: To interface a seven-segment display with Arduino Uno and ESP8266 to display
numerical digits.
Apparatus Required:
1. Arduino Uno / ESP8266
2. 7-segment display (common cathode or anode)
3. Resistors (220Ω for each segment)
4. Breadboard
5. Jumper wires
6. Power supply (USB)
Working:
1. Arduino Uno:
o Connect the pins of the seven-segment display to Arduino digital pins (e.g.,
pin 2 for segment A, pin 3 for segment B, etc.).
o Use 220Ω resistors for each segment to limit current.
o If using a common cathode display, connect the common pin to GND; for
common anode, connect the common pin to VCC.
o Upload code to display a digit (e.g., "3").
2. ESP8266:
• Connect the seven-segment display to the GPIO pins of the ESP8266 in a
similar manner, using resistors for each segment.
• If using a common cathode display, connect the common pin to GND; for
common anode, connect it to 3.3V.
• Upload code for ESP8266 to display a digit (e.g., "5").
EXPERIMENT 6
AIM: To interface a 16x2 LCD module with Arduino Uno and ESP8266 to display text.
Apparatus Required:
1. Arduino Uno / ESP8266
2. 16x2 LCD display module
3. Breadboard
4. Jumper wires
5. Power supply (USB)
Basic Theory: A 16x2 LCD can display up to 16 characters per line, across two rows. It
operates based on the HD44780 controller and uses a parallel communication protocol
with the microcontroller. Typically, a potentiometer is used to control contrast, but it can
be omitted by directly connecting the contrast pin (Vo) to GND for maximum contrast, or
using a resistor if slight adjustment is needed.
• RS: Register Select (0 for command, 1 for data)
• RW: Read/Write (typically grounded for writing only)
• E: Enable pin to trigger data read/write
Working:
1. Arduino Uno:
Connect the LCD pins to Arduino as follows:
§ RS → Pin 12
§ E → Pin 11
§ D4 → Pin 5
§ D5 → Pin 4
§ D6 → Pin 3
§ D7 → Pin 2
§ VCC → 5V
§ GND → GND
2. ESP8266:
Connect the LCD pins to ESP8266 GPIO pins as follows:
§ RS → GPIO D1
§ E → GPIO D2
§ D4 → GPIO D3
§ D5 → GPIO D4
§ D6 → GPIO D5
§ D7 → GPIO D6
§ VCC → 3.3V
§ GND → GND
EXPERIMENT 7
AIM: To interface an IR sensor with Arduino Uno and ESP8266 to detect obstacles and
control the LED (turn it on and oT based on sensor input).
Apparatus Required:
1. Arduino Uno / ESP8266
2. IR sensor module (Infrared sensor)
3. LED
4. Resistor (220Ω for LED)
5. Breadboard
6. Jumper wires
7. Power supply (USB)
Basic Theory: An IR sensor works by emitting infrared light and detecting its reflection
from an object. The sensor has two main components: an IR LED (emitter) and a
photodiode (receiver). When an object comes in front of the sensor, the reflected IR light
is detected by the photodiode, and the sensor outputs a digital signal indicating the
presence of the object.
• IR Sensor Output: When the sensor detects an obstacle, it outputs a LOW signal,
and when no object is detected, it outputs HIGH.
• Arduino/ESP8266: Both microcontrollers can read the digital output from the IR
sensor and use it to control the state of an LED.
Working:
1. Arduino Uno:
o Connect the IR sensor's OUT pin to Arduino digital pin 2.
o Connect the sensor’s VCC to 5V and GND to GND.
o Connect the LED anode (+) to pin 13 (or any digital pin) via a 220Ω resistor
and cathode (-) to GND.
o Upload the following code to control the LED based on IR sensor input.
2. ESP8266:
• Connect the IR sensor's OUT pin to ESP8266 GPIO pin D1.
• Connect the sensor’s VCC to 3.3V and GND to GND.
• Connect the LED anode (+) to GPIO pin D5 via a 220Ω resistor, and the
cathode (-) to GND.
• Upload the following code to control the LED using the IR sensor with
ESP8266.
EXPERIMENT 8
AIM: To interface the DHT11 sensor with Arduino Uno and ESP8266 to measure
temperature and humidity and display the values.
Apparatus Required:
1. Arduino Uno / ESP8266
2. DHT11 sensor
3. 10kΩ resistor (
4. Breadboard
5. Jumper wires
6. Power supply (USB)
Basic Theory: The DHT11 sensor is used to measure both temperature and humidity. It
communicates with microcontrollers via a digital signal on a single data pin, making it
easy to integrate. The DHT11 is capable of measuring temperatures from 0°C to 50°C and
humidity levels from 20% to 90% with a reasonable degree of accuracy.
• Pinout of DHT11:
o VCC: Power supply (3.3V or 5V)
o GND: Ground
o DATA: Data pin for communication (
Working:
1. Arduino Uno:
o Connect the VCC pin of the DHT11 to the 5V pin of the Arduino.
o Connect the GND pin to GND.
o Connect the DATA pin to digital pin 2.
o Upload the following code using the DHT sensor library to read
temperature and humidity.
2. ESP8266:
• Connect the VCC pin of the DHT11 to the 3.3V pin of the ESP8266.
• Connect the GND pin to GND.
• Connect the DATA pin to GPIO pin D4.
• Upload the following code using the DHT sensor library for ESP8266.