Which Microcontroller Is Best Microcontroller?

Let’s say you’re working on a project, and you need a microcontroller. Which chip do you reach for? Probably the one you’re most familiar with, or at least the one whose programmer is hiding away in a corner of your desk. Choosing a microcontroller is a matter of convenience, but it doesn’t have to be this way. There are dozens of different ARM cores alone, hundreds of 8051 clones, and weirder stuff including the Cypress PSoC and TI’s MSP430. Which one is best? Which microcontroller that costs under a dollar is best? That’s the question [Jay Carlson] tried to answer, and it’s the best microcontroller shootout we’ve ever read.

[Jay] put together a monster of a review of a dozen or so microcontrollers that cost no more than a dollar. Included in this review are, from Atmel: the ATtiny1616, ATmega168PB, and the ATSAMD10. From Cypress, the PSoC 4000S. From Freescale, the KE04 and KL03. Holtek’s HT-66, and the Infineon XMC1100. From Microchip, the PIC16, PIC24, and PIC32. From Nuvoton, the N76, and M051. The NXP LPC811, Renesas RL-78, Sanyo LC87, and Silicon Labs EFM8. ST’s STM32F0 and STM8. STCMicro’s STC8, and finally TI’s MSP430. If you’re keeping score at home, most of these are either ARM or 8051-style cores, but the AVRs and PICs bump up the numbers for ‘proprietary’ core designs.

This review begins the same as all tech reviews, with a sampling of tech specs. Everything is there, including the amount of RAM to the number of PWM channels. [Jay] is going a bit further with this review and checking out the development environments, compilers, dev tools, and even the performance of different cores in three areas: blinking bits, a biquad filter, and a DMX receiver. There’s an incredible amount of work that went into this, and right now, this is the best resource we’ve seen for a throwdown of microcontrollers.

With all this data and the experience of going through a dozen different microcontroller platforms, what’s [Jay]’s takeaway? The STM32F0 is great, the Atmel/Microchip SAM D10 has great performance but you’ll be relying on some third-party libraries. The pure Microchip parts — the PIC16, PIC24, and PIC32 — have infinite product lifetimes, a wide range of packages, and a huge community but use a clunky IDE, and expensive compilers. The Cypress PSoC was just okay, and the PSoC5 or PSoC6 would be better. Surprises from this test include the Renesas RL-78 and its high performance, low cost, and the most power-efficient 5V part in the test.

With all that said, what’s the best microcontroller? That’s a dumb question, because the best microcontroller will always be the best microcontroller for that application. Or whatever you have sitting around in the parts drawer, we were never quite clear on what the answer actually is. That said, this is a new high water mark for microcontroller reviews, and we hope [Jay] will continue his research into microcontrollers that cost more than a dollar.

