Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python, how to DIY metal detector

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of python how to DIY metal detector, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will get something after reading this python how to DIY metal detector article. Let's take a look at it.

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 input and output program.

3. Learn the working principle of LJ12A3-4-Z/BX metal proximity switch.

4. Hardware wiring method.

5. Learn to use TPYBoard to receive the output signal of the metal proximity switch, judge and process the signal, and light up the LED light-emitting diode.

two。 Required components

TPYBoardv102 development board (stm32 development board that can run MicroPython)

LJ12A3-4-Z/BX metal proximity switch

A piece of bread

A light emitting diode

A data line

Some DuPont lines

Working principle of 3.LJ12A3-4-Z/BX proximity switch

The proximity switch not only has the characteristics of stroke switch and fretting switch, but also has the characteristics of reliable action, stable performance, fast frequency response, long application life, strong anti-interference ability, waterproof, shockproof, corrosion resistance and so on.

The output signal of the proximity switch is the output digital signal, that is, when there is no metal close, output 1, when there is metal, output 0, through the front probe to detect whether there is metal, and then pass the detected number to

TPYBoard, and then TPYBoard to make a corresponding judgment, widely used in machine tools, metallurgy, chemical industry, aerospace, textile and printing and other industries; in daily life, can be used in hotels, restaurants, garages of automatic doors, automatic hot fans are used; in security anti-theft, such as data archives, accounting, finance, museums, vaults and other important places, usually equipped with a variety of proximity switches composed of anti-theft devices.

We only need the positive (gray wire) to connect the VIN pin of the TPYBoard, the negative (blue wire) to connect the GND pin of the TPYBoard, and the black wire (output signal) to connect the IO pin of the TPYBoard. After the Y1 pin is connected, when there is metal approaching, the red light of the proximity switch itself will light up, and when away from the metal, the light will go out.

LJ12A3-4-Z/BX proximity switch

4. Hardware wiring method

After we connect the proximity switch line above, the TPYboard development board can collect the digital signal transmitted by the metal switch through the Y1 pin, and we can use this signal to let the development board control automatic door opening, alarm, etc., in this is just an easy-to-understand application to light up our red LED LED.

When there's no metal around, when it's close to metal,

5. source code

# main.py-- put your code hereafter import pybfrom machine import Piny1 = Pin ('Y1Christ, Pin.IN) x1 = Pin (' X1') Pin.OUT_PP) while 1: # when there is no metal, if y1.value () = = 1: print (y1.value ()) x1.value (0) # when there is metal, else: print (y1.value ()) x1.value (1) this is the end of the article on "how to DIY metal detector in python". Thank you for reading! I believe that everyone has a certain understanding of "python how to DIY metal detector" knowledge, if you want to learn more knowledge, welcome to follow 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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report