The Microcontroller or MCU

The Brain of our Machine

The Microcontroller or MCU is going to be the key component in all of our projects, it’s the brain of our machine and controls how the device works. In this post I’ll be providing information on which MCU we’ll be using, basic hardware and software requirements and most importantly where to learn more.

There are many online resources available that can help the beginner get started with MCUs and this blog isn’t intended to replace them. Rather I’d like to concentrate on how this technology can be used to further the world of specialty coffee and will focus on those elements specifically. Along the way I’ll be sure to point to resources that can help to fill in the gaps for the beginners following along.

An MCU is a mini computer on a single chip designed to perform basic tasks. While not as powerful as desktop computers, MCUs are able to boot almost instantly because they utilize simple operating systems and as a result provide devices with the feeling of instant on.

Memory, storage, and the operating system are all part of a single chip which makes for an efficient and compact package. Fairly complex systems can be squeezed into an MCU the size of a USB thumb drive. MCUs are great at performing tasks such as reading a sensor and then executing an action over and over again.

Depending on the MCU, it can have any number of inputs and outputs or pins that let data flow in and out of the brain. For example sensors that measure temperature or pressure are considered data inputs. Data outputs on the other hand, control various peripherals such as heating elements or pumps.

One of the most readily available microcontroller boards is the MEGA 2560 from Arduino. We will be using the MEGA almost exclusively in our projects. The MCU can be programmed directly from a personal computer via a USB cable and you can pick a MEGA up online for around $14USD. The MEGA has 54 input/output pins which allow for a large number of attached devices. Built into the chip is an EEPROM to save settings as well as 256KB storage. In comparison to a desktop computer or even a smartphone a MEGA might seem extremely under-powered. But don’t let these seemingly low specs fool you. Once we get going you’ll be surprised at what you can accomplish with one.

In addition to price and availability, another advantage to using the MEGA is the massive online community that supports the Arduino architecture with open source software libraries as well as the multitude of vendors selling inexpensive hardware peripherals. For example there’s a great open source PID libary we will be covering later that can be used to control temperature or line pressure. In the same vein you can pick up a daughter board to read an RTD temperature probe for under $11USD.

So if you’ve made it this far you’re probably interested in learning more. The following is a list of items that are necessary to continue onward. Fortunately you may already have several of these items and for those on a budget, all of the software listed is open source and is free to download.

Required Tools

  • Personal Computer
  • Arduino IDE
  • Text Editor
  • Arduino MEGA 2560 rev3
  • Perseverance
Personal Computer

You will need either a laptop or desktop computer that is running Windows, OSX or a variant of Linux. Using the software listed above, you’ll be able to write the programs or Sketches that run on the Arduino. When ready, Sketches are uploaded to the Arduino via a USB cable.

Arduino IDE

The Arduino IDE is a free to download desktop application that can be used to write and upload Sketches to the Arduino. To note, the IDE is a bare bones text editor without many features and there are other options listed below. A new version of the Arduino IDE is available with a web browser interface which supports online Cloud storage.

Text Editor

While not required, a good text editor can be an invaluable tool. Think of a text editor as a word processor for programming. A good text editor checks the syntax (programming grammar) and color codes parts of a Sketch in order to make it easier to read. My personal choice is Komodo Edit, a free to download application that runs on Windows, OSX and Linux.

Arduino MEGA 2560 rev3.

The Arduino MEGA 2560 is the MCU that we will be using for our projects. Arduino boards are part of an open source platform and are manufactured by different suppliers at various price points. You can purchase boards individually or in starter kits that include a variety of sensors. Some boards include a USB cable which is required to connect the MEGA to a personal computer.

In theory you can use any Arduino for our exercises such as the UNO, but we’re going to be referencing pins and ports specific to the MEGA so it’s a good idea to purchase the same bit of kit. The good news is you can use a MEGA to do the tutorials for an UNO, but not the other way around.

Next Steps

Download the software and go out and purchase an Arduino MEGA. Start doing the basic tutorials and watch a few YouTube videos. In the next installment I’ll be covering the basics of getting data out of the MCU and displaying it on a screen.

Additional Resources

  • Official website for the Arduino platform. Tutorials, instructions, as well as a vibrant user forum.
  • Getting Started with Arduino. An excellent book that explains the basics of the Arduino platform that is perfect for people who have no prior experience with electronics or programming.
  • Arduino MEGA 2560. An online introduction and tutorial from Arduino for the MEGA.
  • For those who don’t like to read, here’s a great YouTube video which explains the basics of an Arduino MCU.

Skill sets

  • Basic understanding of programming or scripting.
Programming

Most people stop reading when they see any mention of programming. This is why I put this at the end of the post. When learning to program no one writes their own code, they copy or hack together bits and pieces of other code. The best way to learn how to program is to edit sample Sketches, make changes and upload your new version to see what happens. When getting started you won’t break anything. Later down the line that won’t be the case but for now, it’s pretty safe. Don’t be afraid to experiment and try something new.