A Beginner's Guide to Microcontrollers


64,974

672

43

Dabbled in dark matter, settled into engineering with a blend of inventing and teaching, always t...

What do remote controllers, routers, and robots all have in common? Microcontrollers! These days, beginner-friendly microcontrollers are easy to use and program with just a laptop, a USB cable, and some (free) open-source software. Woohoo!! All the projects, here we come!

The catch? There are like, 4324302* different microcontrollers and it can be daunting to get started, especially if you're just getting into electronics. Where the heck do you start?!

Right here, bbies, I got chu. Whether you are looking to build some cool electronic projects, learn programming/tech, or wanting to teach others about electronics, this tutorial will help you figure out what microcontroller is right for your needs, goals, and budgets. Yay! Let's get started!

Read Time: ~ 20 min

*Ok, ok, maybe not *that* many, but definitely a few dozen!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wait.... What Is a Microcontroller?

Maybe you've seen this word and were like "wtf" but didn't feel comfy enough to ask*. Totally fine, here's a quick rundown:

A microcontroller is a "simple computer" that runs one program in a loop. They are designed to perform a single, specific task.

In this guide, we'll be focusing on microcontrollers that have breakout boards, or a board that makes it easier to connect to and program the microcontroller.

On a breakout board, the microcontroller pins are soldered to a printed circuit board ("PCB"), headers or other connectors are added to the PCB, and some basic firmware, or permanent software, is loaded to prep the microcontroller to receive signals.

*Questions are always good even if they are "dumb" or "n00by", just find a safe space -- like Instructables!

Step 2: What's the Difference Between the Raspberry Pi and a Microcontroller?

The Raspberry Pi is not only small and adorable, it is also a full-fledged computer! :D

Computers have microprocessors AND microcontrollers that work together to perform many tasks at once.

The microprocessor is what does the “heavy lifting” in a computer. It performs the instructions and calculations that make the computer work. Microprocessors are much faster than microcontrollers, but they need external resources like RAM, Input/Output ports, etc., whereas a microcontroller is typically self-contained.

Computers (which have inputs and outputs, storage, and processing) can run multiple programs at a time -- you can surf the Internet, reminisce with old photos, write a paper, and have like 1000 tabs open all at the same time! Microcontrollers... not so much. You can do one of those things, but not all.

To learn more about the Raspberry Pi, check out the last section of this tutorial!

Step 3: Arduino (Uno)

A robust, open-source microcontroller and programming environment designed for beginners with some knowledge of circuits.

Recommended Ages: 12+ (or kids comfy with programming and algebra)

Difficulty: Intermediate

Average Cost: ~$35

There are lots of different types of Arduino boards. This is the Arduino Uno, the best fit for beginners! There are boards that are larger, smaller, wearable, and for specialty use cases like robotics.

Being familiar with Arduino boards and programming maps well to projects and careers in computer science, engineering, and design.

Hardware Features

  • The Arduino Uno has 14 Digital Input & Output ("I/O") pins, 6 Analog I/O pins, 2 Power Out pins (3.3V and 5V), and 3 Ground (GND) pins.
  • Power input can be anywhere from 5 to 12 VDC
  • The ICSP headers allow you to connect a ton of different add-on boards called "shields".
    • For example, you can add a WiFi shield to connect your Arduino to the 'net!

Programming Language: Wiring (Combo of C++/Processing)

Example Project: Motion-Reactive Shake the Maze Game!

Purchase/Learn More: Arduino Website

Step 4: Micro:Bit

A friendly lil’ microcontroller handy for kids and folks just getting started with coding and hardware.

Recommended Ages: 8+ (or kids comfy with circuits and simple tools)

Difficulty: Beginner

Average Cost: ~$15

The Micro:Bit is a great tool to start learning how to code, teaching others, particularly elementary school students, how to code, and making simple and quick electronic prototypes.

The Micro:Bit is a collaboration between Microsoft and the BBC to bring educational computers into classrooms around the world.

