# How do I determine what microcontroller is the right one for my project? [closed]

I have just started developing a tiny GPS trackingdevice that (eventually) will be able to log positioning-data on demand - via SMS commands and/or via a smartphone-application. The device should be able to store the last known location when turned off (i.e with internal memory). It should be a battery-driven device with re-charging functionallity. The GPS logger is going to be very small, so the size of PCB and IC´ chips has to be small as well.

I am not very familiar with microcontrollers so I need some guidance in what controller to choose for my project. As you can understand - Size matters!

I have no idea on: -how many bits I need. -how much storing space I will need

The microcontroller must have the following features:

-Easy-to-program ( I am no super-guru-programmer. But I have been through some C / Java / Atmel programming )

-Secure

-Firmware-upgradeable (Hopefully USB compatible, but I can live with RS232… )

-Good hibernate/sleep functionallity when tracking isn´t activated.

-Low energy-consumtion

-Small

How do I determine what microcontroller is the right one for my project?

## closed as too broad by Matt Young, placeholder, Nick Alexeev♦, PeterJ, Leon HellerAug 26 '13 at 9:58

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• You'll need to get a handle on the ram and non-volatile storage requirements, and decide if you can fit a 44 or 48 pin flat pack, or if only a qfn or 8 pin tssop is acceptable. – Chris Stratton Aug 25 '13 at 23:39
• You may find this thread interesting. – Nick Alexeev Aug 25 '13 at 23:54
• This is a religious issue, which is off topic here. – Olin Lathrop Aug 26 '13 at 12:04
• I have just edited the question. Had to narrow it down. :p Thanks for all the inputs / tips anyway. – CustomCase Aug 26 '13 at 13:18

Selecting a microcontroller comes largely from experience.

Focusing on the nuts and bolts of this design, it seems like you've got a basic set of requirements already:

• UART interface to the GPS
• UART interface to a cellular device
• microSD interface to the storage
• USB support is a strong want

You don't go into detail about the requirements of your analog input but that's only a small problem. Low-speed USB device support can be done relatively straightforwardly in software, so you don't need dedicated USB hardware. A basic microSD interface can be done with a bog-standard SPI peripheral since it doesn't sound like you need to write super quickly here. You could even bit-bang SPI access if the micro you want to use doesn't have a SPI peripheral. Hell, you can bit-bang the second UART (and even the first one if you want to), so really you haven't nailed down any solid requirements. It's all a tradeoff of how much work you want to do yourself vs pushing things off to dedicated peripherals. None of this is super tricky.

What about memory requirements? It sounds like you need to at least have the following:

• SPI driver to access the microSD card
• UART drivers
• a FAT (preferably VFAT) filesystem library
• a microSD interface library
• NMEA parsing functions
• cell phone (SMS) library

This is on top of the normal micro-RTOSy type stuff you'll have to write. So how much memory does all of this take? How fast does the CPU have to run to do it all quickly enough to work? Good questions! When at this stage of a project I rely on my past experience to guesstimate at memory requirements and then double or triple it for the prototype. I usually also run the prototypes as fast as possible and worry about scaling back speed later. You can always select a "thinner" (less memory, slower) part if you find you want to optimize things but it's better to be pleasantly surprised than desperate to find a new part that might not exist within the family you've settled on.

You also don't mention power requirements. Some micros require multiple supply voltages, and this may make the power supply or bus interface parts of your circuit more expensive. What is the power source? How long do you want this device to run from it? Power consumption is one area where vendors really try to beat each other up and boast that they have the lowest power consumption and the fastest devices. TI's MSP430 usually had the crown when it came to flat out lowest consumption, but both Atmel and Microchip have made really big strides in this specific area. I went to an Atmel seminar this past May which detailed what their SAM4L devices can do. Very, very impressive stuff, and I got a nifty devkit out of it too.

So now we're down to selection. Unfortunately for you, pretty much any of the micros from the popular vendors will likely do. None of this is really narrowing things down, is it? This is why I said it really comes down to previous experience and preference. Let's assume you don't want to bit-bang anything, so you'll need a SPI peripheral, two UART peripherals and a USB device peripheral. Look at the selection charts from Microchip, Atmel, Motorola, TI, SGS-Thompson and Renesas (just to name a few) if you really don't have a strong preference and get a feel for what they offer and what it costs to use their parts. How much is a development kit for a potential micro? TI specifically likes to have sales on their various devkits and you might be able to snag a dev kit for pennies (or for "free" -- I got both an Atmel devkit and an Altera SoC devkit for free when I attended their seminars. The seminar costs were $50 and$100, which is dirt cheap for what I got out of it!)

How much time do you want to spend writing the "nuts and bolts" things? Can you get a VFAT library with an agreeable license from the Internet or do you have to buy one or write your own? What about a micro-SD SPI library? Or a decent SMS library to talk to the phone? Do you want to write your own interrupt-based UART library or find something that exists? How much is your time worth? Atmel has their ASF libraries (and avr-libc for open-source supported libraries for AVR specifically) which pretty much give you all the drivers. I was impressed with that, but the Atmel ASF documentation is severely lacking. I know that @OlinLathrop has some very impressive PIC libraries that he's made freely available, and Texas Instruments also has a lot of drivers they are giving away as part of their strategy to gain wide adoption of their parts.

This leads me back to my original recommendation: what micros have you used before? What did you like or dislike about them? How did you like the toolchain, debugger, programmer? Did they have good support or did they leave you to figure it out on your own (or worse, point to their "community support" and say that's where you get help?) Did they have freely available libraries to get you up and running quickly? How easy are their datasheets to read and understand? I find that most times my decision on a processor comes down to these "soft" requirements and preferences rather since most microcontrollers are very comparable in both price and function.

Something else to consider might be production costs. Is this a personal project or something you'd like to eventually mass-produce and sell? If it's the latter, then you might want to look at volume pricing, cost of supporting components and "lifetime" promises from the vendor for a potential part. Do they have pin-compatible "bigger brothers" with more memory in case you run out of storage space or working memory?

I know I have not specifically given you a vendor or device to consider. You haven't really nailed down what it is that your requirements are, and once you do I think you might have come up with a shorter list of potentials that you could then ask about.

• One more point to consider is power requirements. – miceuz Aug 26 '13 at 7:13
• I had a power requirements paragraph but expanded it to add that some micros require multiple supplies which can drive your board cost up. – akohlsmith Aug 26 '13 at 11:17
• IMO selecting a microcontroller is an overrated problem. Everything akohlsmith says is true, but for a very large class of problems it hardly matters which micro you choose (except maybe for ROM and RAM requirements: it must fit): you will have many more important problems. – Wouter van Ooijen Jun 21 '15 at 9:37