Today we’re continuing to publish our interview with Ivan Kravets, the guy behind [PlatformIO]. The first part of the interview is available here. As before, the most interesting for us is the observation that Ivan has started his career as a web developer, and switched to an embedded one only after achieving success in the web development field. Let’s continue to figure out how you can switch from web development to embedded one (of course, it makes sense only if you feel that hardware and MCUs is your calling).

What was the most difficult when starting embedded development (having only high-level programming background)?

I didn’t have any problems with the embedded programming, but I had difficulties with hardware parts: making own PCBs in the home environment, playing with electronic components where I lacked deep knowledge and the real practice. However, I had the aim and my community required practical results from my side. If someone is interested in your job, it gives your inspiration for creating enormous things. You will forget about missing knowledge and apply maximum efforts to get them studying on your own.

Nevertheless, I want to note certain specifics of embedded programming. If we talk about the web-development world, in most cases it consists from the languages which allow you not to bother with RAM, type of variables or step-by-step debugging. I can’t remember how often I saw someone use “debugging” instruments while developing web projects. High-level languages can fix all the dirty work by the language interpreter. This is a main reason why I don’t recommend to start programming with the languages which permit to make obvious mistakes and then fix them automatically.

I can summarize, that if you decide to deal with the embedded programming, then be ready to forget about all the benefits from the web programming, such as weak typing, unrestricted memory usage, hundreds of frameworks and tools which simplify your work.

Tricky Question: Are you sure that “weak typing” is a benefit? From my perspective, it is rather a double-edged sword (a trade of between development speed and strictness of the program)

This is a moot issue. Many IT critics like to estimate developer’s professionalism by the type of his programming skills: “If a programmer uses “weak typing” languages, then he can’t be a professional in this field”. I don’t agree with this argument. Programming language with it’s own specific grammar is just an instrument, but not the indicator of professionalism. As just one example, I’ve seen a lot of well written (from the points of programming and architecture) project using PHP.

Nevertheless, I like to use different language instruments depending on the specification of task. If I need to prototype something, I prefer to use “weak typing” languages which save me a lot of my valuable time. But if we use the embedded programming with restricted hardware resources, then we don’t have options there (C/C++ are good candidates).

Now, with all the experience you have in the embedded area, what do you think is the best way of moving from highly abstract programming languages to generally low-level embedded development?

The most “high-level” developers don’t want to deal with the embedded development because of ASM/C/C++ languages and electronics. Originally, I have had the same “phobia”. However, just via persistence I was able to get rid of it. It was interesting to find out, that these specifics weren’t so difficult as we imagine them.

So, I will try to explain how you can enter the embedded world. It will be interesting for you. Please follow these rules:

Don’t focus on a low-cost prototype board without any built-in hardware debugging interface. “Debugging” feature will save you a lot of time when you are sure that the code is 100% correct and should work. It compiles without any errors, but apparently doesn’t work properly after uploading to MCU.

I recommend to choose a prototype board from the vendor which provides a complete IDE for the embedded development with “Plug&Build/Debug&Upload” feature.

Don’t start the first “Hello World” project using ASM or Hardware Abstraction Library (HAL) from MCU vendor. You will have a lot of questions not related to general programming (registries, ports/pins selection, etc.). Embedded world doesn’t stay still, you can use a lot of high-level embedded frameworks. Using them will allow you to switch easily between different MCUs.

Choose an embedded development platform which has an active community, and many libraries which cover the most popular sensors and actuators. There are a lot of examples. You will be surprised if some development platform would seem to you a “Lego”-like constructor in the web-development world.

Which high-level embedded framework and/or RTOS would you recommend for a developer just coming from high-level languages to embedded world?

As I’ve mentioned above, I recommend to choose one of the popular development platforms. For the rapid prototyping I recommend to look at Arduino and “mbed” frameworks: hundreds of libraries for the popular sensors, actuators and shields; thousands of examples and a huge embedded open-source community.

If you are going to deal with ARM-based MCUs and want to try RTOS features, then “mbed” will be a good starting point. I like “mbed” for intuitive SDK and supporting of ultra low-cost ARM evaluation boards in the popular Arduino form-factor.

You have earned quite a reputation within embedded developer community due to your project PlatformIO. What is the idea behind it and why is it so popular?

