Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use CNY70: Examples, Pinouts, and Specs

Image of CNY70
Cirkit Designer LogoDesign with CNY70 in Cirkit Designer

Introduction

The CNY70 is an optoisolator that integrates an infrared LED and a phototransistor within a single compact package. This component is designed to provide electrical isolation between different sections of a circuit while enabling signal transmission. The CNY70 is widely used in applications such as object detection, line-following robots, and signal isolation in industrial systems. Its ability to detect reflected infrared light makes it particularly useful in proximity sensing and reflective optical systems.

Explore Projects Built with CNY70

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Emergency Alert System with NUCLEO-F072RB, SIM800L, and GPS NEO 6M
Image of women safety: A project utilizing CNY70 in a practical application
This circuit is an emergency alert system that uses a NUCLEO-F072RB microcontroller to send SMS alerts and make calls via a SIM800L GSM module, while obtaining location data from a GPS NEO 6M module. The system is powered by a Li-ion battery and includes a TP4056 module for battery charging and protection, with a rocker switch to control power to the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Cellular-Enabled IoT Device with Real-Time Clock and Power Management
Image of LRCM PHASE 2 BASIC: A project utilizing CNY70 in a practical application
This circuit features a LilyGo-SIM7000G module for cellular communication and GPS functionality, interfaced with an RTC DS3231 for real-time clock capabilities. It includes voltage sensing through two voltage sensor modules, and uses an 8-channel opto-coupler for isolating different parts of the circuit. Power management is handled by a buck converter connected to a DC power source and batteries, with a fuse for protection and a rocker switch for on/off control. Additionally, there's an LED for indication purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered ESP32-C3 Interactive Control Panel
Image of GTV-Transmitter Advanced: A project utilizing CNY70 in a practical application
This circuit features an ESP32-C3 microcontroller connected to various input devices and an OLED display. The input devices include two KY-023 Dual Axis Joystick Modules for directional input and a Rotary Encoder for incremental input, both interfaced with the ESP32-C3's GPIO pins. The circuit also includes a power management system with a Polymer Lithium Ion Battery, a JST connector, and a toggle switch to control power to an LED indicator.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Real-Time Clock with I2C LCD Display and IO Expansion
Image of teste: A project utilizing CNY70 in a practical application
This circuit is an Arduino-based real-time clock and display system. It uses an Arduino UNO to interface with a DS1307 RTC module for timekeeping and a 20x4 I2C LCD to display the current time and date. Additionally, a PCF8574 IO Expansion Board is used to extend the I2C bus for additional I/O operations.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with CNY70

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 women safety: A project utilizing CNY70 in a practical application
Battery-Powered Emergency Alert System with NUCLEO-F072RB, SIM800L, and GPS NEO 6M
This circuit is an emergency alert system that uses a NUCLEO-F072RB microcontroller to send SMS alerts and make calls via a SIM800L GSM module, while obtaining location data from a GPS NEO 6M module. The system is powered by a Li-ion battery and includes a TP4056 module for battery charging and protection, with a rocker switch to control power to the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of LRCM PHASE 2 BASIC: A project utilizing CNY70 in a practical application
Cellular-Enabled IoT Device with Real-Time Clock and Power Management
This circuit features a LilyGo-SIM7000G module for cellular communication and GPS functionality, interfaced with an RTC DS3231 for real-time clock capabilities. It includes voltage sensing through two voltage sensor modules, and uses an 8-channel opto-coupler for isolating different parts of the circuit. Power management is handled by a buck converter connected to a DC power source and batteries, with a fuse for protection and a rocker switch for on/off control. Additionally, there's an LED for indication purposes.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of GTV-Transmitter Advanced: A project utilizing CNY70 in a practical application
Battery-Powered ESP32-C3 Interactive Control Panel
This circuit features an ESP32-C3 microcontroller connected to various input devices and an OLED display. The input devices include two KY-023 Dual Axis Joystick Modules for directional input and a Rotary Encoder for incremental input, both interfaced with the ESP32-C3's GPIO pins. The circuit also includes a power management system with a Polymer Lithium Ion Battery, a JST connector, and a toggle switch to control power to an LED indicator.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of teste: A project utilizing CNY70 in a practical application
Arduino UNO-Based Real-Time Clock with I2C LCD Display and IO Expansion
This circuit is an Arduino-based real-time clock and display system. It uses an Arduino UNO to interface with a DS1307 RTC module for timekeeping and a 20x4 I2C LCD to display the current time and date. Additionally, a PCF8574 IO Expansion Board is used to extend the I2C bus for additional I/O operations.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

The following table outlines the key technical details of the CNY70:

Parameter Value
Forward Voltage (LED) 1.2 V to 1.5 V
Forward Current (LED) 50 mA (max)
Collector-Emitter Voltage 32 V (max)
Emitter-Collector Voltage 5 V (max)
Collector Current 50 mA (max)
Spectral Peak Wavelength 950 nm
Operating Temperature Range -40°C to +85°C
Package Type 4-pin through-hole

