Modbuz: tool and library for Modbus devices

Hello everyone!

I’m developing an edge gateway with Zig for agri-voltaic plants and I needed a Modbus implementation.
Instead of using libmodbus, I decided to implement the protocol from scratch given that is a pretty simple protocol.
The library implements both TCP and Serial (only RTU, not ASCII yet) transports and all the basic function codes that Modbus provides, but I would like to support also CANopen, serial diagnostics and custom function codes.

Developing this from scratch has been really fun and I can’t wait to test this in a real world scenario!

If you’re an Zig and/or Modbus expert, feel free to critique my work - I’m always open to learn how to write better code :slight_smile:

Here’s the link to the repo (it’s a monorepo for a bigger project):
https://codeberg.org/intales/giacomo/src/branch/main/modbuz

11 Likes

I had to use Modbus at my last company. This is cool!

2 Likes

Zig is very well suited to the industrial use cases in my opinion. Need a zig industrial group (ZIG) :slight_smile:

6 Likes