Electronic – arduino – How to easily convert an analog signal to a digital signal

analogarduinodigital-logic

I've tried searching for an answer on this topic but I must be phrasing it wrong because I can't find anything.

I have a voltage range of about a 1 volt. I want to pass it through an Op Amp (or something else) to convert it to a 0 V – 3.3 V signal to trip a digital interrupt pin. My friend told me about Rail to Rail op amps but I have a 741 I can use that I have in my kit right now.

Is there an easy way to use a 741 op amp to do this conversion? My VCC is 3V3 & my GND is 0 V and I would really like to avoid using a negative voltage in this circuit.

I know it must be possible because I have a light sensor breakout board that takes a 0 V – 3.3 V supply and outputs a digital 1 or 0.
http://www.dx.com/p/photoactivity-diode-light-sensor-detection-sensor-module-152611#.Vbet_6GlvVM

Is there a better way to do this? It must feed an interrupt pin so please don't suggest sending it to an ADC.

Thanks in advance!

Best Answer

If your MCU has an on-board comparator that can be configured to generate an interrupt, then you can simply use it. Many MCUs have such functionality.

Otherwise you can simply add an external comparator such as 1/2 an LM393 or a more modern part if you need very low power. You need a voltage divider to set the threshold- in your case you might use 1.20V (picked because it's exactly between the two levels you mention), so you could use a 1.2K resistor and a 2.1K resistor from the 3.3V supply. You also need a pullup resistor on the output, such as 4.7K. A bit of hysteresis could be added too, but that's outside the scope of this question.

A 741 won't work in this application- not enough supply voltage, and it can't work to near enough to the supply rails either. Well, if you wanted to give it +/-5V supplies and add a transistor after it to provide 3.3V logic levels you could force it to work (but it would work-to-rule, which is slowly)-- that's a bit silly.