Pin Configuration and Descriptions

The CNY70 has four pins, as described in the table below:

Pin Number Name Description
1 LED Anode Positive terminal of the infrared LED. Connect to a current-limiting resistor.
2 LED Cathode Negative terminal of the infrared LED. Connect to ground.
3 Phototransistor Collector Output terminal of the phototransistor. Connect to the load or pull-up resistor.
4 Phototransistor Emitter Ground terminal of the phototransistor.

Usage Instructions

How to Use the CNY70 in a Circuit

  1. Connect the LED Side:

    • Attach a current-limiting resistor (typically 220 Ω to 1 kΩ) in series with the LED anode (Pin 1).
    • Connect the cathode (Pin 2) to the ground of the circuit.
  2. Connect the Phototransistor Side:

    • Connect the collector (Pin 3) to the positive voltage supply (e.g., 5 V) through a pull-up resistor (e.g., 10 kΩ).
    • Connect the emitter (Pin 4) to the ground.
  3. Positioning for Reflective Sensing:

    • Place the CNY70 so that the reflective surface is within 0.3 to 1 cm of the sensor.
    • Ensure the reflective surface is perpendicular to the sensor for optimal performance.
  4. Read the Output:

    • When the infrared light emitted by the LED reflects off a surface and is detected by the phototransistor, the output voltage at the collector will change. This change can be read by a microcontroller or other circuitry.

Important Considerations and Best Practices

  • Current Limiting: Always use a resistor in series with the LED to prevent damage due to excessive current.
  • Ambient Light: Minimize ambient light interference by shielding the sensor or using it in controlled lighting conditions.
  • Reflective Surface: The sensor works best with highly reflective surfaces (e.g., white or shiny materials).
  • Distance Sensitivity: The CNY70 is most effective at short distances (0.3 to 1 cm). Beyond this range, the reflected signal weakens significantly.

Example: Using the CNY70 with an Arduino UNO

The following example demonstrates how to use the CNY70 to detect a reflective surface with an Arduino UNO:

// Define the pin connections
const int sensorPin = A0; // Connect the phototransistor collector to analog pin A0
const int ledPin = 9;     // Connect the LED anode to digital pin 9 (via a resistor)

// Setup function
void setup() {
  pinMode(ledPin, OUTPUT); // Set the LED pin as output
  pinMode(sensorPin, INPUT); // Set the sensor pin as input
  Serial.begin(9600); // Initialize serial communication for debugging
}

// Main loop
void loop() {
  digitalWrite(ledPin, HIGH); // Turn on the infrared LED
  delay(10); // Allow the LED to stabilize

  int sensorValue = analogRead(sensorPin); // Read the sensor value
  Serial.print("Sensor Value: "); // Print the sensor value to the serial monitor
  Serial.println(sensorValue);

  digitalWrite(ledPin, LOW); // Turn off the infrared LED to save power
  delay(100); // Wait before the next reading
}

Notes on the Code

  • The sensorPin reads the voltage from the phototransistor's collector. A higher value indicates more reflected light.
  • The ledPin controls the infrared LED, which can be turned on and off as needed.
  • Use the serial monitor to observe the sensor's output and adjust the positioning of the CNY70 for optimal performance.

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Cause: Incorrect wiring or missing pull-up resistor.
    • Solution: Double-check the connections and ensure a pull-up resistor is connected to the phototransistor's collector.
  2. Weak or Inconsistent Signal:

    • Cause: Reflective surface is too far or not aligned properly.
    • Solution: Adjust the distance and alignment of the reflective surface. Ensure the surface is within 0.3 to 1 cm of the sensor.
  3. Interference from Ambient Light:

    • Cause: Strong ambient light affecting the phototransistor.
    • Solution: Shield the sensor from ambient light or use it in a controlled environment.
  4. Overheating LED:

    • Cause: Excessive current through the LED.
    • Solution: Use an appropriate current-limiting resistor (e.g., 220 Ω to 1 kΩ).

FAQs

Q1: Can the CNY70 detect black surfaces?
A1: Black surfaces absorb infrared light and reflect very little, making detection difficult. Use highly reflective surfaces for best results.

Q2: What is the maximum detection range of the CNY70?
A2: The CNY70 is most effective at distances between 0.3 and 1 cm. Beyond this range, the reflected signal diminishes significantly.

Q3: Can the CNY70 be used for high-speed applications?
A3: Yes, the CNY70 can respond quickly to changes in reflected light, making it suitable for high-speed applications like rotary encoders.

Q4: Is the CNY70 suitable for outdoor use?
A4: The CNY70 is not designed for outdoor use as it is sensitive to ambient light and environmental conditions. Use it in controlled environments for optimal performance.