« DiggX, Hacked Firmware for the Digg Button (youTube and Instructables) | Main | Tutorial: Assembling the SparkFun MegaShield »

February 2, 2010

Tutorial: SparkFun ProtoShield for Arduino Assembly, Updated


The Arduino is a popular, inexpensive, open-source microcontroller board. The software development enviroment is also open-source and freely downloadable. Arduino boards come in a variety of styles and are available from numerous suppliers including SparkFun Electronics.

Shields are extension boards that attach to a standard Arduino board to extend it's capabilities. The ProtoShield kit from SparkFun is such a shield designed to facilitate prototyping and breadboarding projects. It includes a grid for components along with two LEDs and a switch. An optional solderless breadboard makes the ProtoShield a very handy prototyping tool.

When the V1 ProtoShield was released by SparkFun, I created a tutorial showing how to assemble and use the board. Since then, an updated shield has been released. Some of the differences between the two shields are:

  • Stacking headers are used rather than separate sets of male/female headers. This reduces the number of parts and means you can stack multiple ProtoShields on top of each other if you want.
  • The reset button on the V2 board is now connected to the reset pin exposed by newer Arduino Diecimila boards. Again, this makes for easier assembly, but means that the reset button won't work with the older NG boards (making it impossible to upload sketches). The trick to making it work with NG boards is easy, though, and described in this tutorial.
  • The data pins from the BlueSMiRF socket (for an optional BlueSMiRF bluetooth module) are routed to the TX/RX pins on the Arduino (in V1 they were rounted to pins 2/3, I think) which makes it easier to manage communication.

All said, the V2 board is a nice update that's easier to assemble, and is really an excellent experimenting/prototyping tool for the Arduino, well worth an updated tutorial.

Reblog this post [with Zemanta]

So, here goes.

First Stage: Planning

OK. Let's get started. Here's what the kit looks like as it comes from SparkFun:


Here're all the pieces laid out (BTW, clicking on any image will pop up a hires version):


Included in the kit are:

  • (1) Printed Circuit Board (PCB)
  • (2) momentary switches
  • (2) LEDs (light emitting diodes)
  • (2) capacitors (.1uF)
  • (2) 330 ohm resitors (orange, orange, brown)
  • (1) 10k ohm resistor (brown, black, orange)
  • (2) 8-pin stacking headers
  • (2) 6-pin stacking headers

Look at the picture and make sure you can identify all the parts.

In addition to the standard parts, if you want to use the ProtoShield for solderless breadboarding, you can add the following parts:

  • Solderless mini-breadboard (there are several colors available from SparkFun, here)
  • Male headers for connecting to the switch and LEDs (you only need three pins -- I don't see then on the SparkFun or Radio Shack sites, but you can find them from Jameco, part #160882)
  • Finally, not pictured here, but handy for breadboarding are some patch cables. I'm writing an instructable about how to make your own quality breadboard jumper wires, but you can also purchase them from SparkFun, just search on jumper wire. You'll probably want some male/male ones as well as female/female ones. By combining the two types of jumpers, you can connect between any combination of jumper terminations (e.g. male to female, male to male, etc.).


I'm assuming here that you can solder (or, are willing to experiment on this project.) If you want some instruction in that regard, the short instructional videos on the NASA radiojove project site are a good start. And, there are numerous other tutorials around if you search.

I'm going to provide step-by-step instructions, but skim down the pictures and look at all the parts and try to get a general understanding of what's going on. It'll make it a lot easier when you're sorting things out later.

Second Stage: Preparation

Unlike the V1 ProtoShield, there's little preparation required before you assemble the V2 kit. Basically, just bend the leads of the three resistors so you can insert them into the board.

If you have small needle-nose pliers, you can use them to space the bends close to the resistor body. If not, or you just want to get on with it, you can use your fingers to bend the leads down near the body (which is what I usually do).


Third Stage: Assembly

Now, it's time to start putting parts in the board and soldering them. 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. The parts for the ProtoShield are inserted from the stenciled side of the board and soldered on the opposite side. There are two 330 ohm resistors and a 10k ohm resistor. Locate the spot for the 10k resistor (and, identify the 10k resistor -- the one that's different from the others). Insert the leads into the holes. It doesn't matter which direction you put it in, resistors work fine no matter what orientation you use.


Now, turn the board over and spread the leads while you're pressing on the resistor from the other side to hold it in place.


Repeat for the two 330 ohm, resistors.


Now, 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, or you'll definitely feel the heat.


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



Next place the two capacitors (see the picture below) spreading the leads as before. Again, it doesn't make a difference which direction you put the capacitors in. Solder and clip the leads as with the resistors.




The next components to add to the board are the switches. The orientation doesn't matter as long as they fit properly in the associated holes. They should clip solidly in place (press on them until they're flush with the board). Turn the board over and solder and clip the eight 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 LED lense from the top, you'll notice that one edge at the bottom is flat. This should be the edge adjacent to the shorter lead. This is 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.



To make sure the LEDs sit 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 LEDs, turn the board and solder one lead of each one. 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. After reheating the first connection, solder the remaining lead of each LED and clip all the leads as before.



Male Connectors for LEDs/Switch

If you're not going to be using the ProtoShield for solderless breadboarding (i.e. you're going to solder wires where you need them) you can skip this next step.

For this step, prepare three single-pin male headers by snipping them off the row of remaining pins. Using tape to hold them, insert the short end of a pin in the board for each of JC1, JC2, and JC3. These are a little tricky being so small, but take your time to make sure they're positioned correctly. Turn the board and solder each connection. You can reheat and reposition if necessary.





You probably won't need to clip the lead after soldering since these pins are designed to be the right length.


Stackable Headers

Now, we're down to the last few parts -- unfortunately, they require most of the soldering. The remaining parts are the stackable headers that connect to the Arduino board and pass the signals through to other boards, or for use in prototyping.

Insert a header into the board. It doesn't make any difference whether you choose an 8-pin or a 6-pin one, just make sure you match it with right set of holes on the board (this won't be a problem with the 8-pin socket, but you might mistakenly put a 6-pin socket in an 8-pin location). Also, make sure to insert the header in holes closest to the the outside of the board, and not in the inside row of holes. If you do this incorrectly, the board will not mate properly with the Arduino.


Use a bit of tape to hold the header in place and turn the board over.


To solder the header in, solder just one connection at each end of each header. Do not solder the intervening pins. Now, reheat the connection at one end and press the header gently from the other side to make sure it's properly seated and aligned. Now, reheat the connection at the other end while pressing it to make sure it also is seated correctly. Repeat this procedure with the second header. Now, remove the tape and turn the board over and check to make sure the header is aligned and even. If not, reheat and reposition the leads until it is correct. Once the headers are aligned, solder the remaining connections.




Repeat the procedure for the headers located on the other side of the breadboard grid. Again, make sure to place the headers in the outer row of holes.



Before you plug the ProtoShield board into the Arduino, there's one small precaution I recommend you take. It turns out that the reset switch is right over the casing for the USB cable on the Arduino and could short out if it's not insulated. To remedy this, first make sure the leads from the switches are trimmed close to the board. Then, cover the bottom of the board with some electrical tape (I used two layers) so the switch doesn't contact the USB casing. Another option would be to cover the USB case with tape instead of the circuit board. Either should work fine.


If you're going to use your ProtoShield on a Diecimila Arduino, you're ready to roll and can skip the following step. However, if you plan to user the board with an NG or earlier Arduino, the following modification will allow the reset switch on the ProtoShield to work properly (and, on earlier boards, the reset switch is necessary for uploading sketches):

The following picture shows a V2 ProtoShield plugged into an Arduino NG board.


Notice that two pins are unconnected. One of these is the reset pin -- ergo the reset switch is unconnected. On an NG board, which requires that you press the reset button whenever you upload a sketch, that means you can't upload sketches without somehow connecting the reset switch. However, it turns out that the reset pin is also connected to a pin on the 6-pin connector which has mounting holes at the other end of the board.

To connect the reset button, you have to attach a short female header in the pictured location on the bottom of the board. This involves finding a 3-pin female header, or cutting one down; inserting it through the bottom of the board; then, soldering it to the top. In the V1 tutorial, there's a little more information on how to adapt a 4-pin header for this use. A 16-pin female header can be purchased from Jameco, Part #30859., or other suppliers. You can cut a 3-pin section from this for use.




That's it. You're done assembling the ProtoShield. If you're going to use the Shield for non-permanent breadboarding, I highly recommend that you get the small solderless breadboard that SparkFun also sells (multiple colors are available). It has foam tape backing and can be attached to the top of the finished ProtoShield as shown in this photo:


Using the ProtoShield

SO, now that you've finished the ProtoShield, you might be asking, "So, what?" Here are a couple of quick examples using the blink and button sketches (programs) from the Arduino web site. These examples assume you've installed the necessary drivers and the IDE from the Arduino site. There's extensive documentation there, so I won't duplicate instructions here.

To set up the Arduino to run those sketches, first, mate the ProtoShield and the Arduino board. To do this, line the headers and pins up carefully (I usually get one side properly placed, then the other) and apply pressure until they are firmly seated.


For making a connection between the breadboard and a pin, I personally use custom jumper cables with a male pin on one end and a female connector on the other. But you can also use a jumper with an alligator clip at one end, or the jumper wires I mentioned before from SparkFun, for connecting between things. If you purchase premade jumpers, make sure to get some male and female ones. Combining the two allows you to connect the female connector from the ProtoShield to one of the male pins attached to an LED or switch. Note: if you're industrious and have female headers around, you can cut single-pin versions of those and use them when you assemble the ProtoShield rather than the male headers I used. Then, you can just use male jumper cables for all of your patching.





So, for the blink sketch, all you have to do is connect an LED on the ProtoShield to the digital output pin from the Arduino using a jumper. Insert the bare end into #D13 and attach the other end to JC3 (or JC2). Then load and run the sketch according to the instructions on the Arduino site. If all works well, the LED should begin blinking after a few seconds (if you're using the NG board, you'll have to press Reset to upload the sketch).





The second example, button, uses the switch and an LED. The switch is wired to pin #D7. To do this on the ProtoShield, connect a jumper between #D7 and JC1. For the LED, use the same wiring as before between pin #D13 and JC3 (or, JC2). As with the LEDs, the ProtoShield has already wired the switch correctly with the 10k resistor so that you don't need to duplicate this wiring when using it. Loading and running the button example should work. (Note: the ProtoShield button is wired with a pullup resistor so the signal from the button is normally high -- when the button is pressed, the signal changes to low. As a result, in the Button sketch, the LED is normally on and goes off when the button is pressed.)


And, there you have it. I hope this not-so-brief guide to assembly and use of the updated ProtoShield has been helpful. Happy experimenting!

Reblog this post [with Zemanta]

Posted by bob | 11:37 PM | 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?