Как подключить индуктивный датчик к ардуино
Перейти к содержимому

Как подключить индуктивный датчик к ардуино

  • автор:

Arduino.ru

Из-за наличия транзисторного ключа, причём бывают как npn, так и pnp, а также питание датчика 6-36 вольт, необходима рапиновка датчика хотя бы.

  • Войдите на сайт для отправки комментариев

Пнд, 16/02/2015 — 09:50
Зарегистрирован: 05.09.2011

берите с ключем NPN. GND датчика соеденить с GND ардуины, выход датчика через резистор согласно документации датчика на плюс его питания и через диод (катод к датчику, анод к ардуине) на вход ардуины. На входе ардуины активировать подтяжку. Диод нужен, чтобы отвязать от ардуины высокое (от 6в и выше) для ардуины плюсовое напряжение питания датчика, через диод вход ардуины будет замыкаться на землю при срабатвании датчика, а его не срабатывании диод будет блокировать попадание плюсового напряжения с датчика на ардуину

  • Войдите на сайт для отправки комментариев

Interfacing TM7711 Electronic Weighing Sensor with Arduino

The TM7711 is a 24-bit 2-channel analog-to-digital converter used to measure resistance changes. This module is widely used in load cell and air pressure sensors. This module features high accuracy, quality and cost-effectiveness.

Note

This module does not support I2C communication.

TM7711 Pressure Module

You can download the datasheet of this module here.

TM7711 Pressure Module Datasheet

1 file(s) 410.88 KB

TM7711 24-bit Pressure Module Pinout

This sensor has 8 pins:

  • VIN: Module power supply – 3.3-5 V
  • GND: Ground
  • SCK: Module and microcontroller synchronization
  • OUT: Digital output
  • AVDD: Load cell power supply
  • AGND: Load cell ground
  • A+: The first output of load cell
  • A-: The second output of load cell

You can see the pinout of this module in the image bellow.

TM7711 Sensor Pinout

Required Materials

Hardware Components

Arduino UNO R3 × 1
TM7711 24-bit Pressure Sensor Module × 1
10kg Load Cell × 1
male-female-jumper-wire × 1

Software Apps

Arduino IDE

Interfacing TM7711 24-bit Pressure Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to TM7711 module. Connect wires accordingly.

TM7711 Sensor Arduino circuit

Step 2: Code

Install the following library on your Arduino first.

Tip

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Upload the following code to your Arduino.

/* modified on Sep 21, 2020 Modified by MohammedDamirchi from https://github.com/sparkfun/HX711-Load-Cell-Amplifier base on https://www.instructables.com/id/Arduino-Scale-With-5kg-Load-Cell-and-HX711-Amplifi/ 
Home
*/ #include "HX711.h" #define DOUT 3 #define CLK 2 HX711 scale; float calibration_factor = -100000; //Change this for calibration your load cell void setup() < Serial.begin(9600); Serial.println("HX711 calibration sketch"); Serial.println("Remove all weight from scale"); Serial.println("After readings begin, place known weight on scale"); Serial.println("Press + or a to increase calibration factor"); Serial.println("Press - or z to decrease calibration factor"); scale.begin(DOUT, CLK); scale.set_scale(); scale.tare(); //Reset the scale to 0 long zero_factor = scale.read_average(); //Get a baseline reading Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects. Serial.println(zero_factor); >void loop() < scale.set_scale(calibration_factor); //Adjust to this calibration factor Serial.print("Reading: "); Serial.print((scale.get_units()/3.977)-0.4349, 4); Serial.print(" kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person Serial.print(" calibration_factor: "); Serial.print(calibration_factor); Serial.println(); if(Serial.available()) < char temp = Serial.read(); if(temp == '+' || temp == 'a') calibration_factor += 10; else if(temp == '-' || temp == 'z') calibration_factor -= 10; >>

Interfacing Inductive Proximity Sensor LJ12A3-4-Z/BX with Arduino

Proximity sensors are used to detect the presence of nearby objects. The LJ12A3-4-Z / BX sensor has three pins, two of which are connected to a supply voltage of 6 to 36 V. The output pin is PNP and NO (Normal Open). That is, it is normally Low and when it detects an object, it becomes HIGH. The detection distance is 4 mm, and it can only detect metal objects such as copper, aluminum, iron, etc.

Note

