Is it possible to take Python along with the Arduino and use them together to perform rapid prototyping? Let's explore just such a possibility.
In my last article, Significance of Python in real-time embedded system devt, I discussed some ways Python can be used in embedded development. One question that might have come to a readers' mind is whether it is possible to take Python along with the Arduino and use them together to perform rapid prototyping. Let's explore just such a possibility. The label "Arduino" used to signify that the board being used contained an Atmel processor and used the Arduino footprints and software libraries. That is no longer the case. Nearly every microcontroller vendor has created a development kit based on the Arduino hardware footprint using their own microcontroller and software stack. In Prototype to Production: Arduino for the Professional, I argued that the most important feature for a developer using Arduino is to have the hardware compatibility but utilise their own software. Developers looking to merge the best of Python and Arduino should then be looking for a development kit or platform that adheres to the hardware standard and can run Python, but isn't constrained to use an Atmel part or the Arduino libraries. The trick to running Python with Arduino is to find an Arduino compatible development kit that can run Python. This is really a question of finding out what Arduino boards have a Python port that can be easily used with them. No developer should want to port Python themselves for use on a microcontroller. As fun as porting Python would be, the endeavor would be quite time consuming. Surely there are other developers or projects where Python has been ported and open sourced. A look through the magic Google window reveals that there are not very many options. One of the few is a five-year-old open source development known as Pymite. It is a Python port of version 2.5 (not even the latest and last release of 2.7) that hasn't been updated in over two years. Pymite appears to have fallen into the open source trap of lacking critical mass support and lacking a vibrant community. Pymite could be an option but there would be little to no support if something went wrong. A second option is Micro Python. Micro Python is an open source port for Python 3 that is optimised to run efficiently on a microcontroller. (You can learn about Micro Python by reading Getting started with Micro Python). Micro Python has gathered some steam recently and is now supported on a number of different hardware platforms, including the CC3200, ESP8266, PIC16, and the STM32. A quick look through the Micro Python repository (shown in the figure) reveals that there is more support for STM32 derivatives than for any other processor.
Figure: Micro Python stmhal/boards listing.
But, do any of these microcontroller development kits support Micro Python out of the box? A review of the boards currently supporting Micro Python (including non-STM boards) reveals that only the NETDUINO_PLUS_2 and the OLIMEX_E407 have Arduino-compatible outputs. The OLIMEX_E407 uses a slightly different processor than the original 405RG used with the PyBoard, however, the Netduino Plus 2 does use the exact same processor. Unfortunately, the Netduino Plus 2 has just become obsolete. It was replaced by the Netduino Plus 3, which uses a much more powerful processor than the 405RG. This new processor currently does not have a Micro Python port. A developer therefore either has to use the Olimex board or hope they can find a Netduino Plus 2 available somewhere before they are all out of stock.
If neither of these first two options appeals to a developer, a third option for getting Python running with Arduino hardware footprint would be to create an adapter board between the PyBoard header footprints and the standard Arduino pin-out. An adapter board may be the best solution to ensure compatibility with the original Micro Python board and future updates. A fourth option would be to spin our own Arduino compatible board based on the 405RG, but at that point there wouldn't be much rapidity associated with our prototyping.
It is possible for a development team to merge the best of Arduino, the hardware, and the ease of programing using Python, the software. Unfortunately, there doesn't appear to be a good out-of-the-box experience for doing so. Developers interested in running Python with Arduino can get Python up and running on either the Olimex 407 or Netduino Plus 2 with minimal effort, though.
About the author
Jacob Beningo is a Certified Software Development Professional (CSDP) whose expertise is in embedded software. He works with companies to decrease costs and time to market while maintaining a quality and robust product.