A popular device to build when first learning how to build circuits is an AC-driven speaker that produces awful noise. Understandably, this becomes quite entertaining to use when you enjoy irritating others with said noise. Unfortunately, however, the use of this speaker is somewhat limited: the only way to toggle the output is to connect or disconnect the voltage source, and an AC voltage of some sort is required (the speaker is not triggered by a DC battery). To obtain an AC voltage from a simple DC battery, we can use a 555 timer, whose purpose is to output an AC frequency based on what resistors are connected to its pin terminals. To add even more versatility to this annoying instrument, the resistors can be replaced by potentiometers, which can be adjusted to alter the output frequency at will. A conventional way of triggering the output is to use a slide switch; however, since we're unconventional, we'll use something called the PIR (Passive InfraRed) motion sensor. The sensor detects changes in the amount of infrared radiation (which is emitted by humans) it receives. This will allow the speaker to unexpectedly scream at someone when they walk in front of the circuit. In addition to being a fun project to build and bother others with, building and using this circuit should help improve understanding of circuits and how they work. While building this circuit, I learned a lot about the PIR motion sensor and how to use it properly (through trial and error). In addition, its use should improve your understanding of 555 timers, due to being able to witness how the output is affected when the potentiometers are adjusted. I have to say that I'm also quite impressed with the high annoyance factor of the output, with its ability to create a broad spectrum of horrendous noises based on the settings of the potentiometers, from a high-pitched screech to an abrasive buzz (or perhaps a combination of the two).
Step 1: Materials
A bunch of wires
1 555 timer
1 NPN transistor
1 PIR sensor (https://www.amazon.com/DIYmall-HC-SR501-Motion-Infrared-Arduino/dp/B012ZZ4LPM?keywords=pir+sensor&qid=1540494572&sr=8-2-spons&ref=sr_1_2_sspa&psc=1 is the one I used)
1 .01 uF capacitor
1 1 uF capacitor
1 100 uF capacitor
1 8 ohm speaker
Step 2: Assembly
This circuit is relatively simple to assemble, with only one real gimmick. We set a 555 timer to be in astable mode, with two potentiometers connected (in the schematic, these are the resistors with the wipers/arrows next to them). This means the timer will output a constant signal when given a certain resistance. As the potentiometers are turned to apply more resistance, the frequency of the output. The NPN serves as a switch in this circuit, with its purpose being to protect the circuit from too much current, which can damage the components. We use a transistor instead of a resistor because a resistor will drop too much voltage and prevent an audible noise from being produced (this is because the PIR's output is not that high). The PIR itself is the tricky part, as the pins aren't labelled, and it is very difficult to connect to a breadboard with with PIR's pins. If your PIR is like the one I have in this image (likely, as PIR's are fairly standardized), the positive (Vcc) terminal is the pin next to the diode (the small orange cylindrical structure), with the negative (ground) pin at the opposite end and the output pin in the middle. If not, it may be necessary to find a data sheet or tutorial on your particular type of sensor. To connect the pin, I recommend connecting jumper cables to the pins, as it allows the pins to function as wires and be easily plugged into the breadboard.
Step 3: Operation
Operating the circuit is pretty simple for the most part. The speaker will beep at first when turned on (this is completely normal). Waving your hand or walking in front of the sensor will increase the amount of infrared radiation detected by the sensor, outputting a brief signal and making an annoying sound. The frequency of the output signal can be changed by rotating the potentiometer. For a rotary potentiometer, the resistance will increase when the potentiometer is turned counterclockwise; since the 555 timer is in astable mode, this means that the frequency will increase as the potentiometer is turned clockwise (since the resistances connected relate inversely with the output frequency). The potentiometer connected to the threshold will also affect the frequency about twice as much as the one connected to the voltage source. The other parameters of the circuit that can be modified are the trigger time and sensitivity of the circuit; these are controlled by the two orange knobs on the sensor, which can be changed by rotating them with a screwdriver. The knob on the left (in the view above) controls the delay: how long the PIR will output a signal after it is activated. Turning the knob clockwise will increase the delay while turning it counterclockwise will decrease the delay (about 3s minimum and 5s maximum). The knob on the right adjusts the sensitivity to changes in IR radiation by increasing and decreasing the range over which it checks for changes in infrared. Turning the sensitivity knob clockwise will decrease sensitivity while turning it counterclockwise will increase it (for exact values, the minimum range is about 3m while the maximum is about 7m). For more details on operation, check this link: http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-hc-sr501-motion-sensor-tutorial/.
Step 4: Troubleshooting (the Fun Part...)
Here are some common problems (all of which I've encountered myself) that may prevent others from wanting to smash this circuit:
1. If the speaker isn't working:
-Reconnect the voltage source to the PIR and wait for approximately 30 seconds. The PIR has to stabilize a bit and "feel out" the surrounding area (detecting the local temperature, amount of IR radiation, etc.) before it can work properly.
-Check to see that the PIR sensor's pins aren't broken (this is unlikely to happen to you since I instructed you to use jumper cables; the first time, I attempted to plug the PIR into the breadboard by bending the pins, but this didn't work so well).
2. If the speaker lets out a constant signal rather than being triggered by infrared:
-Check for breaks in the wire between the PIR and the transistor's base. This can cause the PIR to be cut off from the circuit entirely.
3. Speaker works, but seems to go off at random times:
-You're probably in a relatively crowded and busy room, which causes frequent changes in the amount of thermal infrared that the sensor may receive. Try adjusting the sensitivity knob (the orange knob opposite to the pins, not the one opposite to the diode) with a screwdriver (turning it counterclockwise will make it less sensitive). In general, however, this circuit works most effectively in quiet, empty areas where somebody just so happens to walk by and wonder what that weird sound is.
If none of these problems were found, it's probably a broken component or wire somewhere. The only option is to test different components to see if they function as needed and replace them if not. Make sure the transistor is working in particular as its pins can be quite fragile and prone to damage if they have been bent too much.