\documentclass[nopageno,letterpaper,11pt]{article}

\input{/Users/pleclair/Documents/Alabama/Teaching/PH126/defs}

\headheight 0.25in
\headsep 3ex
\topmargin -0.5in
\textheight 9in
\textwidth 6.5in
\oddsidemargin 0in
\evensidemargin 0in

\parindent 0in 
 
\begin{document} %\garamond

\pagestyle{headings}          %for TOC, etc use standard headings
\thispagestyle{empty}

\begin{center} 
	{\sc \large  University of Alabama}\\
		{\large Department of Physics and Astronomy}\\
	{\large PH 126 LeClair  \hfill Fall 2011} \bigskip
	
{\bf \Large Introduction to the Arduino Microcontroller}

\end{center}
\setcounter{tocdepth}{2}

\section{Introduction}
\label{sec:intro}

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.\\

Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software running on a computer (e.g. Flash, Processing, MaxMSP).\footnote{Text above from arduino.cc}\\

In this lab, you will construct a circuit consisting of a light-emitting diode and a resistor in series. Through the Arduino board, you will control this circuit with two different programs, one that makes the LED blink, and one that makes it fade.

\section{You will need}

\begin{my-itemize}
\item a prototyping board
\item an Arduino microcontroller
\item $200\,\Omega$ resistors (1)
\item LED (1, loose)
\item various lengths of wire
\end{my-itemize}

\section{Your components}

You will receive a number of tiny components for this lab. Below is a picture to help you identify them. The resistor can be wired in any orientation, but the LED has a definite polarity. The longer leg is the positive terminal, and current flows from positive (long) to negative (short) terminals.

\begin{figure}[h]
	\centering
	\includegraphics[width=0.35\columnwidth]{figures/parts}	\caption{Your components. The resistor is the little stick in the lower middle, the LED is the piece with the little red bulb, and the remainder various lengths of wire.}
	\label{components}
\end{figure}

\section{The prototyping board}

The prototyping board (``protoboard") is a device for quickly connecting electric circuits without needing any soldering or complicated mounting. Here is a picture of a typical small protoboard, along with a close-up of the central region.\\

\begin{figure}[h]
	\centering
	\includegraphics[width=0.5\columnwidth]{figures/protoboard1.pdf}
	\includegraphics[width=0.2\columnwidth, angle=90]{figures/protoboard2.pdf}
	\label{protoboard}
\end{figure}

The protoboard has sets of holes arranged in lines, and these lines are electrically connected under the board itself. In the close-up picture of the center of the protoboard, you see two sets of vertical holes: one set of five holes, a gap, and then another set of five holes. The upper five holes are connected, and so are the lower five {\em but not to each other.} Take one of the upper sets of holes connected by the white line. Any component wires plugged into the holes along a given line are connected to each other across the protoboard, but not to horizontally-adjacent lines {\em or} to the set of vertical holes below it. For example, for the simple circuit you will build today, the LED and resistor in series, we could do this:\\

\begin{figure}[h]
	\centering
	\includegraphics[width=0.25\columnwidth]{figures/wiring-closeup}
	\label{wiring-closeup}
\end{figure}

Here the blue wire is the ground point (negative connection) and the purplish wire the positive supply from the Arduino. The LED and resistor are connected together in a row

This connects the emitter, base, and collector to separate columns of holes. All four holes directly below the emitter are connected, and connected to the emitter plugged into the uppermost hole, so {\bf any wire plugged into a hole directly below the emitter will be electrically connected to the emitter.} That's it! The horizontal sets of holes at the top and bottom of the protoboard are also wired together in sets of five, but grouped {\em horizontally} instead of vertically. You can choose to ignore the horizontal lines and just use the vertical lines in the center to make things easier. \\

A couple of important points. First, {\bf the supply (Arduino) should be the last thing you connect}, after ensuring that the wiring is correct to the best of your knowledge. Second, we will have example circuits correctly wired up for you to inspect to be sure you understand the protoboard. Ask if you are not sure, we are here to help!

\section{The Arduino}

Right now, we don't need to know much about the Arduino. Suffice it to say that it has various input and output pins that you can connect devices to, which can then be controlled by uploading code through a USB connection. For this, you will need to use the development environment; there should be a shortcut on your computer's desktop. Have a look at your Arduino (a simplified schematic is shown below, along with a mock-up of the connections for the circuit you'll use), open up the development program, and proceed to the tutorials listed below when you're ready.

\begin{figure}[h]
	\centering
	\includegraphics[width=0.35\columnwidth]{figures/arduino}
	\caption{Simplified representation of the Arduino. From \url{http://arduino.cc/en/uploads/Tutorial/ExampleCircuit_bb.png}.}
	\label{arduino}
\end{figure}

\section{Circuit construction}

Once you feel that you understand the equipment involved, proceed to the ``Blink'' tutorial on the Arduino web site:\\

\url{http://arduino.cc/en/Tutorial/Blink}\\

Once you have finished that, work through the ``Fade'' tutorial:\\

\url{http://arduino.cc/en/Tutorial/Fade}\\

That's it! There is nothing to turn in for this lab: if you circuit and programs work, you get full credit for the lab.


\end{document}

			