www.apress.com

19/02/18

Python on Hardware Means Choices for Makers

by Liz Clark

It's clear that the Python programming language is having a moment right now. Statistics are showing it as having widespread adoption among programmers making it one of the fastest growing programming languages. While it can be easy to surf along on the hype wave, Python does have concrete benefits and unique features that drive its growing appeal.


Easy to Learn 

Easy is an extraordinarily subjective term, especially when used in a technological and educational context. What comes naturally to one person may be a struggle for another. However, as programming languages go Python does seems to check off the "easy" box in the learning curve department. Its syntax is straightforward, and a bit plain compared to other languages, making it appear less menacing to coding newcomers. More experienced programmers also benefit from this. Having already navigated their first programming lessons, and undoubtedly a few bugs, they can use their skills to hit the ground running with Python.


Open Source Community

If the surface level ease of use isn't enough, there are countless open source resources to reference for Python in the form of books, online repositories and forums. The other unique strength of Python is the community - a community that is passionate and ready to share and contribute in the spirit of open source. If the documentation isn't enough to get you through a challenging few lines of code, then chances are there is someone in the community willing to help or point you in the right direction.


For the Maker

With these two main attributes in mind, it makes sense that Python is now beginning to grow in popularity among makers (hobbyists who create projects with software and electronics.) It first became common to hear of Python used in these homebrew projects on single-board computers (SBCs) running Linux, since you could, of course, run Python programs in a desktop Linux environment. SBCs also usually have breakout pins, or GPIO, that could be controlled with Python scripts, allowing Python to control hardware. 

Python has also been ported to microcontrollers (MCUs), with popular choices being MicroPython and, now, CircuitPython (a fork of MicroPython that is designed from the ground up to be beginner friendly.) This allows end users to use Python for their electronics hardware projects similar to how they may have used C/C++ with the Arduino IDE. This brings the same benefits from the Python programmer side of things to the maker community in an even more dramatic way. Blinking an LED is considered to be the electronic community’s “hello world” equivalent. This can be achieved in CircuitPython with a couple of lines of code that are straightforward and easy to read, making the barrier to entry for beginners to both hardware and software much lower.

If nothing else, the proliferation of Python on hardware, whether it be on a SBC or MCU board, gives makers choices for their projects. Before the main decision was, "Which board should I use?" Now, a maker can draw comparisons between boards and code languages, choosing the combination that best suits their needs based on hardware specs and software library support.

This shift in options and community support for Python on hardware is why I chose to focus the projects in my book, Practical Tinker Board, towards Python. I think that for makers, the Python hype train has arrived. While it may not be the answer for every project, it's definitely an exciting time to explore Python and as a result join in the growing open source community for Python on hardware.


About the Author

Elizabeth Clark is a lifelong DIY-er and in recent years has become dedicated to learning and making with software and hardware. A large component of this is documenting the process through video and project write-ups, which is something that she has really fallen in love with. The Tinker Board is an exciting new platform that Elizabeth spent a lot of time exploring and is excited to contribute a resource to the maker community.

This article was contributed by Liz Clark, author of Practical Tinker Board.