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 Sensor: The sensor itself detects the moisture of the soil, LM393 works same in this case.

Water Drop sensor: the 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.

Infrared obstacle avoidance sensor, also only a few pull-up sensor

Fully same design to Photocell sensor

TCRT5000, Only need two pull-up sensor and bypass cap C1

Photocell sensor, except a pull-up resistor, no any extra parts needed for the sensor

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.

About Us

Electrogragon offers millions of electronic prototyping components online!
Most of our products comes directly from our factory suppliers with a decent price, and we deliver it to you worldwide with quickest shipping and all the following technical supports you need.

Payment Solutions

Product Reviews

Chao { Have to google, http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/ This is a library for it, power down to low power... } – Mar 14

sagram { some more tweak .based on https://github.com/dragino/Arduino-Profile-Examples/blob/master/libraries/Dragino/examples/LoRa/LoRa_Mini_Low_Power/LoRa_Mini_Low_Power.ino low power now is 22uA } – Mar 14

sagram { Excellent. only i have question how to put this into low power mode, I have... } – Mar 14