(One of my summaries of a talk at the 2017 PyCon.de conference).
We’re used to programming for computers that have keyboards and a mouse and displays. Hardy Erlinger talked to a fully packed room about “physical computing”. Computers with all sorts of sensors like temperature sensors, physical switches and with outputs like motors, LEDs, etc.
When you try to teach computing to people, something like print('hello
world')
often fails to excite people. Once you can get LEDs to blink or
servos to move: that helps.
Often, you’ll see is a single board computer. A complete computer build on a single circuit board. A raspberry pi, for instance. That’s already a pretty powerful machine. Effectively a linux machine. Everything’s there. Fine. But it is not very handy if you want it to be mobile. “Mobile” meaning “you want to track the movements of your cat”, for instance. It is too big to tie to your cat. And it requires quite some electrical energy.
The next smaller step in computing: microcontrollers. A computer shrunk into a single very small chip designed for use in an embedded system. It is often used as an embedded “brain” in a larger mechanical or electrical system (like a coffee machine or toaster).
An example is the espressiv ESP8266 chip. It is most handy when used integrated on a development board. Still a small board, but it has a USB connection so that you can get your code on it more easily.
What is micropython? It is a lean and efficient implementation of python 3, optimized to run on microcontrollers in constrained environments. There are multiple versions of micropython, as it needs to be adjusted for the various devices. Sometimes python features need to be cut in order to fit…
An important feature that is always included in micropython: exception handling. There’s no room for a debugger, so exceptions and tracebacks will be your lifeline.
A special mention: the pyboard, the official micropython reference board.
He then started demoing. The ‘hello world’ of microprocessors: blinking a LED. He said, the first time you yourself get such a humple led to blink, you’ll smile from ear to ear. (Personal note: yes, it is true)
He then had some more fun demos.
Personal addition: you can have lots of fun with microprocessors. The video below shows a model railway signal I’m steering with an arduino and two servos.
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):