This tutorial is to teach you about transistors, flyback diodes, and basic Arduino functions. This Instructable is based off of a circuit from the Arduino Experimentation Kit.
This is a good tutorial for anyone starting out with Arduino. These parts are very easy to come by in any starter kit or very cheap if you don't have them. The programming is also very simple and uses functions that are already part of the Arduino library.
This tutorial covers transistors and flyback diodes for educational purposes. This is not necessarily the most efficient way to accomplish this project.
Step 1: The Parts
The materials for this project can be seen below but are as follows:
--- Arduino Uno or similar. If you know how your Arduino works then any should be fine for this project.
--- Breadboard. If this is not a project you want to keep then a breadboard is fine. Otherwise you will need to find perfboard or another way to make the circuit permanent.
--- Jumpers or wires. Many Arduino kits come with jumpers. If you do not have one, regular solid core wire is fine.
--- A Small Speaker. These can be found in many electronic devices. You will need one that can be powered on 5v from the Arduino. A piezoelectric buzzer can also be used in this circumstance.
--- 2.2k Ohm Resistor (Red Red Red). This is a good value for the transistor I am using and will most likely work for yours. If not you will need to find the datasheet and determine the appropriate resistor.
--- A Diode. These all work generally the same but watch for the polarity. It matters which way around it goes.
--- A NPN Transistor. These are quite common as well. Watch for the polarity on this as well.