« Tutorial: SparkFun ProtoShield for Arduino Assembly, Updated | Main | Scroll Relief for Apple's Magic Mouse »

February 7, 2010

Tutorial: Assembling the SparkFun MegaShield


The Arduino is a popular, in-expensive, open-source microcontroller board and software development enviroment. Arduino boards come in a variety of styles and are available from numerous suppliers including SparkFun Electronics. One recent version of the Arduino is the ArduinoMega. The "Mega", just as it's name suggests, is an Arduino, supersized. More digital I/O pins. More PWM outputs. More Analog inputs. and 4 UARTS (hardware serial ports). And, if that wasn't enough, more memory.

Despite the Mega's larger size, it actually still fits Shields designed for the smaller Diecimila and Duemilanove Arduino board. However, if you've got the expanded Mega, why limit yourself to a standard shield? SparkFun sells a MegaShield that's deisgned specifically for the Mega which provides access to all of the Mega's pins and makes for a handy prototyping platform (SparkFun also sells the Arduino Mega if you need one). Unlike the standard ProtoShield, however, it is bare-bones. It includes a dedicated reset switch and power LED, and only a single LED hard-wired to digital pin #13 to use in experiments. But, that also makes for a board that's easier to assemble and more flexible. Even though assembling the MegaShield is pretty straight forward, there are a few things that might not be totally obvious, so here's a short tutorial to help you through the process.

First Stage: Planning

Here's the kit looks as it comes from SparkFun:


And, here's the exploded, annotated version (click on a picture to see it big in a popup):


Included in the kit are:

  • (1) Printed Circuit Board (PCB)
  • (1) momentary switch
  • (2) LEDs (one green, one red)
  • (2) 330 ohm resitors (orange, orange, brown)
  • (1) 10k ohm resistor (brown, black, orange)
  • (11) 8-pin stacking headers

Make sure you can identify all the parts.

In addition to the standard parts, if you want to use the MegaShield for solderless breadboarding, you can add a couple of mini-breadboards (there are several colors available from SparkFun, here). Two of the small breadboard end-to-end fit nicely. Also, handy for breadboarding are some jumper wires. I'm writing an instructable about how to make your own quality jumper wires, but you can also purchase them from SparkFun, just search on jumper wire.

I'm assuming you can solder. If that's not a valid assumption, or if you want a refresher, check out the short instructional videos on the NASA radiojove project site. There are also numerous other soldering tutorials around if you search. You should also have basic tools like some clippers that allow you to clip leads close to the board, and some small needle-nosed pliers. Also, not essential, but helpful, is some kind of vise to hold the board while you work on it.

Before we get started, I recommend skimming through all the steps first, just so you get the big picture.

Second Stage: Preparation

OK. Now that you've got the lay of the land, let's go.

There are a few preparations you can make that will expedite the assembly process:

First, you can identify the resistors and bend the leds for inserting into the board. You can use your fingers (I usually do), or pliers if you want to be precise.


Next, you're going to need to modify a couple of the stacking headers. SparkFun supplies 11 8-pin headers. Turns out one of the blocks of holes (closest to the switch) is only 6-pins long. Also, At the end of the board there is a 36-pin block(2x18). For that, you have to make 2 2-pin sections to fit the additional holes when you use the 8-pin headers for the others (2x8 + 2 = 18).

The following picture shows cutting an 8-pin header down to size. Note that when you break apart a female header, you lose a pin in the process. This can make cutting in the right place a little counter-intuitive. For example, if you think you need to cut off two pins from the 8-pin header to make 6 pins, you might be tempted to put the cutter next to the two pins and clip. Unfortunately, this will remove 3 pins (2 + the one destroyed in cutting), leaving you with a 5-pin header -- doh! SO, make sure you count the number of pins you want and cut the at the pin next to that.

Ok. We need to make two 2-pin sections. Take one of the headers and snip off two pins from one end (see the picture). Then, snip off a second 2-pin section from the other end. This will result in sections with one finished end and one end you may have to neaten-up with your clippers and a file or sandpaper (see the pictures below)




Next, we need to make a 6-pin section from another 8-pin header. Count out 6 pins and clip at the location next to the 6th pin leaving 6 pins intact (see picture). Check your count at least three times before clipping! Clean up the clipped end as before.


Finally, the kit comes with two LEDs, one green and one red. The red one is ostensibly for the power LED. The green LED is for status. However, it turns out the LEDs are clear, so it's a challenge to tell them apart without lighting them. There are an infinite number of ways to light an LED, but if you have your MegaArduino around, you can load up the blink sketch and insert an LED into the D13/Gnd connectors to do the trick. LEDs won't work unless they're inserted correctly, so make sure that the short lead goes to GND and the long lead goes into the D13 connector. Once you've discovered which LED is which, mark them with tape or something so you remember. Note: if you get the LEDs in the wrong place (i.e. green for the power LED), no worries. The board will work just fine, you'll just end up a "special" one that has the colors reversed.


OK. Now that you've identified the LEDs and prepared the modified headers, assembly is really straight forward.

Third Stage: Assembly

Assembly involves putting components on the board and soldering them. The parts for the ProtoShield are inserted from the stenciled side of the board and soldered on the opposite side. It's generally best to start with the shorter parts close to the board and work towards the taller parts. So, the first parts to go in are the resistors.