I’ve never been in the pursuit of fame, I just followed by motto mentioned above: “If I see that something misses in the world and I can fix it, I should do it.”. I’ll try to explain in a nutshell how PlatformIO was born.

In my spare time I tried to join the web development world and the embedded world developing my own SmartHome. In a short time the hardware part was based on several different MCUs with programming part consisting from different scripts connected via GUI. Nonetheless, it was difficult to support them: different MCUs, frameworks, toolchains and firmware upload logic. I wrote a bunch of different scripts per MCU/board which have partially simplified my life. But how about other developers or newcomers of the embedded world? It was the time when SmartAnthill Project was born.

The main idea of SmartAnthill Project was to divide the embedded world into “low-level” and “high-level” parts. It should have allowed to automate different things using low-cost and low-power MCUs. The business logic was moved to the “high-level” part, and the low-level logic was given to Operational State Machine which resides within MCU. This approach gave the opportunity to program general operations ones for the MCUs and then concentrate on business logic over SmartAnthill API which enabled to communicate with hardware devices using “high-level” protocols.

Having different MCUs, frameworks, HALs, etc., I had to deal with another issue: how to build SmartAnthill embedded firmware for the different MCUs (nodes) using single Command Line Interface (CLI), given that it should work under different host OS (I prefer to code within Mac OS X, but my SmartHome server is run under Linux OS). This was the second missing feature in the embedded world – a cross-platform code builder which worked on the popular host OS (Mac OS X, Windows, Linux). I’ve tried to fill this gap in the embedded world through PlatformIO Project.

Today, PlatformIO is the cross-platform code builder and the missing library manager. It allowed to collect all missed things into the one eco-system: the development platforms manager with support for the most popular frameworks, embedded boards explorer and powerful library manager with the own manifest specification (library.json) which allows developers to share their own libraries with the others. You don’t need to install any toolchains, frameworks, IDE or additional software (just Python Interpreter). PlatformIO has its own repository with all the required instruments pre-built. Currently, we are working on PlatformIO 2.0, it should fill up the existing eco-system with new features as project generator for the popular IDEs and an ability to use PlatformIO for Continuous Integration. So, I’m glad that the developers/users have appreciated my work. It is the most valuable reward for me.

You mentioned SmartAnthill project as a reason for PlatformIO. Is it abandoned now or…?

As I’ve said, PlatformIO was born within SmartAnthill Project and I’m glad that I found a friendly and professional team which helps me to work on SmartAnthill 2.0 and the new features:

Refactored Protocol Stack – allows each SmartAnthill Device to assign it’s own unique SmartAnthill Address and to have either one IP address per device, or to have multiple devices per IP address as necessary and/or convenient.

Zepto VM – minimalistic virtual machine which offers the opportunity to run on SmartAnthill Devices with extremely limited resources (as little as 512 bytes of RAM)

Support for SmartAnthill Plugins and Zepto Programming Patterns which are intended to support very limited but highly practical scenarios, optimized to minimize communications between SmartAnthill Central Controller and SmartAnthill Device, therefore allowing to minimize power consumption on the side of SmartAnthill Device.

SmartAnthill is an open IoT system enabling easy control over multiple microcontroller-powered devices, creating a home- or office-wide heterogeneous network out of these devices. It can integrate a wide range of devices beginning from the embedded development boards and ending with off-the-shelf sensors and actuators. They can be connected via different communication means: from wired (currently Serial, with CAN bus and Ethernet planned soon) to wireless (currently IEEE 802.15.4, with low-cost RF, Bluetooth Smart, ZigBee and WiFi planned soon).

Finally, I want to mention that SmartAnthill Project is an open-source and I welcome all the developers to join our development process at https://github.com/smartanthill. Together we can earlier allow users without deep knowledge in electronics to automate the most of things using low-cost hardware parts with the little efforts.

Conclusions

Thank you very much for your answers. I think that there are two main points which we can conclude based on our conversation:

If somebody is tired of what he’s doing, it is not too late to make a career change which many would consider a drastic one

In particular, migration from web development to embedded development is possible

If anybody is interested in this particular career change – some very basic hints “where to start looking for information” can be found above.

Ivan, do you agree?

Absolutely, thanks a lot for the interesting questions!
I hope that my recommendations will be useful and don’t forget that “If you see that something is missing in the world and you can fix it, you should do it”!