王达业

Principle of photoelectric code lock based on microcontroller (hardware circuit and source program)

 
Overview

When the password is 4321, perform the corresponding correct password action, otherwise it will not be performed.
(1) There are no obstacles in front of the reflective photoelectric tube, so the receiving tube does not conduct, and its output is high level. After passing through the 74LS04 inverter, the output is low level, and LED1 emits light; when there are obstacles in front of the tube When , the receiving tube is turned on, the output is high level, and LED1 does not emit light. The output terminal is connected to the T0 pin of the microcontroller.
(2) There are no obstacles in front of the through-beam photoelectric pair tube. The receiving tube can receive the spectrum emitted by the transmitting tube L1. It is in the conducting state and outputs low level. After passing through the 74LS04 inverter, the output pin is high level. LED2 does not emit light; when isolation is added between the two tubes, the receiving tube is in a cut-off state, the output pin outputs a low level, and LED2 emits light. This output pin is connected to the T1 pin of the microcontroller.
(3) Add light to the photocell, and the photogenerated electromotive force will be generated at both ends. After amplification by the 741 amplifier, it is added to pin 6 (negative input terminal) of the comparator LM339, causing the comparator to output a low level, which is passed through the 74LS04 inverter output pin. is high level, LED5 does not emit light; when there is no light, the photovoltaic cell does not generate photogenerated electromotive force, the comparator output is high level, the output pin voltage is low, and LED3 emits light. Generally, pin 7 (positive input terminal) of the comparator is left floating, or it can be connected to an adjustable power supply to adjust the sensitivity of the experimental board to light intensity by changing the comparison threshold. This output pin is connected to the INT0 pin of the microcontroller.
(4) If the photoresistor is not illuminated, its dark resistance is very high. Pin 4 (negative input terminal) of the comparator LM339 is high level, so its pin 9 output is low level, and is output after passing through a first-level inverter. The pin is high level, and then outputs low level after passing through a first-level inverter, and LED4 emits light; when light illuminates the photoresistor, its light resistance is small, and pin 4 (negative input terminal) of the comparator LM339 is low level. level, its pin 9 is high level, the output pin outputs low level, and LED4 does not emit light. Generally, pin 5 (positive input terminal) of the comparator is left floating, or it can be connected to an adjustable power supply to adjust the sensitivity of the experimental board to light intensity by changing the comparison threshold. This output pin is the INT1 pin of the microcontroller.
(5) If there are no obstacles between the transmitting tube and the receiving tube of the optocoupler, the receiving tube is turned on, and its output is low level. After passing through the first-level inverter, the output pin is high level, and LED5 does not emit light; when When there is an obstacle between the optocoupler's transmitting tube and the receiving tube, the transmitting tube does not conduct, the output pin outputs a low level, and LED5 emits light. This output pin is connected to the INT2 pin of the microcontroller.

 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-18 21:46:12

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号