# IR Emitter/Detector with 555 timer alarm

I have this circuit that detects when a tube is empty and pulses a piezo buzzer in .5 second intervals. I have it working with 5v on a breadboard, but I need to move it to 12v from a wall wart.

Firstly, is there anything particularly wrong with the circuit?

Secondly, with 12v R1 should be 220 1W, but I want to stick with 1/4W resistors, maybe 510. Is that possible? I realize that will bring down the 50ma current to QEE113 to 22mA, but my distance is only 1" so I think it will be enough power.

Edit: I changed R1 to 150 which should confirm that it will work with about 22mA

Thridly, I'm not sure how to calculate the size of resistors needed to go to the transistors. The values I have are from various samples I found on the net for 5v. Is there a formula that tells me what they need to be for 12v. I'm not able figure that out from the datasheets.

Q2 should actually be a 2N2907.

simulate this circuit – Schematic created using CircuitLab

• Why not use a 5V regulator? Commented Jun 30, 2013 at 19:43
• Didn't want to add a 5v regulator if I don't have to. Commented Jun 30, 2013 at 19:49
• In the original circuit above the 555 is missing its GND connection. The chip will not work well without a GND connection. Also missing is a VCC to GND bypass capacitor on the 555 chip. (BTW JIm Dearden corrected the missing GND connection in his posting). Commented Jun 30, 2013 at 22:36
• 5 Volt USB wall-warts (mobile phone chargers) are ubiquitous, tiny and inexpensive. Also, they are typically switching regulators, hence little heat generation, and high efficiency. That is an option to consider, and no additional 5 Volt regulator will be needed. Commented Jul 1, 2013 at 9:48
• This will be just one part of the circuit, I'm planning. The end goal will also have a couple 12v motors. Commented Jul 1, 2013 at 21:44

R5 will definitely need to increase to keep the LED (D2) from having too much current. You can probably make this a 680ohm. The QSE113 photodiode will still largely produce the same current into the base of Q1 for the same light so no change envisaged at this point. I think I'd be tempted to add a resistor from Q2 base up to the positive supply rail - make it a 10k but be prepared to increase it should sensitivity be a little too low.

I don't particularly favour where R6 is at the moment - instead of it going to the positive rail, try conecting that leg to Vcc on the 555 and checking things still work OK at 5V, then it should be OK at 12V. Where it was connected and with Q2 switched off (Dark) the 555 would be unpowered except for the R6 connection and this might do some damage in the long run.

Make sure you have a 555 that is suitable for 12V and you should be OK.

• I like R6 to the 555 Vcc and it worked. 10k to Q2 did not work. I kept trying various resistors and the largest one that would work is 330, 470 would light the led but only beep the piezo once. Commented Jul 1, 2013 at 3:34
• @getSurreal OK, just to confirm, the added (10k) resistor to Q2's base up to the positive rail didn't work and you found that a smaller version (i.e. 330ohm) worked? Did you change R5 to 680R? Commented Jul 1, 2013 at 7:03
• So your suggestion of 10k to Q2 is based on 12v? I haven't moved this to 12v yet, so R5 is still 330. 330 to Q2 was with 5v. Commented Jul 1, 2013 at 21:48

There are one or two things that could be improved.

(1) I'm sure its just a slip but in the circuit diagram you show an 8 ohm speaker instead of a piezo buzzer - that would make a huge difference to current output from the 555.

(2) using a transistor to switch the 555 on an off is OK (it works) but it does mean that all the current for the 555 goes through then transistor which might get a bit warm. I've shown an alternative to this. Q2 (NPN) acts as a short circuit switch across the capacitor stopping the oscillation. I've also shifted the LED to the output of the 555 so it will now flash rather than just come on. With the capacitor shorted the output of the 555 will be HIGH so by placing the LED and buzzer between the +12V and output pin they will not be ON until Q2 is turned OFF. (Output acts as a current SINK)

(3) I've recalculated the value for R1 for a 12V supply (about 22mA). The 470 ohm resistor (nearest preferred value - npv) takes just under the 0.25 watts (P= I^2*R) but you could use a 1k0 and 910R resistor (both 0.25W) in parallel to create a 470 ohm 0.5W resistor.

(4) I've added an extra resistor in series with the base of Q1 so that the voltage across R3 is not clamped to 0.6V by the base-emitter junction. Assuming the gain of the 2n2222 is about 100 then Q1 requires a base current of about 10 microamps (0.010mA) to turn it ON. This current produces a 1V drop across R8 (100k). This means this transistor will turn ON when the voltage across R3 reaches or exceeds 1.6 volts (1v + 0.6Vbe) - It will reach this voltage when a current of (1.6/R3) = 0.16mA flows through the IR phototransistor. Increasing the value of R3 will reduce the current needed to reach the critical value of 1.6 volts to turn Q1 ON.

(Values are calculated using Ohm's law (V=IR))

The datasheet for the QSE113 gives a maximum collector current of about 1mA when it is turned on. The total resistance in series with it is 10K + 100R + the resistance of the sensor. The 10K by itself limits the current to 1.2mA (12/10000) - as Andy said a higher value may be needed for R3 to give more sensitivity.

The value of R4 limits the collector current of Q1 to 1.2mA (same calculation). It also limits the base current of Q2 to about the same value when Q1 is turned OFF (no base current through detector)

How it works

When the detector receives IR light a small current will flow into the base of Q1 and turns it ON. The voltage across Q1 (collector - emitter) falls to below 0.6V and so Q2 is turned OFF. This allows the 10uF capacitor to be charged and discharged by the 555 circuit. The LED flashes ON and OFF and the piezo buzzer beeps at a rate of about 3 times per second (set by the values of 10uF, 1k and 22k).

• I really appreciate your detail recommendations, I'm still working on making sense of it all. The short circuit switch is a new concept to me. I like the idea of turning off the power to the 555, because I will need to be able to apply this same concept to a motor. I'll have another pair of emitter/detector LEDs that will turn on/off a motor to refill the tube. I recognize I will need different transistors or mosfets to handle to load of the motors, but I hoped to keep the circuit design similar. Commented Jul 1, 2013 at 21:59