Stufin
Home Quick Cart Profile

KY-010 Broken Light Blocking Sensor

Buy Now on Stufin

Supply Voltage

5V

Supply Current

5mA (typical)

Digital Output

0V (low) or 5V (high)

Response Time

1ms (typical)

Detection Distance

1-10mm (dependent on object size and shape)

Operating Temperature

-20C to 80C

Dimensions

24mm x 12mm x 10mm (L x W x H)

Weight

2g (approximate)

Applications

The KY-010 Broken Light Blocking Sensor is suitable for various IoT applications, including

Object detection and counting in production lines or automation systems

Obstacle detection in robotics and autonomous vehicles

Monitoring the position of moving parts in industrial machinery

Home automation projects, such as automating lighting or security systems

DIY projects, such as building a line follower robot or a smart door sensor

Overall, the KY-010 Broken Light Blocking Sensor is a versatile and reliable component for detecting objects or changes in light intensity, making it an essential component for various IoT applications.

Pin Configuration

  • KY-010 Broken Light Blocking Sensor Documentation
  • Pinout Explanation:
  • The KY-010 Broken Light Blocking Sensor is a digital sensor that detects the presence or absence of an object by blocking light. It has four pins, which are explained below:
  • Pin 1: VCC (Power Supply)
  • Function: Provides power to the sensor module
  • Voltage: Typically 5V, but can operate from 3.3V to 5V
  • Connection: Connect to the positive voltage supply of your microcontroller or power source
  • Pin 2: GND (Ground)
  • Function: Ground connection for the sensor module
  • Connection: Connect to the ground pin of your microcontroller or power source
  • Pin 3: OUT (Output)
  • Function: Digital output signal indicating the presence or absence of an object
  • Logic Level:
  • + High (H) or 1: Object is not blocking the light
  • + Low (L) or 0: Object is blocking the light
  • Connection: Connect to a digital input pin of your microcontroller to read the sensor output
  • Pin 4: No Connection
  • There is no internal connection on this pin. It is not used and should be left unconnected.
  • Connection Structure:
  • To connect the KY-010 Broken Light Blocking Sensor to your microcontroller or circuit, follow this structure:
  • VCC (Pin 1) 5V Power Supply (or 3.3V to 5V)
  • GND (Pin 2) Ground
  • OUT (Pin 3) Digital Input Pin of Microcontroller (e.g., Arduino Uno, Raspberry Pi, etc.)
  • Pin 4: Leave unconnected
  • Important Notes:
  • Make sure to use a stable power supply and a common ground connection between the sensor module and your microcontroller.
  • The OUT pin provides a digital signal, so it should be connected to a digital input pin on your microcontroller.
  • Avoid connecting the OUT pin to an analog input pin, as it may not provide accurate results.
  • By following this documentation, you can successfully connect and utilize the KY-010 Broken Light Blocking Sensor in your IoT projects.

Code Examples

KY-010 Broken Light Blocking Sensor Documentation
Overview
The KY-010 Broken Light Blocking Sensor is a digital sensor used to detect the presence or absence of an object by blocking light. It consists of a light source and a photodiode or phototransistor. When an object blocks the light, the sensor outputs a low signal, and when the light is not blocked, it outputs a high signal. This sensor is commonly used in robotics, automation, and IoT projects.
Pinout
The KY-010 Broken Light Blocking Sensor has three pins:
VCC: Power supply (3.3V to 5V)
 GND: Ground
 OUT: Digital output signal (high or low)
Code Examples
### Example 1: Basic Object Detection with Arduino
This example demonstrates how to use the KY-010 Broken Light Blocking Sensor with an Arduino board to detect the presence or absence of an object.
```cpp
const int sensorPin = 2;  // Pin connected to the OUT pin of the sensor
void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(9600);
}
void loop() {
  int sensorState = digitalRead(sensorPin);
  if (sensorState == LOW) {
    Serial.println("Object detected!");
  } else {
    Serial.println("No object detected.");
  }
  delay(500);
}
```
### Example 2: Object Counting with Raspberry Pi (Python)
This example demonstrates how to use the KY-010 Broken Light Blocking Sensor with a Raspberry Pi to count the number of objects that pass through the sensor.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Set up the sensor pin as an input
sensor_pin = 17
GPIO.setup(sensor_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
object_count = 0
while True:
    if GPIO.input(sensor_pin) == 0:
        object_count += 1
        print("Object detected! Count:", object_count)
    time.sleep(0.1)
```
### Example 3: Object Detection with ESP32 (MicroPython)
This example demonstrates how to use the KY-010 Broken Light Blocking Sensor with an ESP32 board running MicroPython to detect the presence or absence of an object.
```python
import machine
import utime
# Set up the sensor pin as an input
sensor_pin = machine.Pin(21, machine.Pin.IN)
while True:
    if sensor_pin.value() == 0:
        print("Object detected!")
    else:
        print("No object detected.")
    utime.sleep_ms(500)
```
In each example, the sensor's output signal is read and interpreted to determine the presence or absence of an object. The output signal is typically connected to a digital input pin on the microcontroller or single-board computer.