1
\$\begingroup\$

I'm not really an electronics guy, I'll cobble together a circuit here and there every couple of years.

I need to take an IR beam break and use it to toggle an LED (on when the beam is broken, off otherwise).

I've done similar things before, using a microprocessor to sample the sensor diode. Because I need this to be battery driven and light, I decided to go with a seemingly simpler solution, using an op-amp comparator. Initially, I was quite pleased with the results of the comparator, as seen on an oscilloscope. While I had to fiddle with the microprocessor to get it to detect changes in the beambreak, this was quite clear with a nice 2V signal.

It seems the op-amp can't drive the LED directly, so I added a MOSFET.

Then the op-amp couldn't drive the gate of the MOSFET (it's what I had laying around, I've ordered some with lower Vgs requirements). I don't know where I got the idea to try a pull-up resistor, but that's not helping.

The resistors are ones I happened to have around with the prototyping breadboard and weren't chosen for any particular reason. The LED/photodiode model numbers are things I would have to track down, they are all IR (two different types of emitters).

I think I'm not far off from making this work, but I could use a little advice. I've tried a handful of minor variations of this, and tried running it through some simulators, with no luck. The diagram represents the circuit at the current moment.

I want to keep power draw on the battery as low as possible, but we are willing to change them regularly if necessary. The battery needs to power both sides of the beam break, any electronics to process the signal, and the output LED.

Thanks. Beambreak to LED circuit.

\$\endgroup\$
9
  • \$\begingroup\$ A coin cell like that is a terrible choice! A couple of D cells would be much more cost-efficient, or go down to 2 AAAs if you're pushed for space. \$\endgroup\$
    – Finbarr
    May 16 at 23:33
  • \$\begingroup\$ And the LM324 is also a pretty poor choice. A dedicated comparator like the TL331 would be better in every respect - it'll run down to 2V and has an open collector output that can drive the LED directly. \$\endgroup\$
    – Finbarr
    May 17 at 0:01
  • \$\begingroup\$ Thanks. I'll look at the TL331. As for the coin cell, the whole thing has to be well below 30g and no more than 2cm high (preferably less for both). \$\endgroup\$ May 17 at 1:36
  • \$\begingroup\$ I looked at a few suppliers, but I don't see any TL331 parts that are through-hole mounted. That would be far more convenient to work with - both for breadboard testing and final implementation on a generic, little PCB (perhaps flexible), that's not custom printed. I will dig around some more, if nobody has any suggestions. \$\endgroup\$ May 17 at 1:43
  • \$\begingroup\$ AA cells are something like 16mm diameter - less than 2cm. you'll only get a few hours of run time from a CR2032, \$\endgroup\$ May 17 at 2:43

2 Answers 2

1
\$\begingroup\$

If R5 is meant to be a sensitivity adjustment, to set the brightness level at which the output changes state, it is not connected correctly. Connect the bottom of the pot directly to GND, and the wiper to the opamp's non-inverting (-) input.

Running an LM324 on only 3 V means that there is a very small output voltage range. Change the transistor (relabeled Q1) to an NPN bipolar type such as a 2N4401, 2N3904, 2N2222, or PN2222. With this change, you can eliminate R4 and the switch.

R2 might be too small in value, requiring too much current from the photodiode. for the photodiode. Measure the voltage at the D2 cathode (bottom of the diode as shown) in both the on and off states. The voltage in the ON state must be within the input common mode voltage range of the LM324 input stage. The 324 is not fully characterized for 3 V operation in the datasheet. Using the 5 V numbers, your input must be below 1.5 V.

Subtract the ON and OFF state voltages and find the value in the middle. That is the voltage the R5 wiper should be adjusted to.

250 ohms is not a standard value, so I'm wondering what you are using.

UPDATE:

R5 can be replaced by 2 fixed resistors, but only if the ON and OFF voltages across R2 are stable and predictable. For a one-off home project, why bother? For a production design, you need to know a lot more about D1, D2, and the physical conditions around the beam.

BTW - Are D1 and D2 working with a reflector, or is D1 located off in the distance, connected to V1 with two wires? Or is D1 actually powered separately?

The current through D3 is only 4 mA, which the LM324 can supply directly, especially when the output is saturated low. To do this, swap the OA2 + and - inputs so the output goes low when the beam is broken, eliminate Q1, and connect R3 to the OA1 output.

You don't say if you are using the rest of the LM324 for other functions. If you want to use a real comparator, the LM393 is a dual comparator based on the 324 internal design.

\$\endgroup\$
6
  • \$\begingroup\$ Yes, R5 is for that purpose and is connected correctly on the breadboard, but the schematic software didn't cooperate. \$\endgroup\$ May 16 at 23:05
  • \$\begingroup\$ Yes, R5 is for that purpose and is connected correctly on the breadboard, but the schematic software didn't cooperate. There is no actual switch 2, that's just for the diagram, as I have been connecting/disconnecting the resistor. I have ordered some other transistors (ALD1116PAL, etc). The resistors are all in the low hundreds of ohms currently. I am not at the lab, so I can't check them at the moment. I'm open to other suggested values. Should I be using a different op-amp? I switched to the LM324 because it was supposed to be better suited as a comparator. \$\endgroup\$ May 16 at 23:14
  • \$\begingroup\$ Am I better off with a fixed resistor at R5 instead of a pot? I initially went with a pot because I remembered having to tune the trip point for the microprocessor quite a bit previously. \$\endgroup\$ May 16 at 23:27
  • \$\begingroup\$ D1 and D2 are connected as shown, separated by about 1cm. They are both separated from the "board" by wires. I think D3 needs more current than that, but would have to double check. D3 is used to communicate back to the rest of the system from the air bearing on which all of this will live. I'm not using the LM324 for anything else. We had considered using it to run 2 detector systems, but decided against that as they are physically separate and running wiring across to the more remote sensor could bias the experiment. \$\endgroup\$ May 17 at 18:55
  • \$\begingroup\$ Actually, on second thought, we did discuss the possibility of using the LM324 to make a battery tester too. I haven't looked into the details of doing this, so I'm not sure how feasible it would be, given our constraints. \$\endgroup\$ May 17 at 19:04
1
\$\begingroup\$

Use a 555 instead - yes I know you don't need a timer, but expand your mind a bit ... ;)

The humble 555 has a set of building blocks inside which you can use to your advantage here.
It has 2 comparators and a RS latch which you can use to give a nice sharp output with lots of hysteresis (so no noise as your sensor input crosses the trigger threshold), and it has a decent open-collector (or open-drain for the CMOS versions) which can easily drive an LED.

schematic

simulate this circuit – Schematic created using CircuitLab

Choose a CMOS 555 for lower power consumption from your coin cell (although the power consumed by the LEDs will far exceed the 555 anyway).

\$\endgroup\$
1
  • \$\begingroup\$ This is interesting. I definitely hadn't considered a 555. I likely won't go this route, given that I've ordered parts for and prototyped the comparator solution. But, I'll have to keep this in mind for the future. Good to know. Thanks. \$\endgroup\$ May 17 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.