Basic Circuits

There are a million different circuits you could make for a variety of different sensors, displays, and everything that you can think of.  Below are the basics of the basics to get you started.  For more circuits, tutorials, and code, please visit http://www.arduino.cc/playground/Main/InterfacingWithHardware.

Near the end of this e-book are a bunch of circuits and code to use them.  Give it a look over (again, pay attention to the copyright): http://www.lulu.com/items/volume_63/1108000/1108699/4/print/ARDUINO_NOTEBOOKv6.pdf




OUTPUTS
Want to make something light up?  Spin? Make noise?  You need outputs!  Below are a few circuits you might use in your project.

LEDs are extremely useful.  They consume little current, don't get hot, and are easy to use.  They come in every color, from standard colors like red, green, blue, to more exotic colors like ultra violet, pink, and infrared. Looking at a raw LED, the longer lead is the positive side (connected to 5V below) and the shorter lead is connected to the ground through the resistor.  NEVER USE AN LED WITHOUT A RESISTOR.  You will almost certainly burn it out in a few milliseconds if you don't.



Speakers are also very useful.  They allow the end user to get feedback such as alarms, warnings, and more from a distance. There are many types of speakers that you can use and of varying sizes.  Generally, an 8 ohm speaker will suit you best. Piezo buzzers also work well.


Your Arduino will output a square wave (think Mario sound effects).  If you'd like to change the sound, you can add a capacitor in series with the speaker to achieve a sawtooth or triangle wave (depends on the size of capacitor).  If you'd like a sine wave, you can use a switched-capacitor which should give you a close approximation.


INPUTS
In order to do anything useful, you will need to have inputs.  Below are sets of standard input circuits you will likely use.


The most basic circuit you could use for input is a button or a switch.  In the picture shown below, when the switch is engaged, the pin will read HIGH.  When the switch is not engaged, the switch will read LOW.

The resistor between the pin and ground is EXTREMELY important.  What it does is allow excess charge from static electricity and radio frequencies to flow to ground.  The reason this is important is because if you gather enough charge from local noise, you will get random readings from your digital pin.  You will want to use a high enough resistor so that the current flowing through it is very low, but low enough for it to actually work.  10 kOhms is perfect for most applications, but you can go up or down a factor of ten and be okay.


Potentiometers (also known as "pots" or variable resistors) are extrememly useful for many types of input.  The node on one side is connected to 5V, the node in the center is connected to an analog input pin, and the last node is connected to ground. In the sketch below, when the knob is turned all the way to the left (ccw), the reading will be 0.  When the knob is turned all the way to the right (cw), the reading will be 1024. When using cheaper pots, you may need to do mapping (see the analog mapping example in the Arduino IDE).