Coding MicroPython using NodeMCU ESP8266

by Jun 3, 2020IoT Programming, NodeMCU

Before diving into the NodeMCU with MicroPython we should know some key concepts of embedded programming such as flashing , firmware etc.

Development platforms for NodeMCU_ESP8266:

  • ESPlorer
  • LuaIDE
  • Arduino IDE etc

Programming languages for NodeMCU_ESP8266:

  • MicroPython
  • Circuit python
  • Lua scripting
  • Arduino
  • Mongoose

As we see NodeMCU uses different languages we need different firmware installed into it for different languages. Each language has its own firmware to be installed which acts as language translator.

What is Firmware ?

It is the generally lightweight machine-level translation of the code, permanently stored in the device’s memory and acts as an OS analogous setup for the embedded system. It starts execution as soon as you turn on the device.

How to install Firmware ?

You install firmware by flashing the specific firmware file. Note that  Lua Default Firmware which Supports Arduino IDE.

Download the MicroPython file to flash in MicroPython visit here

Some steps to be followed to Run MicroPython on NodeMCU :

We will use ESPlorer IDE for coding NodeMCU

Download the ESPlorer Zip file and extract it from here

Executable java file after extraction

You need to install latest java on your Windows machine

Once you click on the above executable file you will see IDE like below:

micropython
IDE

Follow these steps to Open IDE :

  • Port must be automatically detected there (If port is not detected then you have to install drivers from here  )
  • Click on Open to Check the firmware version of NodeMCU
  • Click RST button on NodeMCU

Follow these steps flash the MicroPython firmware on NodeMCU ESP8266 :

  • Unzip the Already downloaded MicroPython firmware
  • Goto : NodeMCU-flasher-master > “Win32” or “Win64” > Release > Double Click on EPS8266Flasher
  • New NODEMCU FIRMWARE PROGRAMMER window will open
  • Now go to Config Tab Check that It should have 1st entry as “INTERNAL://NODEMCU” (You may have to search for binary files upload)
  •  GO TO: Operation Tab > Click on “FLASH(F)

Blink an LED connected to the NodeMCU using MicroPython :

  • Make a connection as shown below
Circuit connection
  • Connect the NodeMCU to the computer using USB
  • Open ESPlorer
  • Set the Baud_rate = 115200 ( The baud rate is the rate at which information is transferred in a communication channel)
  • Go to settings >Firmware>MicroPython>Script
  • Click on “Open” to Check the firmware version of nodemcu.
  • Then click “RST” button on NodeMCU
  • Write the following code and write it in the left black window of ESPlorer and save it with .py extension
import time
import machine

pin = machine.Pin(4, machine.Pin.OUT)   #D4 pin

while True:
    pin.on() 
    time.sleep(1)
    pin.off()
    time.sleep(1)

  •  Click on Send to ESP

You have successfully Blinked NodeMCU !


Creating a multiplication Skill in Alexa using python

Written By Vishal Naik

Electronics Engineering student. Interested in Python and embedded systems development . I love research and share knowledge on current technology.

RELATED POSTS

Advanced Generics: Higher-Order Functions

Advanced Generics: Higher-Order Functions

In our journey through TypeScript generics, we've covered the basics, interfaces, and classes. Now, it's time to explore advanced concepts by combining generics with higher-order functions. These functions, which take other functions as arguments or return them,...

Basic Usage of Generics in Typescript

Basic Usage of Generics in Typescript

Keypoints Show how to declare generic functions and classes in TypeScript. Provide examples of generic functions that work with different data types. Demonstrate the use of built-in generics like Array<T> and Promise<T>. Here's the content...

Getting Started with Bash Script : A Simple Guide

Getting Started with Bash Script : A Simple Guide

Introduction In this tutorial, we will be looking into Bash Script - a tool used by developers to increase productivity and manage tasks. A lot of professionals use it for tasks such as system administration, data crunching, web app development, automated backups,...

How to Extract REST API Data using Python

How to Extract REST API Data using Python

Introduction In this tutorial, we will be discussing in detail on how to extract REST API data using Python. It is one of the most popular APIs and is used by a majority of applications. We will be using VS code editor for executing the python code. The extracted API...

Create a Simple ReactJs Application – Part 1

Create a Simple ReactJs Application – Part 1

ReactJs is one of the famous front-end open-source libraries of JavaScript developed by Facebook. It aims to allow developers to quickly create fast user interfaces for websites and applications. In this blog, we will create a simple and basic ReactJs...

Create a Simple ReactJs Application – Part 2

Create a Simple ReactJs Application – Part 2

In the tutorial's last part, we discussed about ReactJs and how to run a simple react app on a web browser. In this part, we will dig more into some interesting stuff, such as creating a home, about us, and contact pages. Click here for the first part - Create a...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....