Home > Optoelectronic Circuits >Photoelectric Alarm Circuits > Experiment on realizing photoelectric alarm using photosensitive devices

Experiment on realizing photoelectric alarm using photosensitive devices

Source: InternetPublisher:ohahaha Keywords: Photoelectric alarm Updated: 2024/10/10

Common photosensitive devices include photoresistors, photodiodes, phototransistors, optocouplers, etc. Photodiodes and phototransistors are used in this experiment. Both photodiodes and phototransistors are components with two pins. Phototransistors do not have base leads, and their appearance is similar to that of LEDs. Photodiodes are divided into transmitting tubes and receiving tubes; phototransistors are generally used for receiving, but their receiving sensitivity is much higher than that of photodiodes.

There are many types of photoelectric tubes on the market, many of which are sold in pairs. The transmitting tube and receiving tube of the pair work in the same light wave band, and the receiving tube is only sensitive to the light waves emitted by the transmitting tube. In this experiment, we choose a pair of tubes that work in the "invisible light" band. In addition to avoiding interference from lights and sunlight, intruders cannot see the detection beam even in the dark, which has a strong concealment.

The circuit is shown in the figure below. The left half of the circuit is the transmitting tube circuit. The power supply is connected to the transmitting photodiode IR-D1 through the current limiting resistor R1. The current passes through the photodiode to the ground wire, and the photodiode emits a light beam. We install this part of the circuit on a wall in the corridor; the right half of the circuit is the receiving tube circuit. PT1 is a phototransistor. The function of the transistor Q1 is to increase the sensitivity of the phototransistor receiving. UIA is a Schmidt inverter, which is used to shape the level of point A to ensure that the level sent to the P3.2 port of the microcontroller can only be OV or +5V. We install the receiving tube circuit on the wall opposite the transmitting circuit and adjust the position of the phototransistor so that it is directly opposite the position of the transmitting photodiode.

用光敏器件实现光电报警的实验

When no one passes by, the light emitted by the photodiode IR-D1 shines on the phototransistor PT1, and the light-induced current is directly fed into the base of PT1. When the emitter and collector of PT1 are turned on, Q1 is turned on. At this time, point A is a low level OV, and P3.2 is a high level +5V:

If someone walks by, the light emitted by the photodiode IR-D1 is blocked and cannot illuminate the phototransistor PT1. Because PT1 is only sensitive to the light emitted by IR-D1, no current flows into the base of PT1, and the emitter and collector of PT1 are cut off, causing Q1 to be cut off. At this time, point A is a high level of +5V, and P3.2 becomes a low level of OV.

It can be seen that when no one is walking by, P3.2 is high level +5V, and when someone is walking by, P3.2 will become low level OV. Simply put, when the microcontroller P3.2 port becomes low level OV, it means that someone has walked through this corridor.

In the reed switch program, it is introduced that P3.2 is the port of the microcontroller's external interrupt 0. When the level of P3.2 changes from high to low (falling edge jump), an interrupt will be triggered, and the program will automatically transfer to the service program of external interrupt 0. In this experiment, when someone walks by, the level of the P3.2 port will change from high to low, thereby triggering an interrupt. We can put the program for processing the alarm in the interrupt service program. The program is as follows:

  #include<reg52.h>
  
  voidalarm(void)interrupt0//interrupt service routine
  
  //【Note 1】
  
  //Main program
  
  voiDMAin(void)
  
  {
  
  TCON=OxO1; //Set external interrupt 0 to edge trigger
  
  IE=Ox81: //Enable external interrupt 0
  
  for(;:)
  
  {

  [Note 1]: If someone walks by, the program will jump to that location. We can add processing programs here, such as driving an alarm.

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号