Don't Use Arduino (For Professional Work)

I like the ease of use of Arduino boards. I like that people who think they can’t program or are afraid of embedded systems will happily sit down with an Arduino board to build something awesome. The Arduino ecosystem is an enabling technology, one that enables people to come to engineering in a happy, gentle way. Welcome, I hope you enjoy your stay.

Now, stop telling people it is ok to use Arduino in products. Stop it. Stop. Really. I mean it. Stop.

Let’s start with the most important thing first: using Arduino code means all of your object files must be made public. The standard license for Arduino library code is LGPL. The Arduino FAQ is more enlightening than the license file (thank you, Ben Hencke!):

It is not free for commercial use unless you post your own object files so someone else can recreate your image. Of course, that is only for the main Arduino libraries. Many people also use libraries from other sources. Telling clients to use Arduino for commercial development is dangerous without a license survey of the relevant subsystems.

Are you still here? Why? Oh, your code was already leaked / made public / GPL’d? Ok, then. There is more to this rant.

One of the standard arguments in favor of Arduino is that it is easier for an inexperienced developer. Ok, yes, you don’t know what you are doing so having fewer bells and whistles is more palatable. On the other hand, an experienced developer would much, much rather have a debugger that they can use to… I dunno… debug their code.

I find the lack of debugging in Arduino to be an impediment to taking it seriously. Sure, I can set up GDB but then I rapidly reach the end of Arduino-land. Using print as the sole means of debugging is a gigantic waste of time for someone who knows what they are doing. Speaking of time, those prints change the timing of the system so you can never take them out which means your system is easily hackable (in case you illegally forgot to post all of your object files).

While Arduino’s Processing language is a tiny covering over C++ and classes are a good way get to better unit testing, Arduino actively discourages that. The file layout and directory dependence makes it tough to have multiple builds (run and test builds). You could put your code in a library but then you end up reloading the Arduino IDE a bunch of times and having an extremely odd version control setup. Maybe there are easier ways to do this but I haven't figure them out; they aren't built into the Arduino system for novice or expert users.

(I’m not going to talk about the IDE, it is simple and that is great for beginners. FOR BEGINNERS. Or people who are distracted by basic syntax checking while you type, autocomplete, or built-in documentation. And sure, you can change a setting to use a different editor but why are you wasting my time with the Arduino-is-great argument if you are just going to take away all the Arduino-ness?)

I find the Arduino boards to be very expensive for what they are. Due to their on-board USB firmware download mechanisms, they are far more expensive and power hungry than they need to be. Again, you can buy things like the Arduino Pro with its dependence on external cables for programming, but that's not the standard path. And the flagship Arduino UNO’s ATMega328 is egregiously overpriced for its capabilities so saying you’ll cost-reduce later is only going to help you by an order of magnitude, not the two orders of magnitude you should expect given those ridiculous board prices.

The Arduino core libraries are inefficiently written since they try to support every Arduino-ish platform with no respect for limited resources. I know that processors are getting ever more powerful so there is processing time / code space / power available for such inefficiencies. However, they are reflected in the BOM and in the user cost. If you are wasting large amounts of processing, couldn't you use a cheaper processor instead?

Finally,  I want to see the list and map files. Arduino hides those things (and the files you’d need for manufacturing and the object files you need to comply with their LGPL copyright). These are hidden deep in a scary directory you’ll never find without guidance. The list and map files are important because they tell me about my compiler optimizations and the processor resource usage. I’m building a system that is resource-constrained on many levels, not a hobby project.

If you are using Arduino to build demos for the public to use, internal quick prototypes, or test platforms: super. There is a lot of good there. However, I can’t recommend Arduino code or hardware for shipping products.

Try an mbed board if you want to have compiler system with extensive libraries, little overhead, and no cost. Or learn STM32 with its hardware abstraction layer (HAL) and easy-ish setup software (Cube); Andrei’s got a great getting started series called Embedded Wednesdays.

There are lots of paths, none of them as well-paved as Arduino but many of them are still traversable and less dangerous to commercial applications.