Getting Started with Embedded Python: MicroPython and CircuitPython
Ayan Pahwa (~iayanpahwa) |
The MicroPython project is an open source implementation of Python 3 that includes a small subset of the Python standard libraries, and is optimised to run on microcontrollers with constrained environments like limited ROM, RAM and processing power. It came to life after a successful Kick-starter campaign by Damien George. CircuitPython is a fork of MicroPython further developed by Adafruit Industries(https://www.adafruit.com) which includes great extension to control analog sensors, RGB and neopixel LEDs etc.
Traditionally Microcontrollers like AVR, ARM, ESP8266(WiFi SoC) are programmed in Embedded C or Assembly which has a quite overwhelming learning curve, MicroPython makes it easy and allows you to do same with your favourite scripting language Python. Imagine you want to read a sensor or turn on lights from a web server, now you don't need to learn register level programming for that, you can do that with MicroPython, It is also supported on 5$ WiFi SoC, the ESP8266 which is great for making small IoT devices.
MicroPython is packed full of advanced features such as an interactive prompt, arbitrary precision integers, closures, list comprehension, generators, exception handling and more. Yet it is compact enough to fit and run within just 256k of code space and 16k of RAM.
MicroPython aims to be as compatible with normal Python as possible to allow you to transfer code with ease from the desktop to a microcontroller or embedded system. 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.
- Basic Python programming language.
- Basic understanding of processors and programming paradigm.
- Basic command line exposure.
My article on "Getting Started with MicroPython" was published in:
Open Source for you Magazine - Feb 2017 Link: An Introduction to MicroPython
Electronics for you Magazine - May 2017
I am working as an Embedded Software Engineer at Mentor Graphics- A Siemens Business in Noida facility, working mainly on customised Linux kernel and user land environment for Embedded Automotive Solutions like In-Vehicle-Infotainment(IVI) and Advanced Driver Assistance Systems(ADAS).
Apart from that I am an IoT, Wearable Electronics and Artificial Intelligent enthusiasts, managing operations in same for an IoT startup(http://sdiot.in). I like to code and make DIY projects for fun or automating things. I am a regular blogger for various communities and blog sites. I do lots of open source contribution in various projects ranging from Home Automations to Drone technologies to Embedded libraries.
I am also among few FPV drone racing pilot from India, member of Indian Drone Racing League IDRL. I've organised various workshops, meet ups and drone air shows in Delhi/NCR on Drone technologies, Python programming language, Linux bash scripting, Github, Contributing in open source, Microcontrollers etc, in companies, colleges and meet up groups.