ModbusRTU extension

I have made an extension for Modbus RTU serial communication, for my own needs. It can read and write single registers and is based on my SerialOTG extension (can be expanded to read/write multiple registers). I can make it available to Appinventor users. Please return if there is any interest and any specific functions that you need.

2 Likes

Will it work over WiFi ?

If you mean ModbusTCP, then the answer is no. It is limited to ModbusRTU over serial line for now. I made this extension to be able to read and write registers in a PLC and in I/O devices from ICP-Con. It will work with the same devices as my extension SerialOTG: https://github.com/rkl099/Appinventor-SerialOTG.

There are a lot of other I/O modules and also USB-Rs485, Rs232-Rs485 converters that can be used to connect to ModbusRTU networks.
(ModusTCP may be added in the future.)

Hi rkl099,

I am looking for a ModbusRTU extension.
I am very new in programming with App Inventor, but I need a little App which can read and write some Modbus registers over Bluetooth.
So would it be possible realize this with your extension? And would you share your extension?
Thank you very much!

No, I have only implemented serial line communication, using an usb-serial adapter.
Maybe you can use an serial-bluetooth adapter instead but I have not tried that!
I have made this extension and test program available at:

1 Like

Ok, I see. Thank you very much for sharing!
I will take a look on it. :slight_smile:
Would it be a big effort to use the bluetooth interface instead of serial line?

I have examined the library that I have modified and used for my extensions. It had a Bluetooth serial class, but it only implements BT server (slave), so the external device has to initialize the connection. I think this is possible with HC-05, (not with HC-06) but this does not seems to be so useful.
One solution is to make a new Modbus extension that only do the Modbus formatting and checking. You can then use SerialOTG or a Bluetooth extensions for the communication. But this needs some work.

I have updated my ModbusRTU extension with support for BT and WIFI. I have added ModbusTCP protocol. You can also bridge ModbusRTU over BT or WIFI.

It implements single 16b read/write and a function to calculate modbusRTU CRC. You can use this to implement other Modbus functions.

The new extension can be found at:

https://github.com/rkl099/Appinventor-Modbus

I received the following email by @rkl099

Hello, I want to update information about my contributions to Appinventor

Modbus by rkl099. Support for Modbus RTU/TCP over serial, BT and WIFI

Direct link: https://github.com/rkl099/Appinventor-Modbus

Thank you for listing extensions to Appinventor

Thank you @rkl099, now added in the extensions directory App Inventor Extensions | Pura Vida Apps
Taifun

I have added read of one 32bit register to the Modbus extension (user request).