In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article editor for you detailed introduction of "Python how to make acousto-optic control switch", the content is detailed, the steps are clear, the details are handled properly, I hope this "Python how to make acousto-optic control switch" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
1. Experimental purpose
1. Learn the method of extending the simple Iripple O interface in the PC system.
two。 Further learn the design method of compiling data output program.
3. Learn the working principle of photosensitive sensor module.
4. Learn how the sound sensor module works.
5. Learn how to connect TPYboard with sound sensor and photosensitive sensor and use sound and light to control light-emitting diode to turn off.
two。 Required components
TPYBoard board
A sound sensor.
A photosensitive sensor
A piece of bread
Several light emitting diodes
A data line
Some DuPont lines
3. Working principle of photosensitive sensor module
1. Photosensitive resistor module is the most sensitive to ambient light, which is generally used to detect the brightness of ambient light, trigger single-chip microcomputer or relay module, etc.
two。 When the ambient light brightness of the module does not reach the set threshold, the do output high level, and when the ambient light brightness exceeds the set threshold, the do output low level.
The 3.DO output terminal can be directly connected with the single-chip microcomputer, and the high and low level can be detected by the single-chip microcomputer, thus the light brightness change of the environment can be detected.
The 4.DO output can directly drive the relay module of our store, which can form a light-controlled switch.
Light sensitive sensor
4. Working principle of sound sensor module
1. The sound module is the most sensitive to the ambient sound intensity and is generally used to detect the sound intensity of the surrounding environment.
two。 When the ambient sound intensity does not reach the set threshold, the OUT output high level, when the external ambient sound intensity exceeds the set threshold, the module OUT output low level.
3. The small board digital output OUT can be directly connected with the single-chip microcomputer to detect the high and low level, so as to detect the sound of the environment.
4. The small board digital output OUT can directly drive the relay module of our store, which can form a voice control switch.
5. Hardware wiring method
We already know the working principle of the photosensitive sensor and the sound sensor, as well as the function of the three pins, so we only need to connect the positive and negative poles of the power supply to the 3.3V and GND of our TPYBoard, and then connect the signal output pins of the photosensitive sensor and the sound sensor to our TPYBoard. The signal output pin of my sound sensor is connected to the Y1 pin of TPYBoard. The signal output pin of the photosensitive sensor is connected to the Y2 pin of the TOYBoard, so that the sensor is connected, and then we insert the positive pole of the light emitting digital tube into the positive pole of the bread board, and the negative pole into the longitudinal Jack of the bread board (agraine bforce crection dgrafrect gdrect iMagee j), and then connect the negative pole to the GND of TPYBoard with DuPont wire, and the positive pole of the lamp to the X1 pin of our TOYBoard. Then we control the sound volume and light intensity to control the X1 pin output high level or low level to control the light-emitting diode, after wiring ok, write main.py, so that our DIY acousto-optic electronic switch is completed.
6. source code
# main.py-- put your code hereafter imports pybfrom pyb import Pinvoice = Pin ('Y1century pin. In) light = Pin (' Y2pm Pin.IN) led = pyb.Pin ("X1") Pyb.Pin.OUT_PP) while 1: if light.value () = = 1: if voice.value () = 1: led.value (0) pyb.LED (2). Off () pyb.LED (3). Off () pyb.LED (4). On () else: pyb.LED (3). Off () Pyb.LED (4). Off () led.value (1) pyb.LED (2). On () pyb.delay (5000) else: pyb.LED (3). On () pyb.LED (2). Off () pyb.LED (4). Off () led.value (0) This article "how to make acousto-optic control switch in Python" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the article, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.