Speaker Deck

Arduino Rapid Prototyping with Python, C++ and Web Services

by Robert Smallshire

Published November 13, 2012 in Programming

The Arduino rapid prototyping electronics platform offers a low barrier to entry for hobby use of microcontrollers for art, control, automation and data logging projects. The so-called Arduino programming language is a thin veneer over C++. Program changes - of which there are usually many during project development - require that code changes be re-compiled, uploaded to the Arduino over USB and the program restarted, a process which can quickly become tedious for programs with long calibration times or for systems which interact with the physical environment. The requirement for a physical USB connection can be awkward or impossible with the Arduino in situ. Finally, program and working space on microcontroller platforms is extremely limited, so it can be difficult to temporarily squeeze in debugging, logging and diagnostic code which won't be needed in the final version.

An alternative approach is to implement web service APIs on the Arduino and transfer control logic into a separate program running on a 'real' computer. This frees us from the constraint of using C++ so we can use more flexible languages such as Python during development, with access to debuggers, charting, logging and all the other good things which can transform the development experience compared to the sparse Arduino environment. Importantly, there is no need to restart the Arduino, and physical access is not required since we can use web services over WiFi. Once the system is working and tuned, the control program can be recoded in C++ and uploaded to the Arduino once and for all.

I'll introduce Arduino and show the 'traditional' approach to development, then show how to implement web service APIs in C++ on the Arduino and access them from Python. The talk will include live demonstrations using real Arduino hardware.