Simplify Weighing Scale Integration in .NET Applications

WeighingMachineConnector.NET is a C# class library that simplifies communication between your .NET applications and RS232-based weighing machines. Whether you're working on a manufacturing system, warehouse management, or retail POS software, this library helps you connect and extract weight data from serial-enabled scales with minimal effort.

🎯 What Is It?

This library provides a clean and extensible abstraction for reading weights from electronic weighing scales that communicate over RS232 serial ports. It handles the connection, data reading, and parsing logic so that you can focus on business logic instead of low-level serial communication.

🎯 Purpose

Most digital weighing machines send weight data in raw or formatted byte streams through serial ports. Manually handling this requires byte-level parsing, port configuration, and handling different protocols per device brand — which is repetitive and error-prone.

WeighingMachineConnector.NET was built to standardize and simplify this process for developers.

✅ Key Advantages

  • Plug-and-Play: Just specify COM port and baud rate to start receiving weight data.
  • Asynchronous Operation: Event-driven architecture using .NET events and delegates.
  • Custom Parsers: Built-in support for common weighing scale formats + easy extensibility.
  • Cross-Version Compatibility: Works with both .NET Framework and .NET Core/.NET 6+.
  • Device-Agnostic: Design supports different machines with minimal customization.

⚙️ Supported Devices

The library supports most weighing machines that:

  • Use RS232 Serial communication
  • Transmit ASCII or byte-encoded data for weight output
  • Support configurable baud rate and parity settings

Examples include industrial/commercial weighing machines from brands like:

  • A&D Weighing
  • Mettler Toledo
  • Citizen
  • Radwag
  • KERN
  • And many more RS232-compatible models

🚀 How to Use It

Here's a step-by-step example to connect and receive weight data using the library:


// Import the library
using WeighingMachineConnector;

class Program
{
    static void Main(string[] args)
    {
        // Initialize the weighing machine connection
        var machine = new WeighingMachine("COM3", 9600);

        // Subscribe to the WeightReceived event
        machine.WeightReceived += (sender, weight) =>
        {
            Console.WriteLine($"Weight received: {weight} kg");
        };

        // Start listening for data
        machine.Start();

        Console.WriteLine("Listening for weight data... Press Enter to exit.");
        Console.ReadLine();

        // Stop the connection when done
        machine.Stop();
    }
}

Note: Ensure that the COM port and baud rate match the settings of your weighing machine.

➕ Want to Add a New Device?

If your machine sends weight data in a custom format, you can easily support it by:

  1. Creating a custom parser class that implements IWeightDataParser
  2. Registering it in your application when initializing WeighingMachine

Example:


public class MyDeviceParser : IWeightDataParser
{
    public double? Parse(byte[] buffer)
    {
        // Custom logic to convert raw bytes to a readable weight
    }
}

Usage:


var machine = new WeighingMachine("COM3", 9600, new MyDeviceParser());
machine.WeightReceived += (s, weight) => Console.WriteLine($"Weight: {weight}");
machine.Start();

📦 Installation

    1. Clone the GitHub repository:
git clone https://github.com/encryptedtouhid/WeighingMachineConnector.NET
  1. Add the project or compiled DLL to your solution.
  2. Connect your weighing scale to the computer's COM port.
  3. Initialize and start the machine listener as shown above.

💼 Use Cases

  • Factory Automation Systems
  • Retail POS Terminals with integrated weight support
  • Logistics, packaging, and inventory control
  • Laboratory measurement systems

📬 Contributions & Support

The project is open source and available on GitHub. Pull requests, issue reports, and custom parser contributions are welcome!

Visit: https://github.com/encryptedtouhid/WeighingMachineConnector.NET

👨‍💻 Author

Created and maintained by Khaled Md Tuhidul Hossain, a senior software engineer specializing in systems integration, C#, and industrial automation solutions.


WeighingMachineConnector.NET — Save time, scale integration.

Add comment