Micro Python — Python for Microcontrollers

mpython

University of Cambridge theoretical physicist Damien George has built a tiny microcontroller that is more powerful than Arduino and far simpler than the Raspberry Pi. Just funded on Kickstarter, the £24 board runs an adapted version of Python known as Micro Python and will allow users to simply paste lines of text code onto the board to make it work.

Micro Python is a lean and fast implementation of the Python 3 programming language that is optimized to run on a microcontroller. MicroPython has advantages over traditional programming software such as C/C++ because it is essentially a live development environment and your write and debug code much faster…in fact 5-10 times faster than C++.

Python as a language (and hence Micro Python) is better suited for IoT than any other high-level scripting languages incl. Javascript, Lua and Ruby. Micro Python has the following benefits:

  • Robustness
  • Excellent exception handling
  • Very strict with type coercion (Javascript is terrible in this respect)
  • Good separation between int and float types (unlike Javascript and Lua)
  • Native bitwise operations for operations on 1’s and 0’s (unlike Lua)

“The board has a USB port which allows you to easily connect it to a PC. You don’t need any software to program it: it behaves like a USB flash drive, and you just copy a Python text file to it and it runs,” George explains. Other features of the board, which runs on Windows, Mac and Linux, include a micro SD card slot, two buttons, 4 LEDs, 30 input/output pins for interfacing with sensors, a real-time clock, an accelerometer for sensing angles, and output lines to control servo motors used in robotics.

The idea for a simple Python microcontroller came to George while he was building a walking robot. “I needed something very small, but powerful — something with a lot of input and output lines that was able to precisely control motors for the robot’s joints,” he says.

Since Python is a widely-used programming language for both beginners and experts, he decided to shrink it down so that it could run on a low-powered chip with limited memory. “Unlike the Raspberry Pi, the Micro Python board allows you easy access to the bare-metal of the hardware, which means you can do time-critical operations without worrying about an operating system getting in your way,” George says.

 

Learn more about Micro Python and Pyboard at mircropython.org

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s