{"id":212,"date":"2017-01-18T18:18:27","date_gmt":"2017-01-18T23:18:27","guid":{"rendered":"http:\/\/www.circuitcrush.com\/?p=212"},"modified":"2021-06-30T21:38:03","modified_gmt":"2021-07-01T01:38:03","slug":"working-directly-with-microcontrollers-vs-arduino","status":"publish","type":"post","link":"https:\/\/www.circuitcrush.com\/working-directly-with-microcontrollers-vs-arduino\/","title":{"rendered":"Getting Naked: Working With Naked Microcontrollers vs Trainers Like Arduino"},"content":{"rendered":"<p>Open source electronics \u201ctrainer\u201d boards like the Arduino, Raspberry Pi, the BeagleBone and others have been an enormous boon to introducing more people to electronics and science.<\/p>\n<p>This is because they make working with microcontrollers and programming easier by way of abstraction.<\/p>\n<p>The popularity of these boards has exploded over the past 8-10 years or so.<\/p>\n<p>In the past, using a microcontroller in your projects meant working directly with the micro and supporting hardware, programming in C, and a host of other things.<\/p>\n<p>Be that as it may, there are reasons why the hobbyist should consider learning to work directly with the \u201cnaked\u201d or stand-alone microcontroller. We\u2019ll talk about some of those reasons in the words that follow, but first we\u2019ll talk about the difference between a trainer and a microcontroller.<\/p>\n<p><!--more--><\/p>\n<h1>Difference Between Arduino (or Similar Trainer) and a Stand-Alone Microcontroller<\/h1>\n<p>The Arduino Uno consists of the microcontroller (MCU) and various supporting components like the voltage regulator, crystal, etc.<\/p>\n<p>Just like your brain is part of your whole body, the MCU is the \u201cbrains\u201d behind the board and is part of it.<\/p>\n<p>Often, trainers like the Arduino are referred to as ecosystems.<\/p>\n<p>An ecosystem consists of the board and the integrated development environment or IDE.<\/p>\n<p>A microcontroller is simply one of the components (the main one) on the trainer. It is not an ecosystem in and of itself, but things like supporting hardware and IDEs are readily available. They\u2019re just not wrapped up as neatly as they are in the Arduino ecosystem.<\/p>\n<p>For example, when working with a naked micro, you\u2019ll need to supply the regulator, capacitors, and other components. You\u2019ll also need a compatible IDE, which you can often download for free.<\/p>\n<p>For years, electronics enthusiasts did things this way and worked with stand-alone microcontrollers like the PIC or AVR.<\/p>\n<p>Then came the Arduino, with the purpose of helping students and non-engineers create things, learn, and control their world. Other similar ecosystems or platforms soon followed.<\/p>\n<p>While there are many pros to working with trainers, there are also some cons.<\/p>\n<p><em><strong>[Update: See <a href=\"http:\/\/www.circuitcrush.com\/look-inside-arduino\/\" target=\"_blank\" rel=\"noopener\">A Closer look Inside the Arduino Uno<\/a> for a closer examination of the board and some of the nuances of working with it]<\/strong><\/em><\/p>\n<h3 style=\"text-align: center;\">Become the Maker you were born to be. Try <a href=\"https:\/\/learnarduinonow.com\">Arduino Academy<\/a> for FREE!<\/h3>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-4238\" src=\"https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2.png\" alt=\"\" width=\"536\" height=\"204\" srcset=\"https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2.png 828w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-300x114.png 300w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-150x57.png 150w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-768x292.png 768w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/p>\n<h1>Cost Comparison<\/h1>\n<p>As of this writing, the prices for some trainers range from $24.95 (Arduino Uno) on the low end to $55 on the high end (BeagleBone Black). A Raspberry Pi 3 Model B will set you back $39.95.<\/p>\n<p>Note that the RPi and BeagleBone Black are technically fully-functional, Linux based computers.<\/p>\n<p>Since the Arduino boards seem to be among the most popular of the trainers, we\u2019ll focus on them.<\/p>\n<p>An ATmega328P, the same microcontroller that powers the Arduino Uno, lists for less than $2 in quantities of one from some vendors. If you\u2019re willing to buy a higher quantity, like ten or more, the price drops even more.<\/p>\n<p>Trainers like the Arduino and friends are great for learning and prototyping projects, but if you plan on actually keeping your creation for a while, a naked microcontroller would be better.<\/p>\n<p>Here\u2019s why:<\/p>\n<p>Let\u2019s say I want to build a widget to assist me in parking my car in the \u201csweet spot\u201d in my garage. The hanging tennis ball is too easy and un-elegant, so I decide to grab my Arduino and go to work.<\/p>\n<p>When finished, the gadget works beautifully and I want to keep using it.<\/p>\n<p>The problem is I have to drop another $25 on another Arduino for my next project or cannibalize my helpful parking assistant.<\/p>\n<p>And if you\u2019re planning to mass-produce your project, forget it.<\/p>\n<h1>Getting Flexible – Working with a Stand-alone Microcontroller<\/h1>\n<p>No, we\u2019re not talking about stretching here.<\/p>\n<p>For starters, the Arduino Uno measures 55mm x 75mm; the microcontroller on the Uno only measures 10mm x 35mm. This can save a significant amount of space.<\/p>\n<p>If you can learn to work with the ATmega328P, it won\u2019t be much harder to bridge the gap and work with other micros. There are a plethora of microcontrollers and platforms out there ranging from simple 4-bit micros to vividly more complex 32-bit versions. The choice depends on the needs of the project; sometimes a 4-bit MCU will be good enough. Other times, you\u2019ll need a 16 or 32-bit micro with all the extra peripherals like SPI, I2C, various counters\/timers, etc.<\/p>\n<p>Depending on the complexity of your project, things like the Arduino and Raspberry Pi can be a total over-kill.<\/p>\n<p>You may also find that you need your MCU to run at a higher or lower speed. The Arduino\u2019s built in crystal can get in the way of this. With a naked micro, you can use any crystal you want, if the speed is within the specs of your microcontroller. Many, including the ATmega328P, also have their own internal oscillator.<\/p>\n<p>Remember, the higher the clock rate, the more power the MCU will typically draw. This can be a very important consideration when working with projects that will be powered by a small battery or where it would be inconvenient to change the battery often.<\/p>\n<h1>There\u2019s so much more to Learn<\/h1>\n<p>If you\u2019re an electronics enthusiast it\u2019s likely that you enjoy learning new things and have an inquisitive mind.<\/p>\n<p>That alone could be a compelling reason to learn to work with the naked MCU.<\/p>\n<p>If you were to take your DVR or smartphone apart, you wouldn\u2019t find an Arduino or RPi inside. You would find several microcontrollers though. Things are not produced with trainer boards in the real world. One reason for this is the cost, as we discussed earlier. Another is flexibility.<\/p>\n<p>If you ever wanted to get crazy and say, hack your toaster oven, you may have to work with the microcontroller inside. You could even replace the factory MCU with one containing your own firmware.<\/p>\n<p>Most of us probably won\u2019t hack our toaster, but the idea can be extended to a lot of gadgets.<\/p>\n<h1>IDE Limitations<\/h1>\n<p>The Arduino IDE is a great tool to get you started with embedded systems and programming.<\/p>\n<p>Thing is, it\u2019s very basic as far as IDEs go. This is because to make learning simple, the designers have hidden a lot of detail and functionality behind layers of abstraction, many of which come in the form of libraries.<\/p>\n<p>For example, in C programming, there usually isn\u2019t a built in digitalWrite() function (unless you write your own version).<\/p>\n<p>The libraries and abstractions make doing things like reading the temperature of a sensor (an analog value) much easier for middle-schoolers and electronics newbies.<\/p>\n<p>So why go with a naked MCU and a more complex IDE?<\/p>\n<p>Again, you\u2019re trading simplicity for increased flexibility and functionality.<\/p>\n<p>The Arduino IDE also does not support a wide range of AVR micros out of the box. If you take the plunge and experiment with other micros, you\u2019ll need a different IDE anyway.<\/p>\n<h1>Time to get Naked<\/h1>\n<p>Boards like the Arduino, Raspberry Pi, and Beagle are great for learning and prototyping, so I\u2019m not suggesting at all that you give up on them completely.<\/p>\n<p>But if you strive to keep building more complex projects, you may find yourself eventually hitting a wall.<\/p>\n<p>If you want to take your hobby to the next level, you should consider moving beyond trainers. If you want to learn more about programming, microprocessor architecture, and hardware you should consider the same.<\/p>\n<p>The fact that you\u2019ll learn more, gain more flexibility, and save money are three good reasons for this.<\/p>\n<p>It may seem intimidating at first, but eventually you\u2019ll be doing things you couldn\u2019t do before with your creations.<\/p>\n<h2 style=\"text-align: center;\">Become the Maker you were born to be. Try <a href=\"https:\/\/learnarduinonow.com\">Arduino Academy<\/a> for FREE!<\/h2>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-4238\" src=\"https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2.png\" alt=\"\" width=\"828\" height=\"315\" srcset=\"https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2.png 828w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-300x114.png 300w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-150x57.png 150w, https:\/\/www.circuitcrush.com\/wp-content\/uploads\/FB_Cover2-768x292.png 768w\" sizes=\"(max-width: 828px) 100vw, 828px\" \/><\/p>\n<p><strong><em>\u00a0<\/em><\/strong><\/p>\n<a target=\"_blank\" href=\"https:\/\/www.drpeterscode.com\/index.php\"><img src=\"https:\/\/www.circuitcrush.com\/wp-content\/plugins\/dpabottomofpostpage\/apixel1x1.jpg\" ><\/a><table><\/table>","protected":false},"excerpt":{"rendered":"<p>Open source electronics \u201ctrainer\u201d boards like the Arduino, Raspberry Pi, the BeagleBone and others have been an enormous boon to introducing more people to electronics and science. This is because they make working with microcontrollers and programming easier by way of abstraction. The popularity of these boards has exploded over the past 8-10 years or […]<\/p>\n","protected":false},"author":1,"featured_media":214,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,31],"tags":[34,37,33,35,36],"class_list":{"0":"post-212","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-arduino","8":"category-microcontrollers","9":"tag-arduino","10":"tag-beaglebone","11":"tag-microcontrollers","12":"tag-raspberry-pi","13":"tag-rpi","14":"entry"},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.circuitcrush.com\/wp-content\/uploads\/ATmega328P-Naked.png","_links":{"self":[{"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":2,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":4357,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/posts\/212\/revisions\/4357"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/media\/214"}],"wp:attachment":[{"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.circuitcrush.com\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}