Flip / Flop) in a bistable or monostable (one-shot) multivibrator. Normally, for controlling the output state of an RS latch we need to use two buttons (see figure 1). Pressing the Set or the Reset button, brings output A to logic 1 or logic 0 level, respectively. The output of NOR B always has the opposite logic level of that of NOR A. If we press the Set button for second, third, fourth time, or more, the logical condition of the Flip-Flip outputs will not change. The only way to change again the state of the outputs, is by pressing the Reset button. For avoiding any uncertain output during powering up, we use C1. C1 is connected at one input pin of the NOR A and forces a logic 0 level at NOR A's output during powering up. Figure1. An R-S latch If we want to achieve Set and Reset with a single button, we may use the bistable multivibrator of Figure 2. It differs from the simple latch of figure 1, because it uses two capacitors (C2 and C3), connected on the inputs of the gates, and two diodes (D2 and D3) connected between the input and the output of each NOR. During powering up, as in the simple latch, the A output of the bistable multivibrator goes at logic 0 level, and the B output at logic 1. When S1 button is pressed, C2 and C3 send a positive pulse on both inputs of NORs. However, D2 diode, which is connected between the input and the output of Nor A, short-circuits this positive pulse because pin 1 is at logic level 0. Consequently, this positive pulse excites only the input pin of NOR B, resets its output and sets the output of NOR A at logic 1. Figure 2. Single input R/S latch Pressing the button for second time, sends again a positive pulse on both NOR gates. However, D1 will short-circuit the pulse due to the fact that the logic level on pin 13 is held at logic-0. Consequently, the pulse will only excite NOR A, bringing its output to logic 0 level and the output of NOR B to logic-1 level. Pressing this button for third, fourth time, or more, will change the state of the latch from logic 0 to 1, back to 0, and visa versa. There is also the option of turning the single-button Flip-Flop in a way that its output will return automatically to its initial state after some time from excitation. To do this, we must connect a capacitor (C4) at the output of NOR B, as shown in Figure 3. C4 will convert the previous bistable multi-vibrator in an one-shot (monostable) multivibrator (see figure 3). Figure 3. One shot trigger During start up, C4 will not be able to charge, because it is connected between the output B and the input of NOR A, and the same positive voltage will be present in both its terminals. One terminal will be in positive voltage due to the B output, and the other terminal will be also on the same positive voltage from R5. Pressing S1 button will set immediately a logic 1 state at the output of NOR A and a logic-0 level at the output of NOR B. In these conditions, the electrolytic capacitor C4 will begin to charge, because its positive terminal will be connected to R5, and its negative terminal on the output of the NOR B gate. During C4 charging, the voltage at its positive terminal will gradually increase, and eventually will bring the input of the NOR A at a logic-1 level. This way, the output of NOR A will return at logic-0, after sometime passes from excitation. Every time S1 is pressed, the logic levels on the outputs of the two NORs will change again, and as soon as the electrolytic capacitor C4 will be charged again, the logic levels of the two outputs will be inverted. The time required for returning back to the stable state, depends on the time constant RC (C4 value, multiplied by R5). To obtain sufficiently long times, we have to use a large capacitor and a resistor of a high value. To obtain the time of a few seconds, it is convenient to use a polyester capacitor of 2.2uF, and a resistor of about 1 Meg. For adjustable time constant, we can use a trimmer resistor of about 1 Megohm in series with a resistor of 470K, instead of R5. This is the arrangement we finally decided to use in the Sound Activated Relay (see electronic schematic). Sound Activated Relay circuit (see electronic schematic) To capture the sounds, we use a microphone capsule and a small microphone preamplifier. The signal from the microphone is applied (through C1), to the non-inverting input (pin 3) of the IC1 operational amplifier. IC1 is used as a precision half-wave rectifier. It is used to amplify the signal, and also rectifies it by using D2. R5 trimmer, which is connected between the inverting input (pin 2) and the cathode of D2, enables gain adjustment and allow us to make the microphone more or less sensitive to sounds or noises. In the absence of an input signal, the voltage at D2's cathode is about 6 volts. This voltage, is applied to the non-inverting (pin 3) of the second operational amplifier (IC2). A voltage of about 6.5 volts is also applied on the inverting input of the same op-amp. Since IC2 is used as a comparator, when its non-inverting input is at a lower voltage than that on the inverting pin 2, the output at pin 6 remains at a logic-0 level. To change its state to logic-1, the voltage on pin 3 must exceed the voltage present on the inverting input. This will happen at the presence of a sound or a noise signal. Any sound signal will be amplified and rectified from IC1, and will raise the voltage at D1's cathode above the value of the voltage on the non-inverting pin of IC2. Thus, IC2's output will change to logic-1. This will send a positive pulse across to the inputs of the Flip-Flop and will set a logic-0 state at the output of NOR B. The base of T1 will be grounded through R16, and T1 will saturate and will energize the relay. If S1 switch is set to short-circuit C11, the relay will go-back to its initial state only if the microphone picks-up a new sound or noise of certain intensity. If the S1 switch is left open, the C11 capacitor will create a one-shot behavior, and the relay will return to its initial state (off) after a certain amount of time. This specific time interval can be adjusted from R18. Construction For making construction simple, we have designed a specific Printed Circuit Board for this project. All components must be mounted on this specific board according to the assembly instructions provided together with the PCB layout. There are some PCB tracks needed to be connected to several external components, ie, switches, LEDs, and the microphone. We recommend you to place these external components and the electronic board, at the front panel and inside of an appropriate enclosure, respectively. The equipment you wish to control using the Sound Activated Relay, can be connected using the P1 3-pin terminal block. Initial adjustments After powering up the circuit from a 12V supply unit, you will need to calibrate the sensitivity potentiometer R5. This can be done by putting yourself in front of the microphone at a distance of about two feet. Clap your hands or whistle, and if the relay is not energized, rotate the dial of R5 trimmer to increase sensitivity. Once the relay is energized (LED D7 is turned on), and if S1 switch is turned-on, you'll have to manually re-clap or whistle again to de-energize the relay. If S1 is off, the relay will return automatically to its initial state after a while, and LED D7 will also turn off. At this point you can adjust R18 to lengthen or shorten the time interval needed for the Flip-Flop to return to its stable state.