Educational Post: Microcontrollers

Microcontrollers. They come in a variety of types and sizes and uses! 

One of the most popular microcontrollers is the ATMega328PU and is commonly found on Arduino boards or Ardunio Clones. They are easily used for wide variety of applicaitons. They can be found in Ardunio Nano and Arduino Uno models. 

Utilizing the Arduino IDE or other IDE's it has become extremely easy to program and use Microcontrollers. Other Microcontroller options include: 

The ubiquitous Intel 8051 series of microcontrollers. 

Microchip Technology PIC Microcontrollers.

ARM Cortex M microcontrollers. 

Tons of other manufacturers, but these ones are popular and documentation is relatively immense. 

Microcontrollers are generally inexpensive and programmed to do a single task. Where a SoC has about the same components as a microcontroller, they each have access to memory of some sort, a processor of some sort and a way to program all of this on the chip. SoC's and Microcontroller differ by their use. SoC's are generalists and are capable at doing a wide variety of tasks easily. They can run screens, play music, hook in to the internet and more all at the same time. While a Microncontroller is more efficienct at doing simple tasks quickly. One can program a microcontroller to simply read and store data from a single sensor, but it is extremely efficient at this task. 

The line is bluring and to confuse it even more there are lines of SoC's that act much like a Microcontroller and lines of Microcontrollers that act much like SoC's. The price difference is becoming more important too. A big difference is that SoC's dont handle single tasks or GPIO tasks as easliy as a Microcontroller. To access lines on a Raspberry Pi is relatively difficult to pull data off of a single GPIO, but it is easier to manipulate that data using just about any programming language or use it as a webserver and get the data to the web. Throughput on a Raspberry Pi is also extremely variable depending on the USB line usage, web usage, or CPU usage on other tasks.

A measurement of overall use from a microcontroller is called throughput and is measured in MIPS which is known as Million Instructions Per Second. MIPS are fairly complicated and comparing MIPS but when you compare between microcontrollers it is fairly easy to get a sense of speed between two microcontrollers based in MIPS. MIPS are closely tied to clock speed a 16MHz clock "beats" at 16000000 beats per second. Most Arduinos and other Atmel chips run at 16MHz but it is possible and pretty easy to overclock ATmegas to 20MHz or a little higher and still maintain accuracy. The ATmega328PU has a throughput of approximately 1 MIPS per Clock MHz so at 16MHz the ATmega328PU has a throughput of 16MHz. Just to compare the Throughput of a Core I7 processor has a throughput of approximately 238,310 MIPS at 3.0 GHz. But when was the last time you heard of someone touting easy access to your laptops GPIO pins?! While the Raspberry Pi 2 boasts about 4744 MIPS per 1.0 GHz. This puts the ATmega328PU at about the same throughput as a Rasbperry Pi. But they certainly have different use cases.

Another pro for microcontrollers is that they are capable of running for extreme periods of times. It is estimated that the ATmega328PU is capable of storing data without corruption for 20 years at 85C or for 100 years at 25o C. Arduinos are capable of running completely submerged in oil and will continue running when submerged in oil and then submerged in water! The limiting factor to this are capacitors most of time which often limit to a continuous run time of 5000 hours (over 200 days) this is extended when utilzing larger capacitors or capacitors designed to have a long life. 

Even 10 years ago before the Arduino API and IDE was developed microcontrollers were relatively easy to program and to use, but now that Arduino is so powerful it is trivial to compile arduino flavored C to run on microcontrollers. As far as ease of use goes the Arduino ATmega328PU is the easiest and most powerful Microcontroller on the market. 

The PIC line of mircrocontrollers is compatible with the MPLAB that is capable of compiling for PIC's. Either of these microcontrollers are great choices but in my opinion the Arduino IDE And Arduino ease of use trumps the PIC's but both have their uses. 

Check out this sweet project that is utilizing Arduinos in waterproof boxes for lights that are floating in the Harbor of Copenhagen. Copenhagen Harbor Arduino Example

There are many Tayda Kits Instructions that deal with the ATmega328PU microcontroller. ATmega328PU Instructions

Get many of the microcontrollers and especially the ATmega328PU at Tayda Electronics.  Available here.