Since the operation voltage is more than 5 V, it can’t be powered by Arduino. So, we have used a battery to interface it.

Warning

Since the output voltage is more than 5 volts, we have used a voltage divider to connect the sensor output to the Arduino.

You can download the datasheet of this module here.

LJ12A3-4-Z/BX Inductive Proximity Sensor Dataheet

1 file(s) 125.09 KB

LJ12A3-4-Z/BX Inductive Proximity Sensor

LJ12A3-4-Z/BX Inductive Proximity Sensor Pinout

This Module has 3 pins:

  • VCC: Module power supply – 6-36 V (Brown)
  • GND: Ground (Blue)
  • OUT: Digital output (Black)

You can see the pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
LJ12A3-4-Z/BX Inductive Proximity × 1
10K resistor × 2
9V Battery × 1
9V Battery Clips with Bare Leads × 1
Male to Male Jumper wire × 1
400 Tie point Breadboard × 1

Software Apps

Arduino IDE

Interfacing LJ12A3-4-Z/BX Inductive Proximity Sensor with Arduino

Step 1: Circuit

Reduce the Arduino input voltage from 9 V to 4.5 V as shown below through the voltage divider circuit. Then connect the middle end of the voltage divider circuit to the Arduino input pin.

Step 2: Code

Upload the following code to your Arduino.

 /* LJ12A3-4-ZBX-Inductive-Proximity-Sensor made on 04 Nov 2020 by Amir Mohammad Shojaee @ Electropeak 
Home
*/ const int Pin=2; void setup() < pinMode(Pin, INPUT); Serial.begin(9600); >void loop() < int sensorValue = digitalRead(Pin); if(sensorValue==HIGH)< Serial.println("no Object"); delay(500); >else < Serial.println("Object Detected"); delay(500); >>

First, we read the sensor output. If it is LOW, no object is near the sensor and if it is LOW, it has detected an object. This is done every half second.

The output is as follows. We put a metal object in front of the sensor three times to see its performance.

Interfacing Inductive Proximity Sensor LJ12A3-4-Z/BY with Arduino

Inductive Proximity Sensor LJ12A3-4-Z/BY Features

A proximity sensor is a sensor able to detect the presence of nearby objects. The inductive proximity sensor LJ12A3-4-Z / BY has three pins, two of which are connected to a supply voltage of 6 to 36V. The output pin is PNP and NO (Normally Open). That is, it is normally Low and when it detects an object, it is HIGH. The detection distance is 4 mm and it can only detect metal objects such as copper, aluminum, iron, etc.

Note

Because the operation voltage is more than 5V, it can’t be powered by Arduino. So, we can use a battery to power it up.

Warning

Since the output voltage is more than 5 volts, we use voltage divider to connect the sensor output to Arduino.

LJ12A3-4-Z/BY Inductive Proximity Sensor

Inductive Proximity Sensor LJ12A3-4-Z/BY Pinout

This Module has 3 wires:

  • VCC: Module power supply – 6-36V (Brown)
  • GND: Ground (Blue)
  • OUT: Digital output (Black)

You can see the pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
Inductive Proximity Sensor LJ12A3-4-Z/BY 3-Wire × 1
10K resistor × 2
9V Battery × 1
9V Battery Clips with Bare Leads × 1
Male to Male Jumper wire × 1
400 Tie point Breadboard × 1

Software Apps

Arduino IDE

Interfacing Inductive Proximity Sensor LJ12A3-4-Z/BY with Arduino

Step 1: Circuit

Reduce the Arduino input voltage (sensor output voltage) from 9V to 4.5V as shown below through the resistance circuit. Then connect the middle end of the resistor circuit to the Arduino input.

Step 2: Code

Upload the following code to your Arduino.

 /* LJ12A3-4-ZBY-Inductive-Proximity-Sensor made on 04 Nov 2020 by Amir Mohammad Shojaee @ Electropeak 
Home
*/ const int Pin=2; void setup() < pinMode(Pin, INPUT); Serial.begin(9600); >void loop() < int sensorValue = digitalRead(Pin); if(sensorValue==LOW)< Serial.println("no Object"); delay(500); >else < Serial.println("Object Detected"); delay(500); >>

We read the sensor output every half second. If it is LOW, no object is near the sensor and if it is LOW, it detects the object.

The Serial output is as follows. We put a metal object in front of the sensor three times to measure its performance

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *