If you have not done so already purchase an Arduino Uno with an Atmel ATmega328P microcontroller. The Uno typically costs between $20.00 and $25.00. Please do not by Arduino Uno knock-offs which do not support the open source community. In addition to the Arduino Uno, the CSULB Shield has been designed to work with the Arduino Mega. Most of the step-by-step instructions assume an Arduino Uno with the Atmel ATmega328P microcontroller.
Arduino Uno with an Atmel ATmega328P microcontroller
Arduino Mega with an ATmega1280 microcontroller
If you do not already own a USB cable make sure your Arduino comes with one or purchase separately.
USB Cable (Type A to Type B)
Although it is not required, you may wish to purchase a 9v DC power adapter. If you plan on using your adapter in the lab you will also need to purchase short extension cord.
9v DC power adapter
Short extension cord
Software Development Toolchains
Before we can make applications for the Atmel ATMega AVR microcontroller we have to install and learn a few new tools. When you first learned to program you probably started with “Hello World.” Our equivalent program is named “Blink” and will be used to introduce and test our development environments. The Arduino microcontroller board is designed to work with the Arduino IDE which provides all the tools you will need to develop “hobby” level applications. The simplicity and fun factor of the Arduino and its IDE is one of the reasons it was selected for our class.
While the Arduino is fun for hobbiest (and students) to play with, it does not represent a complete engineering solution for developing industrial level applications. This is why we do not use it in lab. Instead, we use the AVR Studio 4’s development environment to write our programs. You can also use the latest version of this software, which is Atmel Studio 7. While Atmel Studio 7 provides better development environment for Arduino C++ based programs, its level of support for Assembly based programs is not as strong.
To test your board you will be using the Arduino IDE and the programs you wrote in Labs 1 and 2 within the AVR Studio 4 development environment.
Unzip the Arduino folder and follow the instructions provided in the readme text file. This file will ultimately point you to How To Get Arduino Running on Windows and the Blink example. Here is a summary of the steps you will follow.
Here is a handy tool for through-hole components that acts as a wire cutter and a crimper–it cuts the lead just past the mounting hole but then flattens out a portion of the end of the wire so that the component doesn’t fall back through the hole. (Xuron 670 Cut/Crimp tool–about $22.00)
I often like to use a bit of masking tape (electrical tape melts and leaves a sticky mess) to hold a component in place if I don’t feel like burning my fingers. This approach works great for adding the 3-pin headers.
For IC sockets and other hard to work with parts, I hold the part in place with my left hand and then touch the soldering iron to a bit of solder and then put a light tack on two opposing pins to hold the part
in place until I get a formal connection. Another trick is to apply a bit of solder to two opposing pins and then sequentially apply heat while pushing the IC socket onto the board.
When soldering pads that are close to PCB traces, rotate the board to a comfortable viewing position and locate the soldering iron in the barest area of the region (i.e., no traces). This will help prevent the wet solder from the iron’s tip from wicking between traces while the pad is being soldered. A small magnifying glass or Fresnel lens may be used to help inspect the solder joint and adjacent traces.
Apply heat to the pad, then apply solder to the pad/pin connection. Do not apply solder to the iron’s tip when soldering pads/components. The hotter the iron, the faster the pad/lead will heat, but too much heat and the copper pad can lift from the PCB and/or damage the component.
Step 1) Check the contents of your Shield kit against the part list in Appendix A
Step 2) Find on the PCB and/or Appendix C, labels R1, R2, R3, and R4
Step 3) Using the color codes shown in the following photos install/solder the resistors. If you are not sure use your volt-ohm meter.
10 KΩ Resistors R1 and R2
680Ω Resistor R4, R5, and R6
If you are building the MEGA version install 680Ω Resistor R3 (not shown)
Step 4) Install/Solder 0.01 µF capacitors C3 and C4.
Step 5) Locate on the PCB labels LED8 to LED1 (Red) and INDLED (Green).
Install 8 Red LEDs at these location and 1 Green LED . You will notice that the pins of the LEDs are not of equal length. The longer one is the Anode and the shorter the Cathode. The cathode (short pin) of each diode goes to ground.
Starting with LED8 to LED1 (Red). Looking at the board you will see a line wider than the others running between the DIP switches and the LEDs on the bottom of the Printed Circuit Board (PCB) – this is the ground line. Also locate and add the INDLED, TEST0 and TEST1 Green LEDs. The cathode (short pin) of each diode goes to ground. The ground line is the wire on the top of the PCB connecting the pins on the right.
Step 6) Install two (2) Push-buttons.
The buttons should be inserted so the bottom of the button is flush with the PCB.
Step 7) Locate and place on the board (do not solder them in place yet) two (2) 1 Kohm Resistor DIP packages. Look for 1-102 printed on the IC.
Locate and place on the board (again do not solder them in place yet) one (1) 14-pin and two (2) 16-pin IC sockets.
Be sure to verify orientation (identifiable by a half circle or notch ) before you solder.
IMPORTANT The metal USB connector on the Arduino Uno (2009 and later) may potentially short 595 IC Socket pins 6, 7, 8, 9, 10, 11 and resistor pins 6, 7, 8 if extra lead length is not removed. If you have placed these parts on the board, and not yet soldered them in place as requested, place the protot-shield over your Arduino so you can approximately see where the short may occur. The USB port is at the right in the photo below.
If you are happy with your soldering abilities, solder the pins in place and trim to fit using diagonal cutters. If your solder joints tend to be on the blobbing side, you may want to back off the interfering parts from the board before soldering. Another option is to pre-trim the parts before soldering using your diagonal cutters.
Once you understand the potential problem and have decided on a solution solder the parts in place. Do not install 2 74HC595 and 74ALS74 ICs.
Step 8) Solder in place 100 nF capacitor
Plug in 7-segment display.
Verify orientation before soldering. If you are constructing the Mega shield option skip this step for now.
Plug in 2 DIP switches.
Verify orientation (1,2,3,4 in-line with discrete LEDs) before soldering.
Step 9) You are most likely building the Arduino Uno with an Atmel ATmega328 microcontroller version of the shield. If you are then you may skip this step.
If you are using the Arduino Mega with an ATmega1280 microcontroller then break the shorting traces on the PCB using an Xacto knife. The shorting traces are very thin and are therefore very hard to see. I would recommend using a magnifying glass to locate them.
Next, ask me for the four 3-pin jumper headers you will need to install (they are not included with the basic kit). The shorting wire is between two of the pins on the PCB. To make it easier to break it is very thin and consequently, hard to see. I would recommend using a multi-meter and magnifying glass to identify these small shorting wires.
Verify using a multi-meter that you having broken the shorting traces before soldering the jumper.
Step 10) Insert but do not solder the 10 mF capacitor C1.
Unlike the other capacitors, this is a polarized device! Be sure minus lead is wired to ground. The minus lead is easily identified as the shorted of the two leads. It is also identified by a white stripe with minus sign on the capacitor. The positive side is labeled on the PCB. See top view photo below if you are not sure.
Once you are sure you have the polarized capacitor oriented correctly, solder in place.
PLEASE READ AND FOLLOW THE INSTRUCTIONS IN THE NEXT STEP. YOU HAVE BEEN WARNED!
Step 11) Ask if you are not sure, before you solder anything. If I have not done so already, break off two (2) 6-pin and two (2) 8-pin headers. Insert these four (4) headers and 2×3 ICSP socket into your Arduino Uno board. If your Arduino Uno has not yet arrived then do not do this step until it does!
Unlike the other components, the headers and ICSP socket are mounted on the bottom of the board. Now align and plug in your CSULB Shield. Don’t worry if they do not completely connect. There may be a 1/16 inch gap depending on the header that was included in your kit. Verify the USB adapter does not short out any pins on your board (see Step 7). Once everything is fit checked, apply a light solder tack to the two or more pins at the ends of each header and the ICSP socket. Do not remove the shield from the Arduino until they are fixed in place by these tack welds – this will insure a perfect fit with your board. Unplug the shield from the Arduino and solder the remaining pins – then if needed solder the tack pins.
If you are constructing the Mega shield option do Step 8 “7-segment display” now.
Step 12) Using your volt-ohm meter verify that power and ground are not shorted. The 100 nF capacitor provides a quick way of locating and measuring the resistance between power and ground.
Step 13) Once you have verified that your board is not one big short, plug in the 14-pin 74ALS74 two (2) 16-pin 74HC595 ICs and shunts (if used).
When ICs come from the factory, the legs are angled out somewhat which makes it difficult to insert them into the PCB. Prepare them for insertion by gently bending the legs against a flat tabletop so that they are perfectly straight.
Step 14) You are now ready to test your board and if you are really lucky or good, it will work right out of the box (electrical engineers are optimists).
Top view: CSULB shield
Side and Bottom view: CSULB shield
In the ArduinoIDESection at the beginning of this document, you verified the operation of your Arduino Uno. If you did not, then verify that your Arduino works at this time.
Download the sketch_shiftOut_16-bit linked below. Using the same steps you followed above, verify the basic operation of your CSULB Shield by uploading and running sketch_shiftOut_16-bit. This program tests the operation of the 7-segment display and discrete LEDs, plus it is cool to look at.
If working correctly your shield will replicate this.
Again, do not plug in your shield until you know your Arduino works. After verifying that your shield works you can close the Arduino IDE. You will no longer need it.
Open Lab 3 and review the Instructions on uploading programs constructed in AVR Studio. Upload and run LAB01.hex from Lab 1. This will allow you to test the two green TEST LEDs by toggling switches 1 and 2. Next, Upload and run LAB02.hex from Lab 2. This program will let you verify the operation of all the toggle switches.
Trouble-Shooting Tips and Tricks
This is a student-driven section. As you troubleshoot your boards tell me the symptoms and solutions and I will add them to this section.
The Lab2 program is used to test the switches, discrete LEDs, and 7-segment display. Two students when running this test discovered that an LED and its corresponding 7-segment display segment were always ON. The first thought is that the switch is broken (always open). In these two cases that was not the problem. Instead, a pin connecting the suspect switch to the Arduino 2009 board was not soldered properly (always open). Use the following snapshot of the Shield schematic to map the faulty switch to the pin you need to re-solder.
CSULB Shield Parts List
2 MM74HC595N Shift register w/ latch, 16-DIP
3 LDS-C512RI Green 7-seg. LED display, CC, 0.56", 10-DIP
1 DM74ALS74AN D-type FF, 14-DIP (Mouser)
2 76STC04T SPDT 4-position DIP toggle switch
1 A14-LC-TT-R IC socket, straight, 14-DIP, tin (Mouser)
2 A16-LC-TT-R IC socket, straight, 16-DIP, tin
2 4116R-1-102LF Resistor network, 16-DIP, isolated, 1k, 250 mW
2 CFR-25JB-10K Resistor, carbon film, 10k, 250 mW, 5%
2 Header, male, 1x8, 0.318"x0.1"x0.12", gold, breakable
2 Header, male, 1x6, 0.318"x0.1"x0.12", gold, breakable
8 WP7104ID LED, red diffused, 3 mm, T-1, 20 mA
2 K103K15X7RF5TL2 Capacitor, 10 nF, ceramic
1 ECA-1EM100 Capacitor, 10 uF, electrolytic, 25 WVDC
1 B32559C1104K000 Capacitor, 100 nF, metalized poly. Film
2 B3F-1000 SPST momentary pushbutton switch, PCB
1 PPPC032LFBN-RC Header, female, 2x3, 0.1"x0.318", gold
5 15-29-1025 Shunt, 2-position, gold, closed top (Mega Option Only)
3 CFR-25JB-680R Resistor, carbon film, 680 ohms, 250 mW, 5%
3 WP7104GD LED, green diffused, 3 mm, T-1, 20 mA
1 "shield-pcb" "CSULB Shield v1.1a" PCB, 2.1"x4.0", DS, SS, no SM
1 3" x 5" Anti-static bag
1 1" Black electrical tape (not included)