E2 Laboratory 03

Overview of this week's lab.

In this lab you will construct a circuit by soldering (pronounced "soddering") a circuit on to a printed circuit board (or PCB). The circuit schematic and layout are shown below, and available in pdf form here.


PCB Layout


A photograph of the top of the board is shown below, along with a completed board

Start by putting in resistors R1 through R7, all 470Ω (yellow-violet-brown). Be careful to use the holes for the resistors and not those for the connector which are right beside them at the edge of the board. Look at the completed board in the lab to make sure you get it right. You can solder them individually, or all at once.

The board should now look lie the one shown below. Solder the resistors and then cut off the lead on the back of the board.

Repeat with

Your board should now look like the one below.

The last thing to do is to add the connectors for the Arduino. Talk to me about that because physical alignment is very important. The finished board (atop an Arduino is shown below).


Download the code "E2ShieldTest.ino" and use it to program your Arduino. Connect your Arduino to you board and run it. Each of the LED's L1 through L7 should come on in sequence. The sequence should change speed as you turn the potentiometer. If you press on the switch, you should also get "music" along with the light show. The code is shown below - make sure you understand it. If something doesn't work, try to debug it. If you still can't figure it out, come ask for help.



Your task this week is to use the ideas in the code above, and from your "flip a coin" code from last week to implement a die (singular of dice). When you press the button ("roll the die") the processor will rapidly increment a number from 1 to 6, and then display the number on the 7 LED's (you can do whatever you choose for the middle LED - a single color, or some mixture).

1 2 3 4 5 6



To complete this lab you should create a single file (preferably pdf) that has two clearly labeled sections. Whenever you include code you should make sure it is well commented and properly indented.If you go to Tools→Auto Format, the code will be properly indented for you. You can cut an paste code from the Arduino program, but you should also change the font in your final document to one in which all characters are equal width such as "Courier" or "monospace". The first example shows improper indenting with a variable width font, the second example shows peroper indenting and font. The second one is much easier to read and understand, though they are equivalent to the compiler.