There are two 330 ohm resistors and a 10k ohm resistor. Locate the spots for them on the board. Next, identify the 10k resistor --the color rings are brown, black, orange -- or, another way to identify it is that it's the one that's different from the others and insert the leads into the correct holes. It doesn't matter which direction you put it in, resistors work fine no matter what orientation you use. Repeat with the 330 ohm resistors.


Next, turn the board over and spread the leads while you're pressing on the resistors from the other side to hold them in place. Finally, solder all the leads. Turn the board over and check that the resistors are still laying flat on the surface of the board. If not, you can carefully reheat the offending lead while you press and hold the resistor while the solder cools. Make sure not to do that with your bare finger, however, or you'll definitely feel the heat.


Now, clip the leads close to the board with flat sided wire clippers.



The next component to add is the switch. The orientation doesn't matter as long as it fits properly in the associated holes. It should clip solidly in place (press on it until it's flush with the board). Turn the board over and solder and clip the four leads.



Next, insert the LEDs. The LEDs are different than the previous components in that direction does matter. The LEDs have one shorter lead and one longer one. Also, if you look at the base of the LED lense, you'll notice that one edge is flat. This should be the edge adjacent to the shorter lead and is called the cathode (the other lead is referred to as the anode). The symbol silkscreened on the PCB shows what orientation to use for the LED. Make sure the flat side of the LED (i.e. the shorter lead) matches the flat side on the board symbol. Note that the two LEDs here are mounted so the flat edges are adjacent to each other.



Let's start with the green status LED.


Insert the green LED in the location labelled 'STAT". Again, make sure the short lead and straight edge line up with the silkscreen. To make sure the LED sits firmly against the board (more for aesthetics than performance), I'll often use a bit of tape to hold the LED in place while I solder. After placing the LED, turn the board and solder one lead. Then, while you're gently pressing the LED from the other side, reheat the connection. The LED may shift a little. This will make sure the LED is sitting squarely on the board. Make sure you reheat gently and quickly. Excess heat can damage the LED. After reheating the first connection, solder the remaining lead and clip the leads as before.


Repeat with the red power LED.

Stackable Headers

Now, we're down to installing the headers -- unfortunately, they require most of the soldering.

Insert the headers along the side (see picture). They'll wobble around a bit and you can secure them with tape if you want, or just hold them while you turn the board over and place it on a flat surface.



Now, there are many ways to approach this, I'm sure, but the way I decided to do it was to start by soldering just a single lead from each header (see picture). Do not solder the intervening pins.


Now, reheat each connection and press the header gently from the other side to make sure the header is properly seated and aligned. Repeat this procedure with the second header and so on. When you're done, turn the board over to make sure the headers are aligned and even. If not, reheat and reposition until they are correct.


Once the headers are aligned, carefully solder the remaining connections.


Once all the side headers are installed, its time to tackle the 36-pin connector at the end of the board. Look at the photo to see the layout I used.


An alternate layout that might make the end pins set a little better is to push the 8-pin headers to one side and use the 2-pin headers on the same end, one for each row with the finished end towards the other headers. The layout I chose reinforces the fact that one end of the header block connects to 5V and the other to GND. But, it's your choice.

As before, secure the headers with tape, if necessary. Then, turn the board over and solder one pin from each connector. Actually, in the picture, I soldered on pin at each end of the connector to give them a little additional stability as I positioned them while reheating later.


Reheat and align the headers, then finish soldering as before.


One thing that be a bit of a challenge if you use the layout in the photos is that the end 2-pin headers tend to flare out a little. I was able to hold them together while I soldered their pins which helped straighten them, but you could also use a small drop of glue to help hold them as well. If you do use glue, make sure not to get any inside the connector.



If you've gotten this far, your board should be complete. Before you plug the ProtoShield board into the Arduino, you might want to put a small piece of tape to protect the underside of the MegaShield from the casing on the USB port on the ArduinoMega. This will only really be an issue if you try to put components in that part of the board.


Using the ProtoShield

OK, now that you've finished the ProtoShield, it's time to carefully mate it with the ArduinoMega. The operative word here is "carefully". The stackable header pins are a little fragile so you should take care that they are aligned with their matching sockets before you apply any pressure. I usually start with the 36-pin connector, and once that's aligned work on the others. When everything is lined up, apply gentle, but determined pressure until the board is firmly seated.



To separate the boards again, again the key is "carefully". Pull and rock the board until the headers separate from the sockets. If there's too much friction, you might consider using a small screwdriver to help pry them apart. If you pull too hard with your fingers there might be an explosive release when the boards pull apart and some pins might bend in the process. If this happens, straighten the pins carefully with small pliers, but carefully (again) or they'll break.

Solderless Breadboarding

If you want to use the MegaShield for solderless breadboarding, you can add a couple of mini breadboards mentioned before from SparkFun. They're backed with foam tape and very easy to attach.


You can see from the following picture that they're placed a bit to one side to clear the resistors on the other. It's probably a good idea to place them on the board before uncovering the tape to make sure you understand how they will fit


And, there you have it. Happy prototyping!

Posted by bob | 10:15 AM | permalink


Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Remember me?