====== lamaPLC: YR-3180 - Weight sensor module with UART or Modbus communication ====== {{anchor:yr_3180}} The weighing acquisition module is a high-performance, multi-functional electronic weighing equipment. It uses advanced weighing technology to measure item weight in real time and display it on a five-digit digital display. It also includes upper- and lower-limit alarm functions. capable of achieving precise weighing control and monitoring. At the same time, this product also features a TTL communication interface and [[com:basic_modbus|Modbus RTU]] protocol, enabling convenient, rapid communication with PLCs, computers, and other equipment to transmit and remotely control weighing data. In addition, it supports Type-C power supply and button debugging, improving convenience and stability. |< 100%>| |{{ :sensor:yr_3180_1.png?200 |YR-3180 Intelligent weighing sensor module}}|{{ :sensor:yr_3180_2.png?200 |YR-3180 Intelligent weighing sensor module}}| **Key Specifications and Features** * **Function:** The YR-3180 is a smart weighing sensor module designed to be integrated into electronic scales and instruments. It converts the mechanical force from a load cell into a precise electrical signal and displays the weight numerically. * **High Precision:** It features a 24-bit A/D resolution (using an HX710B AD chip) for accurate weight detection. * **Display:** The module has a five-digit digital tube display for intuitive and clear weight readings. * **Connectivity:** It supports both TTL and RS-485 interfaces and uses the standard Modbus RTU protocol, enabling data transmission and remote control. * **Alarm Function:** The module includes upper- and lower-limit alarms for process control and quality management. * **Power Supply:** Powered via a Type-C/5V power supply, it also supports key debugging functions. * **Sensor Compatibility:** When powered by the 5V TTL serial port, it can connect up to 1-4 350Q weighing sensors (load cells). * **Acquisition Rate:** The A/D acquisition rate can be set to 10 or 40 times per second (default is 10). * **Physical:** It is a bare-board module (no shell), measuring 45mm x 22mm. {{page>:tarhal}} ==== Power and Communication (Host Side) ==== The module is powered via Type-C or dedicated pins and supports dual communication modes: * **VCC:** 5V DC Input. * **GND:** System Ground. * TTL Serial Port: * **TX:** Transmit data (connects to MCU RX). * **RX:** Receive data (connects to MCU TX). * RS-485 Interface (if the model variant supports it): * **A (D+):** RS-485 Differential A signal. * **B (D-):** RS-485 Differential B signal ==== Modbus map ==== ^Data Type^Description^Common Address Range^Access| |Current Weight|The main measured value (often a 32-bit float or integer)|30001 - 30002 (Input)|Read Only| |Zero/Tare Command|A single coil or holding register to trigger a zero action|0001 or 40001 (Coil/Holding)|Write Only| |Device Address|The Modbus Slave ID (default is often 1 or 2)|40002 (Holding)|Read/Write| |Baud Rate|Communication speed setting (e.g., 9600, 19200 bps)|40003 (Holding)|Read/Write| |Alarm Limit (Upper)|The high limit for the alarm output|40004 (Holding)|Read/Write| |Alarm Limit (Lower)|The low limit for the alarm output|40005 (Holding)|Read/Write| Description: [[https://www.yunzhan365.com/basic/83969503.html|YR-3180 Intelligent weighing sensor module]] \\ ==== Arduino & YR-3180 ==== The YR-3180 is an ultrasonic distance sensor that communicates via UART (Serial). It typically outputs a 4-byte data packet (Header, Data High, Data Low, and Checksum) every 100ms. **Arduino Wiring** Using SoftwareSerial is recommended to keep the main hardware serial port (USB) free for your Serial Monitor. * **VCC:** 3.3V or 5V (Check your specific module's label) * **GND:** Arduino GND * **TX (Sensor):** Arduino Pin 10 (RX) * **RX (Sensor):** Arduino Pin 11 (TX) **Arduino Example Code** This code listens for the standard 4-byte packet, verifies the checksum, and calculates the distance in millimeters. #include // RX = 10, TX = 11 SoftwareSerial sensorSerial(10, 11); unsigned char buffer[4]; int distance; void setup() { Serial.begin(115200); // Communication with PC sensorSerial.begin(9600); // Standard YR-3180 baud rate Serial.println("YR-3180 Sensor Initialized"); } void loop() { if (sensorSerial.available() > 0) { // Look for the start byte (0xFF) if (sensorSerial.read() == 0xFF) { buffer[0] = 0xFF; for (int i = 1; i < 4; i++) { buffer[i] = sensorSerial.read(); } // Calculate Checksum: (buffer[0] + buffer[1] + buffer[2]) & 0xFF byte sum = (buffer[0] + buffer[1] + buffer[2]) & 0xFF; if (buffer[3] == sum) { // Distance is High Byte << 8 + Low Byte distance = (buffer[1] << 8) + buffer[2]; Serial.print("Distance: "); Serial.print(distance); Serial.println(" mm"); } else { Serial.println("Checksum Mismatch"); } } } delay(100); // Match sensor's output frequency } **Implementation Details** * **Data Format:** The sensor transmits 4 bytes: **0xFF** (Header), **Data_H**, **Data_L**, and **Checksum**. * **Blind Zone:** Like most ultrasonic sensors, it has a minimum detection distance (**typically 3cm to 25cm**) at which readings are inaccurate. * **Interface:** If your module has a //"Trigger"// pin, it may support a //"Controlled Mode"// where it only sends data after you pull the RX line low. ===== Sensor topics on lamaPLC ===== {{topic>sensor}} \\ \\ {{tag>communication modbus RTU sensor weight YR-3180 HX710B Arduino TTL RS-485}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}