Stufin
Home Quick Cart Profile

HC-89 Interrupt Sensor

Buy Now

Supply Voltage

3.3V to 5V

Operating Current

20mA

Detection Range

2-30 cm (0.7-11.8 inches)

Output Type

Digital (NH or NL)

Output Voltage

3.3V to 5V

Response Time

50ms

Dimension

20mm x 15mm x 10mm (0.79 inches x 0.59 inches x 0.39 inches)

Applications

  • Robotics and Automation
  • Security Systems
  • Home Automation
  • IoT Projects
  • Proximity Detection
  • Object Detection
  • Gesture Recognition

Pinout

The HC-89 Interrupt Sensor module typically has a 3-pin interface

VCC

Power supply (3.3V to 5V)

GND

Ground connection

OUT

Digital output signal (NH or NL)

Note

The exact pinout may vary depending on the specific module and manufacturer. Always check the datasheet or documentation provided with the module for specific information.

Pin Configuration

  • HC-89 Interrupt Sensor Documentation
  • The HC-89 Interrupt Sensor is a digital sensor module used to detect objects or obstacles. It operates on the principle of infrared reflection, where an infrared LED emits light, which is then reflected back to a photodiode when an object is present. The sensor module provides a digital output signal, making it easy to interface with microcontrollers and other digital systems.
  • Pin Description:
  • The HC-89 Interrupt Sensor module has a total of 3 pins, which are described below:
  • 1. VCC (Power Supply Pin)
  • Pin Type: Power Input
  • Voltage: 5V DC (Typical)
  • Current: 10mA (Maximum)
  • Function: Provides power to the sensor module.
  • Note: Ensure the power supply voltage is within the recommended range to ensure proper operation and prevent damage to the sensor module.
  • 2. GND (Ground Pin)
  • Pin Type: Ground
  • Function: Provides a ground reference for the sensor module.
  • Note: A stable ground connection is essential for proper operation and to prevent noise or interference.
  • 3. OUT (Digital Output Pin)
  • Pin Type: Digital Output
  • Logic Level: TTL (Transistor-Transistor Logic) compatible
  • Function: Provides a digital output signal (HIGH or LOW) indicating the presence or absence of an object.
  • Note: The output signal is active HIGH, meaning a HIGH output indicates an object is present, and a LOW output indicates no object is present.
  • Connection Structure:
  • To connect the HC-89 Interrupt Sensor module to your microcontroller or digital system, follow these steps:
  • Connect the VCC pin to a 5V power supply.
  • Connect the GND pin to a common ground (GND) on your microcontroller or digital system.
  • Connect the OUT pin to a digital input pin on your microcontroller or digital system.
  • Example Connection Diagram:
  • HC-89 Interrupt Sensor Microcontroller/Digital System
  • ---------------------- ---------------------------
  • VCC (Pin 1) 5V Power Supply
  • GND (Pin 2) GND (Common Ground)
  • OUT (Pin 3) Digital Input Pin (e.g., D2)
  • In this example, the HC-89 Interrupt Sensor module is connected to a microcontroller or digital system with a 5V power supply and a common ground. The digital output signal from the OUT pin is connected to a digital input pin (e.g., D2) on the microcontroller or digital system.
  • By following these connections and understanding the pin descriptions, you can effectively use the HC-89 Interrupt Sensor module in your IoT projects.

Code Examples

HC-89 Interrupt Sensor Documentation
Overview
The HC-89 Interrupt Sensor is a digital sensor module designed to detect objects or movements, commonly used in robotics, automation, and IoT projects. It features a built-in infrared transmitter and receiver, allowing it to detect objects within a specific range. The sensor operates on a 5V power supply and provides a digital output signal when an object is detected.
Pinouts
VCC: 5V Power Supply
 GND: Ground
 OUT: Digital Output Signal
Specifications
Operating Voltage: 5V
 Operating Current: 5mA
 Detection Range: 2-30cm
 Output Signal: Digital (High or Low)
Code Examples
### Example 1: Basic Object Detection using Arduino
In this example, we'll use the HC-89 Interrupt Sensor to detect objects using an Arduino board.
```cpp
const int sensorPin = 2; // Connect the OUT pin to digital pin 2 on your Arduino board
void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
}
void loop() {
  int sensorState = digitalRead(sensorPin);
  if (sensorState == HIGH) {
    Serial.println("Object detected!");
  } else {
    Serial.println("No object detected.");
  }
  delay(50);
}
```
### Example 2: Interrupt-based Object Detection using Raspberry Pi (Python)
In this example, we'll use the HC-89 Interrupt Sensor to detect objects using a Raspberry Pi and Python.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
sensor_pin = 17  # Connect the OUT pin to GPIO pin 17 on your Raspberry Pi
GPIO.setup(sensor_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def callback(channel):
    print("Object detected!")
GPIO.add_event_detect(sensor_pin, GPIO.FALLING, callback=callback, bouncetime=200)
while True:
    time.sleep(1)
```
In this example, we use the `RPi.GPIO` library to set up the GPIO pin as an input and define an interrupt callback function. When the sensor detects an object, the callback function is triggered, printing "Object detected!" to the console.
These examples demonstrate the basic usage of the HC-89 Interrupt Sensor in different contexts. You can modify and build upon these examples to suit your specific IoT project requirements.