I agree with what Steven said, but want to add a few things.
Ceramic resonators look electrically very similar to crystals. The main differences are:
- Resonators are cheaper than crystals. This is the primary reason they are used over crystals, especially in high volume applications. For one offs, the difference is small and therefore irrelevant to hobbyists and anyone doing small scale builds.
- Crystals are more accurate, which is the primary reason they are used over resonators. Resonators may be accurate to 1% or 1/2%, but that's still way more slop than the 50 ppm even a cheap crystal can do. Note that 1/2% is 5000 ppm. Crystals good to 20 ppm are readily available and not much more cost than 50 ppm. 10 ppm is available, usually at a premium. Temperature controlled crystals can be good to around 1 ppm.
- Resonators are mechanically more robust. They can take more shock and vibration than a crystal can. Resonators are preferred in automotive applications, for example, for this reason.
- Resonators usually require a little higher drive to operate than a crystal. Either is still well within what CMOS circuits can do, so this is not a reason to chose one over the other except in very low power applications. But, it is something to consider when using a resonator. Some microcontrollers, for example, have several different drive levels the crystal circuit can be set to. A resonator may need one level higher than a crystal of the same frequency.
Added:
I meant to say this before but got distracted. The schematic above is missing the bypass capacitor. This may seem unimportant, but it's not. You should solder a 100nF to 1µF ceramic cap accross the power and ground pins of the chip right under the socket. The loop from chip thru cap and back to chip should be as small as possible. Various flaky things may happen without this capacitor, even if it appears to be working.
The diode is to provide a safe path for the inductive kickback of the motor. If you try to switch off the current in an inductor suddenly, it will make whatever voltage is necessary to keep the current flowing in the short term. Put another way, the current thru an inductor can never change instantaneously. There will always be some finite slope.
The motor is partially an inductor. If the transistor shuts off quickly, then the current that must still flow thru the inductor for a little while will flow thru the diode and cause no harm. Without the diode, the voltage across the motor would get as large as necessary to keep the current flowing, which would probably require frying the transistor.
A small capacitor across the motor will reduce the speed of the possibly fast voltage transitions, which causes less radiation and limits the dV/dt the transistor is subjected to. 100 nF is excessive for this, and will prevent efficient operation at all but low PWM frequencies. I'd use 100 pF or so, perhaps to up 1 nF.
The resistor is to limit current the digital output must source and the transistor base must handle. The transistor B-E looks like a diode to the external circuit. The voltage will therefore be limited to 750 mV or so. Holding a digital output at 750 mV when it is trying to drive to 5 V or 3.3 V is out of spec. It could damage the digital output. Or, if the digital output can source a lot of current, then it could damage the transistor.
1 kΩ is again a questionable value. Even with a 5 V digital output, that will put only 4.3 mA or so thru the base: the voltage drop at the B-E junction ("diode") is 0.7 V, leaving the 4.3 V at the resistor. You don't show specs for the transistor, so let's figure it has a minimum guaranteed gain of 50. That means you can only count on the transistor supporting 4.3 mA x 50 = 215 mA of motor current. That sounds low, especially for startup, unless this is a very small motor. I would look at what the digital output can safely source and adjust R1 to draw most of that.
Another issue is that the 1N4004 diode is inappropriate here, especially since you will be turning the motor on and off rapidly, as implied by "PWM". This diode is a power rectifier intended for normal power line frequencies like 50-60 Hz. It has very slow recovery. Use a Schottky diode instead. Any generic 1 A 30 V Schottky diode will do fine and be better than a 1N4004.
I can see how this circuit can appear to work, but it clearly wasn't designed by someone that really knew what they were doing. In general, if you see an Arduino in a circuit you find on the 'net someplace, especially a simple one, assume it was posted because the author considers it a great accomplishment. Those that know what they are doing and draw out a circuit like this in a minute don't consider it worth writing up a web page on. That leaves those that took two weeks to get the motor to spin without the transistor blowing up and they're not really sure what everything does to write these web pages.
Best Answer
Likely an error
The overall quality of Arduino connected hardware designs varies widely as the community consists of a comparatively large number of hobbyists and students.
The 0.1uF cap was most likely intended to decouple the adjacent +5V power supply line. Attaching it to the latch signal line serves no unique beneficial purpose and can cause problems if your firmware operates the clock line at its maximum frequency and you have a long serial chain of registers.
Delay
If you need to delay the latch pulse to comply with setup and hold times (timing minimums) of the 74HC595 you are using, then you should address this in other ways: either correct your layout and/or add the delay in your firmware.
Debounce
On its necessity...
jippie said it best:
On its consequences...
Even if we believe that a bouncing source was driving this line, there is no practical consequence of such behavior.
Wouter van Ooijen, said it best: