I'm working on a project where I want to monitor 40 phototransistors (IR breaker beams), but without having to constantly poll the ADCs. Ideally I'd want a digital pin pulled when one of the beams is broken and then I'll poll the ADC(s) to find out exactly which one it was. I'll also need to be able to detect a change on each input regardless of the state of the others.

I see there are ADCs with programmable GPIOs and dedicated alert pin(s). I'm just a beginner, and I find - particularly with the programmable GPIO varieties - the datasheets confusing and I doubt I have the experience to successfully make use of those.

Then the variety with dedicated alert pins seem to be easier to program but don't seem to come any larger than 8-channel. Fewest parts please, particularly since the incredibly small IC packages will likely be hand-soldered. AD7997 is currently the chip I'm considering, but would require 5 TSSOP footprints. I would probably AND the alert pins together to the host.

Are there any other ways to do this? Thanks for your input.

More project details: Beaglebone black, Node.js/bonescript, Phototransistor is the LTR-301.


Breaker beams will be broken or unbroken for large amounts of time.

  • \$\begingroup\$ What is the reason for using ADCs? Digital inputs would make more sense! \$\endgroup\$ Sep 12, 2014 at 15:46
  • \$\begingroup\$ Is this a safety thing (eg. punch press guard) or security thing? \$\endgroup\$ Sep 12, 2014 at 15:58
  • \$\begingroup\$ I like the digital idea. Could you do something 'primitve' like the old DTL Nand gate. Signal changes when on of the diode inputs is pulled low. en.wikipedia.org/wiki/Diode%E2%80%93transistor_logic \$\endgroup\$ Sep 12, 2014 at 16:17
  • \$\begingroup\$ @LeonHeller I was under the impression that photo transistors would not produce enough of an edge for digital input interrupts? I haven't tried it, though. Will try collector to digital input and see if it works. \$\endgroup\$ Sep 12, 2014 at 17:21
  • \$\begingroup\$ @SpehroPefhany Security \$\endgroup\$ Sep 12, 2014 at 17:22

1 Answer 1


If you have 40 inputs that are normally at zero and you want to know if one of those signals has gone high you can use logic gates to detect this or if you want, you can use diode orring to give you one signal that tells your one of the inputs has risen high.

The same can be done if the inputs are normally high and one goes to 0V, It's fairly trivial with real voltage signals but a little more care has to be taken when the signals are from an open-collector as per a photo transistor - you've got to make sure the loading of the diodes/logic isn't too great to cause the signal problems.

By the way - using diodes means that the inputs remain independant and still individually readable should you choose to do so.

  • \$\begingroup\$ I'm not sure I could guarantee the inputs would be high or low, so any logic-level is probably out. Diode oring: after the first event I would be blind any any subsequent events. I should have specified that the beams are usually broken or unbroken for long periods of time. \$\endgroup\$ Sep 12, 2014 at 17:12
  • \$\begingroup\$ OK but maybe make your question clearer - not mentioning logic level inconsistencies and that you need to be able to detect a change on any input no matter what the state of the other inputs are at is a big deal. If you could define logic levels a tad better then using exclusive or gates will do what you want. \$\endgroup\$
    – Andy aka
    Sep 12, 2014 at 17:24
  • \$\begingroup\$ Sorry, still learning. I understand the significance now, and have basic understanding of logic circuits. I think I'm hitting a wall with how that can apply to this, an IR phototransistor. Stray and ambient IR would make it difficult for the IR phototransistor to have a well-defined high or low output, wouldn't it? For a 5V system, if it isn't exactly 0V or 5V, it's floating? \$\endgroup\$ Sep 12, 2014 at 19:48
  • \$\begingroup\$ Do you have a device in mind? \$\endgroup\$
    – Andy aka
    Sep 12, 2014 at 20:50
  • \$\begingroup\$ I'm currently using an LTR-301. You and @LeonHeller put me on a good track, though. ADC is definitely out since I don't need precise values. Following this RPi thread on phototransistor as a pull-down: raspberrypi.org/forums/… \$\endgroup\$ Sep 13, 2014 at 2:42

Your Answer

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

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