Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes: Examples, Pinouts, and Specs

Image of LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil ProbesDesign with LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes in Cirkit Designer

Introduction

The LM393 is a dual comparator integrated circuit (IC) designed to compare two input voltages and output a digital signal based on the comparison. It features two independent voltage comparators in a single package, making it a versatile and cost-effective solution for a wide range of applications. The LM393 operates with a wide range of supply voltages and is known for its low power consumption.

Explore Projects Built with LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino Mega 2560-Based Smart Soil Monitoring System with Bluetooth Connectivity: A project utilizing LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes in a practical application
Arduino Mega 2560-Based Smart Soil Monitoring System with Bluetooth Connectivity

This circuit is designed for soil monitoring and communication, featuring an Arduino Mega 2560 microcontroller interfaced with an NPK soil sensor, a SparkFun soil moisture sensor, an LM393 comparator, an RS485 communication module, and an HC-05 Bluetooth module. The Arduino collects data from the soil sensors and can transmit this data wirelessly via Bluetooth or through RS485 for remote monitoring.

Open Project in Cirkit Designer
Image of ESP32-Based Landslide Monitoring System with SMS Alerts: A project utilizing LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes in a practical application
ESP32-Based Landslide Monitoring System with SMS Alerts

This circuit is designed as a landslide monitoring system that measures soil moisture, temperature, humidity, and pressure. It uses an ESP32 microcontroller to read data from soil moisture sensors, a DHT11 temperature and humidity sensor, and a HX711 load cell interface with a connected load cell for pressure measurement. The system can trigger alerts through LEDs and a buzzer, and it communicates via a SIM800L module to send SMS alerts based on the sensor thresholds.

Open Project in Cirkit Designer
Image of Arduino UNO Based Soil Moisture Monitoring and Water Pump Control System: A project utilizing LM393 Comparator Module (CK-07 / YL-38) for Rain and Soil Probes in a practical application
Arduino UNO Based Soil Moisture Monitoring and Water Pump Control System

This circuit is designed for soil moisture sensing and automated water pumping. An Arduino UNO reads moisture levels from a YL-69 soil moisture sensor through a YL-83 LM393 comparator module and controls a water pump via a KY-019 relay module based on the moisture data. The system's status is displayed on an I2C LCD screen, and a 9V battery powers the pump, with the Arduino and other modules receiving power from the Arduino's onboard voltage regulator.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

The LM393 is a robust and reliable IC with the following key technical specifications:

Parameter Value
Supply Voltage (Vcc) 2V to 36V
Input Offset Voltage ±5 mV (typical)
Input Bias Current 25 nA (typical)
Output Sink Current 6 mA (typical)
Response Time 1.3 µs (for 5 mV input step)
Operating Temperature Range -40°C to +85°C
Package Types DIP-8, SOIC-8, TSSOP-8

Pin Configuration and Descriptions

The LM393 is typically available in an 8-pin package. Below is the pin configuration and description:

Pin Number Pin Name Description
1 Output 1 Output of comparator 1
2 Inverting Input 1 (-) Inverting input of comparator 1
3 Non-Inverting Input 1 (+) Non-inverting input of comparator 1
4 GND Ground (0V reference)
5 Non-Inverting Input 2 (+) Non-inverting input of comparator 2
6 Inverting Input 2 (-) Inverting input of comparator 2
7 Output 2 Output of comparator 2
8 Vcc Positive power supply (2V to 36V)

Usage Instructions

The LM393 is straightforward to use in a variety of circuits. Below are the steps and considerations for using the component effectively:

Basic Circuit Setup

  1. Power Supply: Connect the Vcc pin (Pin 8) to a positive voltage source (2V to 36V) and the GND pin (Pin 4) to ground.
  2. Inputs: Connect the voltage signals to the inverting (-) and non-inverting (+) input pins of the comparator.
  3. Output: The output pin will provide a digital signal (low or high) based on the comparison of the input voltages:
    • If the voltage at the non-inverting input (+) is greater than the inverting input (-), the output will be low (close to GND).
    • If the voltage at the inverting input (-) is greater than the non-inverting input (+), the output will be high (open-collector output).

Important Considerations

Example: Using LM393 with Arduino UNO

The LM393 can be used with an Arduino UNO for voltage level detection. Below is an example circuit and code:

Circuit Description

Arduino Code

// LM393 Comparator Example with Arduino UNO
// This code reads the output of the LM393 and turns on an LED if the input
// voltage exceeds the reference voltage.

const int comparatorOutputPin = 2; // LM393 output connected to digital pin 2
const int ledPin = 13;             // Onboard LED pin

void setup() {
  pinMode(comparatorOutputPin, INPUT); // Set comparator output as input
  pinMode(ledPin, OUTPUT);            // Set LED pin as output
}

void loop() {
  int comparatorState = digitalRead(comparatorOutputPin); // Read LM393 output

  if (comparatorState == HIGH) {
    digitalWrite(ledPin, HIGH); // Turn on LED if input voltage is higher
  } else {
    digitalWrite(ledPin, LOW);  // Turn off LED otherwise
  }
}

Best Practices

Troubleshooting and FAQs

Common Issues

  1. No Output Signal:

    • Ensure the pull-up resistor is connected to the output pin.
    • Verify that the input voltages are within the specified range.
  2. Unstable Output:

    • Add a small capacitor (e.g., 10 pF) between the input pins to filter noise.
    • Check for proper decoupling of the power supply.
  3. Incorrect Comparisons:

    • Verify the polarity of the input connections.
    • Ensure the reference voltage is stable and accurate.

FAQs

Q: Can the LM393 be used for AC signal comparison?
A: Yes, the LM393 can compare AC signals, but you may need to bias the inputs to ensure they remain within the common-mode voltage range.

Q: What is the purpose of the pull-up resistor?
A: The pull-up resistor ensures that the open-collector output of the LM393 can produce a valid high-level signal when the output transistor is off.

Q: Can I use the LM393 with a 3.3V power supply?
A: Yes, the LM393 operates with supply voltages as low as 2V, making it compatible with 3.3V systems.

By following this documentation, you can effectively integrate the LM393 into your projects and troubleshoot any issues that arise.