Home > Hardware, Linux, STMicro STM32, Video, Windows 8 > Micro Python Brings Python to MCU Boards and Robots (Crowdfunding)

Micro Python Brings Python to MCU Boards and Robots (Crowdfunding)

Micro Python is an implementation of the Python programming language, written from scratch and optimized to run on micro-controllers such as the ones based on ARM Cortex-M cores. Damien George, the developer, also designed the Micro Python board powered by STMicro STM32F405 Cortex M4 MCU for the purpose of running Micro Python.

Micro_Python_BoardEven though in this project, the star of the show is not the board itself, as Micro Python will run on other platform once it’s open source, let’s have a look at the hardware specifications:

  • MCU – STMicro STM32F405RG @ 168MHz with 1MB flash, 192KB RAM, and an FPU.
  • External storage – Micro SD slot
  • 30 general purpose I/O pins – 5 USARTs, 2SPIs, 2 I2C busses, 14 ADC pins, 2 DAC pins, 2CANs, and 4 servo ports with power.
  • Built-in USB interface
  • Misc – 4 LEDs, a user switch, a reset switch, a real-time clock, and a 3-axis accelerometer (MMA7660)
  • Dimensions – 33×40 mm

The USB interface acts both as a serial device (CDC VCP) and removable storage device (MSC) to respectively access the Python terminal & debugging, and copy Python scripts to the board. The USB port can also be used to flash Micro Python onto the micro-controller.

Micro Python will handle the low level talks to boot the board, run ./boot.py to configure USB and other low level parameters, and will look for and launch your main program located by default in ./src/main.py. All you need is a Windows, Mac or Linux computer, connect the board via USB, and copy your Python scripts to the board, which just looks like another USB flash drive from your computer point of view.

Here are some code snippets:

  • Blinking LEDs every second:
    while True:
        pyb.led(True)
        pyb.delay(1000)
        pyb.led(False)
        pyb.delay(1000)
  • Reading accelerometer values:
    accel = pyb.mma()                #Read accelometer values
    print(accel[0])                       #Print x-axis value
  • Controlling servos:
    pyb.servo(1,45)        #Set servo 1 to 45 degrees
    pyb.servo(2,90)        #Set servo 2 to 90 degrees

Micro Python has the following key features:

  • Python 3.3 grammar and semantics. Libraries not all available.
  • Support for 32-bit ARM processors with the Thumb v2 instruction set, e.g. ARM Cortex-M.
  • Footprint:
    • Space-optimized binary compiled to Thumb v2 machine code: around 60KB
    • Size of all code, including FAT support, SD card, USB serial, USB mass storage, USB HID, Bluetooth, LCD, servo, timer: about 110KB.
    • RAM – “Hello World”: 4KB.
  • 4 types of code emitters – (compressed) byte code, native code, native code with native types, and inline assembler.

Damien George is taking the project to Kickstarter in order to complete the development of Micro Python, make it open source (MIT License), and fund mass production for the Micro Python board, which will also be Open Source Hardware. If you just want to support his development efforts, and get early access to the source code and updates, you can pledge 10 GBP (~$16 US). You’ll have to pledge 24 GBP (~$39 US) in order to receive Micro Python board as well, adding 4 GBP if you live outside the UK. There are also some other pledges with kits (Robotics, Wireless, etc…).  The project already reached its funding target, and delivery is expected in March 2014.

I’ve also discovered another Python implementation for MCU called PyMite (aka p14p, python-on-a-chip) via the Kickstarter FAQ. Damien explains Micro Python does not allocate heap memory for integer operations and method calls, and by doing so, reduces the risk of inducing a garbage collection cycle which would cause performance issues during critical code, e.g. interrupt subroutines.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. onebir
    December 2nd, 2013 at 21:32 | #1

    So this should work on Arduino Due eventually too?

  2. December 2nd, 2013 at 21:35 | #2

    @onebir
    In theory yes. Somebody would still have to port it to Arduino Due / Atmel SAM3 MCU. I’m not sure how difficult it is however. There’s a 1,000 GBP pledge to port Micro Python to another MCU, and there’s already one backer.

  3. onebir
    January 18th, 2014 at 20:00 | #3

    @cnxsoft Now 2 porting pledges, but no details about which MCUs. Looking for that info I noticed the hardware is being open-sourced: http://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers/posts/693195

  1. No trackbacks yet.