element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs MicroPython #1: Introduction and Gearing In
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: navadeepganeshu
  • Date Created: 5 May 2020 3:52 PM Date Created
  • Views 678 views
  • Likes 1 like
  • Comments 0 comments
  • python
  • espressif
  • powerful
  • micropython
  • esp8266
  • ideas_worth_sharing
Related
Recommended

MicroPython #1: Introduction and Gearing In

navadeepganeshu
navadeepganeshu
5 May 2020

MicroPython

 

An Inroduction and Firmware Flashing to the Tool

MicroPython is re-implemented form of Python 3 programming language that is optimised to run on microcontrollers and in constrained environments. It is much similar to generic Python programming language. Simply said, MicroPython is Python for Microcontrollers.

It only includes a small subset of the Python standard library. It also includes modules to access low-level hardware this means that there are libraries to easily access and interact with the General Purpose Input/Output (GPIO's) of Microcontrollers.

 

 

imageimage

 

 

 

Usually on Microcontrollers, we run Embedded C, C++ or other forms of this language. Here with MicroPython, we can integrate Python environments with MC's and program them. Using Python with MC's extends the power of these small embedded chips and takes it to next level opening vast powerful platform for Embedded Technology Industries, Developers, Hobbyists and also Students.

 

 

Getting Started

To begin with, MicroPython is a full Python compiler and runtime that runs on the bare-metal. You get an interactive prompt (the REPL) to execute commands immediately, along with the ability to run and import scripts from the built-in filesystem. The REPL has history, tab completion, auto-indent and paste mode for a great user experience.

 

As we have some Integrated Development Environments(IDE's) for Python, we have it here too. Noting few, Thonny, uPyCraft are some of the main IDE's used for MicroPython programming. To start,

>> Install Python 3.X installed on your system.

Get it from python.org

 

>> Download respective IDE for MicorPython.

Here, let us go with Thonny IDE. Get it from thonny.org. I am using Windows system throughout. If you're on Mac or Linux, please cope up !
Install the Thonny IDE and lets go on with getting firmware set up for development board.

Now, being Python 3.X and MicroPython platform installed, we must set the hardware and make it compatible to program. We do the same by flashing a firmware to the development board which we'll see soon.


>> Fashing Firmware to the appropriate tool.

Any MicroPython compatible hardware can be used for this. Here are list of few boards supporting MicroPython.
  • MicroPython pyboard
  • Pyboard D-series
  • ESP8266 boards
  • ESP32 boards
  • WiPy and CC3200 boards
Firmwares for all the hardwares can be downloaded from http://micropython.org/download

Say, for ESP 8266 Board, you must go to Downloads >> ESP 8266 >> Latest Firmware and download the same which is given as .bin file.
Here on, we will catch up one particular board and go on with it.

I am choosing ESP 8266 Development board by Espressif Systems, which is most commonly used in IoT and Wi-Fi based stuffs. It is very powerful platform for makers and developers.  Alternatively, ESP 32 can also be chosen for which all follow up steps remains similar.
image
ESP 8266 Module - NodeMCU _V3


Download Firmware for ESP 8266 here.


Note : Basically, MicroPython is an Interpreted programming language and it doesn't use any system compilers or any external technique to convert MicroPython programes to binary/Hex sequences in order to feed it to MC's as it is being done in C++ or Embedded C. So, we need firmware readily flashed onto MC so as to get MicroPython into. All functions are done inside a single chip.
Intresting right ? Move on, lets explore !!

 

>> Finding your MicroPython .bin file

By default, the downloaded file will be saved in downloads folder on your C: drive

Find out exactly where it is. So, with your Terminal window, you’ll need to navigate to the Downloads folder using the cd command:

cd Downloads
dir
image

 

As seen above, it is located at Downloads folder: esp8266-20191220-v1.12.bin



>> Erasing ESP8266 Flash Memory

Before flashing the MicroPython firmware, you'll need to erase the ESP8266 flash memory. So, with your ESP8266 connected to your computer and hold down the “BOOT/FLASH” button in your ESP8266 board.
Type the below commands on your Command Prompt or Powershell window in Downloads directory.

esptool.py --chip esp8266 erase_flash

When the “Erasing” process begins, you can release the “BOOT/FLASH” button. After a few seconds, the ESP8266 flash memory will be erased.

image

 



>>Flashing MicroPython Firmware on ESP8266 with esptool.py

 

With your ESP8266 flash memory erased, you can finally flash the MicroPython firmware. You need to replace with your serial port name (Ex :COM4) and the ESP8266 .bin file location (Ex : esp8266-20191220-v1.12.bin) in the below command and execute the same in your Command Prompt or Powershell Downloads directory.

esptool.py --chip esp8266 --port <serial port> write_flash --flash_mode  dio --flash_size detect 0x0 <bin file name>

Hold down the “BOOT/FLASH“, before running the flash command. After a few seconds this is what you should see :


image



Ended up with this ? Congradulations ! You're all set up to play on your ESP Tool with MicroPython fully loaded.

If not, hold on !  I am still waiting here. Just drop down your comments, troubles or any bugs you found on the way in reaching so far in the comment section below.

 

 

Note : There is also an online IDE for MicroPython provided by them. You can access it at micropython.org/unicorn/




Hope you followed up things tight.

Spark something

Cheers !!!
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube