Contact us by email if you have any questions!

Analog and Digital Sense of Sensors – LM393 The Voltage Comparator

For sensors, there are normally two ways as output, the analog value or digital value output.

  • Analog value: Most sensors only provide the analog value, so it outputs a voltage value to indicate the sensing parameters. Arduino read this value on A0 to A9, and from 0 till 1023. In AVR, the analog voltage varies from 0V till 5V. We sign AO (Analog Output) as a pin name on many sensor boards
  • Digital Value: Sometimes we only want the sensors only give feedback when the sensing value read a threshold that we want, so when it reached the feedback is 1, and 0 vice verse.

Here the LM393 IC do the voltage comparing here, a reference voltage (UR) is set by the adjustable potentiometer, when the analog output value over this value, the LM393 will output a digital value to indicate this sensor is triggered by reaching this setup threshold.

So here we make a collection of these sensor breakout boards, so we can have a overview and have deep understanding on this LM393 IC about how it works.

(Click the link to see how the products look like, all of them are very similar)

  • Infrared Obstacle avoidance sensor: one infrared transmitter and one receiver, the receiver can detect the distance to the obstacles as a analog value and LM393 collect and compare this analog value and output digital value.
  • TCRT5000 Infrared sensor (not yet avaialble in our store): Same working principle as the infrared sensor above, but the transmitter and receiver is integrated. Performance is also better.
  • Microphone sensor: Sound is sensing by the microphone, and send to the LM393, the analog output is not supported for this one, but it still output the digital value to see if the sound is detected or not.
  • Photosensitive photocell sensor: Light intensity is sensed here by the photocell sensor, the sensor itself output the a analog value, and the LM393 IC here works same to generate a digital output.
  • Soil SensorThe sensor itself detects the moisture of the soil, LM393 works same in this case.
  • Water Drop sensorthe water drop sensor board itself detects how many water drop on the board, when a certain value comparing to the potentiometer is reached, then the LM393 will be trigger in the same way.

To see how to use LM393 IC, here is some schematics based on the sensors describe above, a lot of parts are the same, only a few parts changed around the sensor.

As you can see, the design is 99% same! A very classical design. Discard only LM393 draws differently but same functions.

Added a final schematic, a general schematic for LM393 that works for many sensors, the left and right part of the schematic mostly will be the same, only need to change the middle sensor part.

LM393 General Schematic


4 Replies to “Analog and Digital Sense of Sensors – LM393 The Voltage Comparator”

  1. Kevin says:

    Is there a buzzer that can be put on the digital output or a way to activate a buzzer from the DO?

  2. poulbran says:

    Nice Ic to simplify things

  3. jorge says:

    Infrared obstacle avoidance sensor use photodiode or phototransistor?


  4. Chao says:

    Hi. Both sensor photodiode or phototransistor can work with LM393, sensing from anglog to digital value.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.