Tutorial: Building cool projects with MCUs (Part 4)

I still remember the first time I created my own circuit board. It was such an amazing feeling to be able to see it working. It was actually also a microcontroller circuit. But it couldn’t be programmed through USB, you needed a JTAG programmer. That’s why I’m really excited about the circuit we are building in this tutorial – no programmer or debugger required!

But before we begin, let’s recap: In part one we covered the basics of microcontrollers. Then, in part two we chose a microcontroller for our purpose. Later in part three, we selected which other components we needed, and designed a circuit diagram.

Now, in part four, we are ready to create a circuit board.

How to Create Your Own Circuit Board

The basic process for creating a circuit board is as follows:

  • Design schematics
  • Design board layout
  • Create a board from your layout by etching, CNC milling or using a board manufacturer

We need some design software to do this. There are many available alternatives, but in this post we’re going to use Cadsoft Eagle, which is available for Windows, Mac and Linux. And, another bonus, it’s available as a free version for hobbyists.

Creating Schematics in Eagle

In the previous post, we decided which components to use, and how to connect them. Here is the result:

ATmega32U2 circuit diagram

Now, we need to decide if we want through-hole components or surface mount components, then create a schematic diagram in Eagle.

Through-hole components are easier to solder, but surface mount devices takes less space. Also, they don’t require any drilling, which simplifies the manual work that needs to be done if the board is etched.

I decided to go for mostly large SMD components and a few through-hole components.

Some of the components were not available in Eagle’s default component library; the ATmega32U2 and the USB connector. Instead of spending time making custom versions of these, I did some Googling and found a USB connector in the Sparkfun Eagle library. And I also found a library with the ATmega32U2 chip.

We place all the components in the schematics view of Eagle, and connect them according to the image above.

Designing The Circuit Board

When we have our circuit ready in the schematics view of Eagle, all we have to do is to click the «Board» button on the toolbar to create a board layout from the schematics.

Getting from scheamtics to board layout in Eagle

If you want to learn the exact steps on how to design your own circuit boards from scratch, I’ve written a lot of tutorials on PCB design on my personal blog.

Let’s start by setting our board size. I chose 5cm x 5cm (1.9685 in x 1.9685 in). Why? Because I know it’s possible to find really cheap prototype boards that are this size.

Next, we move all the components onto the board. Since everything is designed around the MCU, we’ll place the MCU in the middle. If we want to etch or CNC mill a board, it’s easier if everything is on one side. Therefore, we’ll stay on the top layer of the board on this design.

Circuit board layout for ATmega32U2 circuit tutorial

You can download the Eagle and gerber files here: Microcontroller-tutorial-files.zip

Getting The Circuit Board Design Made

Now, with a board design ready, we need to make this into a physical board. There are several ways to go about doing this — it can be done through etching, CNC milling or by ordering from a prototype manufacturer.

I usually order prototypes from a PCB manufacturer. This is just so easy and you don’t have to worry about manually drilling holes or inserting vias into your board. Everything is just taken care of. And usually with much better precision than you can expect from etching or CNC milling.

Many people think it’s expensive to order prototypes from prototype manufacturer, but this is not the case. Many offer prices as low as $9.99 for 10 boards. That’s 99 cents per board! And if you choose the cheapest shipping option it will only cost a few dollars.

A great tool for finding the best price is pcbshopper.com. Here you can enter board size and other requirements, along with your country – and you’ll find the best price and delivery option for you.

Ordering Components

It’s not much fun with a circuit board without any components; so, the last step we’re going to do today is ordering the components. There are many available shops online that sells components, including digikey.com, farnell.com, jameco.com and mouser.com.

Most of the components we have used in this tutorial are available everywhere. The only component that might not be in stock everywhere is the ATmega32U2. But Atmel has a great tool to check the inventory of several online shops.

Here are the components used for this board:

Part Description Value Package
C1 Capacitor 1µF SMD 1206
C2, C3 Capacitor 12-22pF SMD 1206
C4 Capacitor Polarized 10µF Through-hole
JP1 USB Connector USB Type B Receptacle Through-hole
JP2, JP3 Header 8 pin Through-hole
LED1 Light Emitting Diode 1.8V Through-hole
Q1 Crystal 8 MHz SMD C49UP
R1, R2 Resistor 22 Ohm SMD 1206
R3 Resistor 200 Ohm SMD 1206
R4 Resistor 10k Ohm SMD 1206
S1 Momentary Switch Through-hole
U1 Microcontroller ATmega32U2 TQFP-32

Next Steps

When we have ordered everything we need, it’s time to sit back and relax! Hopefully it won’t take too long before the components arrive at our door. I am already super excited to start soldering the circuit. However, there is no guarantee it’ll work – we will just have to wait and see in the next (and last) part of this tutorial.

Stay tuned for Part 5 in the coming days…

1 thought on “Tutorial: Building cool projects with MCUs (Part 4)

  1. Pingback: Tutorial: Building cool projects with MCUs (Part 5) | Bits & Pieces from the Embedded Design World

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s