94 thoughts on “Which Microcontroller Is Best Microcontroller?

    1. HC11 was awesome! With the EEPROM variants, all you needed to get going was a crystal and an RS232 level shifter since it had its own in-ROM bootloader. This was well before PIC, and in the era when you needed an EPROM programmer for just about any other architecture.

      Motorola also wrote the best microcontroller documentation that’s ever existed for these, and offered them for free in bound paperback form for the asking.

      1. The pink HC11 manual on my shelf is well worn and I read every page. I loved how they had absolutely no duplicate information in those datasheets. However, I switched to PIC due to Motorola being 3 years behind on getting datasheets on-line and having to wait months to receive out of print datasheets thought the mail.

  1. He has some quite nice things to say about the Holtek IDE, Basic but blistering-fast, “Code building and uploading are so fast, it almost feels like you’re in a simulator…”

    I feel like this should be the goal of every environment, but few can ever hope to achieve it.

      1. +1.

        Back when I was still working in software development, the best days were the days we recompiled our libraries and nothing else could be done. Honestly, Mr. Manager! Unless you pay for a decent network and shiny new servers.

    1. Renesas RZ/A1H is technically not a microcontroller, but it has 10MBs on-chip SRAM and there’s nothing stopping you from running bare metal code. Not as cheap as some of the other options mentioned. I would also suggest looking NXP’s i.MXRT1050 (512KB on-chip SRAM) and add some external memory.

  2. > That’s a dumb question, because the best microcontroller will always be the best microcontroller for that application.

    And this super cool review will help you enormously to select appropriate one.

  3. That’s a seriously great round-up of small microcontrollers.

    Regarding the 8-bit MicroChip PICs, I’ve been mostly using the SourceBoost IDE and BoostC compiler. It’s free to use for personal/educational use (with some memory limitations). I found that it was easy to port code from online PIC projects into SB. I thought it had been abandoned, but there’s been a flurry of activity this summer and the latest version release is August 2017.

    I’m about to learn AVR programming with Elliot William’s great AVR book.

    1. Ooh, thanks. I’ve been using the limited version of MPLAB X and the XC8 compilers in free mode. Definitely not optimized code, but for my purposes thus far it’s worked out.

      1. I’ve personally found the XC8 compiler the most reliable of all C compilers for the PIC (for 8 bit devices, can’t comment on the others… but heard bad rumors). PIC was way down on my list of preferred micros, but it had the features I wanted and NO others did (low pin count, low power, self-programmable flash). Tried Mikro, PICC, and as many other compilers as I could find. ALL except XC8 had problems.

        The fact that Microchip cripples the free version may well come back to bite them in the long run though. Sure I’ll buy a compiler for my project, but I have to choose what I want in my project. And if I can’t evaluate a system (micro) because of the entry cost… guess what… it’s off the list.

        1. Free version adds crap to the code to make it slower and bigger. They offer a 60-day trial version for evaluation, but in my opinion breaking a free version to make their full version look better is something an asshole from management would think of. So for hobbyists I’d suggest to grab a crack to get full version and buy legit license only when a project will be sold…

  4. I think they missed a few fairly serious metrics that can constrain your choice of uC: available IO pins and physical package sizes.

    I’ve been heavily using an EFM8 (but from the UB/”Universal Bee” line) as they were the smallest, ‘decent’ spec uC I could readily find. At 3mmx3mm they’re smaller than most with a good few IO lines available (13) and enough processing power plus tons of code space (16kB) for a good few applications in one hit – the only thing more powerful I found were some ARM M0/M3 devices around the 2.5mmx2.5mm sort of size but they were “chip-scale” packages (effectively BGA) but with a pin pitch that was smaller than allowed for the board-fab I have access to.

    1. There are a few 20-pin STM32 Cortex-M0+ chips; they’re about 6.5×4.5mm, and have pins with 0.65mm pitch which is fairly easy to hand-solder especially with a 0.1mm soldermask. They’re a bit smaller and easier to lay out than the 7x7mm QFP32-48 chips, although they do only have 11-15 GPIO lines.

      11 normal ones, 2 used for an optional external crystal oscillator, 2 used for the debugging interface. The debug pins are just GPIOs that initialize to a specific function on reset, but overriding that can make it a bit more difficult to upload code if you aren’t careful.

      1. How easy is a QFN20 to solder? I guess it’s OK with reflow, just difficult to inspect or correct issues by hand once it comes out of the oven. What about PCB routing – can you get away with a 2-layer board?

        I can second the recommendation of the STM32F0/L0 TSSOP packages. They’re cheap, grunty, small-enough-for-what-I-needed, and you can use the cheapest 2-layer PCB processes and load the boards with a $20 hotplate, no skills required.

        1. I would describe it as “moderately hard” outside a reflow oven – I’ve a couple of boards with the EFM8 “QFN20” (they’re really a QFN16 with corner pads) on a cnc-routed double-layer board which I’ve been hand-soldering.
          A lot falls down to how the QFN package is manufactured as if the pads wrap around the side then it’s really easy even outside of an oven (provided you’ve extended your PCB pads to go beyond the package), unfortunately the EFM8 QFN20 pads are only on the underside which means I’ve used a combination of hot-air and heat ‘wicking’ along the track (to re-flow the solder under the device).

    1. The round-up does go into detail about the development boards available for each micro. Regardless, you first need to choose the microprocessor family, then look around for a board that’s closest to your requirements. There are often 3rd-party or knock-off boards as well as those from the chip maker.

      For hobbyists and occasional users, it makes perfect sense to select a microprocessor family that seems to have a lot of love and support, and stick with it. Who has the time to learn a completely different micro for every project? For that reason, I’ve mainly used PICs for 8-bit projects. (learning AVR programming next)

      And – all praise to the Arduino – one free environment, tons of available code, and wide availability of cheap, easy-to use boards. For many people it’s more than enough.

  5. Not mentioned here, but I really like PIC18F2550 as it has many peripheals, even USB 2.0. If you need more pins there is 18F4550. And some other even richer 18F chips. For much simpler applications i like 12F1572, SOIC8, 3 separate PWMs, UART … ideal for interfacing with Bluetooth modules and LED control. I also like Arduino nano, and ofcourse Arduino uno, ATmega328 that is. I’d like to learn more about ARM M0 in the future, it looks very promising when you need some more processing power than above mentioned chips can handle but you still want to stay in battery powered applications.

    1. I personally love the Atmega32u4, pretty much for the same reasons you like the poc18f2550 for. USB2 connectivity is awesome, they’ll even let you upload code via USB per default. Which is nice as i don’t have to search around for a programmer, just stick the USB cable in that i was planning to use anyways and it’s good to go.

    2. You know what I like about Microchip? At last check, if you were a student with a .edu email address, you could get free samples. I have a handful of PIC18F4550 chips because of that, plus some other smaller PIC16 chips.

    3. I really wish/was surprised by the fact that pic18 wasn’t on the list at all! They’re by no means the same as pic16/pic24. The tool chain is (almost) the same as the pic16s though, so maybe that’s why he skipped looking at them.

  6. “J-Link is, by far, the best Arm debugger”
    Well I like my jlink, but don’t get wrong, it’s the best low cost debugger only.
    The real best ARM debuggers are lauterbach, period.

      1. Fast, huge compatibility (not only arm CM/arm CA), can add trace later,huge script ability, support, hefty price tag (10k$ at least per core licence, 15k$ for the trace).
        Clearly a tool for corporation, not hacker/hobbyist/small business

  7. Throwing in my two cents: I’ve used six’ish of these chips, and every one of Jay’s evaluations rings true with my experience. Spot on. This is really an amazing comparo. In fact, I was reading it, and thought “Hackaday should write this up” and Brian was already on it.

    I don’t care about the IDE as much as Jay does, in fact the opposite is true — if it’s easy to compile/build/flash from any old editor, it gets extra points in my book. Fewer dependencies = more freedom.

    But it’s very heartening to see so many of the toolchains working with Eclipse. Partly b/c Eclipse is open and a decent common denominator, but also b/c if it can be made to work with Eclipse, it’s often not very hard to make it work with a simple Makefile.

    Anyway, Jay is so open about his preferences, and so fair in his evaluation that the comparo is tremendously valuable even if you don’t have the same needs that he does. Read this if you’re at all in the cheapo micro market.

    1. Elliot – even when I read one of your comments, I thoroughly enjoy it! You write with class, are fair and respectful of others, and of course know your chops when it comes to technology. We need more Hackaday’ers like you. Well done, sir! 👏

  8. I think that the stm32f042f6p6 is a great low cost/low pin microcontroller. Comes with 32KB Flash, 6KB RAM, USB Device, USART, I2C, SPI, with 16 GPIOs max all in a small yet easy to solder 20 TSSOP package. I also find it to be one of the easier stm32s to program.

    You can easily use the STM32CUBEMX to configure the Serial USB and that use your own register based coding to code your application. 32KB of Flash is surprisingly plenty.

    1. Wait, there’s a 20-TSSOP F042?

      I’ve been using the F030F4…which is also nice, but it only has 16/4KBs. I’ve also been tempted by the slightly slower L031F6 with 32KB flash and 8KB RAM, what with the low-power design.

    2. I agree. I use the STM32f042 for my main project I’ve learned to like it. There’s enough documentation and code out there to learn how to program that chip at register level, avoiding the opaque “standard libraries”. You can program these with a $5 usb programmer form Ebay and open-source tools, on OSX or Linux.

      I use the STM32CUBEMX just to quickly check visually how to assign peripherals to pins, avoiding potential conflicts.

      The STM32F0 has it’s own quirks, however. For example, using DMA with SPI works but is impractical for most applications. Peripheral assignment is not very flexible. Atmel SAMD is better in that respect (but comes with much less code and low-level documentation).

  9. “That’s a dumb question, because the best microcontroller will always be the best microcontroller for that application. Or whatever you have sitting around in the parts drawer, ”

    Nah. It’s the one you already know. I’m sure many of us don’t need to use the one that is the “perfect” fit for the application because we aren’t developing professionally. I also suspect that many of us have parts drawers full of different microcontrolers that we picked up with good intentions to one day learn how to use or were given away free at some show somewhere. More often than not though… we will just use the one we already know even if we have to buy it because chips are cheap these days and we are eager to show off our results.

    1. i hope “whatever you have sitting around in the parts drawer” is the same thing as “the one you already know and love.” otherwise, you’ve got a workbench-stocking problem going on! :P

    1. This comment is silly. Did you even look at the article? What is particularly good about it is that it didn’t jump on any particular controller in a fanboy manner. It is a well balanced and quite neutral look at a wide diversity of options. Worth reading just to become aware of things you never knew about before, very well done.

      1. AVR is certainly a better architecture than any 8-bit PIC (which is basically a cut-down 1960s minicomputer design), but certainly some 8-bit PICs are more capable than some AVRs.

        AVR is not perfect though, IMHO they could have designed the instruction set with 16×16-bit registers with 1 cycle byte and 2 cycle word operations. This would have used one less bit in most instructions providing more ALU opcodes or other choices.

        [WordOp:1][DestReg:4][SrcReg:4] takes 1 less bit than
        [DestReg:5][SrcReg:5] .

        Means they could have expanded the number of address registers for example.

  10. Best one is SIlicone labs! Whoever was tried integrated I/O crossbar, wants this on every microcontroller. Interesting is they scale up great with clock frequency far away from datasheet speeds.

  11. I used to program in 6502 and Z80 machine language and today’s micro-controllers are amazing machines compared to way back then. These days I love PIC controllers. PIC has a huge selection of controllers with such a broad selection of capabilities that you can build just about anything from PIC!!!

    1. Surely though, the Z80 and 6502 were much nicer to program in assembler than an 8-bit PIC? I mean. If you took any 8-bit PIC, but swapped out the CPU core and replaced it with a Z80 or 6052, wouldn’t you much prefer it? Imagine having all your RAM in the same address space as your Flash memory? Imagine having actual pointer registers! Or actual indexing! Or recursion! Imagine being able to have a proper stack frame instead of static local variables! Imagine the compiler not duplicating functions called reentrantly! Imagine there’s no 128byte RAM banks! Imagine DJNZ!!!

      From a programming viewpoint wouldn’t you say that those old CPUs were actually far superior to any 8-bit PIC?

      And I haven’t even gotten onto the 6809 ;-)

  12. This is a great survey. I was a bit surprised at the (only!) choice of MSP430 device being used; I think the MSP430 deserved a little more representation. That said, it seems to have stacked up quite well in the shoot-out, despite not getting much attention in the write-up. The biggest complaint seemed to be lack of peripherals (such as an I2C bus), but those are available in other devices which are also < 1$, so the selection seems to have worked against it.

    I suspect the main argument against the MSP430 is that it does tend to cost more than others, but to be fair, it's not *that* much more. Extend your limit to < $1.50, and you've already got a number of more powerful devices available, such as the MSP430G2553.

    I did appreciate his comments about the LaunchPads; I think one area, aside from low power, where the MSP430 really shines is in learning. My experience has been that the MSP430 is one of the cleanest architectures, and it's really easy to learn not just to write code, but to actually *understand* the device itself. But in this day of super-cheap ARM devices, who's to say what's really the right way to go? =)

    1. The MSP430 definitely didn’t shine here; the MSP series aren’t a low cost part! So the one tested is more of a downgrade option for when you designed for a normal one and ended up not needing much.

      I think of the whole MSP430 series as a downgrade option for MSP432 if you want to share a lot of code and develop a cheaper version of a product. Not the lowest cost part, but it might have the lowest development cost when you already wrote the full version of something!

      Also they missed the fact that you can use the open source GCC-based toolchain with MSP430, and TI has a whole open source (MIT/BSD licensed) driver and example library ecosystem that works both with their tools, and the open tools. They also distribute the GCC package for it, so you can use an open source toolchain but also download it all from the vendor. The only non-open software you’ll be stuck with if you source all the tools from TI is the programmer, but of course you can use nearly any JTAG debugger to do the programming. On the plus side, their programmer works fine on *nix and can be used from the command line.

      I’m not sure about the MSP430 because I don’t have the “explorer” board, but the MSP432 explorer board (~$15) comes with a full hardware JTAG debugger (XDS-110) that works with openocd. They don’t support the openocd integration, but they don’t interfere either. They even put removeable jumpers and headers on the board so you can use the debugger with other devices.

      Some people think open source toolchains are only for hobbyists, but avoiding vendor lock-in is a legitimate business strategy! COTS tools are beginner-friendly, but they often introduce a lot of headaches, uncertainties, and loss of process control.

      emacs + gcc + make = no problem!

    1. Yep. Unless you’re talking tens or hundreds of thousands of devices, a few cents more for one micro opposed to another simply doesn’t equate to the cost of the IDE and learning a new environment/language. Even the differences between chips from the same manufacturer, even from the same family – differences in control registers, set up etc. add to time “wasted”.

      Then add in actual development time.

      But then bean counters don’t think big picture. They never have, and never will.

    1. It drives me nuts that the majority of projects one can find for 8-bit PICs are for the 16F84. Or the ‘877. It’s usually not that hard to port to a newer PIC.

      I have a fondness for the 12F675 (8-pin) and the 16F684, since those are what came with the PICKIT1 in 2008. I also have a bit of experience with some of the 18F series which are USB-capable.

  13. Of course my real favorite microcontroller is the 555, closely followed by the 741, or for twice the power 556s or 747s. ;-)

    What? It’s like the IDT winchip design philisophy of support all the most commonly used instructions with 50% of the transistors, these support the most commonly used applications of the arduino with 0.5% of the transistors.

    1. I often start with a 555-based design on the breadboard, but then I end up wanting a screen, or I want the user to be able to adjust the process value. Maybe even save the process value between restarts!

      But even where I just need the 555, you blow past $1 once you add up all the external components. If all you ask for is a duty cycle under 50%, you blew past the cost of a fancy mcu! This is why I just ordered a bunch of AVRs in SOT-23-6 for 31 cents each. They don’t actually require any additional components at all. A 555 is going to cost me 30 cents, but it requires at least a capacitor and resistor, usually 3 or 4 of each, and a couple diodes if you want the full range out of it.

      A 741 costs about 40 cents and is a pretty awful opamp for most use cases compared to the newer designs for 25 cents! If you really need one that can handle high voltages, and you don’t mind all the problems it has, it might actually be OK. What I do love about the 741 is that makerspaces have lots of them and there are lots of circuits on the internet you can build for them… if you build the split power supply first! If you’re buying a power supply, or using batteries, save some money and use a modern op-amp!

      Now, the 556 is starting to get into better cost territory, but if you need two timers surely you’re about to need a communication peripheral? And the AVR already has multiple timers…

      1. Problem with most of today’s younger hackers is they don’t understand the power of a 555 timer or good op-amp. Everyone wants a programmed part. I’m the first to admit that I love PIC chips but whenever possible I’ll apply a timer or op-amp to a problem. The solution is faster and often more stable.

        1. First, I can’t think of where a microcontroller would replace an opamp. Wait… if you needed a comparator whose output triggers a pulse of a given duration… that would take two opamps and some some resistors and caps… ok so I guess I can…

          555 timers have their uses, and I too have the Forest Mims RS notebook with acres of 555 applications.

          For me the saw-off is parts count, or functional complexity. If the parts count for one small function starts to exceed 10 components, then I start to think about just dropping in an 8-pin microcontroller. Fewer parts, and small changes (eg pulse length) are just a line of code, not changing components. A single microcontroller can provide several such function blocks. If your project includes a microcontroller anyway, then it’s just common sense to have it do as much as possible.

          1. Yup. Discrete components are becoming obsolete. Or already are to a great degree. Apart from caps to decouple the supply rails, and resistors for pullups and pulldowns, we just don’t need them that much. Open anything electronic from the last 10 years, and the vast majority of it’s components are going to be etched into a tiny wafer. Often doesn’t make sense to buy transistors less than 10,000 to a package. Even amplifiers are going digital, an ADC for input and something beefy to drive the output, you can make a Class D audio amp from a microprocessor. The Bluetooth loudspeakers you see all over the place are all Class D.

  14. I claim that the ESP8266 deserves to be in here. Hard to beat a 32 bit processor running at 80 Mhz. Switch off the Wifi and use it for whatever you like. (Works for me). But you can get blue pill ARM boards that run at 72 Mhz, and maybe they are a better choice if you don’t use or need the Wifi.

      1. Sub-$1 arbitrary cutoff? Poor documentation (sorry y’all, you know it’s true!) and limited peripherals? Zero onboard flash? The ESP8266 would get slaughtered on most of the criteria for a general-purpose microcontroller.

        Its killer feature, however, is killer. If you need WiFi, none of the others deliver and the ESP is in a league of its own. (Which is probably why it wasn’t included.)

        1. Even if this microcontroller shootout has its merits, the typical “under $X” assumption is almost always used for some (obviously lying) clickbait title, and once again Hackaday (or the usual suspect) seems glad to peddle those kind of lies, now even used by editors to contradict legitimate questions in the comments !

          It took me 5 minutes to do (what should be) your job and check those 21 microcontrollers on the electronic-parts-search website Octopart, and most of them sell for near $1.50 (cheapest price at quantitiy 1, without taxes) from main distributors, and contrary to what is said in first footnote from linked article (as a justification but without any proof) I could’nt find most of them under one US dollar, below quantity 100 or not…

          Coming back to ESP8266, even with its flaws compared to more solid solutions, it’s easy to parrot a caricatural “only good for wifi” when every of your points aren’t even valid for its exclusion :
          – sub-$1.50 : check ! And that’s single unit price from manufacturer’s chinese retail shop on Taobao, where many sellers propose genuine single QFN32 units for less than a dollar : sub-$1-clickbait-proof : check ! :)
          – poor documentation : sure, but not more than some contenders in the shootoot, whose author says, about one of them : “this part isn’t quite ready for prime-time: the datasheet hasn’t been translated into English yet, the errata is massive, and there’s limited availability of the part.”
          – limited peripherals ? it has I2S master with DMA + WIFI too when some tested chips only have the same basic SPI/I2C/UART/GPIO but without an ADC.
          – zero on-board flash ? Previously someone on Hackaday (probably an homonym?) praised a similarly priced ESP8266 variation with 1MB of on-board flash : https://hackaday.com/2016/06/21/espressif-releases-esp8266-killer/

          Beyond winning the on-board RAM amount by miles (48KB free with a TCP/IP stack loaded, twice that without it), it seems that, far from being “slaughtered” (as you say so very measuredly), the ESP8266 would have competed quite well in many of these tests.

          1. What kind of answer is this ? I certainly tried to oppose some facts to the annoying sub-$1-BS, and to your other arguable points too, not opinions, certainly stronger than a pile of rethorical questions, but no more than your “would get slaughtered” outcome.

          2. Strong opinions? Sounds like solid facts to go with them anyhow. I am doing my ESP8266 development using the SDK and makefiles and have not had a lick of trouble with the device, and yes I use it for a plain old controller after switching off Wifi to save power. It is a great little part. Most people think of it as a Wifi peripheral, which is unfortunate.

  15. I too love the old 68HC11, but pails in comparison to any of the newer parts. And I agree pretty much the one you are using is probably the “best”. On the low end of the NXP family the LPC824 came out for a few cents more, basically code compatible and adds 12 bit AD.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s