Direct connection of a relay board: AgIO talks Modbus

AgOpenGPS has a build-in section control for up to 16 sections. This post describes how to connect a Modbus board to AgIO w/o the need of soldering anything. All you need is a board like this, a $1 adapter for Modbus like this and some cable.

The A and B line is connected between the USB stick and the board and +12V supply is connected to the power inputs of the board. Connect to PC and run this AgIO instead of the original one.

Connection of a electromagnetic valve:
+Battery <-----> NO contact of relay
COM contact of relay <-----> coil of valve
other wire of coil <-----> -Battery

Connection of a motor valve (polarity reversal):
1st Modbus relay board:
+Battery <-----> NO contact of relay
-Battery <-----> NC contact of relay
COM contact of relay <-----> motor valve

2nd Modbus relay board (same Modbus address, same relay):
+Battery <-----> NC contact of relay
-Battery <-----> NO contact of relay
COM contact of relay <-----> other wire of the motor valve

Here is a short video about how all is done.

The Modbus boards can also be connected directly to the Central Unit 1.x and 2.x boards, if the RS485 driver is mounted.


German / Deutsch einschließlich Erklärung zu BNO085 und Arduino Connect:

Wichtig: Dazu muss AgIO.exe durch diese erweiterte Version ersetzt werden.

Timely post the the ali relay module just arrived!
Got one with outputs plus, DI for proof of opening feedback.

DI is technically possible for sure, but not supported yet.

I should also mention, that those China modules don’t care about the Modbus specification much. This beginns with the timing: The modules ignore the mandatory dead time after each telegram. Furthermore, writing “coils” is not supported, which is intentionally made for relays. They use “analog holding registers” instead. Quite wiered. Is working well but may differ with different modules.

1 Like

I have the first board now working with this! Easy easy section control.

With the push to UDP I now have a second 485 board but with a Ethernet interface and 485 interface. 485 works but now how to point the same commands to the Ethernet interface?

Also found a 16 channel relay only board with second Ethernet interface for daisy chaining.

Quite sure there is a lib for Modbus TCP. But I’m not so familiar with C#…

Modbus RTU is so easy to handle, that there is no need for any lib. With Modbus TCP, you’ll have to find a way to put that packet into a TCP frame. Didn’t try, because Ethernet to my mind has no advantage for AOG.

I’ve been using NModbus4 to communicate with PLCs via Modbus TCP/IP. GitHub - NModbus4/NModbus4: NModbus4 is a C# implementation of the Modbus protocol. This project is archived in favor of


If anyone wants help getting Modbus working, feel free to reach out.

The forum where information finds you, thank you for the link.

So the boards Ethernet card card has a web interface, looks like it just goes from Ethernet to ttl serial. So is this just a matter of taking @GoRoNb 485 commands and pointing them at a port?

I think you would have to use the RS485 interface to use @GoRoNb AgIO?

Yes it works with a 485 adapter using @GoRoNb version of agio.

But the fun now is do the same thing over udp. It looks like this ethernet/ttl module just passes the data to A&B.

The quick dirty was to test will be to run the 485 data from Agio to a virtual comport, then pass it out rtklibs server program to udp.

I know rtklib has nothing to do with this, but the server program will pass any data through it between unrelated devices.

You’re talking about strsvr?

1 Like

Yes it will stream data to anything, even if its not even remotely close rtcm3 related.

*** update

Its harder than just shoving the data across, Ali makes a converter to go from usb to 485 ethernet… but then what is the difference in just using the twisted pair, not much.

1 Like

You could take AGIO, and add Modbus TCP/IP with a timer to send the values to the boards similar to what @GoRoNb did with Modbus RTU.

I’m wondering if AGIO would benefit from something like MQTT to make it easier to hook up external applications. Or maybe there is something, and I haven’t come across it yet.

Fully agree - I already suggested MQTT two years ago.

In fact, there are two kinds of communication: Hard realtime for steering requiring low latency and low jitter and all others.

Realtime is GNSS, IMU and Steering only. For this, serial protocols are perfect, because the code has 100% control on the timing (apart from the part, Windows does). Best physics is RS485 - just two short circuit proof wires (or CAN - more difficult to handle).

All others may use WiFi (here, MQTT is a very good option) or Bluetooth (compatible with the existing data packets).