Advertisement

Quick Links

Welcome!
Thank you for purchasing our AZ-Delivery LJ12A3-4-Z BX Inductive
Proximity Sensor. On the following pages, you will be introduced to how to
use and set up this handy device.
Have fun!

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the LJ12A3-4-Z BX and is the answer not in the manual?

Questions and answers

Summary of Contents for AZ-Delivery LJ12A3-4-Z BX

  • Page 1 Welcome! Thank you for purchasing our AZ-Delivery LJ12A3-4-Z BX Inductive Proximity Sensor. On the following pages, you will be introduced to how to use and set up this handy device. Have fun!
  • Page 2 Areas of application Education and teaching: Use in schools, universities and training institutions to teach the basics of electronics, programming and embedded systems. Research and development: Use in research and development projects to create prototypes and experiments in the fields of electronics and computer science. Prototype development: Use in the development and testing of new electronic circuits and devices.
  • Page 3 consult a doctor. Caution: Keep the product out of the reach of children and pets to avoid accidental contact and swallowing of small parts. Note: Store the product in a safe, closed container when not in use. Attention: Avoid contact of the product with food and drinks.
  • Page 4: Table Of Contents

    Table of Contents Introduction....................3 Specifications....................4 The pinout.....................5 How to set-up Arduino IDE................6 How to set-up the Raspberry Pi and Python..........10 Connecting the module with Atmega328p...........11 Sketch example..................12 Connecting the module with Raspberry Pi..........14 Python script....................15 - 2 -...
  • Page 5: Introduction

    Introduction An inductive proximity sensor is a type of sensor that can detect nearby objects made of metal with no physical contact. It doesn't detect other materials, such as wood, plastics, paper, so the sensor can detect metal objects through opaque plastics. The sensor is also durable and dirt- resistant.
  • Page 6: Specifications

    Specifications » Operating voltage: 6V – 36V DC » Output type: NPN, 3 wires, NO (normally open) » Output current: 300mA » Detection distance: » Dimensions: screw diameter – 12mm [0.47in] screw length – 63mm [2.48in] cable length – 115cm [45.27in] »...
  • Page 7: The Pinout

    The pinout The LJ12A3-4-Z BX Inductive Proximity Sensor module has 3 pins. The pinout is shown in the following image: - 5 -...
  • Page 8: How To Set-Up Arduino Ide

    How to set-up Arduino IDE If the Arduino IDE is not installed, follow the link and download the installation file for the operating system of choice. The Arduino IDE version used for this eBook is 1.8.13. For Windows users, double click on the downloaded .exe file and follow the instructions in the installation window.
  • Page 9 For Linux users, download a file with the extension .tar.xz, which has to be extracted. When it is extracted, go to the extracted directory and open the terminal in that directory. Two .sh scripts have to be executed, the first called arduino-linux-setup.sh and the second called install.sh.
  • Page 10 Almost all operating systems come with a text editor preinstalled (for example, Windows comes with Notepad, Linux Ubuntu comes with Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text editors are perfectly fine for the purpose of the eBook. Next thing is to check if your PC can detect an Atmega328p board.
  • Page 11 If the Arduino IDE is used on Windows, port names are as follows: For Linux users, for example, port name is /dev/ttyUSBx, where x represents integer number between 0 and 9. - 9 -...
  • Page 12: How To Set-Up The Raspberry Pi And Python

    How to set-up the Raspberry Pi and Python For the Raspberry Pi, first the operating system has to be installed, then everything has to be set-up so that it can be used in the Headless mode. The Headless mode enables remote connection to the Raspberry Pi, without the need for a PC screen Monitor, mouse or keyboard.
  • Page 13: Connecting The Module With Atmega328P

    Connecting the module with Atmega328p Connect the module with the Atmega328p as shown on the following connection diagram: - 11 -...
  • Page 14: Sketch Example

    Sketch example float metalDetected; monitoring; metalDetection = A0; void setup(){ Serial.begin(9600); void loop(){ Serial.println("Initializing Proximity Sensor "); Serial.println("Please wait... "); monitoring = analogRead(metalDetection); delay(100); (monitoring < 250){ Serial.println("...Metal is detected"); else{ Serial.println("...Metal not detected"); delay(1000); - 12 -...
  • Page 15 The result should look like as on the following image: - 13 -...
  • Page 16: Connecting The Module With Raspberry Pi

    Connecting the module with Raspberry Pi Connect the module with the Raspberry Pi as shown on the following con- nection diagram: - 14 -...
  • Page 17: Python Script

    Python script import time import RPi.GPIO GPIO #Pin of Input GPIOpin = -1 #Initial the Input Pin initialInductive(pin): global GPIOpin GPIOpin = pin GPIO.setmode(GPIO.BCM) GPIO.setup(GPIOpin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) print("Finished Initiation") print(GPIOpin) #Detect Metal detectMetal(): if(GPIOpin != -1) state = GPIO.input(GPIOpin) state: print("Metal not detected") else:...
  • Page 18 #Test Module try: _name_ == '_main_': pin = 24 initialInductive(pin) while True: detectMetal() time.sleep(0.5) except KeyboardInterrupt: print('\nScript end!') - 16 -...
  • Page 19 Save the script under the name proximity.py. To run the script open the terminal in the directory where the script is saved and run the following command: sudo python3 proximity.py To end the script press 'CTRL + C' on the keyboard. - 17 -...
  • Page 20 Internet. If you are looking for the high quality microelectronics and accessories, AZ-Delivery Vertriebs GmbH is the right company to get them from. You will be provided with numerous application examples, full installation guides, eBooks, libraries and assistance from our technical experts.

Table of Contents