Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Python (3150910) Lab Manual

Experiment No.: -______ Date: -


___________

Interfacing of a Micro Python and GPIO pins of NodeMCU (ESP 8266)

Specific Outcome:
After performing this experiment, the student will be able to:
 Interface a MicroPython and GPIO pins of NodeMCU (ESP 8266).
 To send digital data on GPIO pins of NodeMCU.

1. Develop a program in MicroPython to blink a LED using ESP 8266 with

the help of a Thonny IDE.

Now we will start our project to blink an LED using ESP 8266 in MicroPython with
the help of Thonny IDE. To perform this project, we need the following equipment:
 Breadboard
 One LED
 One 220 ohm resistor
 Connecting Wires
 ESP 8266

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____
Python (3150910) Lab Manual

Now, program the nodeMCU board to blink a LED. The following script will be run
on the Thonny IDE's editor.
when uploading the code as ledblink.py it will be saved as main.py on the board
regardless of what you saved it as on your computer.
Once you are done uploading the code press the Reset (RST) button on the board.
Verify the output.

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____
Python (3150910) Lab Manual

Code :

2. Develop a program in MicroPython to generate PWM on ESP 8266 with

the help of a Thonny IDE.

Fading LED lights are one of the typical applications of PWM signals. LED fading is
often used to monitor the PWM output of a microcontroller. In this article, we will
use MicroPython to fade LED on ESP8266.

Components required

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____
Python (3150910) Lab Manual

 Breadboard
 One LED
 One 220 ohm resistor
 Connecting Wires
 ESP 8266
Circuit connections:
Connect the anode of LED with GPIO14 of ESP8266 and its cathode to the ground via
a series resistor of 330 ohm. In this manner, the LED is connected with
ESP32/ESP8266 such that it glows when the GPIO source current to the LED while it
remains off until GPIO is at LOW logic.

Now, program the nodeMCU board to generate PWM. The following script will be
run on the Thonny IDE's editor.
when uploading the code as pwm.py it will be saved as main.py on the board
regardless of what you saved it as on your computer.

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____
Python (3150910) Lab Manual

Once you are done uploading the code press the Reset (RST) button on the board.
Verify the output.

Code :

Conclusion:
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
___________________________________________________________

Sign of Faculty In-charge

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____
Python (3150910) Lab Manual

Reference: www.engineersgarage.com
https://microcontrollerslab.com

ELECT.ENGG.DEPARTMENT
GOVT. ENGG.COLLEGE,BHARUCH
____

You might also like