Hardware Features:

  • The Micro:Bit has 3 Digital and Analog I/O pins, 1 Power Out pin (3.3V), and 1 Ground (GND) pin
  • Power input should be 3 - 5 VDC via micro USB cable or battery pack connector.
  • It also has lots of onboard inputs, outputs, and sensors!
    • 5x5 (25) LED matrix
    • Two (2) Pushbuttons (A, B)
    • Radio Transmitter and Receiver
    • Accelerometer
    • Compass
    • Light and Temperature Sensors
  • For more I/O pins, grab a Micro:Bit breakout!

Programming Language: Block-Based or Javascript (www.MakeCode.org); can also use CircuitPython

Example Project: Text Messenger Puppet!

Purchase/Learn More: Micro:Bit Website

Step 5: Circuit Playground Express

A versatile microcontroller great for kids and folks just getting started with coding and hardware.

Note: There is also the Circuit Playground Classic -- the hardware is nearly identical, but this board is programmed in the Arduino IDE.

Recommended Ages: 8+ (or kids comfy with circuits and simple tools)

Difficulty: Beginner

Average Cost: ~$25

The Circuit Playground Express, or CPX, is a helpful tool to learn how to code, teach others how to code, and make quick prototypes for beginners to experts alike.

The Circuit Playground Express is a powerful and versatile microcontroller created by Adafruit Industries.

Hardware Features

  • The CPX has 7 Digital/Analog Input & Output ("I/O") rings that are also capacitive touch!
    • 1 "true" Analog I/O ring
    • 2 Power out ring (3.3V)
    • 3 Ground (GND) pins
  • Power input should be 3 - 5 VDC via micro USB cable or battery pack connector.
  • There are also tons of onboard inputs, outputs, and sensors!
    • 10 Mini Neopixels (can be all colors)
    • 2 Pushbuttons (A, B)
    • 1 Slide Switch
    • Infrared Transmitter and Receiver
      • Can receive/transmit remote control codes, send message between CPXs, and act as a distance sensor
    • Accelerometer
    • Sound sensor and mini speaker
    • Light and Temperature Sensors

Programming Language: Block-Based or Javascript (www.MakeCode.org); can also use CircuitPython and Wiring (Arduino IDE)

Example Project: Minecraft Gesture Controller!

Purchase/Learn More:Adafruit Industries

Step 6: Makey Makey

An interactive introductory microcontroller great for young kids and folks new to electronics and coding, especially for those who want to play with technology without having to build circuits and code.

Recommended Ages: 5+ (or kids comfy with simple tools)

Difficulty: Beginner

Average Cost: ~$50

The Makey Makey is a great first step into electronics and technology -- no programming required! Connect alligator clips to the pads and then connect any somewhat conductive material, like hands, fruit, or metal objects, to trigger certain keyboard and mouse keys.

The Makey Makey is an Arduino-compatible board, meaning that you can also reprogram it using the Arduino Integrated Development Environment ("IDE").

