Page 1 of 1

I'm searching a modbus library

Posted: Thu May 09, 2019 7:53 am
by P@T
Hi all,

I work in the electronics industry. For me it lacks a great standard to introduce micropython into this field: modbus
It would be very easy to integrate a new Modbus slave on an existing network. (modbus master is rarely a small microcontroller)

Thanks,

Re: I'm searching a modbus library

Posted: Thu May 09, 2019 4:39 pm
by pythoncoder
This is something of a FAQ and there is evident interest in a library. As far as I can see the Pyboard could support Modbus but nobody has written a library. It needs someone with access to a Modbus master to roll up their sleeves and get coding.

Re: I'm searching a modbus library

Posted: Fri May 10, 2019 12:37 am
by rpr
I just want to clarify what you are asking:

You want to setup a Pyboard as a modbus slave on an existing TCP network so that it can be controlled by a master device on same network. I presume you want to be able to use the digital inputs/outputs as well as analog in/out.

In the past I have used standard linux computers (acting as master) with modbustcp (python) to control modbus devices such as Advantech ADAM modules. I think I have recently seen some code which allows a Raspberry PI to act as a Modbus slave. Maybe such a code can be adapted for your use.

Re: I'm searching a modbus library

Posted: Fri May 10, 2019 7:37 am
by P@T
rpr wrote:You want to setup a Pyboard as a modbus slave on an existing TCP network so that it can be controlled by a master device on same network. I presume you want to be able to use the digital inputs/outputs as well as analog in/out.
Exactly, in RTU mode
rpr wrote:In the past I have used standard linux computers (acting as master) with modbustcp (python) to control modbus devices such as Advantech ADAM modules. I think I have recently seen some code which allows a Raspberry PI to act as a Modbus slave. Maybe such a code can be adapted for your use.
Yes ;)

I have already programmed modbus servers to control the slave (with minimalmodbus) but never in slave mode (I haven't found library).
Today I will be able to decode all the frames and then send the answers in the right format and with the CRC (manualy) but a library help me a lot :oops:

thanks,

Re: I'm searching a modbus library

Posted: Fri May 10, 2019 10:17 am
by rpr
P@T wrote:
Fri May 10, 2019 7:37 am

Yes ;)

I have already programmed modbus servers to control the slave (with minimalmodbus) but never in slave mode (I haven't found library).
Today I will be able to decode all the frames and then send the answers in the right format and with the CRC (manualy) but a library help me a lot :oops:

thanks,
That is fantastic. I'd be interested in seeing the resulting code. If possible, may I ask what is the application that you are developing? Thanks.

Re: I'm searching a modbus library

Posted: Fri May 10, 2019 4:09 pm
by JumpZero
Hi!
Not sure if this help but a few years ago I used pymodbus on Raspberry pi it was not very difficult and worked well, it's Python not microPython but may help
Also there is this micropython-modbus for ESP32 (never tested) https://github.com/techbase123/micropython-modbus

Re: I'm searching a modbus library

Posted: Fri May 10, 2019 7:50 pm
by P@T
rpr wrote:That is fantastic. I'd be interested in seeing the resulting code. If possible, may I ask what is the application that you are developing? Thanks.
:?: I have already programmed modbus servers to control the slave (with minimalmodbus) on a PC with python not micropython and with VB6 without library
Sorry, i have not clarify