Exp 2
Exp 2
Name of the Student:- Sujal Sanjay Dubey Div: - CS-AIML Roll No: - SEDA 06
1) Node MCU – 1
2) Micro USB Cable – 1
3) PC/Laptop – 1
4) Connecting Wires
5) Bread Board – 1
6) LED – 4
7) Buzzer -1
8) Resistor 200 Ohm – 1
Software Required:
Arduino IDE
Theory:
We are familiar with blinking LED using Arduino boards as this is the fundamental step towards
using a new development board. In this experiment, first we will see how to connect an external
LED with Node MCU and how to blink it using GPIO pins of ESP8266 Node MCU. After that
we will see how to connect buzzer with Node MCU.
Procedure:
Step 1: Make the circuit diagram on bread board according to connection diagram shown below.
Anode of the LED [long leg of the LED] is connected to the D1 pin of the Node MCU, the cathode
of the LED [short leg of the LED] is connected with the one terminal of the resistor [200 Ohm]
and another terminal of the resistor is connected to the ground pin.
1
Step 2: Connect Node MCU to PC / Laptop with the help of micro USB cable
// the setup function runs once when you press reset or power the board
void setup() {
Step 6: Upload the sketch on Node MCU. Go to Sketch ---- > Upload
Step 1: Make the circuit diagram on bread board according to connection diagram shown below.
Positive terminal of buzzer [long leg of the buzzer] is connected to the D5 pin of the Node MCU,
negative terminal of buzzer [short leg of the buzzer] is connected to the ground pin.
Step 2: Connect Node MCU to PC / Laptop with the help of micro USB cable
void setup()
{
}
void loop()
{
tone(14, 494, 500);
delay(1000);
}
The three numbers inside the tone() function represent: the pin we send the sound (D5 or 14 in
our case), the frequency of the sound wave we send and the duration of the tone.
3
You can change the last two parameters and play with the speed of the beeps and the sound of
them.
Step 5: Save the new sketch by appropriate name in a folder on your PC / Laptop
Step 6: Upload the sketch on Node MCU. Go to Sketch ---- > Upload
Practice:
1. Connect 2/3/4 External LEDs and try different patterns of dancing LEDs
2. In tone function, use different music notes with different time period and run the melody.
4
2. Buzzer Interface
Conclusion:
In conclusion, the experiment to interface an external LED and buzzer to a Node MCU was
successful in providing hands-on experience in combining hardware and software to control
external components. It serves as a crucial building block for future IoT and embedded systems
projects, where the ability to interface various sensors and actuators is essential. Participants
gained valuable skills in electronics, microcontroller programming, and project development
through this experiment.