Hardware Features

  • The Makey Makey has six (6) capacitive touch pads on the front of the board:
    • Four control the keyboard arrow keys,
    • One controls the spacebar, and
    • One controls the left mouse click.
    • On the back of the board are header pins for more controls (also capacitive touch):
      • Six (6) pins that map to letters,
      • Four (4) pins that map to arrows,
      • Two (2) pins that map to mouse keys, and
      • One (1) pin that maps to the spacebar key.
      • There are also three (3) general I/O pins, a 5V power pin, and a ground pin.

    Programming Language: Not applicable for beginners; can write Scratch programs (block-based); can reprogram in Wiring (Arduino IDE)

    Example Projects

    Beginner: Floor Piano

    Intermediate: Interactive Survey Game!

    Purchase/Learn More: Makey Makey website

    Step 7: Other Common Boards

    There are waaaay too many microcontrollers to cover in one tutorial. If you have a super specific specialty need, there is probably a microcontroller for that (just like apps!). To get a feel for some of the other boards not mentioned in this tutorial, peruse the inventories of SparkFun Electronics and Adafruit Industries and/or ask folks in the field!

    Here are a few of my favs:

    Particle Photon

    Similar to the Arduino Nano, the Photon is a WiFi connected microcontroller that can be programmed wirelessly. The easiest setup uses a (free) smartphone app, but if can also be programmed directly via USB in almost the same language as Arduino*.

    Recommended Ages: 12+ (or kids comfy w/ circuits and coding)

    Difficulty: Intermediate

    Cost: ~$20

    For more info and to get the Photon setup, visit the Particle online store here.

    Programming Language: Wiring (more or less)

    Example Project

    IoT Industrial Scale

    *Wiring is the code framework, so most Arduino code will work without modifications. Can also write in C/C++ or ARM assembly

    Adafruit HUZZAH ESP8266 Breakout

    A super small, super cheap (and currently very popular in the IoT* community) WiFi microcontroller. You'll need an FTDI or console cable. You can use the Arduino IDE to program this board or NodeMCU's Lua Interpreter.

    Recommended Ages: 14+ (or kids comfy w/ hardware & software)

    Difficulty: Intermediate++

    Cost: ~$10

    For more info, visit the HUZZAH Adafruit product page.

    (SparkFun also has a similar board, the "ESP8266 Thing", which you can find here for ~$15.)

    Programming Language: Lua (sorta like Python) or Wiring (Arduino IDE)

    *IoT stands for "Internet of Things", which is the term that refers to connecting and controlling various hardware devices, like sensors and household electronics, to the Internet.

    Adafruit Trinket M0

    A teeny tiny yet powerful microcontroller that blurs the lines between computer and microcontroller (it has an ATSAMD21E18 32-bit Cortex M0 processor). It can be programmed with Circuit Python or in the Arudino IDE.

    Recommended Ages: 14+ (or kids comfy w/ hardware & software)

    Difficulty: Intermediate

    Cost: ~$9

    For more info, visit the Adafruit product page for the Trinket M0.

    Programming Language: CircuitPython or Wiring (Arduino IDE)

    There are a TON of other M0 boards, similar in scope to the Arduino Zero connectable microcontrollers. If this doesn't suit your needs or your fancy, search around on the Adafruit and SparkFun websites!

    Step 8: Wearable Microcontrollers

    There are also a handful of microcontrollers designed for wearable projects!

    What makes these special is that they can be washed, so you don't have to rip them out of the awesome project you made (but do remove the battery!).

    Wearable microcontrollers also have special I/O pins that make it easier to sew into clothing and stitch circuits with conductive thread. Here are a few of my favs:

    Adafruit FLORA

    A circular sewable microcontroller with 14 inputs and outputs. Can be washed (but def remove the battery).

    Recommended Ages: 12+ (or kids comfy w/ circuits and coding)

    Difficulty: Intermediate

    Cost: $15

    Programming Language: Wiring (Arduino IDE)

    For more information, visit the Adafruit FLORA product page.

    Arduino Gemma

    A lil' tiny sewable microcontroller with 3 inputs and outputs. Perfect for hiding, connecting to small objects, and creating jewelry.

    Recommended Ages: 12+

    Difficulty: Intermediate

    Cost: ~$5

    Programming Language: Wiring (Arduino IDE)

    For more information, visit the Arduino Gemma product page.

    Arduino Lilypad

    A circular sewable microcontroller with 14 available inputs and outputs.

    Recommended Ages: 12+

    Difficulty: Intermediate

    Cost: ~$25

    Programming Language: Wiring (Arduino IDE)

    For more information, visit the SparkFun product page for the Lilypad.

    Step 9: Raspberry Pi 3

    The Raspberry Pi, or Pi for short, is a credit-card sized computer* that runs a special version of Linux and can be programmed to control hardware.

    Recommended Ages: 12+
    Or kids comfy with coding and algebra

    Difficulty: Intermediate (easy as a computer)

    Average Cost: ~$35

    The Raspberry Pi computer, or Pi for short, can be used as a “standard” computer or as a controller for all sorts of hardware projects. It is a great first computer for kids to use and learn to code on, and is widely used by hardware experts to build all sorts of electronic projects, from robots to 3D printers to home automation systems!

    The Raspberry Pi has changed the way we build electronics! There are a few different versions, the most recent is the Raspberry Pi 3 and the Pi Zero, a miniature version of the Pi 3 for just $10.

    Hardware Overview

    • The recommended Operating System (“OS”) is a special version of Linux called Raspbian.
    • The Pi has 40 General Purpose Input and Output (“GPIO”) pins.
      • 26 Digital I/O pins (no Analog I/O)
      • 4 Power Out pins (two 3.3V and two 5V)
      • 8 Ground (GND) pins
      • 2 Specialty Pins (I2C ID EEPROM, advanced use only)
    • The Pi also has most standard computer features:
      • 4 USB Ports
      • 1 Ethernet port
      • 1 HDMI port
      • 1 Audio Jack
      • 1 Camera Module Port

    Programming Language (for GPIO pins): Python or C++

    Since this is a full computer, you can program in whatever language you want, including programming other microcontrollers!

    Example Projects

    IoT Pet Monitor!

    Impact Force Monitor

    Purchase/More Info: Raspberry Pi Foundation

    *The Pi can be used similar to a standard microcontroller AND can also control microcontrollers! Basically, the Pi is super awesome and I *have* to include it even tho it is technically a computer :)

    Step 10: Final Thoughts

    If you are just getting started and want to build all sorts of projects, I'd recommend the Circuit Playground Express. It's super easy to get up and running and has a ton of onboard gadgets.

    If you are super interested in computer networking, AI, or connecting things to the Internet (e.g. making a "Smart Home"), I'd suggest the Raspberry Pi.

    If you want a sturdy, stable, and reliable board to build a wide variety of projects, go with an Arduino.

    If you still have no idea where to start and are totally intimidated, start with the Micro:Bit -- it's only $15 and has plenty of snazzy things on it to play with. Plus, if you get one for your friend, you can send lil' messages back and forth :)

    The best advice I can give you is to find a project you are passionate about and build it! There are tons of tutorials online so search around for someone who has built the same or similar project. Build off of their findings and adjust as you please!

    And of course, leave any related questions in the comments and I'll do my best to help!

    Happy hacking!

    Be the First to Share

      Recommendations

      • Assistive Tech Contest

        Assistive Tech Contest
      • Reuse Contest

        Reuse Contest
      • Made with Math Contest

        Made with Math Contest

      43 Discussions

      0
      None
      Rellyrell34

      Question 5 weeks ago on Step 10

      I'm looking for what I would need to create a lcd controller to control a toy with directional input similar to a drone.

      1 answer
      0
      None
      jenfoxbotRellyrell34

      Answer 5 weeks ago

      I'm assuming you want to control the toy wirelessly, yea? One of my students built a robotic table w/ a drone radio controller and receiver and we connected 2 continuous servo motors to the receiver. Works great! That would be a quick and fairly easy approach, and radio controllers/receivers aren't super expensive (the one we used was about $35). Hope that helps!

      0
      None
      JessicaT64

      2 months ago

      I've tried many of the environments featured here, I was very keen on bluetooth BLE devices with web interface based on javascript, but finally I give up, it's not reliable, I'll be back to raspberry Pi and WIFI, maybe Raspberry Pi Zero

      1 reply
      0
      None
      jenfoxbotJessicaT64

      Reply 2 months ago

      Well, dang! That's too bad re: BLE being unreliable -- is the signal giving out? I do <3<3<3 the Pi so I definitely support your return to those super cool boards. I'd also recommend checking out some of the edge boards, like the sparkfun edge board (https://www.sparkfun.com/products/15170, it has Google tensorflow on it, is voice-activated, and it can be powered with a COIN CELL!! So cool.

      0
      None
      jenfoxbotDavidR978

      Reply 2 months ago

      lol, i didn't "forget", i purposefully did not include it. as indicated in the guide description and title, it is a beginners guide to microcontrollers. like the pi, beagle boards are computers, not microcontrollers. they are more expensive than the pi and i would not recommend them for beginners w/out any experience in electronics or coding.

      0
      None
      herojig

      10 months ago

      I had no idea these little retail things even existed, outside of the PI and Arduino. Great list, and thx!

      1 reply
      0
      None
      jenfoxbotherojig

      Reply 10 months ago

      Aww, thanks! Glad you found the tutorial when you needed it :D

      0
      None
      Wild-Bill

      10 months ago

      I am an old fart (70) who has been messing around with Pi from when they were first available. Yes I was one of the first to order the original Pi. I have now been looking at the Arduino (robust hardware interface projects) and Micro:Bit (for a local community maker shop class). Thanks for doing this presentation.

      1 reply
      0
      None
      jenfoxbotWild-Bill

      Reply 10 months ago

      That's so awesome!! Very happy to hear that you found this tutorial useful along your maker journey :D

      2
      None
      Willys36

      1 year ago

      I was excited to read your Instructable and was getting into it until I saw that you had to be 8 yrs. old to understand this stuff. Bummer. I am 69 and a 45 yr practicing engineer so there is no hope I can comprehend what you are saying.

      3 replies
      0
      None
      herojigWillys36

      Reply 10 months ago

      Ha, ur kidding no? I'm a 62-year old retired IT manager, and I think I'd find anything on that list recommended for 8 year-olds challenging. I think I'll find a teenager and give one a shot :)

      0
      None
      jenfoxbotWillys36

      Reply 1 year ago

      Welp, I guess you'll just have to unlearn a few things!

      0
      None
      jayrro

      1 year ago

      Nice introduction of the MCU's, but I expected more from this instructable. For example which languages you can use to program them - like Basic, python, C, asm, Pascal... Then how you can connect pins, what is difference between digital and analog i/o pins or ports. I've definitely changed the header of this instructable for something like "which microcontroller to use?"or "What mcu's are out there"

      1 reply
      0
      None
      jenfoxbotjayrro

      Reply 1 year ago

      Good suggestions! I wanted to keep the writing to a minimum, on this tutorial, but I will add in the programming languages.

      0
      None
      garnetshaw

      1 year ago

      Excellent article.

      0
      None
      kjbrand

      1 year ago on Introduction

      Add another to the pile: the STM32F103C8T6 - what they call the Blue Pill. It's under $4 on Bangood and very fast - 72MHz, 64K Flash, 37 I/O. Great tutorial videos on YouTube.

      2 replies
      0
      None
      jenfoxbotkjbrand

      Reply 1 year ago

      Right -- there are more microcontrollers out there than one person could possibly keep track of. The goal of this tutorial was to provide an overview on the most common and easily accessible microcontrollers.

      0
      None
      Omniventjenfoxbot

      Reply 1 year ago

      Hi,

      Yes, it's impossible to know them all, considering the speed at which new variants hit the market. For a hobbyist, it's better to just go with a few models, which also makes it easier to get good prices from large(-ish) orders. Buying e.g. PIC10F chips from MicroChipDirect can get you like.3 to 4 chips/$ when you buy them by the hundreds
      (and you do, as their quite steep shipping fee is probably meant to scare off those who aren't serious ;)

      The ever changing landscape of microcontrollers also means new programming chains (if you look outside Arduinos and such)

      .

      I won't turn this into a "hey, you missed ARM etc.", but I do have a few corrections though:

      Arduinos, Pi's etc. are microcontroller _boards_

      A _breakout board_ is a PCB that makes it easier to use SMD chips of any kind. (e.g. in a solderless breadboard)

      .

      The forerunner to microcontrollers we called Minimum Systems, which held CPU, (UVEP)ROM and RAM, with optional periferal adapter and Timer-Counter chips etc. for special functions, some of them smaller than the larger Arduinos (and packed so hard that there was no place for a speck of dust ;)

      .

      A microcontroller is not a one-job chip either, just like with a (single core) CPU - The early pre-Windows PC's could run one job at a time, then along came Win 1,0 and all computer guys had a ROFL moment. Around Win 3.1 it started to look usable for multitasking, but it was really just a shell for (MS/PC)DOS.

      Software can add multitasking to all but the smallest microcontrollers - just add a RTOS or build your software with State Machines for simulated or Time Slice multitasking (and you even have multi-kernal microcontrollers that are born for multitasking (The Propellor is an early-ish example), although I personally prefer to just add the amount of microcontrollers needed, to make both the hardware and the software handling easier and modular.(Master/Slave setup).

      .

      Have a nice day :)