MB2HAL example with cheap 16I/16O 24v 'Geroosaty' Modbus boards over RS485

More
05 Jan 2026 19:45 #341021 by freemoore
Hi all.
This is currently working at dining-table levels, but will (hoepfully) become part of a Morbidelli Author 503 retrofit. I haven't found many examples of working mb2hal .hal and .ini files and had a bit of a time getting it all to work, so wanted to post results/a simple guide now that it does. The Morbidelli wants somewhere near 60 inputs/90 outputs and the budget is tight, hence going for the cheapest available:

Geroosaty UM72 board, model number on the board is N4D3E16. These were about £18 each.
Waveshare's USB to RS485 converter based on CH343G and SP485EEN chips, for about £15.
Linuxcnc version is 2.9.8.

I've attached .ini and .hal files. Note that modbus_io.ini is not a separate config file for lcnc but the config file for the mb2hal component. 

The board is 16I/16O, 24v, and has SlaveID settable by dip switches:
board 1 has A0 ON and A1-5 OFF for SlaveID 1,
board 2 has A0 OFF, A1 ON, A2-5 OFF for SlaveID 2.

I found some docs which suggest that the baud rate can be changed to 19200 but default is 9600. Wiring: A and B were correctly marked and wired A to A, B to B; GND was attached to the GND of the 24v psu.

I didn't have much success with modbus functions other than 03 or 06; other functions I could get to show up in hal configuration, but either not work or work in a way I couldn't use, hence the weighted_sum components. Notes there: weighted_sum doesn't seem to work with the 'names=' option, just numbered instances. Invoking 'weighted_sum' instances are referred to by 'wsum.0, wsum.1' etc. and when you add them to the servo thread, you add 'process_wsums'. Also when setting up the bits and their weights, it doesn't like the form 'wsum.01.bit.01.weight' but worked when 'wsum.1.bit.1.weight' was used.

I hope reading my config files helps someone else with this setup! Spent a whole day trying to get it to work with either one of two identical but ~15 year old rs485-usb adapters, eventually binned them and had the waveshare one working in a few minutes, once it arrived. Happy New Year all

Andy
The following user(s) said Thank You: SOLD, michaeln

Please Log in or Create an account to join the conversation.

More
05 Jan 2026 19:55 - 05 Jan 2026 19:57 #341023 by freemoore
Attaching what documentation I could find, though these refer to the boards having baud rate jumpers, which mine did not.  
Attachments:
Last edit: 05 Jan 2026 19:57 by freemoore. Reason: mistake made when trying to attach files

Please Log in or Create an account to join the conversation.

Time to create page: 0.146 seconds
Powered by Kunena Forum